[Scummvm-git-logs] scummvm master -> a85cd0fa0b4e2ca4301c6b858a13bdff743f4f55
sev-
noreply at scummvm.org
Thu Aug 10 15:10:57 UTC 2023
This automated email contains information about 477 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
0454dafbc8 CRAB: Add skeleton engine
1fbd053b9a CRAB: Add game detection
6a3681e9fe CRAB: Import engine code
dca60a00bb CRAB: Rewrite various utility classes related to XML loading
40723d0ec5 CRAB: Use Common::File to open files
1c4fac39ce CRAB: Run clang-format
44722beab9 CRAB: Include copyright headers and fix newlines
a73534cc3b CRAB: Replace #pragma once with include guards
81cedd071a CRAB: Remove extra files(stdafx[.cpp/.h])
92f7422a60 CRAB: fix includes to have engine path
645b6bbf05 CRAB: Use PNGDecoder to decode images
eced6c0e56 CRAB: Implement parser_error_handler() for rapidXML
5e134473b7 CRAB: Make timer compilable
343fab6d9a CRAB: Make some misc game related classes compilable
699fcbdaa4 CRAB: Make app class compilable
160cfb9321 CRAB: Hook app class to crab
7ffd0bfee1 CRAB: Make splash class compilable
485b927470 CRAB: fix warnings in ScreenSettings
c3b90fa5a1 CRAB: Declutter engine directory by moving compenents to their own folder
a0eb2c1741 CRAB: Remove unneeded file
611cb4b762 CRAB: Fix issue related to transparent PNGs
aa3b7cc054 CRAB: Port ImageManager class
0c51adcb04 CRAB: Index 5 levels deep in the res folder
62908b6c4d CRAB: Port and make cursor compilable
3205f795ab CRAB: Use ImageManager class in splash since its compilable
2eff515139 CRAB: bring remaining files under Crab namespace
d1e1916299 CRAB: Fix all includes
c8bf335029 CRAB: Start making item component compilable
fe58e46312 CRAB: Make people and stat components compilable
ee8c5627a3 CRAB: Stub out music component and make it compilable
1a0c39123d CRAB: Add define to allow forbidden symbols where necessary
d1b716dbdf CRAB: Create a overload for converting string to number using std::string
1149de1fee CRAB: Make most of event component compilable
ac4a22a6a0 CRAB: Stub out and make text component compilable
4e6ad3d2d3 CRAB: Make Shape related classes compilable
6da6468b81 CRAB: Make most of TMX component compilable
146c1a8ca8 CRAB: Make some UI classes compilable
973b34cb67 CRAB: Make all classes in input component compilable
e104f0c7d8 CRAB: Enable hotkey usage in ui components
3706cb2e1b CRAB: Fix compilation error due to missing include
611a097bc7 CRAB: Make some classes in animation component compilable
3fa3e30806 CRAB: Make various Pathfinding classes compilable
438db4e4aa CRAB: Make some ai classes compilable
e863443161 CRAB: Make all of animation component compilable
857108c3e3 CRAB: spriteAI class should be compilable now
e49e2cbbd8 CRAB: Fix compilation due to missing includes
cf9be95a4a CRAB: Make some more UI classes compilable
81242375f8 CRAB: Make some more UI cmponents compilable
c5735cc1e0 CRAB: Make all classes in item component compilable
f24339e148 CRAB: Make animation component fully compilable
625084122c CRAB: Make most of level component compilable
28e1544781 CRAB: Make all UI components compilable
b844b8adcb CRAB: Make GameEventManager class compilable
121f99b6e5 CRAB: Enable tilesets and make misc files compilable
0b3da1d2b4 CRAB: Make base game classes compilable
fff85231cb CRAB: Fix warnings in animation component due to extra consts
8d367daa57 CRAB: Fix warnings by removing extra const specifiers
25b4de6531 CRAB: Fix noisy warning due to missing return
4e178d844e CRAB: Enable linking of mainmenu from app and handle events correctly
339e5b8f16 CRAB: Init TextManager and LoadScreen in Splash
f7aab0489b CRAB: Create a Crab::Rect clip overload for drawing calls
0eb75982b3 CRAB: Unstub button and ImageData drawing routines
27c62f5e36 CRAB: Start enabling HandleEvents routine
7828c1f853 CRAB: Enable HandleEvents routine for diffrent types of buttons
4e6e782c1c CRAB: Enable HandleEvents() rotine for some more UI classes
37dbcce972 CRAB: Enable HandleEvents() for FightInput class
6ae92431bd CRAB: Enable HandleEvents() for Sprite Class
0c10a65c17 CRAB: Enable HandleEvents() for classes inside Level component
1ec4c9f29a CRAB: Enable HandleEvents() for the whole Item Component
7c946e9f4a CRAB: Enable HandleEvents() for rest of the UI component
4bcfcba976 CRAB: Fix some shadow declarations in spriteAI
1805db93d9 CRAB: Enable HandleEvents() of GameEventManager
3230845177 CRAB: Remove unneeded warnings
12fe5ecd72 CRAB: Enable HandleEvents() for rest of the classes
97a8356a64 CRAB: Unstub ChapterIntro and HUD drawing funcs
ebef8bd49c CRAB: Add warnings for stubs in ImageManager
b0e2512578 CRAB: Add clipping and flipping of textures
fb05da3c39 CRAB: Use Graphics::Screen instead of renderBuffer
1b24558cef CRAB: Unstub Game::LoadLevel function
32024f73c2 CRAB: Unstub ItemSlot::Draw()
1b7a7c6502 CRAB: Unstub misc funcs in TMX
49fcc5f4e2 CRAB: Unstub Sprite drawing function
cd14fb46e9 CRAB: Unstub misc functions in event component
c30b37f1db CRAB: Use stringstream to convert string to number for now
a5e52ed9a3 CRAB: Unstub PersonScreen::Draw and PersonHandler::Draw
58548c7ad7 CRAB: Port and unstub DrawLine() function
268bf022c3 CRAB: Change default resolution to 1280x720
e9e78480e3 CRAB: Create an overload for ManagedSurface
f67cd91a3f CRAB: Unstub ColorPool::load()
8d3760482c CRAB: Port and unstub PathFindingAgent::Update
bd6b56b633 CRAB: Port most of TextManager
8ffc3c475e CRAB: Fix/Unstub misc functions for ReplyMenu and ReplyButton
d5958a8182 CRAB: Fix warnings due to narrowing in image.cpp
dfccfc5e66 CRAB: Display fps on top left corner
a64187ae1c CRAB: Cache tilesets and blit them using a faster method
80853afd90 CRAB: Add const to operator overloads
3191745328 CRAB: Remove stub warning in HUD::Draw()
2b64108f56 CRAB: Use CursorManager
194c5bb646 CRAB: Add a extend method to Rectangle class
3093ffa552 CRAB: Pre-render level and certain objects
5610a0cf79 CRAB: Fix misc. warnings in the animation component
ff87d6818f CRAB: Fix misc. warnings in the event component
12ae56bac4 CRAB: Fix misc. warnings in the image component
3314b58a05 CRAB: Fix misc. warnings in the item component
dc0b649049 CRAB: Fix misc. warnings in the level component
4167069574 CRAB: Fix misc. warnings in the people component
afd30a0e8e CRAB: Fix misc. warnings in the text component
ea86cf4e62 CRAB: Fix misc. warnings in the TMX component
aefa597a91 CRAB: Fix misc. warnings in the ui component
3f729fa953 CRAB: Fix warnings in misc classes
a2a401c8d7 CRAB: JANITORIAL: Remove semicolon after closing brace of a namespace
54a933545d CRAB: JANITORIAL: Append end of namespace comment
d1700016a9 CRAB: Make ImageManager a public member of Engine class
58d3861447 CRAB: Make Cursor a public member of Engine class
3e5795f19d CRAB: Do not create global object for ImageManager
536344c42a CRAB: Get rid of unused ZERO_VEL global object
cae078aa23 CRAB: Make EventStore a public member of Engine class
3ea2ffa476 CRAB: Make TextManager a public member of Engine class
a554abe626 CRAB: Make LoadingScreen a public member of Engine class
ed2786e8eb CRAB: Make HelpScreen a public member of Engine class
d8331e83d2 CRAB: Make OptionMenu a public member of Engine class
387e1116cb CRAB: Make LoadMenu a public member of Engine class
93ec4959d4 CRAB: Remove unused private members in Image class
ab0460d744 CRAB: JANITORIAL: Cleanup Engine class for CRAB
2fe79da95a CRAB: Make InputManager a public member of Engine class
3fcee45f8b CRAB: Do not create a global object for OptionMenu
b2782a05d4 CRAB: Make ScreenSettings a public member of Engine class
a3f6951358 CRAB: Make MusicManager a public member of Engine class
014d6b68de CRAB: JANITORIAL: Cleanup CRAB Engine code and add some whitespaces
8eaf8235e0 CRAB: Make FilePath a public member of Engine class
41f2996740 CRAB: Stub out Vector2D::SaveState()
79a1207890 CRAB: Make TempValue a public member of Engine class
7d502038a0 CRAB: Use CursorManager properly to render correct cursor
b18ba615cb CRAB: Do not create global object for MusicManager
d9a1662f80 CRAB: Do not create global objects for TempValue and FilePath
bfafbe2ce2 CRAB: Convert gStrPool to a pointer
a5c8cb267b CRAB: Fix broken builds on windows due to type mixing errors
49d5038f63 CRAB: Fix memory bug in Image::Draw()
67c4c7db1c CRAB: Fix cursor img hover not being drawn
626639fdba CRAB: Fix bug due to which loadingScreen was not drawn
0a3ff2d9a6 CRAB: Unstub StatTemplates::Load()
fe067820a4 CRAB: Unstub Sprite::FlyAround()
c42e3879d4 CRAB: Unstub StatInfo:Draw()
53bce6b93c CRAB: Load a random AnimationClip incase random is true
a30b1704dd CRAB: Fix range for random numer generated in Sprite::FlyAround()
7c3f4b3c78 CRAB: Use operator[] instead of .at() throughout the engine
b1e85e9db6 CRAB: Replace std::vector with Common::Array where possible in UI component
abf297372d CRAB: Replace std::vector with Common::Array in text component
ce4da9f1d9 CRAB: Replace std::vector with Common::Array in TMX and Pathfinding component where possible
af2fbdb0e1 CRAB: Replace std::vector with Common::Array throughout the engine
135daff6b4 CRAB: Replace std::string with Common::String in TMX
13425ef92e CRAB: Replace std::list with Common::list throughout the engine
924eee956f CRAB: Use Common::StableMap instead of std::map
126bad6e27 CRAB: Use Common::MultiMap instead of std::multimap
36a6f31462 CRAB: Get rid of STL libs in GameOverMenu and SlideShow
b55d209f47 CRAB: Use Common::String instead of std::String in GameClock
2834ce2cff CRAB: Get rid of STL string and vector from Option Select
b2dff13474 CRAB: Get rid of STL vector of std::string from HUD
25742dff7f CRAB: Use Common::Array and Common::String instead of STL vector and String for animset
79908b0f2d CRAB: Remove unneeded class member from TMXTileSet
34201c4c59 CRAB: Use Common::Hashmap instead of STL equivalent
d7f83c3608 CRAB: Use Common::Hashmap and Common::String instead of STL equivalent on GameEventManager
b76eaf4d56 CRAB: Use Common Equivalents of STL throughout the engine
966e629707 CRAB: Use Common::sort instead of std::sort
c645e08f4f CRAB: Use Common::find and Common::find_if instead of std::find and std::find_if
6d2babc286 CRAB: Use size_t instead of std::size_t
5825e872a4 CARB: Delegate to default constructor from parameterized constructor
8b03e93940 CRAB: Fix warnings temporarily
ed263d267a CRAB: Get rid of temporarily defined SDL_Rect
1a325c87e8 CRAB: Remove unnecessary conversions to C string
8b5ee5a429 CRAB: Refactor code to draw transparent black box around text
e4d5733fd4 CRAB: Unstub Map::Draw()
5026cc4715 CRAB: Fix bug due to which textboxes were not rendered correctly
92547ac546 CRAB: Remove overloads for std::string
f79690c4c5 CRAB: Get rid of std::stringstream
21092e726c CRAB: Explicitly specify c_str() in LevelPaths
13e4a834ca CRAB: Fix warning generated by GameEventInfo
426bb043f4 CRAB: Replace of std::deque with Common::Array in quest related classes
89a6923cf0 CRAB: Remove dependence on STL libs from PriorityQueue
376d65329d CRAB: Use Common::remove instead of std::remove in PathfindingAgent
8905e9e5ce CRAB: Do not include STL headers
5f3b249691 CRAB: Do not use isdigit
15daa2c34d CRAB: Rename PathfindingAgent::exit() to PathfindingAgent::reset()
e2f726ea1a CRAB: FORBIDDEN_SYMBOL_ALLOW_ALL is no longer needed
b1bc78a105 CRAB: Cleanup and stub out OpenURL()
33f203abb9 CRAB: Remove unneeded rapixml includes
7fe602fe1a CRAB: Cleanup rapidxml includes
0ebc971055 CRAB: Use scummsys instead of including standard library headers directly
434c65e1ba CRAB: Add basic keyboard controls using keymapper
0ee6bda96b CRAB: Unstub keybaord controls in Sprite::HandleEvents()
145955dfd6 CRAB: Specify default block to deal with unhandled cases
a360d850fe CRAB: Add more keymaps
251cc23baf CRAB: Add function to query the key associated with an InputType
fc0aadbaed CRAB: Make hotkey class usable
5f597e11c0 CRAB: Enable hotkey usage in Button class
74f5d6f963 CRAB: Unstub HUD::SetTooltip
012f5e76d5 CRAB: Enable keyboard usage to navigate menu
6a83b30f4f CRAB: Show hotkeys in ReplyMenu
1ba5dee659 CRAB: Create and use separate keymappings for UI and Game
20485df18a CRAB: Free surface after use in TextManager
e75ca85bd4 CRAB: Cache mapped keys during intialization of the engine
326d735c5e CRAB: Free objects created by CrabEngine class
0a2b1ffd06 CRAB: Fix memory-leak due to format not being free'd
c7a4e53c79 CRAB: Fix incorrect usage of delete
ee6233484e CRAB: Fix memory leaks by freeing objects in app class
d36588b72b CRAB: Free app class in CrabEngine destructor
0301445881 CRAB: Check for h and w as well in Image::Delete()
384f0227ce CRAB: Invalid_img is already freed by this point
56df01afcc CRAB: Call Level::Reset from Level destructor as well
659dde2cd0 CRAB: Use the implicit destructor in Game
a5abea6e8f CRAB: Unstub TextManager::Quit()
2ac2678d65 CRAB: Free cursor hover textures
dd1da417ac CRAB: Fix a possible double free
8862a71479 CRAB: Free cursor on exit
4e9416d900 CRAB: Fix incorrrect order of calls for InputManager
225f393d10 CRAB: Fix memleaks in level
6d3bf8cb85 CRAB: Fix memleak due to PathfindingAgent not being reset
7a028f0265 CRAB: Fix memleaks due to image textures not being freed in map
3fb26d0081 CRAB: Fix memleak in Level::PreDraw
3a10a273b7 CRAB: Remove uneeded if block
fa96b84640 CRAB: Rework keymapper logic
828b29e422 CRAB: Fix memleak in PathfindingGrid
b4ed1635e7 CRAB: Do no render text if it only contains whitespace
0af468927f CRAB: Add texture rotation for properly rendering textures
0a9370d77c CRAB: Skip PreDraw if it is an ImageLayer
44fd620ea6 CRAB: Use enum instead of arbitary numbers for rotation
77726cc2a4 CRAB: Add rotation by 180 degrees
a7df9e6964 CRAB: Cleanup unnecessary static_casts in various Image drawing functions
883e467c2d CRAB: Remove and Cleanup unneeded code
f2cc4568f4 CRAB: Fix bug where start.x could be less than 0
e5cc0bda71 CRAB: Fix error due to which last tiles in a scene weren't drawn
dbbfd39405 CRAB: Unstub Button::ImageCaptionOnlyDraw
bab60b050a CRAB: Unstub SectionHeader::Load
a4aff67661 CRAB: Add backInserter()
f1927067a5 CRAB: Add necessary include for savefiles
934eef9cf1 CRAB: Fix boxy look incase of FLIP_XY
caabd15c46 CRAB: Create a new constructor for XMLDoc()
125157fe36 CRAB: Make FileData compilable
1b09c220c0 CRAB: Do not blit if height/width are invalid
e3e7c52c96 CRAB: Do not try to open files if path is empty
de7f3dc064 CRAB: Implement stubbed out functions in TextArea
2dcc8f975e CRAB: Add rapidxml_print
c25edc3f8b CRAB: Implement stubbed out Game::SaveStae()
b52ae746ae CRAB: Implement necessary functions for save/load menu
b3fea6d213 CRAB: Repopulate saves list when load/save menu are opened
e41cbbbd22 CRAB: Allow loading saves from main menu
d70de1ea86 CRAB: Explicity specify maximum number of slots
502e360323 CRAB: Do not support loading savegames directly
f13391ce3c CRAB: Use ScummVM's load/save dailogs
2f9d204ae2 CRAB: Make LoadState and SaveState read/write directly from streams
e0a9f09af4 CRAB: Make Game a class member of app class
3d043f424f CRAB: Implement functions needed to load/save from GMM
ef51102af1 CRAB: Only allow saving when inside game
2d63615899 CRAB: Open GMM load menu from main menu
a20f835b26 CRAB: Port FileMenu::ScanDir
ec510a5597 CRAB: Make XMLDoc follow ScummVM formatting convention
6cd9527c88 CRAB: Make MoveEffect struct follow code formatting conventions
7d05908d6f CRAB: Make MovementSet struct follow code formatting conventions
c13dd00e9a CRAB: Make SpriteAIData struct follow code formatting conventions
5d119e97b4 CRAB: Make SpriteConstant/FlyerConstant struct follow code formatting conventions
e307d304fc CRAB: Make Animation class follow code formatting conventions
115c13571c CRAB: Make AnimationEffect class follow code formatting conventions
ed4055b00d CRAB: Make AnimationFrame class follow code formatting conventions
d1bc64ac73 CRAB: Make AnimFrame/AnimationFrames follow code formatting conventions
7b7b73709a CRAB: Make AnimSet follow code formatting conventions
82224719a3 CRAB: Make FightAnimFrame(s) follow code formatting conventions
0e9fa535d4 CRAB: Make loaders.[h, cpp] follow code formatting conventions
47076f5d39 CRAB: Make FightMove struct follow code formatting conventions
4b10b353c9 CRAB: Make FightMoves class follow code formatting conventions
89d019d471 CRAB: Make FightMoveAIData struct follow code formatting conventions
4f9038ca38 CRAB: Make ImageEffect struct follow code formatting conventions
b6eecaa9d1 CRAB: Rename Load() to load() across CRAB codebase
05ded6201d CRAB: Rename Draw() to draw() across CRAB codebase
4db8e7cbcc CRAB: Rename InternalEvents() to internalEvents() across CRAB codebase
793b39628d CRAB: Make Popup struct follow code formatting conventions
2ce24324af CRAB: Rename Reset() to reset() across CRAB codebase
e16af72a39 CRAB: Make Range/Shadow related structs follow code formatting conventions
07ffe2069f CRAB: Rename SaveState()/loadState() to saveState()/loadState() across CRAB codebase
f0697d4888 CRAB: Make Sprite follow code formatting conventions
b0d129f1a5 CRAB: Rename SetUI() to setUI() across CRAB codebase
957acdba71 CRAB: Make WalkFrames class follow code formatting conventions
3ae2210f42 CRAB: Make ChangeVal/Conversation related structs follow code formatting conventions
7c6d3b82b6 CRAB: Make Effect related structs follow code formatting conventions
0314db31a0 CRAB: Make EventSeqGroup class follow code formatting conventions
583a00327c CRAB: Rename HandleEvents() to handleEvents() throughout CRAB codebase
0670044eaa CRAB: Make GameEventStore and EventSequence follow code formatting conventions
73c5c049e1 CRAB: Make GameEvent follow code formatting conventions
1f2055c88b CRAB: Make GameEventInfo class follow code formatting conventions
2507b59aab CRAB: random should be _random
321f1379be CRAB: Make GameEventManager class follow code formatting conventions
0c7668ce27 CRAB: Make rest of the event component follow code formatting conventions
e3581221b2 CRAB: Make Image class follow code formatting conventions
1b6150c2c8 CRAB: Make ImageManager class follow code formatting conventions
0e500aaa81 CRAB: Make cursor class follow code formatting conventions
a82d514065 CRAB: Make FightInput and Hotkey class follow code formatting conventions
e0d27c9e0b CRAB: Make InputManager class follow code formatting conventions
71bc6577a4 CRAB: Make Item and ItemCollection classes follow code formatting conventions
0f9564a9e9 CRAB: Make button and element realted UI classes follow code formatting conventions
fd61c1f2ae CRAB: Make some misc. UI classes follow code formatting conventions
fd0055fcc3 CRAB: Make misc. classes follow code formatting conventions
de421bdd37 CRAB: Make StatPreview class follow code formatting conventions
94c7777055 CRAB: Make all level class follow code formatting conventions
8e1ae3174b CRAB: Make music component follow code formatting conventions
9d2a32a433 CRAB: Make people component follow code formatting conventions
61b24cf928 CRAB: Make stat component follow code formatting conventions
bd576ca667 CRAB: Make Text component follow code formatting conventions
5831d909e5 CRAB: Make TMX component follow code formatting conventions
1e04b7e276 CRAB: Make multiple UI classes follow code formatting conventions
1dcf544251 CRAB: Make more UI classes follow code formatting conventions
a9ccc1719f CRAB: Make rest of the UI classes follow code formatting conventions
a7e3ecff2a CRAB: Make app class follow code formatting conventions
2451b030a8 CRAB: Make collision.[cpp, h] follow code formatting conventions
5e1e95bc98 CRAB: Remove duplicate copyright headers
9ec832a165 CRAB: Make Timer class follow code formatting conventions
7012578714 CRAB: Make Splash class follow code formatting conventions
10d18367ed CRAB: Make FileSystem and Game class follow code formatting conventions
b58ad50f97 CRAB: Make misc classes follow code formatting conventions
b002ccd8df CRAB: Make remaining files follow code formatting conventions
0e829d92f9 CRAB: Rename Quit() to quit() for cursor and LoadingScreen
512f11ec8f CRAB: Fix an error caused due to refactoring in effect
39aa9d0e63 CRAB: Port part of code responsible for sounds in ReplyMenu
a0312e5db9 CRAB: Fix code formatting in GameEventInfo
55de8b708f CRAB: Unstub code to load MusicManager
48ce6dc22a CRAB: Port code for playing sound effects and music
1d6ac07291 CRAB: JANITORIAL: Remove extra pair of ()
b1fe7efa89 CRAB: JANITORIAL: Cleanup App class
43fcd93bde CRAB: JANITORIAL: Cleanup Timer class
93dc0cfc30 CRAB: JANITORIAL: Remove unneeded App constructor
dcd2e28545 CRAB: JANITORIAL: Remove stubbed out code where possible
f2c8b2f953 CRAB: JANITORIAL: Fix code formatting and cleanup multiple classes
a091928251 CRAB: Fix code formatting in ItemMenu class
6928a4738a CRAB: JANITORIAL: Remove duplicate license from console.cpp
03e5d5815c CRAB: Port rest of the MusicManager
f4f6a157a7 CRAB: Get sound and music volume from ConfMan
f4a1d6499c CRAB: Get rid of inputVal class
e9fd5d9134 CRAB: Move gStrPool to Engine class
8d272b4506 CRAB: Unstub Sprite::attack()
ef6e36d650 CRAB: contains() returns a bool and not an int
d4e1991ecb CRAB: Fix bug due to which _startTicks was not set in resume()
fa086abcc4 CRAB: Fix types of MusicKey and ChunkKey
bd8824b0be CRAB: Remove unneeded resource.h file
27329370e9 CRAB: Unstub SlideShow::refresh()
fbeb586fda CRAB: Simplify numberToString()
42fcc61888 CRAB: _state should be signed
0907c5cc1f CRAB: Fix signed/unsigned warning in journal.cpp
7297454e8f CRAB: Unstub Info::saveState
77e9936811 CRAB: Clear old journal entries on loadState()
de0820c672 CRAB: Use nullptr instead oF NULL
225cff85fa CRAB: JANITORIAL: Cleanup hotkey.cpp
2d4b439f59 CRAB: JANITORIAL: Remove unneeded warning
453f79271b CRAB: JANITORIAL: Cleanup TextManager
dab387b1f3 CRAB: Move warning to debug in Image.cpp
8d586b7c58 CRAB: Move warning about cur height and weight to debug
8ce8efa546 CRAB: JANITORIAL: Cleanup filesystem.[cpp, h]
b80501fbc0 CRAB: Move a TMX related warning to debug
f45082bf0c CRAB: Remove uneeded url.cpp/url.h
4f87989f29 CRAB: Remove unneeded warnings and leave a comment
608b0fcf1b CRAB: JANITORIAL: Add some whitespaces in Image.cpp
4e6a602af9 CRAB: Stop music before freeing
83e77c269c CRAB: Handle AutoShow layer correctly
c97593c76d CRAB: Create thumbnails correctly
2b8d0366b6 CRAB: Remove unneeded warning
e1ed69a296 CRAB: JANITORIAL: Remove old code in LoadingScreen.cpp
222d37cb53 CRAB: Add warning that LoadingScreen::dim() is stubbed
cec7b34522 CRAB: Add input.cpp to POTFILES
7f43dd2435 CRAB: collide() does not modify class
8adef975d8 CRAB: Add const-correctness to various methods in TMXMap
b1e1c2847a CRAB: JANITORIAL: Fix code formatting in TMXMap.cpp
951237e4e9 CRAB: Append end of namespace message in GameParam.h
b71c4901a7 CRAB: Remove code leftovers in GameParam.h
73bb1b5845 CRAB: Remove wrapper around Graphics::Screen::drawLine()
bff5403608 CRAB: Allow dawing debugLines via debug console
0c65d4b9cd CRAB: Cleanup TMXMap::drawDebug()
d06d7b7b5d CRAB: Remove unneeded overload of Image::load()
34b2565b0f CRAB: JANITORIAL: Update comments in ImageManager
62e5879f22 CRAB: Make Vectors class follow code formatting conventions
f0c816a3fb CRAB: JANITORIAL: Append of namespace message at the end of GameParam.cpp
2e955b366a CRAB: JANITORIAL: Fix code formatting in PathfindingAgent.cpp
6db58b9ff8 CRAB: JANITORIAL: Fix code formatting in PathfindingGrid.cpp
d7ac8b6185 CRAB: Replace unsigned int with uint
d1a43f0ec0 CRAB: Do not mix long and uint32
2a7cff595f CRAB: Add a newline in POTFILES
8465061b20 CRAB: JANITORIAL: Fix code formatting in PathfindingAgent.cpp
33e1a6eae7 CRAB: Use shorthand for loop in PathfindingAgent.cpp
7d19280051 CRAB: JANITORIAL: Remove dead code in PathfindingAgent.cpp
d4f5ef4e28 CRAB: Make comparision functions static
e04ac9197d CRAB: Move from C style func(void) sytem to func() syntax
ac2ec635a2 CRAB: Use shorthand range based for loop in animation component
d9228252c2 CRAB: Use shorthand range based for loop in event component
49d31ba53e CRAB: Use shorthand range based for loop in image component
58e07a575a CRAB: Use shorthand range based for loop in item component
57baa32881 CRAB: Use shorthand range based for loop in level component
e3c9a23e72 CRAB: Use shorthand range based for loop in music component
43b417e400 CRAB: Use shorthand range based for loop in text component
13e7fbb180 CRAB: Use shorthand range based for loop in TMX component
d100544575 CRAB: Use shorthand range based for loop in UI component
d9272dd290 CRAB: Use shorthand range based for loop in rest of the files
c48e1588af CRAB: Rename variable to timeLeft in PathfindingAgent.cpp
3f2eb15a8f CRAB: JANITORIAL: Code cleanup and fix formatting
610e3dd7b6 CRAB: JANITORIAL: Code cleanup and fix formatting in TMXMap.cpp
e3920899b1 CRAB: Start cleaning up headers
a0a7d3b131 CRAB: Remove common_header.h
4ed560b96e CRAB: Cleanup headers in crab.h
283f670968 CRAB: Cleanup includes in ai and animation component
c85ccac724 CRAB: Cleanup includes in event and image component
6507841cd5 CRAB: Cleanup includes in input and item component
e30b96978c CRAB: Cleanup includes in level and music component
565f448363 CRAB: Cleanup includes in people and stat component
7a385d22d1 CRAB: Cleanup includes in text and TMX component
a2939b77a8 CRAB: Cleanup app class includes
da2d783552 CRAB: Cleanup includes for most of the files in Crab/
ecb8e77e43 CRAB: Cleanup includes in UI component
f091215d16 CRAB: Cleanup includes of game class
15b1bd2ec3 CRAB: Add credits
723e33cc32 CRAB: Reorder files in module.mk
197735b9f4 CRAB: JANITORIAL: Fix code formatting in Sprite.cpp
32291cd3f5 CRAB: Allow drawing sprite bound and pathing via debug console
c1ee15d5e9 CRAB: Include copyright header in backInserter.h
03ed3cf1a7 CRAB: JANITORIAL: Convert spaces to tab in backInserter.h
61777adefc CRAB: Remove detection_tables.h
7de1b64b25 CRAB: Rework game detection
4f22227dc9 CRAB: Fix files not being found due to error in CrabEngine::initializePath
5f045bb6f8 CRAB: Fix builds failing on msvc
04cf31f513 CRAB: Replace SDL_Color with CRAB::Color
f617a4c8ad CRAB: JANITORIAL: Fix indentation of copyright notice
1c6f1d4166 CRAB: Fix warnings and errors emitted by msvc
3963bc5124 CRAB: Add proper deps in configure.engine
a6b9374f80 CRAB: Rmeove code leftover in ImageManager.h
6fbb3d1f24 CRAB: Strip most functionality of ScreenSettings class
34627d105d CRAB: Use command directly instead of preprocessor constant
7763801745 CRAB: Fix code formatting in Spriteai.cpp
708c9594e6 CRAB: Fix code formatting of switch case blocks in multiple files
b2d7871a7e CRAB: Fix Color struct
6c91493bca CRAB: Remove SHOULD_QUIT preprocessor constant
c225d337b1 CRAB: Redo game detection again
7012a351e4 CRAB: Change platform to unknown as detection entries are same for all platforms
ef03c984db CRAB: Print a message incase params for cmdDraw are incorrect
f2b19a9d47 CRAB: Rename IsChar to isChar
566ba3f699 CRAB: Rename some vars to follow code convention in trigger.cpp
01fc771843 CRAB: JANITORIAL: Remove some leftovers and code cleanup
81e18e83bf CRAB: Implement missing functionality in SlideShow class
3e7f4beda5 CRAB: Remove unused functions from ImageManager
2e7e796e7d CRAB: Cleanup InputManager code
75abee340c CRAB: JANITORIAL: Cleanup Game::saveState
2bbe5880a0 CRAB: Make engine work without the res prefix in paths
47d15889de CRAB: Add entries for Unrest demo
299078fb38 CRAB: Fix crash incase there is an error opening audio files
a97409f241 CRAB: JANITORIAL: Update comment in MusicManager.cpp
f8e6492b51 CRAB: Show demo UI elements when playing demo
632347a257 CRAB: Do not playStream when id is invalid
57121880ac CRAB: Fix code formatting in TextManager.cpp
50e5b9c93c CRAB: JANITORIAL: Fix code formatting of structs
5d54b93bc4 CRAB: No need to init Common::String with ""
608d13f70d CRAB: Improve code for Level::getSprite
3e2f011bb5 CRAB: Be consistent with usage of nullptr
ddfca3c1d9 CRAB: Unstub code for handling closing various submenus in mainmenu
78d969cacd CRAB: JANITORIAL: Remove old code in mainmenu
df9d7db35d CRAB: Unstub code to warn when xml attribs/values are invalid
f62c609e49 CRAB: Remove loadRect()
a54f0ee80f CRAB: Allow sound settings to be changed while the game is active
706f5edef9 CRAB: Unstub GameOverMenu::reset()
2b3d7f5a8b CRAB: JANITORIAL: Cleanup FileMenu.h
368208cca6 CRAB: Get rid of unused FileMenu.cpp
a11f7c58eb CRAB: Implement missing openURL calls() in CreditScreen and remove old code
c1558ca1bc CRAB: Make StringPool class follow code conventions
2bca19e367 CRAB: Handle floats in numberTostring
3e5e3987c5 CRAB: Fix StringPool::fGet()
5957287eb5 CRAB: Properly initialize the value of AlphaImage
64d5affe60 CRAB: Cleanup MusicManager class
6cf9715244 CRAB: Make gameid lowercase in gameDescriptions
6fb80da1a1 CRAB: Implement DebugConsole::handleEvents()
0d111de090 CRAB: Print cleansedPath instead of normal path in warnings
4099b18b7a CRAB: JANITORIAL: Remove old code in PauseMEnu::handleEvents()
f2ebf7276d CRAB: Remove leftover in HUD::draw()
36f348da5e CRAB: Remove code leftover in Button:handleEvents()
a939f3e962 CRAB: Implement Map::move keyboard controls and remove old code
a85cd0fa0b CRAB: Remove bogus warning in TextArea::handleEvents()
Commit: 0454dafbc860a09a2db26e73a75231d33a5b9106
https://github.com/scummvm/scummvm/commit/0454dafbc860a09a2db26e73a75231d33a5b9106
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add skeleton engine
Changed paths:
A engines/crab/POTFILES
A engines/crab/configure.engine
A engines/crab/console.cpp
A engines/crab/console.h
A engines/crab/crab.cpp
A engines/crab/crab.h
A engines/crab/credits.pl
A engines/crab/detection.cpp
A engines/crab/detection.h
A engines/crab/detection_tables.h
A engines/crab/metaengine.cpp
A engines/crab/metaengine.h
A engines/crab/module.mk
diff --git a/engines/crab/POTFILES b/engines/crab/POTFILES
new file mode 100644
index 00000000000..c1eee4543d3
--- /dev/null
+++ b/engines/crab/POTFILES
@@ -0,0 +1 @@
+engines/crab/metaengine.cpp
diff --git a/engines/crab/configure.engine b/engines/crab/configure.engine
new file mode 100644
index 00000000000..f3144ba2a24
--- /dev/null
+++ b/engines/crab/configure.engine
@@ -0,0 +1,3 @@
+# This file is included from the main "configure" script
+# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
+add_engine crab "Crab" no "" "" ""
diff --git a/engines/crab/console.cpp b/engines/crab/console.cpp
new file mode 100644
index 00000000000..2b195996298
--- /dev/null
+++ b/engines/crab/console.cpp
@@ -0,0 +1,38 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "crab/console.h"
+
+namespace Crab {
+
+Console::Console() : GUI::Debugger() {
+ registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+}
+
+Console::~Console() {
+}
+
+bool Console::Cmd_test(int argc, const char **argv) {
+ debugPrintf("Test\n");
+ return true;
+}
+
+} // End of namespace Crab
diff --git a/engines/crab/console.h b/engines/crab/console.h
new file mode 100644
index 00000000000..425af9c6292
--- /dev/null
+++ b/engines/crab/console.h
@@ -0,0 +1,40 @@
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CRAB_CONSOLE_H
+#define CRAB_CONSOLE_H
+
+#include "gui/debugger.h"
+
+namespace Crab {
+
+class Console : public GUI::Debugger {
+private:
+ bool Cmd_test(int argc, const char **argv);
+public:
+ Console();
+ ~Console() override;
+};
+
+} // End of namespace Crab
+
+#endif // CRAB_CONSOLE_H
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
new file mode 100644
index 00000000000..fb17bb06e2d
--- /dev/null
+++ b/engines/crab/crab.cpp
@@ -0,0 +1,107 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "crab/crab.h"
+#include "crab/detection.h"
+#include "crab/console.h"
+#include "common/scummsys.h"
+#include "common/config-manager.h"
+#include "common/debug-channels.h"
+#include "common/events.h"
+#include "common/system.h"
+#include "engines/util.h"
+#include "graphics/palette.h"
+
+namespace Crab {
+
+CrabEngine *g_engine;
+
+CrabEngine::CrabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst),
+ _gameDescription(gameDesc), _randomSource("Crab") {
+ g_engine = this;
+}
+
+CrabEngine::~CrabEngine() {
+ delete _screen;
+}
+
+uint32 CrabEngine::getFeatures() const {
+ return _gameDescription->flags;
+}
+
+Common::String CrabEngine::getGameId() const {
+ return _gameDescription->gameId;
+}
+
+Common::Error CrabEngine::run() {
+ // Initialize 320x200 paletted graphics mode
+ initGraphics(320, 200);
+ _screen = new Graphics::Screen();
+
+ // Set the engine's debugger console
+ setDebugger(new Console());
+
+ // If a savegame was selected from the launcher, load it
+ int saveSlot = ConfMan.getInt("save_slot");
+ if (saveSlot != -1)
+ (void)loadGameState(saveSlot);
+
+ // Draw a series of boxes on screen as a sample
+ for (int i = 0; i < 100; ++i)
+ _screen->frameRect(Common::Rect(i, i, 320 - i, 200 - i), i);
+ _screen->update();
+
+ // Simple event handling loop
+ byte pal[256 * 3] = { 0 };
+ Common::Event e;
+ int offset = 0;
+
+ while (!shouldQuit()) {
+ while (g_system->getEventManager()->pollEvent(e)) {
+ }
+
+ // Cycle through a simple palette
+ ++offset;
+ for (int i = 0; i < 256; ++i)
+ pal[i * 3 + 1] = (i + offset) % 256;
+ g_system->getPaletteManager()->setPalette(pal, 0, 256);
+ _screen->update();
+
+ // Delay for a bit. All events loops should have a delay
+ // to prevent the system being unduly loaded
+ g_system->delayMillis(10);
+ }
+
+ return Common::kNoError;
+}
+
+Common::Error CrabEngine::syncGame(Common::Serializer &s) {
+ // The Serializer has methods isLoading() and isSaving()
+ // if you need to specific steps; for example setting
+ // an array size after reading it's length, whereas
+ // for saving it would write the existing array's length
+ int dummy = 0;
+ s.syncAsUint32LE(dummy);
+
+ return Common::kNoError;
+}
+
+} // End of namespace Crab
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
new file mode 100644
index 00000000000..949e7a889a8
--- /dev/null
+++ b/engines/crab/crab.h
@@ -0,0 +1,105 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CRAB_H
+#define CRAB_H
+
+#include "common/scummsys.h"
+#include "common/system.h"
+#include "common/error.h"
+#include "common/fs.h"
+#include "common/hash-str.h"
+#include "common/random.h"
+#include "common/serializer.h"
+#include "common/util.h"
+#include "engines/engine.h"
+#include "engines/savestate.h"
+#include "graphics/screen.h"
+
+#include "crab/detection.h"
+
+namespace Crab {
+
+struct CrabGameDescription;
+
+class CrabEngine : public Engine {
+private:
+ const ADGameDescription *_gameDescription;
+ Common::RandomSource _randomSource;
+protected:
+ // Engine APIs
+ Common::Error run() override;
+public:
+ Graphics::Screen *_screen = nullptr;
+public:
+ CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
+ ~CrabEngine() override;
+
+ uint32 getFeatures() const;
+
+ /**
+ * Returns the game Id
+ */
+ Common::String getGameId() const;
+
+ /**
+ * Gets a random number
+ */
+ uint32 getRandomNumber(uint maxNum) {
+ return _randomSource.getRandomNumber(maxNum);
+ }
+
+ bool hasFeature(EngineFeature f) const override {
+ return
+ (f == kSupportsLoadingDuringRuntime) ||
+ (f == kSupportsSavingDuringRuntime) ||
+ (f == kSupportsReturnToLauncher);
+ };
+
+ bool canLoadGameStateCurrently() override {
+ return true;
+ }
+ bool canSaveGameStateCurrently() override {
+ return true;
+ }
+
+ /**
+ * Uses a serializer to allow implementing savegame
+ * loading and saving using a single method
+ */
+ Common::Error syncGame(Common::Serializer &s);
+
+ Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
+ Common::Serializer s(nullptr, stream);
+ return syncGame(s);
+ }
+ Common::Error loadGameStream(Common::SeekableReadStream *stream) override {
+ Common::Serializer s(stream, nullptr);
+ return syncGame(s);
+ }
+};
+
+extern CrabEngine *g_engine;
+#define SHOULD_QUIT ::Crab::g_engine->shouldQuit()
+
+} // End of namespace Crab
+
+#endif // CRAB_H
diff --git a/engines/crab/credits.pl b/engines/crab/credits.pl
new file mode 100644
index 00000000000..076ba2ec91e
--- /dev/null
+++ b/engines/crab/credits.pl
@@ -0,0 +1,3 @@
+begin_section("Crab");
+ add_person("Name 1", "Handle 1", "");
+end_section();
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
new file mode 100644
index 00000000000..ed0068af8bd
--- /dev/null
+++ b/engines/crab/detection.cpp
@@ -0,0 +1,45 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "base/plugins.h"
+#include "common/config-manager.h"
+#include "common/file.h"
+#include "common/md5.h"
+#include "common/str-array.h"
+#include "common/translation.h"
+#include "common/util.h"
+#include "crab/detection.h"
+#include "crab/detection_tables.h"
+
+const DebugChannelDef CrabMetaEngineDetection::debugFlagList[] = {
+ { Crab::kDebugGraphics, "Graphics", "Graphics debug level" },
+ { Crab::kDebugPath, "Path", "Pathfinding debug level" },
+ { Crab::kDebugFilePath, "FilePath", "File path debug level" },
+ { Crab::kDebugScan, "Scan", "Scan for unrecognised games" },
+ { Crab::kDebugScript, "Script", "Enable debug script dump" },
+ DEBUG_CHANNEL_END
+};
+
+CrabMetaEngineDetection::CrabMetaEngineDetection() : AdvancedMetaEngineDetection(Crab::gameDescriptions,
+ sizeof(ADGameDescription), Crab::crabGames) {
+}
+
+REGISTER_PLUGIN_STATIC(CRAB_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, CrabMetaEngineDetection);
diff --git a/engines/crab/detection.h b/engines/crab/detection.h
new file mode 100644
index 00000000000..5a49b0e596c
--- /dev/null
+++ b/engines/crab/detection.h
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CRAB_DETECTION_H
+#define CRAB_DETECTION_H
+
+#include "engines/advancedDetector.h"
+
+namespace Crab {
+
+enum CrabDebugChannels {
+ kDebugGraphics = 1 << 0,
+ kDebugPath = 1 << 1,
+ kDebugScan = 1 << 2,
+ kDebugFilePath = 1 << 3,
+ kDebugScript = 1 << 4,
+};
+
+extern const PlainGameDescriptor crabGames[];
+
+extern const ADGameDescription gameDescriptions[];
+
+#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
+
+} // End of namespace Crab
+
+class CrabMetaEngineDetection : public AdvancedMetaEngineDetection {
+ static const DebugChannelDef debugFlagList[];
+
+public:
+ CrabMetaEngineDetection();
+ ~CrabMetaEngineDetection() override {}
+
+ const char *getName() const override {
+ return "crab";
+ }
+
+ const char *getEngineName() const override {
+ return "Crab";
+ }
+
+ const char *getOriginalCopyright() const override {
+ return "Crab (C)";
+ }
+
+ const DebugChannelDef *getDebugChannels() const override {
+ return debugFlagList;
+ }
+};
+
+#endif // CRAB_DETECTION_H
diff --git a/engines/crab/detection_tables.h b/engines/crab/detection_tables.h
new file mode 100644
index 00000000000..cfecfa90f66
--- /dev/null
+++ b/engines/crab/detection_tables.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+namespace Crab {
+
+const PlainGameDescriptor crabGames[] = {
+ { "crab", "Crab" },
+ { 0, 0 }
+};
+
+const ADGameDescription gameDescriptions[] = {
+ {
+ "crab",
+ nullptr,
+ AD_ENTRY1s("file1.bin", "00000000000000000000000000000000", 11111),
+ Common::EN_ANY,
+ Common::kPlatformDOS,
+ ADGF_UNSTABLE,
+ GUIO1(GUIO_NONE)
+ },
+
+ AD_TABLE_END_MARKER
+};
+
+} // End of namespace Crab
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
new file mode 100644
index 00000000000..01347f99ce3
--- /dev/null
+++ b/engines/crab/metaengine.cpp
@@ -0,0 +1,69 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#include "common/translation.h"
+
+#include "crab/metaengine.h"
+#include "crab/detection.h"
+#include "crab/crab.h"
+
+namespace Crab {
+
+static const ADExtraGuiOptionsMap optionsList[] = {
+ {
+ GAMEOPTION_ORIGINAL_SAVELOAD,
+ {
+ _s("Use original save/load screens"),
+ _s("Use the original save/load screens instead of the ScummVM ones"),
+ "original_menus",
+ false,
+ 0,
+ 0
+ }
+ },
+ AD_EXTRA_GUI_OPTIONS_TERMINATOR
+};
+
+} // End of namespace Crab
+
+const char *CrabMetaEngine::getName() const {
+ return "crab";
+}
+
+const ADExtraGuiOptionsMap *CrabMetaEngine::getAdvancedExtraGuiOptions() const {
+ return Crab::optionsList;
+}
+
+Common::Error CrabMetaEngine::createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const {
+ *engine = new Crab::CrabEngine(syst, desc);
+ return Common::kNoError;
+}
+
+bool CrabMetaEngine::hasFeature(MetaEngineFeature f) const {
+ return checkExtendedSaves(f) ||
+ (f == kSupportsLoadingDuringStartup);
+}
+
+#if PLUGIN_ENABLED_DYNAMIC(CRAB)
+REGISTER_PLUGIN_DYNAMIC(CRAB, PLUGIN_TYPE_ENGINE, CrabMetaEngine);
+#else
+REGISTER_PLUGIN_STATIC(CRAB, PLUGIN_TYPE_ENGINE, CrabMetaEngine);
+#endif
diff --git a/engines/crab/metaengine.h b/engines/crab/metaengine.h
new file mode 100644
index 00000000000..7c65b503d32
--- /dev/null
+++ b/engines/crab/metaengine.h
@@ -0,0 +1,43 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CRAB_METAENGINE_H
+#define CRAB_METAENGINE_H
+
+#include "engines/advancedDetector.h"
+
+class CrabMetaEngine : public AdvancedMetaEngine {
+public:
+ const char *getName() const override;
+
+ Common::Error createInstance(OSystem *syst, Engine **engine, const ADGameDescription *desc) const override;
+
+ /**
+ * Determine whether the engine supports the specified MetaEngine feature.
+ *
+ * Used by e.g. the launcher to determine whether to enable the Load button.
+ */
+ bool hasFeature(MetaEngineFeature f) const override;
+
+ const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
+};
+
+#endif // CRAB_METAENGINE_H
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
new file mode 100644
index 00000000000..a1128a843b6
--- /dev/null
+++ b/engines/crab/module.mk
@@ -0,0 +1,17 @@
+MODULE := engines/crab
+
+MODULE_OBJS = \
+ crab.o \
+ console.o \
+ metaengine.o
+
+# This module can be built as a plugin
+ifeq ($(ENABLE_CRAB), DYNAMIC_PLUGIN)
+PLUGIN := 1
+endif
+
+# Include common rules
+include $(srcdir)/rules.mk
+
+# Detection objects
+DETECT_OBJS += $(MODULE)/detection.o
Commit: 1fbd053b9a030f3990d42ff0b902799935e91779
https://github.com/scummvm/scummvm/commit/1fbd053b9a030f3990d42ff0b902799935e91779
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add game detection
Changed paths:
engines/crab/detection.cpp
engines/crab/detection.h
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
index ed0068af8bd..422263a677e 100644
--- a/engines/crab/detection.cpp
+++ b/engines/crab/detection.cpp
@@ -20,14 +20,9 @@
*/
#include "base/plugins.h"
-#include "common/config-manager.h"
-#include "common/file.h"
-#include "common/md5.h"
-#include "common/str-array.h"
-#include "common/translation.h"
-#include "common/util.h"
+#include "engines/advancedDetector.h"
+
#include "crab/detection.h"
-#include "crab/detection_tables.h"
const DebugChannelDef CrabMetaEngineDetection::debugFlagList[] = {
{ Crab::kDebugGraphics, "Graphics", "Graphics debug level" },
@@ -38,8 +33,30 @@ const DebugChannelDef CrabMetaEngineDetection::debugFlagList[] = {
DEBUG_CHANNEL_END
};
+static const PlainGameDescriptor crabGames[] = {
+ {"unrest", "Unrest"},
+ {nullptr, nullptr}
+};
+
+namespace Crab {
+
+static const ADGameDescription gameDescriptions[] = {
+ {
+ "Unrest",
+ "",
+ AD_ENTRY1s("Unrest.exe", "bae406538172eb062480f25ea6e387e5", 805376),
+ Common::EN_ANY,
+ Common::kPlatformWindows,
+ ADGF_NO_FLAGS,
+ GUIO1(GUIO_NONE),
+ },
+ AD_TABLE_END_MARKER
+};
+
+}
+
CrabMetaEngineDetection::CrabMetaEngineDetection() : AdvancedMetaEngineDetection(Crab::gameDescriptions,
- sizeof(ADGameDescription), Crab::crabGames) {
+ sizeof(ADGameDescription), crabGames) {
}
REGISTER_PLUGIN_STATIC(CRAB_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, CrabMetaEngineDetection);
diff --git a/engines/crab/detection.h b/engines/crab/detection.h
index 5a49b0e596c..74779a6ab50 100644
--- a/engines/crab/detection.h
+++ b/engines/crab/detection.h
@@ -34,10 +34,6 @@ enum CrabDebugChannels {
kDebugScript = 1 << 4,
};
-extern const PlainGameDescriptor crabGames[];
-
-extern const ADGameDescription gameDescriptions[];
-
#define GAMEOPTION_ORIGINAL_SAVELOAD GUIO_GAMEOPTIONS1
} // End of namespace Crab
@@ -58,7 +54,7 @@ public:
}
const char *getOriginalCopyright() const override {
- return "Crab (C)";
+ return "Unrest (c) Pyrodactyl Games 2009-2023";
}
const DebugChannelDef *getDebugChannels() const override {
Commit: 6a3681e9feddc7c93c86f5d7827ce03a23b42e09
https://github.com/scummvm/scummvm/commit/6a3681e9feddc7c93c86f5d7827ce03a23b42e09
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Import engine code
Changed paths:
A engines/crab/AlphaImage.cpp
A engines/crab/AlphaImage.h
A engines/crab/AnimationEffect.h
A engines/crab/AnimationFrame.cpp
A engines/crab/AnimationFrame.h
A engines/crab/Caption.cpp
A engines/crab/Caption.h
A engines/crab/ChapterIntro.cpp
A engines/crab/ChapterIntro.h
A engines/crab/ClipButton.cpp
A engines/crab/ClipButton.h
A engines/crab/CreditScreen.cpp
A engines/crab/CreditScreen.h
A engines/crab/DevConsole.cpp
A engines/crab/DevConsole.h
A engines/crab/EventSeqGroup.cpp
A engines/crab/EventSeqGroup.h
A engines/crab/EventSequence.cpp
A engines/crab/EventSequence.h
A engines/crab/FileData.cpp
A engines/crab/FileData.h
A engines/crab/FileMenu.cpp
A engines/crab/FileMenu.h
A engines/crab/GameClock.h
A engines/crab/GameEventInfo.cpp
A engines/crab/GameEventInfo.h
A engines/crab/GameOverMenu.cpp
A engines/crab/GameOverMenu.h
A engines/crab/GameParam.cpp
A engines/crab/GameParam.h
A engines/crab/GeneralSettingMenu.cpp
A engines/crab/GeneralSettingMenu.h
A engines/crab/GfxSettingMenu.cpp
A engines/crab/GfxSettingMenu.h
A engines/crab/HealthIndicator.cpp
A engines/crab/HealthIndicator.h
A engines/crab/HoverInfo.cpp
A engines/crab/HoverInfo.h
A engines/crab/Image.cpp
A engines/crab/Image.h
A engines/crab/ImageData.cpp
A engines/crab/ImageData.h
A engines/crab/ImageManager.cpp
A engines/crab/ImageManager.h
A engines/crab/Inventory.cpp
A engines/crab/Inventory.h
A engines/crab/Item.cpp
A engines/crab/Item.h
A engines/crab/ItemCollection.cpp
A engines/crab/ItemCollection.h
A engines/crab/ItemDesc.h
A engines/crab/ItemMenu.cpp
A engines/crab/ItemMenu.h
A engines/crab/ItemSlot.cpp
A engines/crab/ItemSlot.h
A engines/crab/KeyBindMenu.cpp
A engines/crab/KeyBindMenu.h
A engines/crab/LevelExit.cpp
A engines/crab/LevelExit.h
A engines/crab/LevelResult.h
A engines/crab/Line.cpp
A engines/crab/Line.h
A engines/crab/LoadingScreen.cpp
A engines/crab/LoadingScreen.h
A engines/crab/MapData.cpp
A engines/crab/MapData.h
A engines/crab/MapMarkerMenu.cpp
A engines/crab/MapMarkerMenu.h
A engines/crab/ModMenu.cpp
A engines/crab/ModMenu.h
A engines/crab/MusicArea.cpp
A engines/crab/MusicArea.h
A engines/crab/MusicManager.cpp
A engines/crab/MusicManager.h
A engines/crab/OptionMenu.cpp
A engines/crab/OptionMenu.h
A engines/crab/OptionSelect.cpp
A engines/crab/OptionSelect.h
A engines/crab/PageMenu.h
A engines/crab/ParagraphData.cpp
A engines/crab/ParagraphData.h
A engines/crab/PathfindingAgent.cpp
A engines/crab/PathfindingAgent.h
A engines/crab/PathfindingGraphNode.cpp
A engines/crab/PathfindingGraphNode.h
A engines/crab/PathfindingGrid.cpp
A engines/crab/PathfindingGrid.h
A engines/crab/PauseMenu.cpp
A engines/crab/PauseMenu.h
A engines/crab/PersonHandler.cpp
A engines/crab/PersonHandler.h
A engines/crab/PersonScreen.cpp
A engines/crab/PersonScreen.h
A engines/crab/Polygon.cpp
A engines/crab/Polygon.h
A engines/crab/PopUp.cpp
A engines/crab/PopUp.h
A engines/crab/PriorityQueue.h
A engines/crab/ProgressBar.cpp
A engines/crab/ProgressBar.h
A engines/crab/QuestText.cpp
A engines/crab/QuestText.h
A engines/crab/RadioButton.h
A engines/crab/RadioButtonMenu.h
A engines/crab/Rectangle.cpp
A engines/crab/Rectangle.h
A engines/crab/ReplyButton.cpp
A engines/crab/ReplyButton.h
A engines/crab/ReplyMenu.cpp
A engines/crab/ReplyMenu.h
A engines/crab/ResolutionMenu.cpp
A engines/crab/ResolutionMenu.h
A engines/crab/SaveGameMenu.cpp
A engines/crab/SaveGameMenu.h
A engines/crab/ScreenSettings.cpp
A engines/crab/ScreenSettings.h
A engines/crab/SectionHeader.cpp
A engines/crab/SectionHeader.h
A engines/crab/Shape.cpp
A engines/crab/Shape.h
A engines/crab/SlideShow.cpp
A engines/crab/SlideShow.h
A engines/crab/SpriteConstant.cpp
A engines/crab/SpriteConstant.h
A engines/crab/Stairs.cpp
A engines/crab/Stairs.h
A engines/crab/Stat.cpp
A engines/crab/Stat.h
A engines/crab/StatDrawHelper.cpp
A engines/crab/StatDrawHelper.h
A engines/crab/StatPreview.cpp
A engines/crab/StatPreview.h
A engines/crab/StatTemplate.cpp
A engines/crab/StatTemplate.h
A engines/crab/StateButton.cpp
A engines/crab/StateButton.h
A engines/crab/TMXLayer.cpp
A engines/crab/TMXLayer.h
A engines/crab/TMXMap.cpp
A engines/crab/TMXMap.h
A engines/crab/TMXTileSet.cpp
A engines/crab/TMXTileSet.h
A engines/crab/TextData.h
A engines/crab/TextManager.cpp
A engines/crab/TextManager.h
A engines/crab/TileInfo.h
A engines/crab/ToggleButton.cpp
A engines/crab/ToggleButton.h
A engines/crab/TraitButton.cpp
A engines/crab/TraitButton.h
A engines/crab/TraitMenu.cpp
A engines/crab/TraitMenu.h
A engines/crab/XMLDoc.cpp
A engines/crab/XMLDoc.h
A engines/crab/animation.cpp
A engines/crab/animation.h
A engines/crab/animframe.cpp
A engines/crab/animframe.h
A engines/crab/animset.cpp
A engines/crab/animset.h
A engines/crab/app.cpp
A engines/crab/app.h
A engines/crab/bonus.h
A engines/crab/button.cpp
A engines/crab/button.h
A engines/crab/changeval.h
A engines/crab/collision.cpp
A engines/crab/collision.h
A engines/crab/color.cpp
A engines/crab/color.h
A engines/crab/common_header.h
A engines/crab/conversationdata.cpp
A engines/crab/conversationdata.h
A engines/crab/cursor.cpp
A engines/crab/cursor.h
A engines/crab/dialogbox.cpp
A engines/crab/dialogbox.h
A engines/crab/effect.cpp
A engines/crab/effect.h
A engines/crab/element.cpp
A engines/crab/element.h
A engines/crab/emotion.cpp
A engines/crab/emotion.h
A engines/crab/eventstore.cpp
A engines/crab/eventstore.h
A engines/crab/fightanim.cpp
A engines/crab/fightanim.h
A engines/crab/fightinput.cpp
A engines/crab/fightinput.h
A engines/crab/fightmove.cpp
A engines/crab/fightmove.h
A engines/crab/fightmoves.cpp
A engines/crab/fightmoves.h
A engines/crab/filesystem.cpp
A engines/crab/filesystem.h
A engines/crab/fm_ai_data.h
A engines/crab/game.cpp
A engines/crab/game.h
A engines/crab/gameevent.cpp
A engines/crab/gameevent.h
A engines/crab/gameeventmanager.cpp
A engines/crab/gameeventmanager.h
A engines/crab/gamestate_container.h
A engines/crab/gamestates.h
A engines/crab/gametype.h
A engines/crab/hotkey.cpp
A engines/crab/hotkey.h
A engines/crab/hud.cpp
A engines/crab/hud.h
A engines/crab/imageeffect.cpp
A engines/crab/imageeffect.h
A engines/crab/input.cpp
A engines/crab/input.h
A engines/crab/inputval.cpp
A engines/crab/inputval.h
A engines/crab/journal.cpp
A engines/crab/journal.h
A engines/crab/level.cpp
A engines/crab/level.h
A engines/crab/level_ai.cpp
A engines/crab/level_collide.cpp
A engines/crab/level_draw.cpp
A engines/crab/level_load.cpp
A engines/crab/level_objects.cpp
A engines/crab/level_objects.h
A engines/crab/levelpaths.h
A engines/crab/loaders.cpp
A engines/crab/loaders.h
A engines/crab/main.cpp
A engines/crab/mainmenu.cpp
A engines/crab/mainmenu.h
A engines/crab/map.cpp
A engines/crab/map.h
A engines/crab/mapbutton.h
A engines/crab/menu.h
A engines/crab/moveeffect.cpp
A engines/crab/moveeffect.h
A engines/crab/movement.cpp
A engines/crab/movement.h
A engines/crab/musicparam.h
A engines/crab/numstr.h
A engines/crab/opinion.cpp
A engines/crab/opinion.h
A engines/crab/person.cpp
A engines/crab/person.h
A engines/crab/personbase.cpp
A engines/crab/personbase.h
A engines/crab/quest.cpp
A engines/crab/quest.h
A engines/crab/questmenu.cpp
A engines/crab/questmenu.h
A engines/crab/range.h
A engines/crab/rapidxml/license.txt
A engines/crab/rapidxml/manual.html
A engines/crab/rapidxml/rapidxml.hpp
A engines/crab/rapidxml/rapidxml_iterators.hpp
A engines/crab/rapidxml/rapidxml_print.hpp
A engines/crab/rapidxml/rapidxml_utils.hpp
A engines/crab/resource.h
A engines/crab/shadow.h
A engines/crab/slider.cpp
A engines/crab/slider.h
A engines/crab/splash.cpp
A engines/crab/splash.h
A engines/crab/sprite.cpp
A engines/crab/sprite.h
A engines/crab/spriteai.cpp
A engines/crab/spriteai.h
A engines/crab/stdafx.cpp
A engines/crab/stdafx.h
A engines/crab/talknotify.cpp
A engines/crab/talknotify.h
A engines/crab/textarea.cpp
A engines/crab/textarea.h
A engines/crab/textdata.cpp
A engines/crab/timer.cpp
A engines/crab/timer.h
A engines/crab/trait.cpp
A engines/crab/trait.h
A engines/crab/trigger.cpp
A engines/crab/trigger.h
A engines/crab/triggerset.cpp
A engines/crab/triggerset.h
A engines/crab/url.cpp
A engines/crab/url.h
A engines/crab/vectors.h
A engines/crab/walkframes.cpp
A engines/crab/walkframes.h
diff --git a/engines/crab/AlphaImage.cpp b/engines/crab/AlphaImage.cpp
new file mode 100644
index 00000000000..28ec692cce7
--- /dev/null
+++ b/engines/crab/AlphaImage.cpp
@@ -0,0 +1,49 @@
+#include "stdafx.h"
+#include "AlphaImage.h"
+#include "TextManager.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+
+void AlphaImage::Load(rapidxml::xml_node<char> *node, const bool &echo)
+{
+ pos.Load(node, echo);
+ LoadImgKey(img, "img", node, echo);
+
+ LoadNum(alpha.min, "min", node);
+ LoadNum(alpha.max, "max", node);
+ LoadNum(alpha.change, "inc", node);
+
+ alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
+}
+
+void AlphaImage::InternalEvents()
+{
+ if (alpha.inc)
+ {
+ alpha.cur += alpha.change;
+ if (alpha.cur >= alpha.max)
+ {
+ alpha.cur = alpha.max;
+ alpha.inc = false;
+ }
+ }
+ else
+ {
+ alpha.cur -= alpha.change;
+ if (alpha.cur <= alpha.min)
+ {
+ alpha.cur = alpha.min;
+ alpha.inc = true;
+ }
+ }
+
+ if (gImageManager.ValidTexture(img))
+ gImageManager.GetTexture(img).Alpha(alpha.cur);
+}
+
+void AlphaImage::Draw(const int &XOffset, const int &YOffset)
+{
+ if (gImageManager.ValidTexture(img))
+ gImageManager.GetTexture(img).Draw(pos.x + XOffset, pos.y + YOffset);
+}
\ No newline at end of file
diff --git a/engines/crab/AlphaImage.h b/engines/crab/AlphaImage.h
new file mode 100644
index 00000000000..9f454dc8056
--- /dev/null
+++ b/engines/crab/AlphaImage.h
@@ -0,0 +1,50 @@
+#pragma once
+
+#include "common_header.h"
+#include "ImageManager.h"
+#include "element.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class AlphaImage
+ {
+ //The image used - we don't use the image manager
+ //because we don't change the alpha for those images
+ ImageKey img;
+
+ //The information for drawing the image
+ Element pos;
+
+ //The information related to alpha modulation of the image
+ struct AlphaVal
+ {
+ int cur, min, max;
+
+ //Are we increasing or decreasing the alpha
+ bool inc;
+
+ //By how much do we change the alpha every update
+ int change;
+
+ AlphaVal() { cur = 255; min = 255; max = 255; inc = true; change = 0; }
+ } alpha;
+
+ public:
+ AlphaImage(){}
+ AlphaImage(rapidxml::xml_node<char> *node){ Load(node); }
+
+ ~AlphaImage(){}
+
+ void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
+
+ //This is used to vary the alpha
+ void InternalEvents();
+
+ void SetUI(){ pos.SetUI(); }
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/AnimationEffect.h b/engines/crab/AnimationEffect.h
new file mode 100644
index 00000000000..3ee7f8760da
--- /dev/null
+++ b/engines/crab/AnimationEffect.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include "common_header.h"
+#include "loaders.h"
+
+namespace pyrodactyl
+{
+ namespace anim
+ {
+ //Types of fade effects
+ enum FadeType { FADE_NONE, FADE_IN, FADE_OUT };
+
+ //Sometimes we need to stop drawing the game for proper fade effects
+ //Use DRAW_STOP to stop drawing the game until DRAW_START is called. DRAW_SAME doesn't change anything
+ enum DrawType { DRAW_SAME, DRAW_STOP, DRAW_START };
+
+ struct AnimationEffect
+ {
+ //What sort of effect do we apply to the image
+ FadeType type;
+
+ //The duration of the effect relative to the start of this animation
+ Uint32 start, finish;
+
+ //Warning: the only way to start drawing the game again is having another animation event with DRAW_START
+ DrawType draw_game;
+
+ AnimationEffect() { type = FADE_NONE; draw_game = DRAW_SAME; start = 0; finish = 0; }
+
+ AnimationEffect(rapidxml::xml_node<char> *node)
+ {
+ if (NodeValid("effect", node))
+ {
+ rapidxml::xml_node<char> *effnode = node->first_node("effect");
+ LoadNum(start, "start", effnode);
+ LoadNum(finish, "finish", effnode);
+
+ std::string str;
+ LoadStr(str, "type", effnode);
+ if (str == "fade_in") type = FADE_IN;
+ else if (str == "fade_out") type = FADE_OUT;
+ else type = FADE_NONE;
+
+ LoadStr(str, "game_draw", effnode);
+ if (str == "start") draw_game = DRAW_START;
+ else if (str == "stop") draw_game = DRAW_STOP;
+ else draw_game = DRAW_SAME;
+ }
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/AnimationFrame.cpp b/engines/crab/AnimationFrame.cpp
new file mode 100644
index 00000000000..6111ed48b95
--- /dev/null
+++ b/engines/crab/AnimationFrame.cpp
@@ -0,0 +1,63 @@
+#include "stdafx.h"
+#include "AnimationFrame.h"
+
+using namespace pyrodactyl::image;
+using namespace pyrodactyl::anim;
+
+AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : eff(node)
+{
+ Vector2i::Load(node);
+ LoadImgKey(img, "img", node);
+ LoadNum(start, "start", node);
+ LoadNum(finish, "finish", node);
+ LoadColor(col, node);
+
+ if (NodeValid("text", node, false))
+ text.Load(node->first_node("text"));
+
+ Reset();
+}
+
+void AnimationFrame::Reset()
+{
+ switch (eff.type)
+ {
+ case FADE_IN: col.a = 0; break;
+ case FADE_OUT: col.a = 255; break;
+ default: col.a = 255; break;
+ }
+}
+
+void AnimationFrame::Draw(const Uint32 ×tamp)
+{
+ //Only draw the frame in the specified duration
+ if (timestamp >= start && timestamp <= finish)
+ {
+ //Fill the screen with the color indicated
+ SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
+ SDL_SetRenderDrawColor(gRenderer, col.r, col.g, col.b, col.a);
+ SDL_RenderFillRect(gRenderer, NULL);
+
+ gImageManager.Draw(x, y, img);
+ text.Draw();
+ }
+}
+
+DrawType AnimationFrame::InternalEvents(const Uint32 ×tamp)
+{
+ //Vary alpha according to the effect values in the variation time frame
+ if (timestamp >= eff.start && timestamp <= eff.finish)
+ {
+ //These equations courtesy of linear algebra
+ switch (eff.type)
+ {
+ case FADE_IN: col.a = (255 * (timestamp - eff.start)) / (eff.finish - eff.start); break;
+ case FADE_OUT: col.a = (255 * (eff.finish - timestamp)) / (eff.finish - eff.start); break;
+ default: break;
+ }
+
+ return eff.draw_game;
+ }
+
+ return DRAW_SAME;
+}
\ No newline at end of file
diff --git a/engines/crab/AnimationFrame.h b/engines/crab/AnimationFrame.h
new file mode 100644
index 00000000000..f4c03c0ca20
--- /dev/null
+++ b/engines/crab/AnimationFrame.h
@@ -0,0 +1,38 @@
+#pragma once
+
+#include "common_header.h"
+#include "AnimationEffect.h"
+#include "ImageManager.h"
+#include "TextManager.h"
+#include "HoverInfo.h"
+
+namespace pyrodactyl
+{
+ namespace anim
+ {
+ struct AnimationFrame : public Vector2i
+ {
+ //The image drawn in this frame
+ ImageKey img;
+
+ //This is the time in we draw the frame milliseconds relative to the start of the entire animation
+ Uint32 start, finish;
+
+ //The effect applied to the image
+ AnimationEffect eff;
+
+ //In case we want to display any words during the animation
+ pyrodactyl::ui::HoverInfo text;
+
+ //The color drawn on the screen
+ SDL_Color col;
+
+ AnimationFrame(){ img = 0; start = 0; finish = 0; col.r = 0; col.g = 0; col.b = 0; col.a = 255; }
+ AnimationFrame(rapidxml::xml_node<char> *node);
+
+ void Reset();
+ void Draw(const Uint32 ×tamp);
+ DrawType InternalEvents(const Uint32 ×tamp);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Caption.cpp b/engines/crab/Caption.cpp
new file mode 100644
index 00000000000..06f7fd9982a
--- /dev/null
+++ b/engines/crab/Caption.cpp
@@ -0,0 +1,34 @@
+#include "stdafx.h"
+
+#include "Caption.h"
+
+using namespace pyrodactyl::text;
+using namespace pyrodactyl::ui;
+
+void Caption :: Init(const Caption &c, const int &XOffset, const int &YOffset)
+{
+ *this = c;
+ x += XOffset;
+ y += YOffset;
+}
+
+void Caption :: Load(rapidxml::xml_node<char> *node, Rect *parent)
+{
+ if(TextData::Load(node,parent,false))
+ {
+ LoadStr(text, "text", node);
+ LoadNum(col_s,"color_s",node,false);
+ enabled = true;
+ }
+}
+
+void Caption :: Draw(bool selected, const int &XOffset, const int &YOffset)
+{
+ if(enabled)
+ {
+ if(selected)
+ TextData::DrawColor(text, col_s, XOffset, YOffset);
+ else
+ TextData::Draw(text, XOffset, YOffset);
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Caption.h b/engines/crab/Caption.h
new file mode 100644
index 00000000000..cf382a383e0
--- /dev/null
+++ b/engines/crab/Caption.h
@@ -0,0 +1,28 @@
+#pragma once
+#include "common_header.h"
+
+#include "TextData.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ //Caption for buttons
+ class Caption : public TextData
+ {
+ public:
+ bool enabled;
+ int col_s;
+
+ std::string text;
+
+ Caption(void){ col_s = 0; enabled = false; }
+ ~Caption(void){}
+
+ void Init(const Caption &c, const int &XOffset = 0, const int &YOffset = 0);
+
+ void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
+ void Draw(bool selected, const int &XOffset = 0, const int &YOffset = 0);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ChapterIntro.cpp b/engines/crab/ChapterIntro.cpp
new file mode 100644
index 00000000000..f28eb257f5a
--- /dev/null
+++ b/engines/crab/ChapterIntro.cpp
@@ -0,0 +1,40 @@
+#include "stdafx.h"
+#include "ChapterIntro.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+
+void ChapterIntro::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid("dialog", node))
+ dialog.Load(node->first_node("dialog"));
+
+ if (NodeValid("image", node))
+ pos.Load(node->first_node("image"));
+
+ if (NodeValid("trait", node))
+ traits.Load(node->first_node("trait"));
+}
+
+bool ChapterIntro::HandleEvents(SDL_Event &Event)
+{
+ if (traits.HandleEvents(Event))
+ show_traits = true;
+
+ return dialog.HandleEvents(Event);
+}
+
+void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
+ pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state)
+{
+ dialog.Draw(false);
+ dialog.Draw(info, text);
+
+ traits.Draw();
+
+ if (cur_sp != nullptr)
+ {
+ Rect clip = cur_sp->DialogClip(state);
+ gImageManager.Draw(pos.x, pos.y, cur_sp->Img(), &clip);
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ChapterIntro.h b/engines/crab/ChapterIntro.h
new file mode 100644
index 00000000000..4bde3e52d71
--- /dev/null
+++ b/engines/crab/ChapterIntro.h
@@ -0,0 +1,35 @@
+#pragma once
+
+#include "button.h"
+#include "dialogbox.h"
+#include "GameEventInfo.h"
+#include "sprite.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class ChapterIntro
+ {
+ //This contains the background image info and start button
+ GameDialogBox dialog;
+
+ //This is where the sprite is drawn
+ Element pos;
+
+ //The traits button
+ Button traits;
+
+ public:
+ //Should we show the traits screen
+ bool show_traits;
+
+ ChapterIntro(){ show_traits = false; }
+
+ void Load(rapidxml::xml_node<char> *node);
+ bool HandleEvents(SDL_Event &Event);
+ void Draw(pyrodactyl::event::Info &info, std::string &text,
+ pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state);
+ };
+ }
+}
diff --git a/engines/crab/ClipButton.cpp b/engines/crab/ClipButton.cpp
new file mode 100644
index 00000000000..c35209c9d11
--- /dev/null
+++ b/engines/crab/ClipButton.cpp
@@ -0,0 +1,26 @@
+#include "stdafx.h"
+
+#include "ClipButton.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+
+void ClipButton :: Load(rapidxml::xml_node<char> * node, const bool &echo)
+{
+ Button::Load(node, echo);
+
+ if(NodeValid("clip", node, false))
+ clip.Load(node->first_node("clip"));
+ else
+ {
+ clip.x = 0;
+ clip.y = 0;
+ clip.w = gImageManager.GetTexture(img.normal).W();
+ clip.h = gImageManager.GetTexture(img.normal).H();
+ }
+}
+
+void ClipButton :: Draw(const int &XOffset, const int &YOffset)
+{
+ Button::Draw(XOffset, YOffset, &clip);
+}
\ No newline at end of file
diff --git a/engines/crab/ClipButton.h b/engines/crab/ClipButton.h
new file mode 100644
index 00000000000..3387d3d892f
--- /dev/null
+++ b/engines/crab/ClipButton.h
@@ -0,0 +1,23 @@
+#pragma once
+#include "common_header.h"
+#include "button.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ //Sometimes we need to display a clipped version of the button image
+ class ClipButton : public Button
+ {
+ public:
+ //The clip rectangle
+ Rect clip;
+
+ ClipButton(){}
+ ~ClipButton(){}
+
+ void Load(rapidxml::xml_node<char> * node, const bool &echo = true);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ };
+ }
+}
diff --git a/engines/crab/CreditScreen.cpp b/engines/crab/CreditScreen.cpp
new file mode 100644
index 00000000000..9e5425d7614
--- /dev/null
+++ b/engines/crab/CreditScreen.cpp
@@ -0,0 +1,160 @@
+#include "stdafx.h"
+#include "CreditScreen.h"
+#include "url.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::text;
+
+void CreditScreen::Reset()
+{
+ start.x = gScreenSettings.cur.w / 2 - 150;
+ start.y = gScreenSettings.cur.h + 20;
+ cur.x = start.x;
+ speed.cur = speed.slow;
+}
+
+void CreditScreen::Load(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("credits");
+
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+
+ if (NodeValid("h", node))
+ heading.Load(node->first_node("h"));
+
+ if (NodeValid("p", node))
+ paragraph.Load(node->first_node("p"));
+
+ if (NodeValid("logo", node))
+ logo.Load(node->first_node("logo"));
+
+ if (NodeValid("website", node))
+ website.Load(node->first_node("website"), false);
+
+ if (NodeValid("twitter", node))
+ twitter.Load(node->first_node("twitter"), false);
+
+ if (NodeValid("twitter", node))
+ back.Load(node->first_node("back"));
+
+ if (NodeValid("fast", node))
+ {
+ rapidxml::xml_node<char> *fnode = node->first_node("fast");
+ fast.Load(fnode);
+ LoadNum(speed.fast, "val", fnode);
+ }
+
+ if (NodeValid("slow", node))
+ {
+ rapidxml::xml_node<char> *snode = node->first_node("slow");
+ slow.Load(snode);
+ LoadNum(speed.slow, "val", snode);
+ }
+
+ if (NodeValid("reverse", node))
+ {
+ rapidxml::xml_node<char> *rnode = node->first_node("reverse");
+ reverse.Load(rnode);
+ LoadNum(speed.reverse, "val", rnode);
+ }
+
+ speed.cur = speed.slow;
+
+ if (NodeValid("pause", node))
+ pause.Load(node->first_node("pause"));
+
+ if (NodeValid("text", node))
+ {
+ rapidxml::xml_node<char> *tnode = node->first_node("text");
+ for (rapidxml::xml_node<char> *n = tnode->first_node(); n != NULL; n = n->next_sibling())
+ {
+ CreditText t;
+ t.text = n->value();
+ t.heading = (n->name()[0] == 'h');
+ list.push_back(t);
+ }
+ }
+ }
+}
+
+bool CreditScreen::HandleEvents(SDL_Event& Event)
+{
+ if (slow.HandleEvents(Event) == BUAC_LCLICK)
+ speed.cur = speed.slow;
+ else if (fast.HandleEvents(Event) == BUAC_LCLICK)
+ speed.cur = speed.fast;
+ else if (pause.HandleEvents(Event) == BUAC_LCLICK)
+ speed.cur = 0.0f;
+ else if (reverse.HandleEvents(Event) == BUAC_LCLICK)
+ speed.cur = speed.reverse;
+
+ if (website.HandleEvents(Event))
+ OpenURL("http://pyrodactyl.com");
+ else if (twitter.HandleEvents(Event))
+ OpenURL("https://www.twitter.com/pyrodactylgames");
+
+ return (back.HandleEvents(Event) == BUAC_LCLICK);
+}
+
+void CreditScreen::Draw()
+{
+ bg.Draw();
+
+ slow.Draw();
+ fast.Draw();
+ pause.Draw();
+ reverse.Draw();
+
+ logo.Draw();
+ twitter.Draw();
+ website.Draw();
+
+ back.Draw();
+
+ cur.y = start.y;
+
+ for (auto i = list.begin(); i != list.end(); ++i)
+ {
+ cur.y += paragraph.inc;
+
+ if (i->heading)
+ {
+ cur.y += heading.inc;
+ if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40) //Only draw text if it is actually visible on screen
+ gTextManager.Draw(cur.x, cur.y, i->text, heading.color, heading.font, heading.align);
+ }
+ else if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40)
+ gTextManager.Draw(cur.x, cur.y, i->text, paragraph.color, paragraph.font, paragraph.align);
+
+ //If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
+ if (cur.y > gScreenSettings.cur.h + 40)
+ break;
+ }
+
+ start.y -= speed.cur;
+
+ //Sanity check so that we don't scroll too high or low
+ if (start.y > gScreenSettings.cur.h + 40)
+ start.y = gScreenSettings.cur.h + 40;
+ else if (start.y < INT_MIN + 10)
+ start.y = INT_MIN + 10;
+}
+
+void CreditScreen::SetUI()
+{
+ bg.SetUI();
+ back.SetUI();
+
+ slow.SetUI();
+ fast.SetUI();
+ pause.SetUI();
+ reverse.SetUI();
+
+ logo.SetUI();
+ twitter.SetUI();
+ website.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/CreditScreen.h b/engines/crab/CreditScreen.h
new file mode 100644
index 00000000000..ee87cf7c44e
--- /dev/null
+++ b/engines/crab/CreditScreen.h
@@ -0,0 +1,87 @@
+#pragma once
+
+#include "common_header.h"
+#include "ImageData.h"
+#include "TextData.h"
+#include "TextManager.h"
+#include "timer.h"
+#include "button.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class CreditScreen
+ {
+ //Text and formatting information
+ struct CreditText
+ {
+ //Title of the section (stuff like programmer, designer etc)
+ std::string text;
+
+ //The style it should be drawn in
+ bool heading;
+ };
+
+ //The background image and company logo
+ pyrodactyl::ui::ImageData bg, logo;
+
+ //The names displayed in the credits
+ std::vector<CreditText> list;
+
+ //The starting position
+ Vector2i start;
+
+ //The current position
+ Vector2D<long> cur;
+
+ //Text parameters
+ struct TextParam
+ {
+ int inc, color;
+ FontKey font;
+ Align align;
+
+ TextParam(){ inc = 30; color = 0; font = 1; align = ALIGN_CENTER; }
+
+ void Load(rapidxml::xml_node<char> *node)
+ {
+ LoadNum(inc, "inc", node);
+ LoadNum(color, "color", node);
+ LoadFontKey(font, "font", node);
+ LoadAlign(align, node);
+ }
+ } heading, paragraph;
+
+ //All speed levels at which credits can scroll through
+ struct ScrollSpeed
+ {
+ //The current speed
+ float cur;
+
+ //Various levels
+ float slow, fast, reverse;
+
+ ScrollSpeed(){ slow = 1.0f; fast = 4.0f; reverse = -2.0f; cur = slow; }
+ } speed;
+
+ //Speed controls for credits
+ Button fast, slow, reverse, pause;
+
+ //The back button, website and twitter buttons
+ Button back, website, twitter;
+
+ public:
+ CreditScreen(){ Reset(); }
+ ~CreditScreen(){}
+
+ void Load(const std::string &filename);
+ void Reset();
+
+ bool HandleEvents(SDL_Event& Event);
+ void Draw();
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/DevConsole.cpp b/engines/crab/DevConsole.cpp
new file mode 100644
index 00000000000..040d90d969e
--- /dev/null
+++ b/engines/crab/DevConsole.cpp
@@ -0,0 +1,104 @@
+#include "stdafx.h"
+#include "DevConsole.h"
+
+using namespace pyrodactyl::ui;
+
+void DebugConsole::Load(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("debug");
+ if (NodeValid(node))
+ {
+ if (NodeValid("menu", node))
+ menu.Load(node->first_node("menu"));
+
+ if (NodeValid("variable", node))
+ {
+ rapidxml::xml_node<char> *varnode = node->first_node("variable");
+
+ if (NodeValid("bg", varnode))
+ bg.Load(varnode->first_node("bg"));
+
+ if (NodeValid("check", varnode))
+ check.Load(varnode->first_node("check"));
+
+ if (NodeValid("back", varnode))
+ back.Load(varnode->first_node("back"));
+
+ if (NodeValid("value", varnode))
+ value.Load(varnode->first_node("value"));
+
+ if (NodeValid("text", varnode))
+ text_field.Load(varnode->first_node("text"));
+ }
+ }
+ }
+}
+
+void DebugConsole::Draw(pyrodactyl::event::Info &info)
+{
+ switch (state)
+ {
+ case STATE_NORMAL:
+ menu.Draw();
+ break;
+ case STATE_VAR:
+ bg.Draw();
+ check.Draw();
+ back.Draw();
+ text_field.Draw();
+
+ {
+ int temp = 0;
+ if (info.VarGet(var_name, temp))
+ value.Draw(NumberToString(temp));
+ else
+ value.Draw("Does not exist.");
+ }
+ break;
+
+ default:break;
+ }
+}
+
+void DebugConsole::HandleEvents(const SDL_Event &Event)
+{
+ switch (state)
+ {
+ case STATE_NORMAL:
+ {
+ int choice = menu.HandleEvents(Event);
+ if (choice == 0)
+ state = STATE_VAR;
+ }
+ break;
+ case STATE_VAR:
+ text_field.HandleEvents(Event);
+
+ if (check.HandleEvents(Event))
+ var_name = text_field.text;
+
+ //Control+V pastes clipboard text into text field
+ if (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_V && Event.key.keysym.mod & KMOD_CTRL)
+ {
+ if (SDL_HasClipboardText() == SDL_TRUE)
+ {
+ char* temp = SDL_GetClipboardText();
+ text_field.text = temp;
+ SDL_free(temp);
+ }
+ }
+
+ if (back.HandleEvents(Event))
+ state = STATE_NORMAL;
+ break;
+
+ default:break;
+ }
+}
+
+void DebugConsole::InternalEvents()
+{
+}
\ No newline at end of file
diff --git a/engines/crab/DevConsole.h b/engines/crab/DevConsole.h
new file mode 100644
index 00000000000..d26c0c977b9
--- /dev/null
+++ b/engines/crab/DevConsole.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "common_header.h"
+#include "GameEventInfo.h"
+#include "textarea.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class DebugConsole
+ {
+ //The state of the menu
+ enum { STATE_NORMAL, STATE_VAR } state;
+
+ //The overarching menu that is the starting point for all functions
+ ButtonMenu menu;
+
+ //The dialog box UI - used to check value of a variable
+ ImageData bg;
+ Button check, back;
+ TextData value;
+ TextArea text_field;
+
+ //The variable name we're tracking
+ std::string var_name;
+
+ public:
+ DebugConsole(){ state = STATE_NORMAL; }
+ ~DebugConsole(){}
+
+ //Only restrict input when we're in variable state
+ bool RestrictInput() { return (state == STATE_VAR || menu.HoverIndex() != -1); }
+
+ void Load(const std::string &filename);
+ void Draw(pyrodactyl::event::Info &info);
+
+ void HandleEvents(const SDL_Event &Event);
+ void InternalEvents();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/EventSeqGroup.cpp b/engines/crab/EventSeqGroup.cpp
new file mode 100644
index 00000000000..3c4bbdbac79
--- /dev/null
+++ b/engines/crab/EventSeqGroup.cpp
@@ -0,0 +1,78 @@
+#include "stdafx.h"
+
+#include "EventSeqGroup.h"
+
+using namespace pyrodactyl::event;
+
+void EventSeqGroup::EndSeq(const unsigned int &id)
+{
+ seq.erase(id);
+ end.push_back(id);
+}
+
+void EventSeqGroup::AddSeq(const unsigned int &id, std::string &path)
+{
+ seq[id].Load(path);
+}
+
+bool EventSeqGroup::EventInProgress(const unsigned int &id)
+{
+ return seq.count(id) > 0 && seq.at(id).EventInProgress();
+}
+
+GameEvent* EventSeqGroup::CurEvent(const unsigned int &id)
+{
+ return seq.at(id).CurrentEvent();
+}
+
+void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const std::string &player_id,
+ std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq, const int choice)
+{
+ return seq.at(id).NextEvent(info, player_id, result, end_seq, choice);
+}
+
+void EventSeqGroup::InternalEvents(Info &info)
+{
+ for (auto it = seq.begin(); it != seq.end(); ++it)
+ it->second.InternalEvents(info);
+}
+
+bool EventSeqGroup::ActiveSeq(unsigned int &active_seq)
+{
+ for (auto i = seq.begin(); i != seq.end(); ++i)
+ if (i->second.EventInProgress())
+ {
+ active_seq = i->first;
+ return true;
+ }
+
+ active_seq = UINT_MAX;
+ return false;
+}
+
+void EventSeqGroup::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ for (auto i = end.begin(); i != end.end(); ++i)
+ {
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "end");
+ child->value(gStrPool.Get(*i));
+ root->append_node(child);
+ }
+
+ for (auto i = seq.begin(); i != seq.end(); ++i)
+ i->second.SaveState(doc, root, gStrPool.Get(i->first));
+}
+
+void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node)
+{
+ for (rapidxml::xml_node<char> *i = node->first_node("end"); i != NULL; i = i->next_sibling("end"))
+ EndSeq(StringToNumber<unsigned int>(i->value()));
+
+ for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set"))
+ if (n->first_attribute("name") != NULL)
+ {
+ unsigned int id = StringToNumber<unsigned int>(n->first_attribute("name")->value());
+ if (seq.count(id) > 0)
+ seq[id].LoadState(n);
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/EventSeqGroup.h b/engines/crab/EventSeqGroup.h
new file mode 100644
index 00000000000..f9620a008f3
--- /dev/null
+++ b/engines/crab/EventSeqGroup.h
@@ -0,0 +1,39 @@
+#pragma once
+#include "common_header.h"
+
+#include "EventSequence.h"
+
+namespace pyrodactyl
+{
+ namespace event
+ {
+ class EventSeqGroup
+ {
+ typedef std::unordered_map<unsigned int, EventSequence> SeqMap;
+
+ //The event sequences in this group
+ SeqMap seq;
+
+ //The sequences that have ended in this group
+ std::vector<unsigned int> end;
+
+ public:
+ EventSeqGroup(void){}
+ ~EventSeqGroup(void){}
+
+ void AddSeq(const unsigned int &id, std::string &path);
+ void EndSeq(const unsigned int &id);
+ bool EventInProgress(const unsigned int &id);
+ bool ActiveSeq(unsigned int &active_seq);
+
+ GameEvent* CurEvent(const unsigned int &id);
+ void NextEvent(const unsigned int &id, Info &info, const std::string &player_id, std::vector<EventResult> &result,
+ std::vector<EventSeqInfo> &end_seq, const int choice = -1);
+
+ void InternalEvents(Info &info);
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/EventSequence.cpp b/engines/crab/EventSequence.cpp
new file mode 100644
index 00000000000..0da747c4e77
--- /dev/null
+++ b/engines/crab/EventSequence.cpp
@@ -0,0 +1,123 @@
+#include "stdafx.h"
+
+#include "EventSequence.h"
+
+using namespace pyrodactyl::event;
+
+//------------------------------------------------------------------------
+// Purpose: Load
+//------------------------------------------------------------------------
+void EventSequence::Load(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("events");
+ for (auto n = node->first_node("event"); n != NULL; n = n->next_sibling("event"))
+ {
+ GameEvent e(n);
+ events.push_back(e);
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Check for events happening
+//------------------------------------------------------------------------
+void EventSequence::InternalEvents(pyrodactyl::event::Info &info)
+{
+ for (auto nxe = next.begin(); nxe != next.end(); ++nxe)
+ if (*nxe < events.size())
+ {
+ if (events[*nxe].trig.Evaluate(info))
+ {
+ event_in_progress = true;
+ cur = *nxe;
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Go to next event
+//------------------------------------------------------------------------
+void EventSequence::NextEvent(pyrodactyl::event::Info &info, const std::string &player_id, std::vector<EventResult> &result,
+ std::vector<EventSeqInfo> &end_seq, int NextEventChoice)
+{
+ bool sync = false;
+ event_in_progress = false;
+
+ //Execute all effects associated with the event
+ for (auto i = events[cur].effect.begin(); i != events[cur].effect.end(); ++i)
+ if (i->Execute(info, player_id, result, end_seq))
+ sync = true;
+
+ //Play a notification sound
+ using namespace pyrodactyl::music;
+
+ if (info.sound.rep_dec) gMusicManager.PlayEffect(gMusicManager.rep_dec, 0);
+ else if (info.sound.rep_inc) gMusicManager.PlayEffect(gMusicManager.rep_inc, 0);
+ else if (info.sound.notify) gMusicManager.PlayEffect(gMusicManager.notify, 0);
+
+ info.sound.notify = false;
+ info.sound.rep_dec = false;
+ info.sound.rep_inc = false;
+
+ if (!result.empty() || sync)
+ {
+ EventResult r;
+ r.type = ER_SYNC;
+ result.push_back(r);
+ }
+
+ //Clear the next event list
+ next.clear();
+
+ //Add the next event to the event list
+ if (NextEventChoice != -1)
+ next.push_back(NextEventChoice);
+ else
+ {
+ for (auto i = events[cur].next.begin(); i != events[cur].next.end(); ++i)
+ next.push_back(*i);
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Save the state of the object
+//------------------------------------------------------------------------
+void EventSequence::SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char* name)
+{
+ rapidxml::xml_node<char> *seqnode = doc.allocate_node(rapidxml::node_element, "set");
+
+ //Write current event id and name to node
+ seqnode->append_attribute(doc.allocate_attribute("name", name));
+ seqnode->append_attribute(doc.allocate_attribute("current", gStrPool.Get(cur)));
+
+ //Prepare strings of next events and write them
+ for (unsigned int i = 0; i < next.size(); i++)
+ {
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "next");
+ child->value(gStrPool.Get(next[i]));
+ seqnode->append_node(child);
+ }
+
+ root->append_node(seqnode);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Load the state of the object
+//------------------------------------------------------------------------
+void EventSequence::LoadState(rapidxml::xml_node<char> *node)
+{
+ rapidxml::xml_attribute<char> *curid = node->first_attribute("current");
+ if (curid != NULL)
+ cur = StringToNumber<unsigned int>(curid->value());
+
+ next.clear();
+ for (auto n = node->first_node("next"); n != NULL; n = n->next_sibling("next"))
+ next.push_back(StringToNumber<unsigned int>(n->value()));
+
+ if (next.empty())
+ next.push_back(0);
+}
\ No newline at end of file
diff --git a/engines/crab/EventSequence.h b/engines/crab/EventSequence.h
new file mode 100644
index 00000000000..323a30b84b2
--- /dev/null
+++ b/engines/crab/EventSequence.h
@@ -0,0 +1,49 @@
+#pragma once
+#include "common_header.h"
+
+#include "ImageManager.h"
+#include "GameEventInfo.h"
+#include "gameevent.h"
+#include "journal.h"
+#include "Inventory.h"
+
+namespace pyrodactyl
+{
+ namespace event
+ {
+ class EventSequence
+ {
+ std::vector<GameEvent> events;
+ bool event_in_progress;
+
+ //The event currently in execution - updated only when all trigger conditions are met in InternalEvents
+ unsigned int cur;
+
+ //The events that can happen next - these are updated when the cur event is over
+ //This means cur and next operate in an alternating way
+ //scan next until find event, make it cur, end cur and update next, repeat
+ std::vector<unsigned int> next;
+
+ public:
+
+ EventSequence(){ event_in_progress = false; next.push_back(0); cur = 0; }
+ ~EventSequence(){}
+
+ GameEvent* CurrentEvent() { return &events[cur]; }
+
+ //See if we should trigger any event
+ void InternalEvents(pyrodactyl::event::Info &info);
+ void NextEvent(Info &info, const std::string &player_id, std::vector<EventResult> &result,
+ std::vector<EventSeqInfo> &end_seq, int NextEventChoice = -1);
+
+ bool EventInProgress() { return event_in_progress; }
+ void EventInProgress(bool val) { event_in_progress = val; }
+
+ //Load and save
+ void Load(const std::string &filename);
+
+ void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char* name);
+ void LoadState(rapidxml::xml_node<char> *node);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/FileData.cpp b/engines/crab/FileData.cpp
new file mode 100644
index 00000000000..7f594b9dccc
--- /dev/null
+++ b/engines/crab/FileData.cpp
@@ -0,0 +1,70 @@
+#include "stdafx.h"
+#include "FileData.h"
+#include <iomanip>
+
+using namespace pyrodactyl::ui;
+
+FileData::FileData(const boost::filesystem::path &filepath)
+{
+ if (boost::filesystem::exists(filepath))
+ {
+ name = boost::filesystem::basename(filepath);
+ path = filepath.string();
+
+#if defined(__WIN32__) || defined(__APPLE__)
+ std::time_t temp = boost::filesystem::last_write_time(filepath);
+ last_modified = NumberToString(std::put_time(std::localtime(&temp), "%d %b %Y %H:%M:%S"));
+#else
+ //Workaround for GNU C++ not having implemented std::put_time
+ std::time_t temp = boost::filesystem::last_write_time(filepath);
+ char timestr[100];
+
+ std::strftime(timestr, sizeof(timestr), "%d %b %Y %H:%M:%S", std::localtime(&temp));
+ last_modified = timestr;
+#endif
+ }
+ else
+ name = "New Save";
+}
+
+SaveFileData::SaveFileData(const boost::filesystem::path &filepath) : FileData(filepath)
+{
+ if (boost::filesystem::exists(filepath))
+ {
+ XMLDoc conf(filepath.string());
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> * node = conf.Doc()->first_node("save");
+ if (NodeValid(node))
+ {
+ LoadStr(diff, "diff", node);
+ LoadStr(loc_id, "loc_id", node);
+ LoadStr(loc_name, "loc_name", node);
+ LoadStr(char_name, "char_name", node);
+ LoadStr(time, "time", node);
+ LoadStr(preview, "preview", node);
+ blank = false;
+ }
+ }
+ }
+}
+
+ModFileData::ModFileData(boost::filesystem::path filepath) : FileData(filepath)
+{
+ if (boost::filesystem::exists(filepath))
+ {
+ XMLDoc conf(filepath.string());
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> * node = conf.Doc()->first_node("config");
+ if (NodeValid(node))
+ {
+ LoadStr(author, "author", node);
+ LoadStr(version, "version", node);
+ LoadStr(info, "info", node);
+ LoadStr(website, "website", node);
+ LoadStr(preview, "preview", node);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/FileData.h b/engines/crab/FileData.h
new file mode 100644
index 00000000000..3fc83499bff
--- /dev/null
+++ b/engines/crab/FileData.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "common_header.h"
+#include "loaders.h"
+#include "XMLDoc.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class FileData
+ {
+ public:
+ std::string name, path, last_modified;
+ FileData(const boost::filesystem::path &filepath);
+ };
+
+ class SaveFileData : public FileData
+ {
+ public:
+ std::string loc_id, loc_name, char_name, diff, time, preview;
+
+ //This is to account for the first save slot, called "New Save", which doesn't actually have a file
+ bool blank;
+
+ SaveFileData(const boost::filesystem::path &filepath);
+ SaveFileData(const bool empty);
+ };
+
+ class ModFileData : public FileData
+ {
+ public:
+ std::string author, version, info, website, preview;
+ ModFileData(boost::filesystem::path filepath);
+ };
+
+ //The types of data shown about the save file
+ enum { DATA_SAVENAME, DATA_LASTMODIFIED, DATA_BUTTON_TOTAL };
+
+ //Both of these are capped at DATA_HOVER_TOTAL
+ enum { DATA_LOCNAME, DATA_DIFFICULTY, DATA_TIMEPLAYED, DATA_PLAYERNAME };
+ enum { DATA_AUTHOR, DATA_VERSION, DATA_INFO, DATA_WEBSITE };
+ const int DATA_HOVER_TOTAL = 4;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/FileMenu.cpp b/engines/crab/FileMenu.cpp
new file mode 100644
index 00000000000..a9ff4b6ca65
--- /dev/null
+++ b/engines/crab/FileMenu.cpp
@@ -0,0 +1,10 @@
+#include "stdafx.h"
+#include "FileMenu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ FileMenu<SaveFileData> gLoadMenu;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/FileMenu.h b/engines/crab/FileMenu.h
new file mode 100644
index 00000000000..40f1a3b09ac
--- /dev/null
+++ b/engines/crab/FileMenu.h
@@ -0,0 +1,236 @@
+#pragma once
+
+#include "common_header.h"
+#include "PageMenu.h"
+#include "TextData.h"
+#include "ImageData.h"
+#include "FileData.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ //Used for menus that are responsible for reading multiple files from disk
+ template <typename FileType>
+ class FileMenu
+ {
+ protected:
+ //The background of the menu
+ ImageData bg;
+
+ //The collection of buttons
+ PageButtonMenu menu;
+
+ //The final filename that is selected
+ std::string selected;
+
+ //The extension and directory used by this menu
+ std::string extension, directory;
+
+ //The save information for each slot
+ std::vector<FileType> slot_info;
+ TextData td_b[DATA_BUTTON_TOTAL];
+
+ //The titles for loc_name, difficulty, time_played and player_name
+ HoverInfo hov[DATA_HOVER_TOTAL];
+ TextData td_h[DATA_HOVER_TOTAL];
+
+ //The preview picture details
+ struct
+ {
+ //We load only the current preview image instead of all of them
+ pyrodactyl::image::Image preview;
+
+ //Fallback path if there is no preview image or if we fail to load it
+ std::string no_preview_path;
+
+ //Position of image
+ Element pos;
+
+ //Is the image loaded
+ bool loaded;
+ } img;
+
+ //Are we hovering over a button right now?
+ bool hover;
+
+ //The previously hover button
+ int prev_hover;
+
+ public:
+ FileMenu()
+ {
+ img.loaded = false;
+ hover = false;
+ prev_hover = -1;
+ }
+
+ ~FileMenu(){ if (img.loaded) img.preview.Delete(); }
+ void Reset() { if (img.loaded) img.preview.Delete(); img.loaded = false; hover = false; }
+
+ std::string SelectedPath() { return selected; }
+ void SelectedPath(const std::string &val) { selected = val; }
+
+ void ScanDir()
+ {
+ using namespace boost::filesystem;
+
+ slot_info.clear();
+ menu.Clear();
+
+ path filedir(directory);
+ if (exists(filedir) && is_directory(filedir))
+ {
+ directory_iterator dir_it(filedir);
+ std::vector<path> file_in_dir;
+
+ std::copy(directory_iterator(filedir), directory_iterator(), std::back_inserter(file_in_dir));
+ std::sort(file_in_dir.begin(), file_in_dir.end(), PathCompare);
+
+ //First, we must load all the files with the same extension as our save file
+ unsigned int count_slot = 0, count_menu = 0;
+ for (auto i = file_in_dir.begin(); i != file_in_dir.end(); ++i)
+ if (is_regular_file(*i) && i->extension().string() == extension)
+ {
+ slot_info.push_back(FileType(*i));
+ menu.Add(count_slot, count_menu);
+ }
+ }
+ else
+ create_directories(filedir);
+
+ menu.AssignPaths();
+ }
+
+ void Load(rapidxml::xml_node<char> *node)
+ {
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+
+ if (NodeValid("menu", node))
+ menu.Load(node->first_node("menu"));
+
+ if (NodeValid("preview", node))
+ {
+ auto prnode = node->first_node("preview");
+ img.pos.Load(prnode);
+ LoadStr(img.no_preview_path, "path", prnode);
+ }
+
+ if (NodeValid("offset", node))
+ {
+ rapidxml::xml_node<char> *offnode = node->first_node("offset");
+
+ //Stuff displayed on the slot button
+ td_b[DATA_SAVENAME].Load(offnode->first_node("save_name"));
+ td_b[DATA_LASTMODIFIED].Load(offnode->first_node("last_modified"));
+
+ //Stuff displayed when you hover over a slot button
+ td_h[DATA_LOCNAME].Load(offnode->first_node("loc_name"));
+ td_h[DATA_DIFFICULTY].Load(offnode->first_node("difficulty"));
+ td_h[DATA_TIMEPLAYED].Load(offnode->first_node("time_played"));
+ td_h[DATA_PLAYERNAME].Load(offnode->first_node("player_name"));
+
+ //Titles for the stuff displayed when you hover over a slot button
+ hov[DATA_LOCNAME].Load(offnode->first_node("loc_name_title"));
+ hov[DATA_DIFFICULTY].Load(offnode->first_node("difficulty_title"));
+ hov[DATA_TIMEPLAYED].Load(offnode->first_node("time_played_title"));
+ hov[DATA_PLAYERNAME].Load(offnode->first_node("player_name_title"));
+ }
+
+ extension = gFilePath.save_ext;
+ directory = gFilePath.appdata + gFilePath.save_dir;
+ ScanDir();
+ }
+
+ bool HandleEvents(const SDL_Event &Event)
+ {
+ int choice = menu.HandleEvents(Event);
+ if (choice >= 0)
+ {
+ menu.Reset();
+ selected = slot_info[menu.Index() + choice].path;
+ Reset();
+ return true;
+ }
+
+ return false;
+ }
+
+ void Draw()
+ {
+ bg.Draw();
+ menu.Draw();
+ for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++)
+ {
+ auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
+ td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
+ td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
+ }
+
+ DrawHover();
+ }
+
+ void DrawHover()
+ {
+ if (menu.HoverIndex() >= 0)
+ {
+ int i = menu.HoverIndex();
+
+ if (!img.loaded || prev_hover != i)
+ {
+ img.loaded = true;
+ prev_hover = i;
+ if (!img.preview.Load(slot_info[i].preview))
+ img.preview.Load(img.no_preview_path);
+ }
+
+ hover = true;
+ img.preview.Draw(img.pos.x, img.pos.y);
+
+ td_h[DATA_LOCNAME].Draw(slot_info[i].loc_name);
+ td_h[DATA_DIFFICULTY].Draw(slot_info[i].diff);
+ td_h[DATA_TIMEPLAYED].Draw(slot_info[i].time);
+ td_h[DATA_PLAYERNAME].Draw(slot_info[i].char_name);
+
+ for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
+ hov[num].Draw();
+ }
+ else if (hover)
+ Reset();
+ }
+
+ bool Empty() { ScanDir(); return slot_info.empty(); }
+
+ bool SelectNewestFile()
+ {
+ if (slot_info.size() > 0)
+ {
+ selected = slot_info[0].path;
+ return true;
+ }
+
+ return false;
+ }
+
+ void SetUI()
+ {
+ bg.SetUI();
+ menu.SetUI();
+ ScanDir();
+ img.pos.SetUI();
+
+ for (int i = 0; i < DATA_BUTTON_TOTAL; ++i)
+ td_b[i].SetUI();
+
+ for (int i = 0; i < DATA_HOVER_TOTAL; ++i)
+ {
+ td_h[i].SetUI();
+ hov[i].SetUI();
+ }
+ }
+ };
+
+ extern FileMenu<SaveFileData> gLoadMenu;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
new file mode 100644
index 00000000000..29696e7485f
--- /dev/null
+++ b/engines/crab/GameClock.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#include "common_header.h"
+#include "timer.h"
+
+class GameClock
+{
+ Timer timer;
+ Uint32 start;
+ std::string seperator;
+
+public:
+ GameClock() : seperator(" : "){ start = 0; }
+
+ void Start(Uint32 initial_time = 0)
+ {
+ start = initial_time;
+ timer.Start();
+ }
+
+ void Start(const std::string &str)
+ {
+ Uint32 ms = 0, hr = 0, min = 0, sec = 0;
+ std::string str_hrs, str_min, str_sec;
+
+ std::size_t found_1 = str.find_first_of(seperator);
+ if(found_1 > 0 && found_1 != std::string::npos)
+ {
+ str_hrs = str.substr(0,found_1);
+ hr = StringToNumber<Uint32>(str_hrs);
+
+ std::size_t found_2 = str.find_last_of(seperator);
+ if(found_2 > 0 && found_2 != std::string::npos)
+ {
+ str_sec = str.substr(found_2+1,std::string::npos);
+ sec = StringToNumber<Uint32>(str_sec);
+
+ str_min = str.substr(found_1+seperator.length(), found_2-(2*seperator.length()));
+ min = StringToNumber<Uint32>(str_min);
+ }
+ }
+
+ ms = 3600000 * hr + 60000 * min + 1000 * sec;
+ Start(ms);
+ }
+
+ std::string GetTime()
+ {
+ Uint32 ms = start + timer.Ticks();
+
+ Uint32 x = ms / 1000;
+ Uint32 seconds = x % 60;
+ x /= 60;
+ Uint32 minutes = x % 60;
+ Uint32 hours = x / 60;
+
+ return NumberToString(hours) + seperator + NumberToString(minutes) + seperator + NumberToString(seconds);
+ }
+};
\ No newline at end of file
diff --git a/engines/crab/GameEventInfo.cpp b/engines/crab/GameEventInfo.cpp
new file mode 100644
index 00000000000..70616139173
--- /dev/null
+++ b/engines/crab/GameEventInfo.cpp
@@ -0,0 +1,415 @@
+#include "stdafx.h"
+#include "GameEventInfo.h"
+#include "eventstore.h"
+
+namespace pyrodactyl
+{
+ namespace event
+ {
+ bool IsChar(char c)
+ {
+ return !isdigit(c);
+ }
+ }
+}
+
+using namespace pyrodactyl::people;
+using namespace pyrodactyl::event;
+
+//------------------------------------------------------------------------
+// Purpose: Load from xml
+//------------------------------------------------------------------------
+void Info::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid("people", node))
+ {
+ rapidxml::xml_node<char> *pnode = node->first_node("people");
+
+ stem.Load(pnode->first_attribute("templates")->value());
+
+ XMLDoc conf(pnode->first_attribute("list")->value());
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *cnode = conf.Doc()->first_node("characters");
+ if (NodeValid(cnode))
+ {
+ LoadNum(OPINION_MIN, "op_min", cnode);
+ LoadNum(OPINION_MAX, "op_max", cnode);
+
+ for (auto n = cnode->first_node("group"); n != NULL; n = n->next_sibling("group"))
+ LoadPeople(n->value());
+ }
+ }
+ }
+
+ if (NodeValid("objective", node))
+ journal.Load(node->first_node("objective")->first_attribute("layout")->value());
+
+ if (NodeValid("inventory", node))
+ {
+ rapidxml::xml_node<char> *inode = node->first_node("inventory");
+ inv.Load(inode->first_attribute("layout")->value());
+ }
+
+ CurLocID(node->first_node("level")->first_attribute("start")->value());
+ inv.ItemFile(node->first_node("item")->first_attribute("list")->value());
+}
+
+void Info::LoadPeople(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("people");
+ if (NodeValid(node))
+ {
+ for (auto n = node->first_node(); n != NULL; n = n->next_sibling())
+ {
+ std::string str;
+ LoadStr(str, "id", n);
+ people[str].Load(n, stem);
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Get/Set information about object type
+//------------------------------------------------------------------------
+void Info::Type(const std::string &id, const PersonType &val)
+{
+ if (people.count(id) > 0)
+ people.at(id).type = val;
+}
+
+PersonType Info::Type(const std::string &id)
+{
+ if (people.count(id) > 0)
+ return people.at(id).type;
+
+ return PE_NEUTRAL;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Get/Set information about object state
+//------------------------------------------------------------------------
+void Info::State(const std::string &id, const PersonState &val)
+{
+ if (people.count(id) > 0)
+ people.at(id).state = val;
+}
+
+PersonState Info::State(const std::string &id)
+{
+ if (people.count(id) > 0)
+ return people.at(id).state;
+
+ return PST_NORMAL;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Get/Set information about variables
+//------------------------------------------------------------------------
+bool Info::VarGet(const std::string &name, int &val)
+{
+ if (var.count(name) == 0)
+ return false;
+ else
+ val = var.at(name);
+ return true;
+}
+
+void Info::VarSet(const std::string &name, const std::string &val)
+{
+ int var_val = 0;
+ bool assign_to_var = std::find_if(val.begin(), val.end(), IsChar) != val.end();
+
+ if (assign_to_var)
+ VarGet(val, var_val);
+ else
+ var_val = StringToNumber<int>(val);
+
+ var[name] = var_val;
+}
+
+void Info::VarAdd(const std::string &name, const int &val)
+{
+ if (var.count(name) == 0)
+ VarSet(name, 0);
+
+ var.at(name) += val;
+}
+
+void Info::VarSub(const std::string &name, const int &val)
+{
+ if (var.count(name) == 0)
+ VarSet(name, 0);
+
+ var.at(name) -= val;
+}
+
+void Info::VarMul(const std::string &name, const int &val)
+{
+ if (var.count(name) == 0)
+ VarSet(name, 0);
+
+ var.at(name) *= val;
+}
+
+void Info::VarDiv(const std::string &name, const int &val)
+{
+ if (var.count(name) == 0)
+ VarSet(name, 0);
+
+ var.at(name) /= val;
+}
+
+void Info::VarDel(const std::string &name)
+{
+ var.erase(name);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Get/Set person traits
+//------------------------------------------------------------------------
+void Info::TraitAdd(const std::string &per_id, const int &trait_id)
+{
+ if (PersonValid(per_id)) //Valid person id
+ {
+ if (trait_id >= 0 && trait_id < gEventStore.trait.size()) //Valid trait id
+ {
+ //Check for duplicate traits, DONT award anything if duplicate found
+ Person *p = &PersonGet(per_id);
+
+ for (auto i = p->trait.begin(); i != p->trait.end(); ++i)
+ if (i->id == trait_id)
+ return;
+
+ p->trait.push_back(gEventStore.trait.at(trait_id));
+
+ gEventStore.SetAchievement(gEventStore.trait.at(trait_id).id);
+ }
+ }
+}
+
+void Info::TraitDel(const std::string &per_id, const int &trait_id)
+{
+ if (PersonValid(per_id)) //Valid person id
+ {
+ if (trait_id > 0 && trait_id < gEventStore.trait.size()) //Valid trait id
+ {
+ Person *p = &PersonGet(per_id);
+
+ for (auto j = p->trait.begin(); j != p->trait.end(); ++j)
+ {
+ if (j->id == trait_id)
+ {
+ p->trait.erase(j);
+ break;
+ }
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Get/Set information about object opinion
+//------------------------------------------------------------------------
+bool Info::OpinionGet(const std::string &name, const pyrodactyl::people::OpinionType &type, int &val)
+{
+ if (people.count(name) == 0)
+ return false;
+
+ val = people.at(name).opinion.val[type];
+ return true;
+}
+
+void Info::OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val)
+{
+ if (people.count(name) > 0)
+ people.at(name).opinion.Change(type, val);
+}
+
+void Info::OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val)
+{
+ if (people.count(name) > 0)
+ people.at(name).opinion.Set(type, val);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Get/Set information about object stats
+//------------------------------------------------------------------------
+bool Info::StatGet(const std::string &name, const pyrodactyl::stat::StatType &type, int &num)
+{
+ if (people.count(name) == 0)
+ return false;
+
+ num = people.at(name).stat.val[type].cur;
+ return true;
+}
+
+void Info::StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num)
+{
+ if (people.count(name) > 0)
+ people.at(name).stat.Set(type, num);
+}
+
+void Info::StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num)
+{
+ if (people.count(name) > 0)
+ people.at(name).stat.Change(type, num);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Get person object
+//------------------------------------------------------------------------
+bool Info::PersonGet(const std::string &id, pyrodactyl::people::Person &p)
+{
+ if (people.count(id) == 0)
+ return false;
+
+ p = people.at(id);
+ return true;
+}
+
+bool Info::PersonValid(const std::string &id)
+{
+ return people.count(id) > 0;
+}
+
+pyrodactyl::people::Person& Info::PersonGet(const std::string &id)
+{
+ //Make sure to check PersonValid before doing this!
+ //Only use this to change parts of an object
+ return people.at(id);
+}
+
+bool Info::CollideWithTrigger(const std::string &id, int rect_index)
+{
+ if (people.count(id) > 0)
+ {
+ for (auto i = people.at(id).trig.begin(); i != people.at(id).trig.end(); ++i)
+ if (*i == rect_index)
+ return true;
+ }
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Replace all #values with their appropriate names in a string
+//------------------------------------------------------------------------
+void Info::InsertName(std::string &msg)
+{
+ //We scan the dialog for #id values, which we convert to actual NPC names
+ for (unsigned int i = 0; i < msg.size(); ++i)
+ {
+ //The # symbol indicates that the next string until an end character needs to be replaced by the name
+ if (msg.at(i) == '#')
+ {
+ //The position we want to start from, and the length of the substring
+ unsigned int start = i, end = i + 1, len = 0;
+
+ //First make sure # wasn't the end of the string
+ for (; end < msg.size(); ++end, ++len)
+ if (msg.at(end) == ',' || msg.at(end) == '.' || msg.at(end) == '!' || msg.at(end) == ' ' ||
+ msg.at(end) == '?' || msg.at(end) == '-' || msg.at(end) == '\'' || msg.at(end) == '\"')
+ break;
+
+ if (end < msg.size())
+ {
+ //We use start+1 here because # isn't part of the id
+ std::string s = msg.substr(start + 1, len);
+
+ //We use length+1 here because otherwise it lets the last character stay in dialog
+ if (PersonValid(s))
+ msg.replace(start, len + 1, PersonGet(s).name);
+ }
+ }
+ }
+}
+
+std::string Info::GetName(const std::string &id)
+{
+ if (PersonValid(id))
+ return PersonGet(id).name;
+
+ return id;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Save and load object state
+//------------------------------------------------------------------------
+void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ for (auto v = var.begin(); v != var.end(); ++v)
+ {
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
+ child->append_attribute(doc.allocate_attribute("id", v->first.c_str()));
+ child->append_attribute(doc.allocate_attribute("val", gStrPool.Get(v->second)));
+ root->append_node(child);
+ }
+
+ for (auto p = people.begin(); p != people.end(); ++p)
+ p->second.SaveState(doc, root);
+
+ rapidxml::xml_node<char> *child_unr = doc.allocate_node(rapidxml::node_element, "unread");
+
+ SaveBool(unread.inventory, "inventory", doc, child_unr);
+ SaveBool(unread.journal, "journal", doc, child_unr);
+ SaveBool(unread.trait, "trait", doc, child_unr);
+ SaveBool(unread.map, "map", doc, child_unr);
+
+ root->append_node(child_unr);
+
+ rapidxml::xml_node<char> *child_img = doc.allocate_node(rapidxml::node_element, "img");
+ child_img->append_attribute(doc.allocate_attribute("index", gStrPool.Get(player_img)));
+ root->append_node(child_img);
+
+ rapidxml::xml_node<char> *child_money = doc.allocate_node(rapidxml::node_element, "money");
+ child_money->append_attribute(doc.allocate_attribute("var", money_var.c_str()));
+ root->append_node(child_money);
+
+ journal.SaveState(doc, root);
+ inv.SaveState(doc, root);
+}
+
+void Info::LoadState(rapidxml::xml_node<char> *node)
+{
+ for (rapidxml::xml_node<char> *v = node->first_node("var"); v != NULL; v = v->next_sibling("var"))
+ var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
+
+ for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object"))
+ {
+ std::string id;
+ LoadStr(id, "id", p);
+ people[id].LoadState(p);
+ }
+
+ if (NodeValid("unread", node))
+ {
+ rapidxml::xml_node<char> *unrnode = node->first_node("unread");
+ LoadBool(unread.inventory, "inventory", unrnode);
+ LoadBool(unread.journal, "journal", unrnode);
+ LoadBool(unread.trait, "trait", unrnode);
+ LoadBool(unread.map, "map", unrnode);
+ }
+
+ if (NodeValid("img", node))
+ LoadNum(player_img, "index", node->first_node("img"));
+
+ if (NodeValid("money", node))
+ LoadStr(money_var, "var", node->first_node("money"));
+
+ journal.LoadState(node);
+ inv.LoadState(node);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Calculate UI positions after change in screen size
+//------------------------------------------------------------------------
+void Info::SetUI()
+{
+ journal.SetUI();
+ inv.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/GameEventInfo.h b/engines/crab/GameEventInfo.h
new file mode 100644
index 00000000000..837c0e1f36c
--- /dev/null
+++ b/engines/crab/GameEventInfo.h
@@ -0,0 +1,169 @@
+#pragma once
+
+#include "common_header.h"
+#include "person.h"
+#include "journal.h"
+#include "Inventory.h"
+#include "StatTemplate.h"
+
+namespace pyrodactyl
+{
+ namespace event
+ {
+ bool IsChar(char c);
+
+ class Info
+ {
+ //The characters in the game
+ pyrodactyl::people::PersonMap people;
+
+ //The stat templates used in declaring person objects
+ pyrodactyl::stat::StatTemplates stem;
+
+ //The variables set by the events so far
+ typedef std::unordered_map<std::string, int> VarMap;
+ VarMap var;
+
+ //The last object player interacted with
+ std::string lastobj;
+
+ //Is the game Iron Man or not?
+ //Iron man means only one save - no reloading
+ bool ironman;
+
+ //The player's current location
+ struct PlayerLoc
+ {
+ //id of the player's current location
+ std::string id;
+
+ //The name of the player's current location
+ std::string name;
+
+ PlayerLoc() : id(""), name(""){}
+ } loc;
+
+ //This image changes to reflect the playable character
+ int player_img;
+
+ void LoadPeople(const std::string &filename);
+
+ public:
+ //The player's one stop shop for objectives and lore
+ pyrodactyl::ui::Journal journal;
+
+ //The current player inventory
+ pyrodactyl::ui::Inventory inv;
+
+ //This structure keeps track of unread indicators
+ struct UnreadData
+ {
+ bool inventory, journal, trait, map;
+
+ UnreadData(){ inventory = false; journal = false; trait = true; map = false; }
+ } unread;
+
+ //This is the variable corresponding to money that is drawn
+ std::string money_var;
+
+ //Has the player pressed the talk key
+ bool TalkKeyDown;
+
+ //Used so we only play one sound per event
+ struct NotifySounds
+ {
+ bool notify, rep_inc, rep_dec;
+
+ NotifySounds(){ notify = false; rep_inc = false; rep_dec = false; }
+ } sound;
+
+ Info(){ Init(); }
+ ~Info(){}
+
+ void Init() { lastobj = ""; ironman = false; player_img = 0; TalkKeyDown = false; }
+ void Load(rapidxml::xml_node<char> *node);
+
+ //Person related stuff
+ void Type(const std::string &id, const pyrodactyl::people::PersonType &val);
+ pyrodactyl::people::PersonType Type(const std::string &id);
+
+ void State(const std::string &id, const pyrodactyl::people::PersonState &val);
+ pyrodactyl::people::PersonState State(const std::string &id);
+
+ //Opinion
+ bool OpinionGet(const std::string &name, const pyrodactyl::people::OpinionType &type, int &val);
+ void OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val);
+ void OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val);
+
+ //Stats
+ bool StatGet(const std::string &name, const pyrodactyl::stat::StatType &type, int &num);
+ void StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num);
+ void StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num);
+
+ //Variables
+ bool VarGet(const std::string &name, int &val);
+ void VarSet(const std::string &name, const std::string &val);
+ void VarAdd(const std::string &name, const int &val);
+ void VarSub(const std::string &name, const int &val);
+ void VarMul(const std::string &name, const int &val);
+ void VarDiv(const std::string &name, const int &val);
+ void VarDel(const std::string &name);
+
+ //The trait functions
+ void TraitAdd(const std::string &per_id, const int &trait_id);
+ void TraitDel(const std::string &per_id, const int &trait_id);
+
+ //Player character button
+ void PlayerImg(const int &val) { player_img = val; }
+ int PlayerImg() { return player_img; }
+
+ std::string CurLocID() { return loc.id; }
+ void CurLocID(const std::string &id){ loc.id = id; }
+
+ std::string CurLocName() { return loc.name; }
+ void CurLocName(const std::string &name) { loc.name = name; }
+
+ //Player stuff
+ std::string LastPerson() { return lastobj; }
+ void LastPerson(const std::string &name) { lastobj = name; }
+
+ //Return the variable map for stuff like visibility checks
+ VarMap &MapGet() { return var; }
+ bool PersonGet(const std::string &id, pyrodactyl::people::Person &p);
+
+ bool PersonValid(const std::string &id);
+ pyrodactyl::people::Person& PersonGet(const std::string &id);
+
+ //Is an object colliding with a trigger area
+ bool CollideWithTrigger(const std::string &id, int rect_index);
+
+ //Replace all #values with their appropriate names in a string
+ void InsertName(std::string &msg);
+ std::string GetName(const std::string &id);
+
+ //Draw the inventory
+ void InvDraw(const std::string &id)
+ {
+ if (var.count(money_var) > 0)
+ inv.Draw(people.at(id), var.at(money_var));
+ else
+ inv.Draw(people.at(id), 0);
+ }
+
+ //Get whether game is iron man or not
+ const bool IronMan() { return ironman; }
+ void IronMan(const bool &val) { ironman = val; }
+ void LoadIronMan(rapidxml::xml_node<char> *node)
+ {
+ std::string str;
+ LoadStr(str, "diff", node);
+ ironman = (str == "Iron Man");
+ }
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/GameOverMenu.cpp b/engines/crab/GameOverMenu.cpp
new file mode 100644
index 00000000000..cb15b9c007e
--- /dev/null
+++ b/engines/crab/GameOverMenu.cpp
@@ -0,0 +1,51 @@
+#include "stdafx.h"
+
+#include "GameOverMenu.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+
+void GameOverMenu::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid(node))
+ {
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+
+ if (NodeValid("title", node))
+ {
+ rapidxml::xml_node<char> *tinode = node->first_node("title");
+ title.Load(tinode);
+
+ for (auto n = tinode->first_node("quote"); n != NULL; n = n->next_sibling("quote"))
+ {
+ std::string str;
+ LoadStr(str, "text", n);
+ quote.push_back(str);
+ }
+ }
+
+ menu.Load(node->first_node("menu"));
+ }
+}
+
+int GameOverMenu::HandleEvents(const SDL_Event &Event)
+{
+ return menu.HandleEvents(Event);
+}
+
+void GameOverMenu::Draw()
+{
+ bg.Draw();
+ if (cur < quote.size())
+ title.Draw(quote.at(cur));
+
+ menu.Draw();
+}
+
+void GameOverMenu::SetUI()
+{
+ bg.SetUI();
+ title.SetUI();
+ menu.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/GameOverMenu.h b/engines/crab/GameOverMenu.h
new file mode 100644
index 00000000000..e5844445062
--- /dev/null
+++ b/engines/crab/GameOverMenu.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "common_header.h"
+#include "menu.h"
+#include "TextData.h"
+#include "ImageData.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class GameOverMenu
+ {
+ //Background image
+ ImageData bg;
+
+ //The selection of quotes, we pick one out of these
+ std::vector<std::string> quote;
+
+ //The current picked quote
+ unsigned int cur;
+
+ //How to draw the quote
+ TextData title;
+
+ //The menu for actions we can take
+ ButtonMenu menu;
+
+ public:
+ GameOverMenu(void){ cur = 0; }
+ ~GameOverMenu(void){}
+
+ void Reset() { cur = gRandom.Num() % quote.size(); }
+
+ void Load(rapidxml::xml_node<char> *node);
+ int HandleEvents(const SDL_Event &Event);
+ void Draw();
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
new file mode 100644
index 00000000000..1b93b959468
--- /dev/null
+++ b/engines/crab/GameParam.cpp
@@ -0,0 +1,149 @@
+#include "stdafx.h"
+#include "GameParam.h"
+
+//Temporary values go here
+TempValue gTemp;
+
+//The global file path object
+FilePaths gFilePath;
+
+//Are we in debug mode or not?
+bool GameDebug = false;
+
+//A temporary list of strings we use when storing numbers in a file
+StringPool gStrPool;
+
+//Generate random numbers using this
+RandomNumberGen gRandom;
+
+FilePaths::FilePaths() :
+common("res/levels/common.xml"),
+mod_path("mods/"),
+mod_ext(".unrmod"),
+mod_cur("res/default.xml"),
+mainmenu_l("res/layout/main_menu_l.xml"),
+mainmenu_r("res/layout/main_menu_r.xml"),
+sound_effect("res/sounds/effects.xml"),
+sound_music("res/sounds/music.xml"),
+font("res/fonts/fonts.xml"),
+icon("res/gfx/icon.bmp"),
+save_dir("save/"),
+save_ext(".unr"),
+shaders("res/shaders/list.xml"),
+colors("res/gfx/colors.xml"),
+current_r("res/layout/main_menu_r.xml")
+{
+ level.clear();
+ loaded = false;
+
+ char *path = SDL_GetPrefPath("Pyrodactyl", "Unrest");
+ appdata = path;
+ SDL_free(path);
+}
+
+void FilePaths::LoadLevel(const std::string &filename)
+{
+ level.clear();
+ XMLDoc lev_list(filename);
+ if (lev_list.ready())
+ {
+ rapidxml::xml_node<char> *node = lev_list.Doc()->first_node("world");
+
+ for (rapidxml::xml_node<char> * n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc"))
+ {
+ LevelPath l;
+ l.Load(n);
+
+ std::string id;
+ LoadStr(id, "id", n);
+
+ level[id] = l;
+ }
+ }
+}
+
+void FilePaths::Load(const std::string &filename)
+{
+ XMLDoc settings(filename);
+ if (settings.ready())
+ {
+ rapidxml::xml_node<char> *node = settings.Doc()->first_node("paths");
+
+ if (NodeValid(node) && !loaded)
+ {
+ if (NodeValid("icon", node))
+ {
+ rapidxml::xml_node<char> *iconode = node->first_node("icon");
+ icon = iconode->value();
+ }
+
+ if (NodeValid("common", node))
+ {
+ rapidxml::xml_node<char> *commonnode = node->first_node("common");
+ common = commonnode->value();
+ }
+
+ if (NodeValid("font", node))
+ {
+ rapidxml::xml_node<char> *fontnode = node->first_node("font");
+ font = fontnode->value();
+ }
+
+ if (NodeValid("shader", node))
+ {
+ rapidxml::xml_node<char> *shadnode = node->first_node("shader");
+ shaders = shadnode->value();
+ }
+
+ if (NodeValid("color", node))
+ {
+ rapidxml::xml_node<char> *colnode = node->first_node("color");
+ colors = colnode->value();
+ }
+
+ if (NodeValid("mod", node))
+ {
+ rapidxml::xml_node<char> *modnode = node->first_node("mod");
+ LoadStr(mod_path, "path", modnode);
+ LoadStr(mod_ext, "ext", modnode);
+ LoadStr(mod_cur, "cur", modnode);
+ }
+
+ if (NodeValid("main_menu", node))
+ {
+ rapidxml::xml_node<char> *menunode = node->first_node("main_menu");
+ LoadStr(mainmenu_l, "l", menunode);
+ LoadStr(mainmenu_r, "r", menunode);
+ current_r = mainmenu_r;
+ }
+
+ if (NodeValid("sound", node))
+ {
+ rapidxml::xml_node<char> *soundnode = node->first_node("sound");
+ LoadStr(sound_effect, "effect", soundnode);
+ LoadStr(sound_music, "music", soundnode);
+ }
+
+ if (NodeValid("save", node))
+ {
+ rapidxml::xml_node<char> *savenode = node->first_node("save");
+ LoadStr(save_dir, "dir", savenode);
+ LoadStr(save_ext, "ext", savenode);
+
+ std::string custom_path;
+ if (LoadStr(custom_path, "custom", savenode))
+ {
+ using namespace boost::filesystem;
+
+ path customdir(custom_path);
+ if (exists(customdir) && is_directory(customdir))
+ {
+ appdata = custom_path;
+ }
+ }
+ }
+
+ loaded = true;
+ }
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
new file mode 100644
index 00000000000..06cd5ac52ce
--- /dev/null
+++ b/engines/crab/GameParam.h
@@ -0,0 +1,159 @@
+#pragma once
+
+#include "common_header.h"
+#include "XMLDoc.h"
+#include "loaders.h"
+
+//The index for all levels in the game
+struct LevelPath
+{
+ //The file paths
+ std::string layout, asset;
+
+ //The name of the level
+ std::string name;
+
+ LevelPath() : layout(""), asset(""), name("") {}
+
+ void Load(rapidxml::xml_node<char> *node)
+ {
+ LoadStr(name, "name", node);
+ LoadStr(layout, "layout", node);
+ LoadStr(asset, "res", node);
+ }
+};
+
+//Stores all layout paths for the game
+struct FilePaths
+{
+ //Resources common to all levels and states
+ std::string common;
+
+ //Mod file location, current mod and their extension
+ std::string mod_path, mod_ext, mod_cur;
+
+ //Main menu resources
+ std::string mainmenu_l, mainmenu_r;
+
+ //Sounds
+ std::string sound_effect, sound_music;
+
+ //Fonts and window icon file
+ std::string font, icon;
+
+ //Save directory and extension
+ std::string save_dir, save_ext;
+
+ //The location of the shader index file
+ std::string shaders;
+
+ //The location of the color index file
+ std::string colors;
+
+ //The list of levels in the game
+ std::unordered_map<std::string, LevelPath> level;
+
+ //The file path of the current resource file
+ std::string current_r;
+
+ //The application data path (where saves and settings are stored)
+ std::string appdata;
+
+ //Has this been loaded?
+ bool loaded;
+
+ FilePaths();
+ void Load(const std::string &filename);
+ void LoadLevel(const std::string &filename);
+};
+
+//Storage pool used for saving numbers as strings
+class StringPool
+{
+ //Store integer strings here
+ std::unordered_map<int, std::string> pool_i;
+
+ //Store floating point strings here
+ struct FloatString
+ {
+ float val;
+ std::string str;
+
+ FloatString() { val = 0.0f; }
+ };
+
+ std::list<FloatString> pool_f;
+
+public:
+ StringPool() { pool_i.clear(); pool_f.clear(); }
+
+ const char* Get(const int &num)
+ {
+ if (pool_i.count(num) == 0)
+ pool_i[num] = NumberToString<int>(num);
+
+ return pool_i.at(num).c_str();
+ }
+
+ const char* FGet(const float &num)
+ {
+ for (auto &i : pool_f)
+ if (i.val == num)
+ return i.str.c_str();
+
+ FloatString fs;
+ fs.val = num;
+ fs.str = NumberToString<float>(num);
+ pool_f.push_back(fs);
+
+ auto ret = pool_f.rbegin();
+ return ret->str.c_str();
+ }
+};
+
+//Our source of random numbers
+class RandomNumberGen
+{
+ std::random_device rd;
+ std::default_random_engine dre;
+
+public:
+ RandomNumberGen() : rd(), dre(rd()) {}
+
+ int Num() { return dre(); }
+};
+
+struct TempValue
+{
+ //Differences between normal mode and iron man mode
+ //save button - iron man saves in existing file
+ //load button - hidden in iron man
+ //exit - saves and exits in iron man
+ //quick save and quick load - operate on the iron man file in iron man mode
+ bool ironman;
+
+ //This is the filename a player chose when selecting "new game" + iron man mode
+ std::string filename;
+
+ //We use this to see whether the player is exiting to main menu or to credits
+ bool credits;
+
+ TempValue() : filename("No IronMan"){ ironman = false; credits = false; }
+};
+
+//Our global objects
+
+//Where we store some temporary data used in between GameState swapping
+extern TempValue gTemp;
+
+//Whether to draw debug outlines on polygons
+extern bool GameDebug;
+
+//Paths of all files
+extern FilePaths gFilePath;
+
+//Strings are stored here to avoid duplicates and invalid values when writing to XML
+extern StringPool gStrPool;
+
+//Generate random numbers using this
+extern RandomNumberGen gRandom;
\ No newline at end of file
diff --git a/engines/crab/GeneralSettingMenu.cpp b/engines/crab/GeneralSettingMenu.cpp
new file mode 100644
index 00000000000..bc6e1ece21e
--- /dev/null
+++ b/engines/crab/GeneralSettingMenu.cpp
@@ -0,0 +1,117 @@
+#include "stdafx.h"
+#include "GeneralSettingMenu.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::music;
+
+//------------------------------------------------------------------------
+// Purpose: Load components from file
+//------------------------------------------------------------------------
+void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid("volume", node))
+ {
+ rapidxml::xml_node<char> *musnode = node->first_node("volume");
+
+ if (NodeValid("desc", musnode))
+ notice_volume.Load(musnode->first_node("desc"));
+
+ if (NodeValid("music", musnode))
+ vol_music.Load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, gMusicManager.VolMusic());
+
+ if (NodeValid("effects", musnode))
+ vol_effects.Load(musnode->first_node("effects"), 0, MIX_MAX_VOLUME, gMusicManager.VolEffects());
+ }
+
+ if (NodeValid("mouse_trap", node))
+ mouse_trap.Load(node->first_node("mouse_trap"));
+
+ if (NodeValid("save_on_exit", node))
+ save_on_exit.Load(node->first_node("save_on_exit"));
+
+ if (NodeValid("text_speed", node))
+ text_speed.Load(node->first_node("text_speed"));
+
+ //Sync popup text value with actual value
+ for (auto &i : text_speed.element)
+ i.state = (i.val == gScreenSettings.text_speed);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Handle user input
+//------------------------------------------------------------------------
+void GeneralSettingMenu::HandleEvents(const SDL_Event &Event)
+{
+ if (vol_music.HandleEvents(Event))
+ gMusicManager.VolMusic(vol_music.Value());
+
+ if (vol_effects.HandleEvents(Event))
+ gMusicManager.VolEffects(vol_effects.Value());
+
+ //No need to change screen here
+ if (save_on_exit.HandleEvents(Event))
+ gScreenSettings.save_on_exit = !gScreenSettings.save_on_exit;
+
+ if (mouse_trap.HandleEvents(Event))
+ {
+ gScreenSettings.mouse_trap = !gScreenSettings.mouse_trap;
+ gScreenSettings.SetMouseTrap();
+ }
+
+ int result = text_speed.HandleEvents(Event);
+ if (result >= 0)
+ gScreenSettings.text_speed = text_speed.element.at(result).val;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Sync our buttons with screen settings
+//------------------------------------------------------------------------
+void GeneralSettingMenu::InternalEvents()
+{
+ save_on_exit.state = gScreenSettings.save_on_exit;
+ mouse_trap.state = gScreenSettings.mouse_trap;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw stuff
+//------------------------------------------------------------------------
+void GeneralSettingMenu::Draw()
+{
+ //Draw volume sliders
+ notice_volume.Draw();
+ vol_music.Draw();
+ vol_effects.Draw();
+
+ //Draw the auto-save on exit option
+ save_on_exit.Draw();
+ mouse_trap.Draw();
+
+ //Text speed radio button menu
+ text_speed.Draw();
+}
+
+//------------------------------------------------------------------------
+// Purpose: Revert to previously backed up settings
+//------------------------------------------------------------------------
+void GeneralSettingMenu::RestoreBackup()
+{
+ vol_music.RestoreBackup();
+ gMusicManager.VolMusic(vol_music.Value());
+
+ vol_effects.RestoreBackup();
+ gMusicManager.VolEffects(vol_effects.Value());
+}
+
+//------------------------------------------------------------------------
+// Purpose: Set UI positioned on screen size change
+//------------------------------------------------------------------------
+void GeneralSettingMenu::SetUI()
+{
+ save_on_exit.SetUI();
+ mouse_trap.SetUI();
+
+ vol_music.SetUI();
+ vol_effects.SetUI();
+
+ text_speed.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/GeneralSettingMenu.h b/engines/crab/GeneralSettingMenu.h
new file mode 100644
index 00000000000..4adbf00ebeb
--- /dev/null
+++ b/engines/crab/GeneralSettingMenu.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#include "common_header.h"
+#include "slider.h"
+#include "ToggleButton.h"
+#include "RadioButtonMenu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class GeneralSettingMenu
+ {
+ //The volume sliders and their caption
+ Slider vol_music, vol_effects;
+ HoverInfo notice_volume;
+
+ //Other settings
+ ToggleButton save_on_exit, mouse_trap;
+
+ //The menu for select pop-up text speed
+ RadioButtonMenu text_speed;
+
+ public:
+ GeneralSettingMenu(){}
+ ~GeneralSettingMenu(){}
+
+ void Load(rapidxml::xml_node<char> *node);
+ void HandleEvents(const SDL_Event &Event);
+ void InternalEvents();
+
+ void Draw();
+ void SetUI();
+
+ void CreateBackup()
+ {
+ vol_music.CreateBackup();
+ vol_effects.CreateBackup();
+ }
+
+ void RestoreBackup();
+ };
+ }
+}
diff --git a/engines/crab/GfxSettingMenu.cpp b/engines/crab/GfxSettingMenu.cpp
new file mode 100644
index 00000000000..4024dc9dd42
--- /dev/null
+++ b/engines/crab/GfxSettingMenu.cpp
@@ -0,0 +1,130 @@
+#include "stdafx.h"
+#include "GfxSettingMenu.h"
+
+using namespace pyrodactyl::ui;
+
+//------------------------------------------------------------------------
+// Purpose: Load components from file
+//------------------------------------------------------------------------
+void GfxSettingMenu::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid("resolution", node))
+ resolution.Load(node->first_node("resolution"));
+
+ if (NodeValid("fullscreen", node))
+ fullscreen.Load(node->first_node("fullscreen"));
+
+ if (NodeValid("vsync", node))
+ vsync.Load(node->first_node("vsync"));
+
+ if (NodeValid("border", node))
+ border.Load(node->first_node("border"));
+
+ if (NodeValid("quality", node))
+ {
+ rapidxml::xml_node<char> *qnode = node->first_node("quality");
+ quality.Load(qnode);
+
+ if (NodeValid("message", qnode))
+ notice_quality.Load(qnode->first_node("message"), &quality);
+ }
+
+ if (NodeValid("brightness", node))
+ brightness.Load(node->first_node("brightness"), 0, 100, gScreenSettings.gamma * 100);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw stuff
+//------------------------------------------------------------------------
+void GfxSettingMenu::Draw()
+{
+ //Window border doesn't matter if you are in fullscreen
+ if (!gScreenSettings.fullscreen)
+ border.Draw();
+
+ //Draw toggle buttons
+ brightness.Draw();
+ fullscreen.Draw();
+ vsync.Draw();
+
+ //Quality and resolution can only be changed in the main menu
+ if (!gScreenSettings.in_game)
+ {
+ //Tree quality button
+ quality.Draw();
+ }
+ else
+ notice_quality.Draw();//Notice about quality settings
+
+ //Draw resolution menu
+ resolution.Draw();
+}
+
+//------------------------------------------------------------------------
+// Purpose: Handle input
+//------------------------------------------------------------------------
+int GfxSettingMenu::HandleEvents(const SDL_Event &Event)
+{
+ if (fullscreen.HandleEvents(Event))
+ {
+ //Setting video flags is necessary when toggling fullscreen
+ gScreenSettings.fullscreen = !gScreenSettings.fullscreen;
+ gScreenSettings.SetFullscreen();
+ }
+
+ //Vsync doesn't need to set the change value
+ if (vsync.HandleEvents(Event))
+ {
+ gScreenSettings.vsync = !gScreenSettings.vsync;
+ gScreenSettings.SetVsync();
+ }
+
+ //Quality and resolution can only be changed in the main menu
+ if (!gScreenSettings.in_game)
+ {
+ if (quality.HandleEvents(Event))
+ gScreenSettings.quality = !gScreenSettings.quality;
+ }
+
+ //Window border doesn't matter if you are in fullscreen
+ if (border.HandleEvents(Event) && !gScreenSettings.fullscreen)
+ {
+ gScreenSettings.border = !gScreenSettings.border;
+ gScreenSettings.SetWindowBorder();
+ }
+
+ if (brightness.HandleEvents(Event))
+ {
+ gScreenSettings.gamma = static_cast<float>(brightness.Value()) / 100.0f;
+ gScreenSettings.SetGamma();
+ }
+
+ return resolution.HandleEvents(Event);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Keep button settings synced with our screen settings
+//------------------------------------------------------------------------
+void GfxSettingMenu::InternalEvents()
+{
+ fullscreen.state = gScreenSettings.fullscreen;
+ vsync.state = gScreenSettings.vsync;
+ border.state = gScreenSettings.border;
+ quality.state = gScreenSettings.quality;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Rearrange UI when resolution changes
+//------------------------------------------------------------------------
+void GfxSettingMenu::SetUI()
+{
+ resolution.SetUI();
+
+ fullscreen.SetUI();
+ vsync.SetUI();
+ border.SetUI();
+ quality.SetUI();
+
+ notice_quality.SetUI();
+ brightness.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/GfxSettingMenu.h b/engines/crab/GfxSettingMenu.h
new file mode 100644
index 00000000000..b9c46ddce7e
--- /dev/null
+++ b/engines/crab/GfxSettingMenu.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "common_header.h"
+#include "slider.h"
+#include "ImageData.h"
+#include "StateButton.h"
+#include "ToggleButton.h"
+#include "ResolutionMenu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class GfxSettingMenu
+ {
+ //The brightness slider
+ Slider brightness;
+
+ //The button to toggle between full and windowed, and turn vsync on/off, window borders or not, game quality
+ ToggleButton fullscreen, vsync, border, quality;
+
+ //The buttons and menus for changing resolution
+ ResolutionMenu resolution;
+
+ //Notice that quality setting can only be changed outside the game
+ HoverInfo notice_quality;
+
+ public:
+ GfxSettingMenu(){}
+ ~GfxSettingMenu(){}
+
+ void Load(rapidxml::xml_node<char> *node);
+ int HandleEvents(const SDL_Event &Event);
+ void InternalEvents();
+
+ void Draw();
+ void SetUI();
+
+ void SetInfo() { resolution.SetInfo(); }
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/HealthIndicator.cpp b/engines/crab/HealthIndicator.cpp
new file mode 100644
index 00000000000..68f070a8b1f
--- /dev/null
+++ b/engines/crab/HealthIndicator.cpp
@@ -0,0 +1,50 @@
+#include "stdafx.h"
+
+#include "HealthIndicator.h"
+
+using namespace pyrodactyl::ui;
+
+void HealthIndicator :: Load(rapidxml::xml_node<char> *node)
+{
+ if(NodeValid(node))
+ {
+ LoadXY(x, y, node);
+
+ for(auto n = node->first_node("img"); n != NULL; n = n->next_sibling("img"))
+ {
+ HealthImage hi;
+ LoadImgKey(hi.normal, "normal", n);
+ LoadImgKey(hi.glow, "glow", n);
+ LoadNum(hi.val, "val", n);
+
+ img.push_back(hi);
+ }
+ }
+}
+
+void HealthIndicator :: Draw(int num)
+{
+ for(auto i = img.begin(); i != img.end(); ++i)
+ if(num == i->val)
+ {
+ using namespace pyrodactyl::image;
+ gImageManager.Draw(x, y, i->normal);
+ gImageManager.GetTexture(i->glow).Alpha(alpha);
+ gImageManager.Draw(x, y, i->glow);
+
+ if(inc)
+ {
+ alpha += 2;
+ if(alpha >= 250)
+ inc = false;
+ }
+ else
+ {
+ alpha -= 2;
+ if(alpha < 4)
+ inc = true;
+ }
+
+ break;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/HealthIndicator.h b/engines/crab/HealthIndicator.h
new file mode 100644
index 00000000000..0702c3bfcd8
--- /dev/null
+++ b/engines/crab/HealthIndicator.h
@@ -0,0 +1,33 @@
+#pragma once
+#include "common_header.h"
+
+#include "ImageManager.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class HealthIndicator
+ {
+ struct HealthImage
+ {
+ ImageKey normal, glow;
+ int val;
+ };
+
+ int x, y;
+ std::vector<HealthImage> img;
+
+ //Related to the pulse effect
+ Uint8 alpha;
+ bool inc;
+
+ public:
+ HealthIndicator(){ x = 0; y = 0; alpha = 0; inc = true; }
+ ~HealthIndicator(){}
+
+ void Load(rapidxml::xml_node<char> *node);
+ void Draw(int num);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/HoverInfo.cpp b/engines/crab/HoverInfo.cpp
new file mode 100644
index 00000000000..02daca446d3
--- /dev/null
+++ b/engines/crab/HoverInfo.cpp
@@ -0,0 +1,28 @@
+#include "stdafx.h"
+
+#include "HoverInfo.h"
+
+using namespace pyrodactyl::text;
+using namespace pyrodactyl::ui;
+
+void HoverInfo :: Init(const HoverInfo &h, const int &XOffset, const int &YOffset)
+{
+ *this = h;
+ x += XOffset;
+ y += YOffset;
+}
+
+void HoverInfo :: Load(rapidxml::xml_node<char> *node, Rect *parent)
+{
+ if(TextData::Load(node,parent,false))
+ {
+ LoadStr(text, "text", node);
+ enabled = true;
+ }
+}
+
+void HoverInfo :: Draw(const int &XOffset, const int &YOffset)
+{
+ if(enabled)
+ TextData::Draw(text, XOffset, YOffset);
+}
\ No newline at end of file
diff --git a/engines/crab/HoverInfo.h b/engines/crab/HoverInfo.h
new file mode 100644
index 00000000000..d5fb356ad90
--- /dev/null
+++ b/engines/crab/HoverInfo.h
@@ -0,0 +1,26 @@
+#pragma once
+#include "common_header.h"
+
+#include "TextData.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ //Tooltip for buttons
+ class HoverInfo : public TextData
+ {
+ public:
+ bool enabled;
+ std::string text;
+
+ HoverInfo(void){ enabled = false; }
+ ~HoverInfo(void){}
+
+ void Init(const HoverInfo &h, const int &XOffset = 0, const int &YOffset = 0);
+
+ void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Image.cpp b/engines/crab/Image.cpp
new file mode 100644
index 00000000000..4b13e900239
--- /dev/null
+++ b/engines/crab/Image.cpp
@@ -0,0 +1,136 @@
+#include "stdafx.h"
+#include "Image.h"
+
+using namespace pyrodactyl::image;
+
+//------------------------------------------------------------------------
+// Purpose: Load a texture
+//------------------------------------------------------------------------
+bool Image::Load(SDL_Surface *surface)
+{
+ //Create texture from surface pixels
+ texture = SDL_CreateTextureFromSurface(gRenderer, surface);
+ if (texture == NULL)
+ {
+ fprintf(stderr, "Unable to create texture from SDL_Surface! SDL Error: %s\n", SDL_GetError());
+ return false;
+ }
+
+ //Get image dimensions
+ w = surface->w;
+ h = surface->h;
+ return true;
+}
+
+bool Image::Load(const std::string &path)
+{
+ //Get rid of preexisting texture
+ Delete();
+
+ //Load image at specified path
+ SDL_Surface* loadedSurface = IMG_Load(path.c_str());
+ if (loadedSurface == NULL)
+ {
+ fprintf(stderr, "Unable to load image %s! SDL_image Error: %s\n", path.c_str(), IMG_GetError());
+ }
+ else
+ {
+ //Create texture from surface pixels
+ texture = SDL_CreateTextureFromSurface(gRenderer, loadedSurface);
+
+ if (texture == NULL)
+ fprintf(stderr, "Unable to create texture from %s! SDL Error: %s\n", path.c_str(), SDL_GetError());
+ else
+ {
+ //Get image dimensions
+ w = loadedSurface->w;
+ h = loadedSurface->h;
+ }
+
+ //Get rid of old loaded surface
+ SDL_FreeSurface(loadedSurface);
+ }
+
+ //Return success
+
+ return texture != NULL;
+}
+
+bool Image::Load(rapidxml::xml_node<char> *node, const char* name)
+{
+ if (node->first_attribute(name) != NULL)
+ return Load(node->first_attribute(name)->value());
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw a texture to the screen without cropping
+//------------------------------------------------------------------------
+void Image::Draw(const int &x, const int &y, SDL_Rect *clip, const TextureFlipType &flip)
+{
+ //Set rendering space and render to screen
+ SDL_Rect renderQuad = { x, y, w, h };
+
+ //Set clip rendering dimensions
+ if (clip != NULL)
+ {
+ renderQuad.w = clip->w;
+ renderQuad.h = clip->h;
+ }
+
+ switch (flip)
+ {
+ case FLIP_NONE:
+ //Render to screen
+ SDL_RenderCopy(gRenderer, texture, clip, &renderQuad);
+ break;
+ case FLIP_X:
+ //Bottom right <-> Bottom left
+ //Top right <-> Top left
+ SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 0, NULL, SDL_FLIP_HORIZONTAL);
+ break;
+ case FLIP_Y:
+ //Top right <-> Bottom right
+ //Top left <-> Bottom left
+ SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 0, NULL, SDL_FLIP_VERTICAL);
+ break;
+ case FLIP_XY:
+ //Top right <-> Bottom left
+ //Top left <-> Bottom right
+ SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 180, NULL, SDL_FLIP_NONE);
+ break;
+ case FLIP_D:
+ //Top left <-> Bottom right
+ SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_HORIZONTAL);
+ break;
+ case FLIP_DX:
+ //Rotate 90 degrees clockwise
+ SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 90, NULL, SDL_FLIP_NONE);
+ break;
+ case FLIP_DY:
+ //Rotate 270 degrees clockwise
+ SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_NONE);
+ break;
+ case FLIP_XYD:
+ //This is just flipping across the diagonal, instead of the anti-diagonal
+ //Top right <-> Bottom left
+ SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_VERTICAL);
+ break;
+ default: break;
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Delete texture data
+//------------------------------------------------------------------------
+void Image::Delete()
+{
+ if (texture != nullptr)
+ {
+ SDL_DestroyTexture(texture);
+ texture = nullptr;
+ w = 0;
+ h = 0;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Image.h b/engines/crab/Image.h
new file mode 100644
index 00000000000..b4f146c9a45
--- /dev/null
+++ b/engines/crab/Image.h
@@ -0,0 +1,51 @@
+#pragma once
+
+#include "common_header.h"
+#include "ScreenSettings.h"
+
+namespace pyrodactyl
+{
+ namespace image
+ {
+ //Image data used in Asset Manager
+ class Image
+ {
+ //The dimensions of the image
+ int w, h;
+
+ //The actual hardware texture
+ SDL_Texture* texture;
+
+ public:
+ Image() : texture(nullptr), w(0), h(0){}
+ ~Image(){}
+
+ //Set color modulation
+ void Color(const Uint8 &r, const Uint8 &g, const Uint8 &b){ SDL_SetTextureColorMod(texture, r, g, b); }
+
+ //Set blending
+ void BlendMode(const SDL_BlendMode &mode){ SDL_SetTextureBlendMode(texture, mode); }
+
+ //Set alpha modulation
+ int Alpha(const Uint8 &alpha){ return SDL_SetTextureAlphaMod(texture, alpha); }
+
+ //Get alpha modulation
+ Uint8 Alpha(){ Uint8 res = 255; SDL_GetTextureAlphaMod(texture, &res); return res; }
+
+ //Load the image
+ bool Load(const std::string &path);
+ bool Load(rapidxml::xml_node<char> *node, const char* name);
+ bool Load(SDL_Surface *surface);
+
+ //Draw the openGL texture
+ void Draw(const int &x, const int &y, SDL_Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+
+ //Delete the openGL texture
+ void Delete();
+
+ const int W() { return w; }
+ const int H() { return h; }
+ const bool Valid() { return texture != nullptr; }
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ImageData.cpp b/engines/crab/ImageData.cpp
new file mode 100644
index 00000000000..84c68de8906
--- /dev/null
+++ b/engines/crab/ImageData.cpp
@@ -0,0 +1,24 @@
+#include "stdafx.h"
+#include "ImageData.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+
+void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo)
+{
+ LoadImgKey(key, "img", node, echo);
+ LoadBool(crop, "crop", node, false);
+
+ if (NodeValid("clip", node, false))
+ clip.Load(node->first_node("clip"));
+
+ Element::Load(node, key, echo);
+}
+
+void ImageData::Draw(const int &XOffset, const int &YOffset)
+{
+ if (crop)
+ gImageManager.Draw(x + XOffset, y + YOffset, key, &clip);
+ else
+ gImageManager.Draw(x + XOffset, y + YOffset, key);
+}
\ No newline at end of file
diff --git a/engines/crab/ImageData.h b/engines/crab/ImageData.h
new file mode 100644
index 00000000000..5206c7f68c1
--- /dev/null
+++ b/engines/crab/ImageData.h
@@ -0,0 +1,30 @@
+#pragma once
+
+#include "common_header.h"
+#include "ImageManager.h"
+#include "element.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class ImageData : public Element
+ {
+ //The image
+ ImageKey key;
+
+ //Should we clip the image? (usually used for large background images)
+ bool crop;
+
+ //The clip rectangle, used only when clip is true
+ Rect clip;
+
+ public:
+ ImageData(){ key = 0; crop = false; }
+ ~ImageData(){}
+
+ void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ImageManager.cpp b/engines/crab/ImageManager.cpp
new file mode 100644
index 00000000000..4274df8609a
--- /dev/null
+++ b/engines/crab/ImageManager.cpp
@@ -0,0 +1,165 @@
+//=============================================================================
+// Author: Arvind
+// Purpose: Contains the image manager class - used to manage in-game images
+//=============================================================================
+#include "stdafx.h"
+#include "ImageManager.h"
+#include "XMLDoc.h"
+
+using namespace pyrodactyl::image;
+
+//Stuff we use throughout the game
+namespace pyrodactyl
+{
+ namespace image
+ {
+ ImageManager gImageManager;
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Load assets here.
+//------------------------------------------------------------------------
+void ImageManager::LoadMap(const std::string &filename, const MapID &mapid)
+{
+ for (auto it = map[mapid].begin(); it != map[mapid].end(); ++it)
+ it->second.Delete();
+
+ map[mapid].clear();
+ XMLDoc image_list(filename);
+ if (image_list.ready())
+ {
+ rapidxml::xml_node<char> *node = image_list.Doc()->first_node("res");
+ for (auto n = node->first_node("image"); n != NULL; n = n->next_sibling("image"))
+ {
+ ImageKey key;
+ if (LoadImgKey(key, "name", n))
+ {
+ //Load different images depending on image quality setting
+ //Check if there is a low quality image specified for the asset id
+ //if yes, load it - if no, just load the higher quality one
+
+ bool valid = false;
+ std::string path;
+
+ if (!gScreenSettings.quality)
+ valid = LoadStr(path, "path_low", n, false);
+
+ if (!valid)
+ valid = LoadStr(path, "path", n, false);
+
+ if (valid)
+ map[mapid][key].Load(path);
+ else
+ fprintf(stderr, "Unable to load image id %u from %s! SDL Error: %s\n", key, path.c_str(), SDL_GetError());
+ }
+ }
+
+ if (NodeValid("mouse", node, false))
+ {
+ using namespace pyrodactyl::input;
+ gMouse.Quit();
+ gMouse.Load(node->first_node("mouse"));
+ }
+ }
+}
+
+bool ImageManager::Init()
+{
+ //First, delete everything that exists
+ Quit();
+
+ //Load common assets
+ LoadMap(gFilePath.common, MAP_COMMON);
+
+ //Load main menu assets
+ LoadMap(gFilePath.current_r, MAP_CURRENT);
+
+ invalid_img = map[MAP_COMMON][0];
+
+ return true;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Add texture to image map
+//------------------------------------------------------------------------
+void ImageManager::AddTexture(const ImageKey &id, SDL_Surface* surface, int mapindex)
+{
+ if (map[mapindex].count(id) > 0)
+ FreeTexture(id, mapindex);
+
+ map[mapindex][id].Load(surface);
+ SDL_FreeSurface(surface);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Get texture for a particular id
+//------------------------------------------------------------------------
+void ImageManager::GetTexture(const ImageKey &id, Image &data)
+{
+ if (map[MAP_CURRENT].count(id) > 0)
+ data = map[MAP_CURRENT][id];
+ else if (map[MAP_COMMON].count(id) > 0)
+ data = map[MAP_COMMON][id];
+ else
+ data = invalid_img;
+}
+
+Image& ImageManager::GetTexture(const ImageKey &id)
+{
+ if (map[MAP_CURRENT].count(id) > 0)
+ return map[MAP_CURRENT][id];
+ else if (map[MAP_COMMON].count(id) > 0)
+ return map[MAP_COMMON][id];
+
+ return invalid_img;
+}
+
+bool ImageManager::ValidTexture(const ImageKey &id)
+{
+ if (id != 0 && (map[MAP_CURRENT].count(id) > 0 || map[MAP_COMMON].count(id) > 0))
+ return true;
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw
+//------------------------------------------------------------------------
+void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Rect* clip,
+ const TextureFlipType &flip)
+{
+ GetTexture(id).Draw(x, y, clip, flip);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Dim the screen by drawing a 128 alpha black rectangle over it
+//------------------------------------------------------------------------
+void ImageManager::DimScreen()
+{
+ SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
+ SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 128);
+ SDL_RenderFillRect(gRenderer, NULL);
+}
+
+void ImageManager::BlackScreen()
+{
+ SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
+ SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 255);
+ SDL_RenderFillRect(gRenderer, NULL);
+}
+//------------------------------------------------------------------------
+// Purpose: free resources
+//------------------------------------------------------------------------
+void ImageManager::Quit()
+{
+ for (int i = 0; i < MAP_TOTAL; i++)
+ {
+ for (auto it = map[i].begin(); it != map[i].end(); ++it)
+ it->second.Delete();
+
+ map[i].clear();
+ }
+
+ invalid_img.Delete();
+}
\ No newline at end of file
diff --git a/engines/crab/ImageManager.h b/engines/crab/ImageManager.h
new file mode 100644
index 00000000000..2dc379171ff
--- /dev/null
+++ b/engines/crab/ImageManager.h
@@ -0,0 +1,82 @@
+//=============================================================================
+// Author: Arvind
+// Purpose: Contains the image manager class - used to manage in-game assets
+//=============================================================================
+#pragma once
+
+#include "common_header.h"
+#include "Image.h"
+#include "loaders.h"
+#include "GameParam.h"
+#include "LoadingScreen.h"
+#include "cursor.h"
+#include "TMXTileSet.h"
+
+//We use this object as the key for all image assets
+typedef unsigned int ImageKey;
+
+//Since we use unsigned int as a key for images, our LoadImgKey function is LoadNum
+#define LoadImgKey LoadNum
+
+namespace pyrodactyl
+{
+ namespace image
+ {
+ //We store images here
+ typedef std::unordered_map<ImageKey, Image> TextureMap;
+
+ //Two image maps are used in the game - current (changes with level) and common
+ enum MapID { MAP_CURRENT, MAP_COMMON, MAP_TOTAL };
+
+ class ImageManager
+ {
+ //Assets are stored in images
+ //Common is stuff used everywhere - this is only loaded once
+ TextureMap map[MAP_TOTAL];
+
+ //The default image for all invalid image names
+ Image invalid_img;
+
+ public:
+ //The tile sets used in the level
+ TMX::TileSetGroup tileset;
+
+ //This image is used to notify player about changes to quests and inventory
+ ImageKey notify;
+
+ ImageManager(){ notify = 0; }
+ ~ImageManager(){}
+
+ void Quit();
+
+ bool Init();
+ void LoadPaths();
+
+ //image related stuff
+
+ //Load all images specified in an xml file in a map
+ void LoadMap(const std::string &filename, const MapID &mapid = MAP_CURRENT);
+
+ void AddTexture(const ImageKey &id, SDL_Surface* surface, int mapindex = MAP_COMMON);
+ void FreeTexture(const ImageKey &id, int mapindex = MAP_COMMON) { map[mapindex][id].Delete(); }
+ void GetTexture(const ImageKey &id, Image &data);
+ Image& GetTexture(const ImageKey &id);
+ bool ValidTexture(const ImageKey &id);
+
+ void Draw(const int &x, const int &y, const ImageKey &id,
+ Rect* clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+
+ void DimScreen();
+ void BlackScreen();
+
+ //Draw the notification icon
+ void NotifyDraw(const int &x, const int &y)
+ {
+ auto *k = &GetTexture(notify);
+ Draw(x - k->W() / 2, y - k->H() / 2, notify);
+ }
+ };
+
+ extern ImageManager gImageManager;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Inventory.cpp b/engines/crab/Inventory.cpp
new file mode 100644
index 00000000000..6017bb17ef1
--- /dev/null
+++ b/engines/crab/Inventory.cpp
@@ -0,0 +1,115 @@
+#include "stdafx.h"
+#include "Inventory.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+using namespace pyrodactyl::item;
+using namespace pyrodactyl::people;
+
+//------------------------------------------------------------------------
+// Purpose: Load layout
+//------------------------------------------------------------------------
+void Inventory::Load(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> * node = conf.Doc()->first_node("inventory");
+ if (NodeValid(node))
+ {
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+
+ collection.Load(node->first_node("items"));
+
+ /*if (NodeValid("stats", node))
+ helper.Load(node->first_node("stats"));*/
+
+ if (NodeValid("money", node))
+ money.Load(node->first_node("money"));
+ }
+ }
+}
+
+void Inventory::LoadItem(const std::string &char_id, const std::string &id)
+{
+ Item i;
+ XMLDoc item_list(itemfile);
+ if (item_list.ready())
+ {
+ rapidxml::xml_node<char> *node = item_list.Doc()->first_node("items");
+ for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item"))
+ {
+ std::string str = n->first_attribute("id")->value();
+ if (id == str)
+ {
+ i.Load(n);
+ AddItem(char_id, i);
+ break;
+ }
+ }
+ }
+}
+
+void Inventory::DelItem(const std::string &char_id, const std::string &item_id)
+{
+ collection.Del(char_id, item_id);
+}
+
+void Inventory::AddItem(const std::string &char_id, Item &item)
+{
+ collection.Add(char_id, item);
+}
+
+bool Inventory::HasItem(const std::string &char_id, const std::string &container, const std::string &item_id)
+{
+ return collection.Has(char_id, container, item_id);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw
+//------------------------------------------------------------------------
+void Inventory::Draw(Person &obj, const int &money_val)
+{
+ bg.Draw();
+ //helper.DrawInfo(obj);
+ collection.Draw(obj.id/*, helper*/);
+
+ money.caption.text = NumberToString(money_val);
+ money.Draw();
+}
+
+//------------------------------------------------------------------------
+// Purpose: Handle events
+//------------------------------------------------------------------------
+void Inventory::HandleEvents(const std::string &char_id, const SDL_Event &Event)
+{
+ collection.HandleEvents(char_id, Event);
+ money.HandleEvents(Event);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Load and save items
+//------------------------------------------------------------------------
+void Inventory::LoadState(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid("items", node))
+ collection.LoadState(node->first_node("items"));
+}
+
+void Inventory::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "items");
+ collection.SaveState(doc, child);
+ root->append_node(child);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Set UI positions after screen size change
+//------------------------------------------------------------------------
+void Inventory::SetUI()
+{
+ bg.SetUI();
+ collection.SetUI();
+ money.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/Inventory.h b/engines/crab/Inventory.h
new file mode 100644
index 00000000000..07483f4433a
--- /dev/null
+++ b/engines/crab/Inventory.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include "common_header.h"
+#include "ItemCollection.h"
+#include "ImageData.h"
+#include "ItemSlot.h"
+#include "Stat.h"
+#include "button.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class Inventory
+ {
+ //The background image and location
+ ImageData bg;
+
+ //The equipment and storage space, stored according to the player character id
+ pyrodactyl::item::ItemCollection collection;
+
+ //To draw the player stats
+ //pyrodactyl::stat::StatDrawHelper helper;
+
+ //The file where all the item information is stored
+ std::string itemfile;
+
+ //Used to draw the money value
+ Button money;
+
+ public:
+ Inventory(){}
+ ~Inventory(){}
+
+ void Init(const std::string &char_id) { collection.Init(char_id); }
+
+ void LoadItem(const std::string &char_id, const std::string &name);
+ void AddItem(const std::string &char_id, pyrodactyl::item::Item &item);
+ void DelItem(const std::string &char_id, const std::string &item_id);
+ bool HasItem(const std::string &char_id, const std::string &container, const std::string &item_id);
+
+ void Load(const std::string &filename);
+ void Draw(pyrodactyl::people::Person &obj, const int &money_val);
+ void HandleEvents(const std::string &char_id, const SDL_Event &Event);
+
+ void LoadState(rapidxml::xml_node<char> *node);
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+
+ void ItemFile(const std::string &filename) { itemfile = filename; }
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Item.cpp b/engines/crab/Item.cpp
new file mode 100644
index 00000000000..3150eab597f
--- /dev/null
+++ b/engines/crab/Item.cpp
@@ -0,0 +1,88 @@
+#include "stdafx.h"
+#include "Item.h"
+
+using namespace pyrodactyl::image;
+using namespace pyrodactyl::item;
+using namespace pyrodactyl::stat;
+using namespace pyrodactyl::people;
+
+//------------------------------------------------------------------------
+// Purpose: Load
+//------------------------------------------------------------------------
+void Item::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid(node))
+ {
+ LoadStr(id, "id", node);
+ LoadStr(name, "name", node);
+ LoadStr(type, "type", node);
+ LoadStr(desc, "desc", node);
+ LoadImgKey(img, "img", node);
+
+ bonus.clear();
+ for (auto n = node->first_node("bonus"); n != NULL; n = n->next_sibling("bonus"))
+ {
+ Bonus b;
+ b.Load(n);
+ bonus.push_back(b);
+ }
+ }
+}
+
+void Item::Clear()
+{
+ id = "";
+ name = "";
+ type = "";
+ desc = "";
+ img = 0;
+ bonus.clear();
+ value = 0;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Save and load state
+//------------------------------------------------------------------------
+void Item::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ root->append_attribute(doc.allocate_attribute("id", id.c_str()));
+ root->append_attribute(doc.allocate_attribute("name", name.c_str()));
+ root->append_attribute(doc.allocate_attribute("type", type.c_str()));
+ root->append_attribute(doc.allocate_attribute("img", gStrPool.Get(img)));
+ root->append_attribute(doc.allocate_attribute("desc", desc.c_str()));
+
+ for (auto i = bonus.begin(); i != bonus.end(); ++i)
+ {
+ auto n = doc.allocate_node(rapidxml::node_element, "bonus");
+ switch (i->type)
+ {
+ case STAT_HEALTH:n->append_attribute(doc.allocate_attribute("type", STATNAME_HEALTH)); break;
+ case STAT_ATTACK:n->append_attribute(doc.allocate_attribute("type", STATNAME_ATTACK)); break;
+ case STAT_DEFENSE:n->append_attribute(doc.allocate_attribute("type", STATNAME_DEFENSE)); break;
+ case STAT_SPEED:n->append_attribute(doc.allocate_attribute("type", STATNAME_SPEED)); break;
+ /*case STAT_CHARISMA:n->append_attribute(doc.allocate_attribute("type", STATNAME_CHARISMA)); break;
+ case STAT_INTELLIGENCE:n->append_attribute(doc.allocate_attribute("type", STATNAME_INTELLIGENCE)); break;*/
+ default:break;
+ }
+
+ n->append_attribute(doc.allocate_attribute("val", gStrPool.Get(i->val)));
+ root->append_node(n);
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Calculate effect of item on stats
+//------------------------------------------------------------------------
+void Item::StatChange(Person &obj, bool increase)
+{
+ for (auto i = bonus.begin(); i != bonus.end(); ++i)
+ if (increase)
+ obj.stat.Change(i->type, i->val);
+ else
+ obj.stat.Change(i->type, -i->val);
+}
+
+void Item::Draw(const int &x, const int &y)
+{
+ gImageManager.Draw(x, y, img);
+}
\ No newline at end of file
diff --git a/engines/crab/Item.h b/engines/crab/Item.h
new file mode 100644
index 00000000000..03c9e7eb2e3
--- /dev/null
+++ b/engines/crab/Item.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "common_header.h"
+#include "ImageManager.h"
+#include "person.h"
+#include "bonus.h"
+
+namespace pyrodactyl
+{
+ namespace item
+ {
+ struct Item
+ {
+ //The id, name and description of the item
+ std::string id, name, desc;
+
+ //The image for the item
+ ImageKey img;
+
+ //The type of item
+ std::string type;
+
+ //The stat bonuses provided by the item
+ std::vector<pyrodactyl::stat::Bonus> bonus;
+
+ //The price
+ unsigned int value;
+
+ Item(){ Clear(); }
+ ~Item(){}
+
+ void Clear();
+ void StatChange(pyrodactyl::people::Person &obj, bool increase);
+
+ void Load(rapidxml::xml_node<char> *node);
+ void Draw(const int &x, const int &y);
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ItemCollection.cpp b/engines/crab/ItemCollection.cpp
new file mode 100644
index 00000000000..8572dda41f4
--- /dev/null
+++ b/engines/crab/ItemCollection.cpp
@@ -0,0 +1,126 @@
+#include "stdafx.h"
+#include "ItemCollection.h"
+
+using namespace pyrodactyl::people;
+using namespace pyrodactyl::item;
+using namespace pyrodactyl::ui;
+
+//------------------------------------------------------------------------
+// Purpose: Load the reference information
+//------------------------------------------------------------------------
+void ItemCollection :: Load(rapidxml::xml_node<char> *node)
+{
+ if(NodeValid("info",node))
+ item_info.Load(node->first_node("info"));
+
+ if(NodeValid("ref", node))
+ ref.Load(node->first_node("ref"));
+
+ if(NodeValid("inc", node))
+ inc.Load(node->first_node("inc"));
+
+ if(NodeValid("dim",node))
+ {
+ rapidxml::xml_node<char> *dimnode = node->first_node("dim");
+ LoadNum(rows, "rows", dimnode);
+ LoadNum(cols, "cols", dimnode);
+ }
+
+ LoadBool(usekeyboard, "keyboard", node);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Add a character's inventory if not added already
+//------------------------------------------------------------------------
+void ItemCollection :: Init(const std::string &char_id)
+{
+ if(item.count(char_id) == 0)
+ item[char_id].Init(ref, inc, rows, cols, usekeyboard);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Handle events
+//------------------------------------------------------------------------
+void ItemCollection :: HandleEvents(const std::string &char_id, const SDL_Event &Event)
+{
+ if(item.count(char_id) > 0)
+ item[char_id].HandleEvents(Event);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw
+//------------------------------------------------------------------------
+void ItemCollection :: Draw(const std::string &char_id)
+{
+ if(item.count(char_id) > 0)
+ item[char_id].Draw(item_info);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Delete an item from a character's inventory
+//------------------------------------------------------------------------
+void ItemCollection :: Del(const std::string &char_id, const std::string &item_id)
+{
+ if(item.count(char_id) > 0)
+ item[char_id].Del(item_id);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Add an item to a character's inventory
+//------------------------------------------------------------------------
+void ItemCollection :: Add(const std::string &char_id, Item &item_data)
+{
+ //We might want to give a player character not yet encountered an item before we ever meet them
+ //Which is why we add a new inventory in case the character inventory does not exist yet
+ Init(char_id);
+
+ item[char_id].Equip(item_data);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Find if a character has an item
+//------------------------------------------------------------------------
+bool ItemCollection :: Has(const std::string &char_id, const std::string &container, const std::string &item_id)
+{
+ if(item.count(char_id) > 0)
+ return item[char_id].Has(container, item_id);
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Load items from save file
+//------------------------------------------------------------------------
+void ItemCollection :: LoadState(rapidxml::xml_node<char> *node)
+{
+ for(auto n = node->first_node(); n != NULL; n = n->next_sibling())
+ {
+ //Add all characters in the save file, whether we have them in the inventory or not
+ Init(n->name());
+ item[n->name()].LoadState(n);
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Write items to save file
+//------------------------------------------------------------------------
+void ItemCollection :: SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ for(auto i = item.begin(); i != item.end(); ++i)
+ {
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, i->first.c_str());
+ i->second.SaveState(doc,child);
+ root->append_node(child);
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Reset UI elements when resolution changes
+//------------------------------------------------------------------------
+void ItemCollection :: SetUI()
+{
+ item_info.SetUI();
+
+ for(auto i = item.begin(); i != item.end(); ++i)
+ i->second.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/ItemCollection.h b/engines/crab/ItemCollection.h
new file mode 100644
index 00000000000..acc6be90044
--- /dev/null
+++ b/engines/crab/ItemCollection.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#include "common_header.h"
+#include "StatDrawHelper.h"
+#include "ItemMenu.h"
+
+namespace pyrodactyl
+{
+ namespace item
+ {
+ //All the items owned by characters controlled by the player
+ class ItemCollection
+ {
+ //The items for all player characters
+ std::unordered_map<std::string, ItemMenu> item;
+
+ //The reference information for these menus used to display these items
+
+ //The reference item slot
+ ItemSlot ref;
+
+ //This vector stores the increments in x,y for each new slot
+ Vector2i inc;
+
+ //The dimensions of the menu
+ unsigned int rows, cols;
+
+ //Draw item description when user clicks an item to select it
+ pyrodactyl::ui::ItemDesc item_info;
+
+ //Should we enable keyboard for the menus
+ bool usekeyboard;
+
+ public:
+ ItemCollection(){ rows = 1; cols = 1; usekeyboard = true; }
+ ~ItemCollection(){}
+
+ void Load(rapidxml::xml_node<char> *node);
+ void HandleEvents(const std::string &char_id, const SDL_Event &Event);
+
+ void Init(const std::string &char_id);
+ void Draw(const std::string &char_id);
+
+ //Requires: id of the character, the item information
+ void Add(const std::string &char_id, Item &item_data);
+
+ //Requires: id of the character from which to remove the item, and id of the item
+ void Del(const std::string &char_id, const std::string &item_id);
+
+ //Requires: id of the character, the name of the container and name of the item
+ bool Has(const std::string &char_id, const std::string &container, const std::string &item_id);
+
+ void LoadState(rapidxml::xml_node<char> *node);
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ItemDesc.h b/engines/crab/ItemDesc.h
new file mode 100644
index 00000000000..82ad2355cb2
--- /dev/null
+++ b/engines/crab/ItemDesc.h
@@ -0,0 +1,45 @@
+#pragma once
+
+#include "ParagraphData.h"
+#include "SectionHeader.h"
+#include "Item.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class ItemDesc
+ {
+ //The name of the item
+ TextData name;
+
+ //The description of the item
+ ParagraphData desc;
+
+ public:
+ ItemDesc(){}
+ ~ItemDesc(){}
+
+ void Load(rapidxml::xml_node<char> *node)
+ {
+ if (NodeValid("name", node))
+ name.Load(node->first_node("name"));
+
+ if (NodeValid("desc", node))
+ desc.Load(node->first_node("desc"));
+ }
+
+ void Draw(pyrodactyl::item::Item &item)
+ {
+ name.Draw(item.name);
+ desc.Draw(item.desc);
+ }
+
+ void SetUI()
+ {
+ name.SetUI();
+ desc.SetUI();
+ }
+ };
+ }
+}
diff --git a/engines/crab/ItemMenu.cpp b/engines/crab/ItemMenu.cpp
new file mode 100644
index 00000000000..da75622f8ff
--- /dev/null
+++ b/engines/crab/ItemMenu.cpp
@@ -0,0 +1,157 @@
+#include "stdafx.h"
+#include "ItemMenu.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::item;
+using namespace pyrodactyl::people;
+
+//------------------------------------------------------------------------
+// Purpose: Load the layout and items
+//------------------------------------------------------------------------
+void ItemMenu::Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows, const unsigned int &cols,
+ const bool &keyboard)
+{
+ unsigned int size = rows * cols;
+ for (unsigned int i = 0; i < size; ++i)
+ {
+ ItemSlot b;
+ b.Init(ref, inc.x*(i%cols), inc.y*(i / cols));
+ element.push_back(b);
+ }
+
+ use_keyboard = keyboard;
+ AssignPaths();
+}
+
+//------------------------------------------------------------------------
+// Purpose: Load items from file
+//------------------------------------------------------------------------
+void ItemMenu::LoadState(rapidxml::xml_node<char> *node)
+{
+ unsigned int count = 0;
+ for (auto n = node->first_node(); n != NULL && count < element.size(); n = n->next_sibling(), ++count)
+ element[count].LoadState(n);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Save to file
+//------------------------------------------------------------------------
+void ItemMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ for (auto i = element.begin(); i != element.end(); ++i)
+ i->SaveState(doc, root);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
+//------------------------------------------------------------------------
+void ItemMenu::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset)
+{
+ int result = Menu<ItemSlot>::HandleEvents(Event);
+ if (result != -1)
+ {
+ select_index = result;
+ for (unsigned int i = 0; i < element.size(); ++i)
+ element.at(i).State(i == select_index);
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw the slot backgrounds first, then the items
+//------------------------------------------------------------------------
+void ItemMenu::Draw(ItemDesc &item_info)
+{
+ if (select_index != -1)
+ item_info.Draw(element[select_index].item);
+
+ for (auto i = element.begin(); i != element.end(); ++i)
+ i->Draw();
+}
+
+//------------------------------------------------------------------------
+// Purpose: Equip an item at the first available location (used in events)
+//------------------------------------------------------------------------
+bool ItemMenu::Equip(Item &item)
+{
+ for (auto i = element.begin(); i != element.end(); ++i)
+ if (i->category == SLOT_STORAGE && i->Equip(item))
+ return true;
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Remove all instances of an item
+//------------------------------------------------------------------------
+bool ItemMenu::Del(const std::string &id)
+{
+ bool result = false;
+
+ for (auto &i : element)
+ if (i.item.id == id)
+ {
+ i.empty = true;
+ i.item.Clear();
+ i.unread = false;
+ result = true;
+ break;
+ }
+
+ return result;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Find out if we have an item with a name
+//------------------------------------------------------------------------
+bool ItemMenu::Has(const std::string &container, const std::string &id)
+{
+ for (auto i = element.begin(); i != element.end(); ++i)
+ if (i->item.id == id)
+ {
+ if (container == "equip")
+ {
+ if (i->category == SLOT_EQUIP)
+ return true;
+ }
+ else if (container == "storage")
+ {
+ if (i->category == SLOT_STORAGE)
+ return true;
+ }
+ else
+ return true;
+ }
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Swap an item with another item menu
+//------------------------------------------------------------------------
+bool ItemMenu::Swap(ItemMenu &target, int index)
+{
+ //We need to scan the slots first for an empty slot to store the item.
+ //If no empty slot is found, then swap with a filled slot of same type
+ //If no slot of type is found, don't swap items at all
+ int found_index = -1, cur_index = 0;
+
+ for (auto i = element.begin(); i != element.end(); ++i, ++cur_index)
+ if (i->item_type == target.element[index].item_type)
+ {
+ if (i->empty)
+ {
+ i->Swap(target.element[index]);
+ return true;
+ }
+ else
+ found_index = cur_index;
+ }
+
+ if (found_index != -1)
+ {
+ element[found_index].Swap(target.element[index]);
+ return true;
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/engines/crab/ItemMenu.h b/engines/crab/ItemMenu.h
new file mode 100644
index 00000000000..e0eb5832d68
--- /dev/null
+++ b/engines/crab/ItemMenu.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include "common_header.h"
+#include "menu.h"
+#include "person.h"
+#include "ItemSlot.h"
+#include "StatDrawHelper.h"
+#include "StatPreview.h"
+#include "ItemDesc.h"
+
+namespace pyrodactyl
+{
+ namespace item
+ {
+ //The menu is used to handle interactions like the player clicking on an item to equip it
+ class ItemMenu : public pyrodactyl::ui::Menu<ItemSlot>
+ {
+ protected:
+ int preview_index, select_index;
+
+ //Variable to determine if stats of object need updating
+ bool update;
+
+ public:
+ //The preview for selected item and hovered item
+ //StatPreview select, hover;
+
+ ItemMenu(){ preview_index = -1; select_index = -1; update = false; }
+ ~ItemMenu(){}
+
+ int HoverIndex() { return hover_index; }
+
+ void Draw(pyrodactyl::ui::ItemDesc &item_info);
+ /*pyrodactyl::people::Person &obj, pyrodactyl::stat::StatDrawHelper &helper*/
+
+ void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
+ const unsigned int &cols, const bool &keyboard);
+
+ void HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ /* pyrodactyl::people::Person &obj,*/
+
+ bool Swap(ItemMenu &target, int index);
+ bool Equip(Item &item);
+ bool Del(const std::string &id);
+ bool Has(const std::string &container, const std::string &id);
+
+ //Used to calculate enabled slots
+ //void SetEnable();
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ItemSlot.cpp b/engines/crab/ItemSlot.cpp
new file mode 100644
index 00000000000..3a57131d3ec
--- /dev/null
+++ b/engines/crab/ItemSlot.cpp
@@ -0,0 +1,147 @@
+#include "stdafx.h"
+#include "ItemSlot.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::item;
+using namespace pyrodactyl::input;
+using namespace pyrodactyl::music;
+using namespace pyrodactyl::people;
+
+//------------------------------------------------------------------------
+// Purpose: Load
+//------------------------------------------------------------------------
+void ItemSlot::Load(rapidxml::xml_node<char> *node)
+{
+ StateButton::Load(node);
+
+ if (node->first_attribute("slot") == NULL)
+ no_type = true;
+ else
+ {
+ LoadStr(item_type, "slot", node);
+ no_type = false;
+ }
+
+ std::string name = node->name();
+ if (name == "equip")
+ category = SLOT_EQUIP;
+ else
+ category = SLOT_STORAGE;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Initialize from reference item slot
+//------------------------------------------------------------------------
+void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset)
+{
+ StateButton::Init(ref, XOffset, YOffset);
+ canmove = ref.canmove;
+ no_type = ref.no_type;
+ category = ref.category;
+ unread = ref.unread;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Save state to file
+//------------------------------------------------------------------------
+void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ rapidxml::xml_node<char> *child;
+
+ if (category == SLOT_EQUIP)
+ child = doc.allocate_node(rapidxml::node_element, "equip");
+ else
+ child = doc.allocate_node(rapidxml::node_element, "storage");
+
+ item.SaveState(doc, child);
+ SaveBool(unread, "unread", doc, child);
+
+ root->append_node(child);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Load state from file
+//------------------------------------------------------------------------
+void ItemSlot::LoadState(rapidxml::xml_node<char> *node)
+{
+ item.Load(node);
+ LoadBool(unread, "unread", node);
+
+ if (item.id == "")
+ empty = true;
+ else
+ empty = false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw
+//------------------------------------------------------------------------
+void ItemSlot::Draw()
+{
+ StateButton::Draw();
+
+ if (!empty)
+ item.Draw(x, y);
+
+ if (unread)
+ pyrodactyl::image::gImageManager.NotifyDraw(x + w, y);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Handle user input
+//------------------------------------------------------------------------
+ButtonAction ItemSlot::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset)
+{
+ ButtonAction ac = StateButton::HandleEvents(Event, XOffset, YOffset);
+ if (ac == BUAC_LCLICK || ac == BUAC_RCLICK)
+ unread = false;
+
+ return ac;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Exchange items with another slot
+// this object is the current slot, parameter object is target slot
+//------------------------------------------------------------------------
+bool ItemSlot::Swap(ItemSlot &target)
+{
+ if (CanSwap(target))
+ {
+ Item temp = item;
+ item = target.item;
+ target.item = temp;
+
+ bool val = empty;
+ empty = target.empty;
+ target.empty = val;
+
+ return true;
+ }
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Equip an item
+//------------------------------------------------------------------------
+bool ItemSlot::Equip(Item &i)
+{
+ if ((item_type == i.type || no_type) && empty)
+ {
+ item = i;
+ empty = false;
+ unread = true;
+ return true;
+ }
+
+ return false;
+}
+
+//------------------------------------------------------------------------
+// Purpose: Change stats based on item
+//------------------------------------------------------------------------
+void ItemSlot::StatChange(Person &obj, bool increase)
+{
+ if (enabled)
+ item.StatChange(obj, increase);
+}
\ No newline at end of file
diff --git a/engines/crab/ItemSlot.h b/engines/crab/ItemSlot.h
new file mode 100644
index 00000000000..66778ea157e
--- /dev/null
+++ b/engines/crab/ItemSlot.h
@@ -0,0 +1,57 @@
+#pragma once
+
+#include "common_header.h"
+#include "ImageManager.h"
+#include "Item.h"
+#include "StateButton.h"
+
+namespace pyrodactyl
+{
+ namespace item
+ {
+ enum SlotType { SLOT_EQUIP, SLOT_STORAGE };
+
+ class ItemSlot : public pyrodactyl::ui::StateButton
+ {
+ //Ignore the type of item check
+ bool no_type;
+
+ public:
+ //The type of item allowed in this slot (can be overridden by item_type)
+ std::string item_type;
+
+ //Is the slot empty?
+ bool empty;
+
+ //Is the slot enabled? (used for stat calculation)
+ bool enabled;
+
+ //Is this a new item? Draw the unread notification icon if so
+ bool unread;
+
+ //The type of the item slot
+ SlotType category;
+
+ //The item contained in the slot
+ Item item;
+
+ ItemSlot() { empty = true; enabled = true; category = SLOT_STORAGE; no_type = false; unread = false; }
+ ~ItemSlot() {}
+
+ void Init(const ItemSlot &ref, const int &XOffset = 0, const int &YOffset = 0);
+ void Load(rapidxml::xml_node<char> *node);
+
+ void Draw();
+ pyrodactyl::ui::ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+
+ bool CanSwap(ItemSlot &target){ return target.no_type || item.type == target.item_type; }
+ bool Swap(ItemSlot &target);
+ bool Equip(Item &i);
+
+ void StatChange(pyrodactyl::people::Person &obj, bool increase);
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/KeyBindMenu.cpp b/engines/crab/KeyBindMenu.cpp
new file mode 100644
index 00000000000..884da025cb7
--- /dev/null
+++ b/engines/crab/KeyBindMenu.cpp
@@ -0,0 +1,181 @@
+#include "stdafx.h"
+#include "KeyBindMenu.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+using namespace pyrodactyl::text;
+using namespace pyrodactyl::input;
+
+void KeyBindMenu::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid(node))
+ {
+ if (NodeValid("menu", node))
+ {
+ rapidxml::xml_node<char> *menode = node->first_node("menu");
+
+ if (NodeValid("primary", menode))
+ prim.Load(menode->first_node("primary"));
+
+ if (NodeValid("alt", menode))
+ alt.Load(menode->first_node("alt"));
+
+ if (NodeValid("prompt", menode))
+ prompt.Load(menode->first_node("prompt"));
+
+ if (NodeValid("inc", menode))
+ inc.Load(menode->first_node("inc"));
+
+ if (NodeValid("dim", menode))
+ dim.Load(menode->first_node("dim"));
+
+ if (NodeValid("divide", menode))
+ divide.Load(menode->first_node("divide"));
+
+ if (NodeValid("desc", menode))
+ desc.Load(menode->first_node("desc"));
+ }
+
+ //Initialize the menus
+ InitMenu(CON_GAME);
+ InitMenu(CON_UI);
+
+ if (NodeValid("controls", node))
+ sel_controls.Load(node->first_node("controls"));
+ }
+}
+
+void KeyBindMenu::StartAndSize(const int &type, int &start, int &size)
+{
+ switch (type)
+ {
+ case CON_GAME: start = IG_START; size = IG_SIZE; break;
+ case CON_UI: start = IU_START; size = IU_SIZE; break;
+ default: break;
+ }
+}
+
+void KeyBindMenu::InitMenu(const int &type)
+{
+ int start = 0, size = 0;
+ StartAndSize(type, start, size);
+
+ //Initialize the menu
+ menu[type].element.resize(size * 2);
+ for (int i = 0; i < size * 2; i += 2)
+ {
+ int xoffset = inc.x*(i / 2) + divide.x*((i / 2) / dim.x);
+ int yoffset = inc.y* ((i / 2) % dim.x) + divide.y*((i / 2) / dim.x);
+
+ menu[type].element.at(i).Init(prim, xoffset, yoffset);
+ menu[type].element.at(i).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].key);
+
+ menu[type].element.at(i + 1).Init(alt, xoffset, yoffset);
+ menu[type].element.at(i + 1).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].alt);
+ }
+}
+
+void KeyBindMenu::DrawDesc(const int &type)
+{
+ int start = 0, size = 0;
+ StartAndSize(type, start, size);
+
+ for (int i = 0; i < size; i++)
+ {
+ int xoffset = inc.x * i + divide.x * (i / dim.x);
+ int yoffset = inc.y * (i % dim.x) + divide.y * (i / dim.x);
+
+ desc.Draw(gInput.iv[i + start].name, xoffset, yoffset);
+ }
+}
+
+void KeyBindMenu::Draw()
+{
+ sel_controls.Draw();
+
+ menu[sel_controls.cur].Draw();
+ DrawDesc(sel_controls.cur);
+}
+
+void KeyBindMenu::SetCaption()
+{
+ int start = 0, size = 0;
+ StartAndSize(sel_controls.cur, start, size);
+
+ for (int i = 0; i < size * 2; i += 2)
+ {
+ menu[sel_controls.cur].element.at(i).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].key);
+ menu[sel_controls.cur].element.at(i + 1).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].alt);
+ }
+}
+
+void KeyBindMenu::HandleEvents(const SDL_Event &Event)
+{
+ if (sel_controls.HandleEvents(Event))
+ SetCaption();
+
+ switch (state)
+ {
+ case STATE_NORMAL:
+ choice = menu[sel_controls.cur].HandleEvents(Event);
+ if (choice >= 0)
+ {
+ prompt.Swap(menu[sel_controls.cur].element.at(choice).caption);
+ state = STATE_KEY;
+ break;
+ }
+
+ break;
+ case STATE_KEY:
+ if (Event.type == SDL_KEYDOWN)
+ {
+ SwapKey(Event.key.keysym.scancode);
+ SetCaption();
+ menu[sel_controls.cur].element.at(choice).caption.col = prompt.col_prev;
+ state = STATE_NORMAL;
+ }
+ break;
+ default:break;
+ }
+}
+
+void KeyBindMenu::SwapKey(const SDL_Scancode &find)
+{
+ int start = 0, size = 0;
+ StartAndSize(sel_controls.cur, start, size);
+ int pos = start + (choice / 2);
+
+ for (int i = start; i < start + size; ++i)
+ {
+ if (gInput.iv[i].key == find)
+ {
+ gInput.iv[i].key = gInput.iv[pos].key;
+ break;
+ }
+ else if (gInput.iv[i].alt == find)
+ {
+ gInput.iv[i].alt = gInput.iv[pos].key;
+ break;
+ }
+ }
+
+ if (choice % 2 == 0)
+ gInput.iv[pos].key = find;
+ else
+ gInput.iv[pos].alt = find;
+}
+
+void KeyBindMenu::SetUI()
+{
+ menu[CON_GAME].Clear();
+ menu[CON_UI].Clear();
+
+ //Initialize the menus
+ prim.SetUI();
+ alt.SetUI();
+ InitMenu(CON_GAME);
+ InitMenu(CON_UI);
+
+ desc.SetUI();
+ sel_controls.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/KeyBindMenu.h b/engines/crab/KeyBindMenu.h
new file mode 100644
index 00000000000..3adf28d1df3
--- /dev/null
+++ b/engines/crab/KeyBindMenu.h
@@ -0,0 +1,87 @@
+#pragma once
+
+#include "common_header.h"
+#include "menu.h"
+#include "ImageData.h"
+#include "OptionSelect.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class KeyBindMenu
+ {
+ //The keyboard controls menu has 2 types of inputs
+ enum Controls { CON_GAME, CON_UI, CON_TOTAL };
+
+ //Each menu can be in these 2 states
+ enum States { STATE_NORMAL, STATE_KEY } state;
+
+ //This button swaps between sub-sections "Gameplay" and "Interface"
+ OptionSelect sel_controls;
+
+ //These two buttons are the template buttons for the menu
+ Button prim, alt;
+
+ //This is the template text info
+ TextData desc;
+
+ //inc tells us what to add to the reference buttons to get multiple buttons
+ //Divide is the space between two columns
+ Vector2i inc, divide;
+
+ //The number of rows and columns
+ Vector2i dim;
+
+ //The menu for the keyboard options in both sub categories
+ //all control types have equal entries so we just need to change the text displayed
+ ButtonMenu menu[CON_TOTAL];
+
+ //The selected button in the current menu
+ int choice;
+
+ struct PromptInfo
+ {
+ int col, col_prev;
+ std::string text;
+
+ PromptInfo(){ col = 0; col_prev = 0; }
+
+ void Load(rapidxml::xml_node<char> *node)
+ {
+ if(NodeValid(node))
+ {
+ LoadStr(text, "text", node);
+ LoadNum(col,"color",node);
+ }
+ }
+
+ void Swap(Caption &c)
+ {
+ col_prev = c.col;
+ c.text = text;
+ c.col = col;
+ }
+ } prompt;
+
+ void StartAndSize(const int &type, int &start, int &size);
+ void InitMenu(const int &type);
+ void DrawDesc(const int &type);
+
+ public:
+ KeyBindMenu(){ Reset(); choice = -1; }
+ ~KeyBindMenu(){}
+
+ void Reset(){ state = STATE_NORMAL; }
+ void SwapKey(const SDL_Scancode &find);
+ bool DisableHotkeys() { return state != STATE_NORMAL; }
+
+ void Load(rapidxml::xml_node<char> *node);
+ void HandleEvents(const SDL_Event &Event);
+ void SetCaption();
+
+ void Draw();
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/LevelExit.cpp b/engines/crab/LevelExit.cpp
new file mode 100644
index 00000000000..fe417a831e4
--- /dev/null
+++ b/engines/crab/LevelExit.cpp
@@ -0,0 +1,30 @@
+#include "stdafx.h"
+#include "LevelExit.h"
+
+using namespace pyrodactyl::level;
+
+void Exit :: Load(rapidxml::xml_node<char> *node)
+{
+ dim.Load(node);
+ LoadStr(name, "name", node);
+
+ if(NodeValid("properties",node))
+ {
+ rapidxml::xml_node<char> *propertynode = node->first_node("properties");
+ for(auto n = propertynode->first_node("property"); n != NULL; n = n->next_sibling("property"))
+ {
+ std::string node_name;
+ LoadStr(node_name, "name", n);
+ if(node_name == "entry_x")
+ {
+ if(!LoadNum(entry.x, "value", n))
+ entry.x = -1;
+ }
+ else if(node_name == "entry_y")
+ {
+ if(!LoadNum(entry.y, "value", n))
+ entry.y = -1;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/LevelExit.h b/engines/crab/LevelExit.h
new file mode 100644
index 00000000000..5e46ebd0e60
--- /dev/null
+++ b/engines/crab/LevelExit.h
@@ -0,0 +1,24 @@
+#pragma once
+
+#include "common_header.h"
+#include "ImageManager.h"
+#include "GameEventInfo.h"
+#include "Shape.h"
+
+namespace pyrodactyl
+{
+ namespace level
+ {
+ struct Exit
+ {
+ std::string name;
+ Shape dim;
+ Vector2i entry;
+
+ Exit() : entry(-1,-1) {}
+ Exit(rapidxml::xml_node<char> *node){ Load(node); }
+
+ void Load(rapidxml::xml_node<char> *node);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
new file mode 100644
index 00000000000..57610f62325
--- /dev/null
+++ b/engines/crab/LevelResult.h
@@ -0,0 +1,20 @@
+#pragma once
+#include "common_header.h"
+
+#include "ImageManager.h"
+
+enum LevelResultType { LR_NONE, LR_LEVEL, LR_GAMEOVER };
+
+struct LevelResult
+{
+ LevelResultType type;
+ std::string val;
+ int x,y;
+
+ LevelResult() : val("")
+ {
+ type = LR_NONE;
+ x = -1;
+ y = -1;
+ }
+};
\ No newline at end of file
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
new file mode 100644
index 00000000000..3b1a2072dde
--- /dev/null
+++ b/engines/crab/Line.cpp
@@ -0,0 +1,12 @@
+#include "stdafx.h"
+#include "Line.h"
+
+//------------------------------------------------------------------------
+// Purpose: Draw a line from start to end
+//------------------------------------------------------------------------
+void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
+ const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a)
+{
+ SDL_SetRenderDrawColor(gRenderer, r, g, b, a);
+ SDL_RenderDrawLine(gRenderer, x1, y1, x2, y2);
+}
\ No newline at end of file
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
new file mode 100644
index 00000000000..72125723d8c
--- /dev/null
+++ b/engines/crab/Line.h
@@ -0,0 +1,42 @@
+#pragma once
+
+#include "common_header.h"
+#include "ScreenSettings.h"
+#include "vectors.h"
+
+//Find if 2 lines intersect and store the point of intersection
+template <typename T>
+bool CollideLine(const T& p0_x, const T& p0_y, const T& p1_x, const T& p1_y,
+ const T& p2_x, const T& p2_y, const T& p3_x, const T& p3_y,
+ T *x = NULL, T *y = NULL)
+{
+ Vector2D<T> s1, s2;
+ s1.x = p1_x - p0_x; s1.y = p1_y - p0_y;
+ s2.x = p3_x - p2_x; s2.y = p3_y - p2_y;
+
+ float d = (-s2.x * s1.y + s1.x * s2.y);
+
+ if (d != 0)
+ {
+ float s, t;
+ s = (-s1.y * (p0_x - p2_x) + s1.x * (p0_y - p2_y)) / d;
+ t = (s2.x * (p0_y - p2_y) - s2.y * (p0_x - p2_x)) / d;
+
+ if (s >= 0 && s <= 1 && t >= 0 && t <= 1)
+ {
+ // Collision detected
+ if (x != NULL)
+ *x = p0_x + (t * s1.x);
+ if (y != NULL)
+ *y = p0_y + (t * s1.y);
+
+ return true;
+ }
+ }
+
+ return false; // No collision
+}
+
+//Draw a line OpenGL style
+void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
+ const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a);
\ No newline at end of file
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
new file mode 100644
index 00000000000..2a41184cf19
--- /dev/null
+++ b/engines/crab/LoadingScreen.cpp
@@ -0,0 +1,63 @@
+#include "stdafx.h"
+#include "LoadingScreen.h"
+#include "XMLDoc.h"
+
+void LoadingScreen::Load()
+{
+ const std::string &filename = "res/layout/loading.xml";
+ XMLDoc doc(filename);
+ if (doc.ready())
+ {
+ rapidxml::xml_node<char> *node = doc.Doc()->first_node("loading");
+ if (NodeValid(node))
+ {
+ if (NodeValid("screens", node))
+ {
+ rapidxml::xml_node<char> *scrnode = node->first_node("screens");
+ for (auto n = scrnode->first_node("screen"); n != NULL; n = n->next_sibling("screen"))
+ screen.push_back(n);
+ }
+
+ if (NodeValid("text", node))
+ text.Load(node->first_node("text"), "img");
+ }
+ }
+}
+
+void LoadingScreen::Draw()
+{
+ //Change to a random screen
+ Change();
+
+ //Draw the current screen
+ if (cur < screen.size())
+ screen.at(cur).Draw();
+
+ //Draw the loading text
+ text.Draw((gScreenSettings.cur.w - text.W()) / 2, (gScreenSettings.cur.h - text.H()) / 2);
+
+ //Update the screen
+ SDL_RenderPresent(gRenderer);
+}
+
+void LoadingScreen::Dim()
+{
+ //This is used when starting or loading a game from the main menu in order to dim the screen
+ //until an actual loading screen is drawn
+ SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
+ SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 200);
+ SDL_RenderFillRect(gRenderer, NULL);
+
+ //Update the screen
+ SDL_RenderPresent(gRenderer);
+}
+
+void LoadingScreen::Quit()
+{
+ text.Delete();
+
+ for (auto i = screen.begin(); i != screen.end(); ++i)
+ i->Delete();
+}
+
+LoadingScreen gLoadScreen;
\ No newline at end of file
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
new file mode 100644
index 00000000000..dadc344c397
--- /dev/null
+++ b/engines/crab/LoadingScreen.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "common_header.h"
+#include "vectors.h"
+#include "timer.h"
+#include "Image.h"
+
+class LoadingScreen
+{
+ struct Screen
+ {
+ //The background image
+ pyrodactyl::image::Image bg;
+
+ Screen(rapidxml::xml_node<char> *node) { bg.Load(node, "bg"); }
+ void Delete() { bg.Delete(); }
+ void Draw(){ bg.Draw((gScreenSettings.cur.w - bg.W()) / 2, (gScreenSettings.cur.h - bg.H()) / 2); }
+ };
+
+ //The different loading screens
+ std::vector<Screen> screen;
+
+ //The current loading screen
+ unsigned int cur;
+
+ //The text image (says loading)
+ pyrodactyl::image::Image text;
+
+public:
+ LoadingScreen(){ cur = 0; };
+ ~LoadingScreen(){};
+
+ void Change(){ cur = gRandom.Num() % screen.size(); }
+
+ void Load();
+ void Draw();
+ void Dim();
+ void Quit();
+};
+
+extern LoadingScreen gLoadScreen;
\ No newline at end of file
diff --git a/engines/crab/MapData.cpp b/engines/crab/MapData.cpp
new file mode 100644
index 00000000000..7ce44cb6a8f
--- /dev/null
+++ b/engines/crab/MapData.cpp
@@ -0,0 +1,66 @@
+#include "stdafx.h"
+#include "MapData.h"
+
+using namespace pyrodactyl::ui;
+
+void MapData::Load(rapidxml::xml_node<char> *node)
+{
+ LoadStr(path_bg, "bg", node);
+ LoadStr(path_overlay, "overlay", node);
+}
+
+void MapData::DestAdd(const std::string &name, const int &x, const int &y)
+{
+ MarkerData md;
+ md.name = name;
+ md.pos.x = x;
+ md.pos.y = y;
+ dest.push_back(md);
+}
+
+void MapData::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ rapidxml::xml_node<char> *child_clip = doc.allocate_node(rapidxml::node_element, "clip");
+ for (auto c = reveal.begin(); c != reveal.end(); ++c)
+ c->SaveState(doc, child_clip, "rect");
+ root->append_node(child_clip);
+
+ rapidxml::xml_node<char> *child_dest = doc.allocate_node(rapidxml::node_element, "dest");
+ for (auto d = dest.begin(); d != dest.end(); ++d)
+ {
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "pos");
+ child->append_attribute(doc.allocate_attribute("name", d->name.c_str()));
+ child->append_attribute(doc.allocate_attribute("x", gStrPool.Get(d->pos.x)));
+ child->append_attribute(doc.allocate_attribute("y", gStrPool.Get(d->pos.y)));
+ child_dest->append_node(child);
+ }
+ root->append_node(child_dest);
+}
+
+void MapData::LoadState(rapidxml::xml_node<char> *node)
+{
+ reveal.clear();
+ if (NodeValid("clip", node))
+ {
+ rapidxml::xml_node<char> *clipnode = node->first_node("clip");
+ for (rapidxml::xml_node<char> *n = clipnode->first_node("rect"); n != NULL; n = n->next_sibling("rect"))
+ {
+ Rect r;
+ r.Load(n);
+ reveal.push_back(r);
+ }
+ }
+
+ dest.clear();
+ if (NodeValid("dest", node))
+ {
+ rapidxml::xml_node<char> *destnode = node->first_node("dest");
+ for (rapidxml::xml_node<char> *n = destnode->first_node("pos"); n != NULL; n = n->next_sibling("pos"))
+ {
+ MarkerData md;
+ LoadStr(md.name, "name", n);
+ md.pos.Load(n);
+ dest.push_back(md);
+ }
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/MapData.h b/engines/crab/MapData.h
new file mode 100644
index 00000000000..299c68e2e59
--- /dev/null
+++ b/engines/crab/MapData.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "common_header.h"
+#include "Rectangle.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ struct MapData
+ {
+ //The paths of set of map images - background and the fully revealed map overlay
+ std::string path_bg, path_overlay;
+
+ //The places the player has revealed in this world map
+ std::vector<Rect> reveal;
+
+ struct MarkerData
+ {
+ //The name of the marker, same name as the quest
+ std::string name;
+
+ //Position of the marker
+ Vector2i pos;
+ };
+
+ //The set of destinations currently active
+ std::vector<MarkerData> dest;
+
+ MapData(){}
+ MapData(rapidxml::xml_node<char> *node){ Load(node); }
+ ~MapData(){}
+
+ void Load(rapidxml::xml_node<char> *node);
+ void DestAdd(const std::string &name, const int &x, const int &y);
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/MapMarkerMenu.cpp b/engines/crab/MapMarkerMenu.cpp
new file mode 100644
index 00000000000..da2a599cbd9
--- /dev/null
+++ b/engines/crab/MapMarkerMenu.cpp
@@ -0,0 +1,112 @@
+#include "stdafx.h"
+#include "MapMarkerMenu.h"
+
+using namespace pyrodactyl::ui;
+
+//------------------------------------------------------------------------
+// Purpose: Load
+//------------------------------------------------------------------------
+void MapMarkerMenu::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid("ref", node))
+ ref.Load(node->first_node("ref"));
+
+ if (NodeValid("player", node))
+ player.Load(node->first_node("player"));
+
+ if (NodeValid("offset", node))
+ {
+ rapidxml::xml_node<char> *offnode = node->first_node("offset");
+
+ if (NodeValid("marker", offnode))
+ offset.marker.Load(offnode->first_node("marker"));
+
+ if (NodeValid("player", offnode))
+ offset.player.Load(offnode->first_node("player"));
+ }
+
+ menu.UseKeyboard(true);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw
+//------------------------------------------------------------------------
+void MapMarkerMenu::Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera)
+{
+ //Calculate all offsets
+ Vector2i offset_p(pos.x + player_pos.x + offset.player.x - camera.x, pos.y + player_pos.y + offset.player.y - camera.y);
+ Vector2i offset_m(pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+
+ //Only draw the image - captions drawn later to prevent drawing another button over caption
+ player.ImageCaptionOnlyDraw(offset_p.x, offset_p.y);
+
+ for (auto &i : menu.element)
+ i.ImageCaptionOnlyDraw(offset_m.x, offset_m.y);
+
+ //Now draw the tool-tips for everything combined
+ player.HoverInfoOnlyDraw(offset_p.x, offset_p.y);
+
+ for (auto &i : menu.element)
+ i.HoverInfoOnlyDraw(offset_m.x, offset_m.y);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Handle Events
+//------------------------------------------------------------------------
+void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event)
+{
+ if (player_pos.x >= camera.x && player_pos.y >= camera.y)
+ player.HandleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
+
+ int choice = menu.HandleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+ if (choice != -1)
+ {
+ int c = 0;
+ for (auto &i : menu.element)
+ {
+ if (c == choice) //For an already selected marker, clicking it toggles the selection state
+ i.State(!i.State());
+ else
+ i.State(false);
+
+ ++c;
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Internal Events
+//------------------------------------------------------------------------
+void MapMarkerMenu::InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds)
+{
+ //Find if the player marker is visible or not
+ {
+ Rect r(pos.x + player_pos.x - offset.marker.x - camera.x,
+ pos.y + player_pos.y - offset.marker.y - camera.y,
+ player.w + offset.marker.x,
+ player.h + offset.marker.y);
+
+ player.visible = bounds.Contains(r);
+ }
+
+ //Redefine p for marker buttons
+ Vector2i p(pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+
+ //Calculate visibility for each marker
+ for (auto &i : menu.element)
+ {
+ Rect r(i.x + p.x - offset.marker.x, i.y + p.y - offset.marker.y,
+ i.w + offset.marker.x, i.h + offset.marker.y);
+
+ i.visible = bounds.Contains(r);
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Reposition UI
+//------------------------------------------------------------------------
+void MapMarkerMenu::SetUI()
+{
+ player.SetUI();
+ menu.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/MapMarkerMenu.h b/engines/crab/MapMarkerMenu.h
new file mode 100644
index 00000000000..d371bca3cd8
--- /dev/null
+++ b/engines/crab/MapMarkerMenu.h
@@ -0,0 +1,68 @@
+#pragma once
+
+#include "common_header.h"
+#include "StateButton.h"
+#include "menu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class MapMarkerMenu
+ {
+ //The reference map marker
+ StateButton ref;
+
+ //The menu containing all the map markers
+ Menu<StateButton> menu;
+
+ //The offset at which every map marker is drawn (used to compensate for icon design width)
+ struct { Vector2i marker, player; } offset;
+
+ //The button for the player's current position
+ Button player;
+
+ public:
+ MapMarkerMenu(){}
+ ~MapMarkerMenu(){}
+
+ void AddButton(const std::string &name, const int &x, const int &y)
+ {
+ StateButton b;
+ b.Init(ref, x, y);
+ b.tooltip.text = name;
+ menu.element.push_back(b);
+ }
+
+ void Clear(){ menu.element.clear(); }
+ void AssignPaths() { menu.AssignPaths(); }
+
+ void SelectDest(const std::string &name)
+ {
+ for (auto &i : menu.element)
+ i.State(i.tooltip.text == name);
+ }
+
+ void Erase(const std::string &name)
+ {
+ for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
+ {
+ if (i->tooltip.text == name)
+ {
+ menu.element.erase(i);
+ AssignPaths();
+ break;
+ }
+ }
+ }
+
+ void Load(rapidxml::xml_node<char> *node);
+
+ void Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
+ void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
+ void InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ModMenu.cpp b/engines/crab/ModMenu.cpp
new file mode 100644
index 00000000000..4733c4f29b0
--- /dev/null
+++ b/engines/crab/ModMenu.cpp
@@ -0,0 +1,101 @@
+#include "stdafx.h"
+#include "ModMenu.h"
+
+using namespace pyrodactyl::ui;
+
+void ModMenu::Load(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("mod_menu");
+
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+
+ if (NodeValid("menu", node))
+ menu.Load(node->first_node("menu"));
+
+ if (NodeValid("preview", node))
+ {
+ auto prnode = node->first_node("preview");
+ img.pos.Load(prnode);
+ LoadStr(img.no_preview_path, "path", prnode);
+ }
+
+ if (NodeValid("offset", node))
+ {
+ rapidxml::xml_node<char> *offnode = node->first_node("offset");
+
+ //Stuff displayed on the slot button
+ td_b[DATA_SAVENAME].Load(offnode->first_node("mod_name"));
+ td_b[DATA_LASTMODIFIED].Load(offnode->first_node("last_modified"));
+
+ //Stuff displayed when you hover over a slot button
+ td_h[DATA_AUTHOR].Load(offnode->first_node("author"));
+ td_h[DATA_VERSION].Load(offnode->first_node("version"));
+ td_h[DATA_INFO].Load(offnode->first_node("info"));
+ td_h[DATA_WEBSITE].Load(offnode->first_node("website"));
+
+ //Titles for the stuff displayed when you hover over a slot button
+ hov[DATA_AUTHOR].Load(offnode->first_node("author_title"));
+ hov[DATA_VERSION].Load(offnode->first_node("info_title"));
+ hov[DATA_INFO].Load(offnode->first_node("version_title"));
+ hov[DATA_WEBSITE].Load(offnode->first_node("website_title"));
+ }
+
+ extension = gFilePath.mod_ext;
+ directory = gFilePath.mod_path;
+ ScanDir();
+ }
+}
+
+bool ModMenu::HandleEvents(const SDL_Event &Event)
+{
+ int choice = menu.HandleEvents(Event);
+ if (choice >= 0)
+ {
+ gFilePath.mod_cur = slot_info[menu.Index() + choice].path;
+ return true;
+ }
+
+ return false;
+}
+
+void ModMenu::Draw()
+{
+ bg.Draw();
+ menu.Draw();
+ for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++)
+ {
+ auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
+ td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
+ td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
+ }
+
+ if (menu.HoverIndex() >= 0)
+ {
+ int i = menu.HoverIndex();
+
+ if (!img.loaded || prev_hover != i)
+ {
+ img.loaded = true;
+ prev_hover = i;
+ if (!img.preview.Load(slot_info[i].preview))
+ img.preview.Load(img.no_preview_path);
+ }
+
+ hover = true;
+ img.preview.Draw(img.pos.x, img.pos.y);
+
+ td_h[DATA_AUTHOR].Draw(slot_info[i].author);
+ td_h[DATA_VERSION].Draw(slot_info[i].version);
+ td_h[DATA_INFO].Draw(slot_info[i].info);
+ td_h[DATA_WEBSITE].Draw(slot_info[i].website);
+
+ for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
+ hov[num].Draw();
+ }
+ else if (hover)
+ Reset();
+}
\ No newline at end of file
diff --git a/engines/crab/ModMenu.h b/engines/crab/ModMenu.h
new file mode 100644
index 00000000000..7a528bffb7d
--- /dev/null
+++ b/engines/crab/ModMenu.h
@@ -0,0 +1,22 @@
+#pragma once
+
+#include "common_header.h"
+#include "FileMenu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class ModMenu : public FileMenu<ModFileData>
+ {
+ public:
+
+ ModMenu(){}
+ ~ModMenu(){}
+
+ void Load(const std::string &filename);
+ bool HandleEvents(const SDL_Event &Event);
+ void Draw();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/MusicArea.cpp b/engines/crab/MusicArea.cpp
new file mode 100644
index 00000000000..2ec1231e709
--- /dev/null
+++ b/engines/crab/MusicArea.cpp
@@ -0,0 +1,24 @@
+#include "stdafx.h"
+#include "MusicArea.h"
+
+using namespace pyrodactyl::level;
+
+void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo)
+{
+ Shape::Load(node, echo);
+
+ if (NodeValid("properties", node, echo))
+ {
+ auto pnode = node->first_node("properties");
+ for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property"))
+ {
+ std::string name;
+ if (LoadStr(name, "name", n, echo))
+ {
+ if (name == "music") LoadBool(track, "value", n, echo);
+ else if (name == "id") LoadNum(id, "value", n, echo);
+ else if (name == "loops") LoadNum(loops, "value", n, echo);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/MusicArea.h b/engines/crab/MusicArea.h
new file mode 100644
index 00000000000..59862ed2343
--- /dev/null
+++ b/engines/crab/MusicArea.h
@@ -0,0 +1,36 @@
+#pragma once
+
+#include "common_header.h"
+#include "musicparam.h"
+#include "Shape.h"
+
+namespace pyrodactyl
+{
+ namespace level
+ {
+ struct MusicInfo
+ {
+ //Are we playing a sound effect or a music track
+ bool track;
+
+ //The id of the music track or sound effect being played
+ int id;
+
+ //The amount of loops
+ int loops;
+
+ MusicInfo(){ track = false; id = -1; loops = -1; }
+ ~MusicInfo(){}
+ };
+
+ class MusicArea : public Shape, public MusicInfo
+ {
+ public:
+
+ MusicArea(){}
+ ~MusicArea(){}
+
+ void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/MusicManager.cpp b/engines/crab/MusicManager.cpp
new file mode 100644
index 00000000000..c8dc1b6a654
--- /dev/null
+++ b/engines/crab/MusicManager.cpp
@@ -0,0 +1,135 @@
+#include "stdafx.h"
+
+#include "MusicManager.h"
+#include "ScreenSettings.h"
+#include "XMLDoc.h"
+
+using namespace pyrodactyl::music;
+
+namespace pyrodactyl
+{
+ namespace music
+ {
+ MusicManager gMusicManager;
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Clear stored data
+//------------------------------------------------------------------------
+void MusicManager::FreeMusic()
+{
+ Mix_FreeMusic(bg.track);
+}
+
+void MusicManager::FreeChunk()
+{
+ for (auto i = effect.begin(); i != effect.end(); ++i)
+ Mix_FreeChunk(i->second);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Play or queue music
+//------------------------------------------------------------------------
+void MusicManager::PlayMusic(const MusicKey &id)
+{
+ if (bg.id != id)
+ {
+ XMLDoc track_list(gFilePath.sound_music);
+ if (track_list.ready())
+ {
+ rapidxml::xml_node<char> *node = track_list.Doc()->first_node("music");
+ for (auto n = node->first_node(); n != NULL; n = n->next_sibling())
+ {
+ rapidxml::xml_attribute<char> *att = n->first_attribute("id");
+ if (att != NULL && id == StringToNumber<MusicKey>(att->value()))
+ {
+ bg.Load(n);
+ break;
+ }
+ }
+ }
+
+ if (bg.track != NULL)
+ Mix_FadeInMusic(bg.track, -1, bg.fade_in_duration);
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Play or queue sound effects
+//------------------------------------------------------------------------
+void MusicManager::PlayEffect(const ChunkKey &id, const int &loops)
+{
+ if (effect.count(id) > 0)
+ Mix_PlayChannel(-1, effect[id], loops);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Initialize the music subsystem (currently SDL_mixer) and load sound effects
+//------------------------------------------------------------------------
+bool MusicManager::Load(rapidxml::xml_node<char> *node)
+{
+ //Initialize music parameters
+ int volume_mus = 100, volume_eff = 100;
+
+ if (NodeValid("sound", node))
+ {
+ rapidxml::xml_node<char> *volnode = node->first_node("sound");
+ LoadNum(volume_mus, "music", volnode);
+ LoadNum(volume_eff, "effects", volnode);
+ LoadNum(freq, "frequency", volnode);
+ LoadNum(channels, "channels", volnode);
+ LoadNum(chunksize, "chunk_size", volnode);
+ }
+
+ // Start up audio
+ const int audioflags = MIX_INIT_OGG;
+ if ((Mix_Init(audioflags) & audioflags) != audioflags)
+ {
+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to initialize audio mixer", "Please install libsdl2_mixer", NULL);
+ return false;
+ }
+
+ if (Mix_OpenAudio(freq, MIX_DEFAULT_FORMAT, channels, chunksize) == -1)
+ {
+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to open audio channels", "Please check settings", NULL);
+ return false;
+ }
+
+ //Set the volume from the settings
+ VolEffects(volume_eff);
+ VolMusic(volume_mus);
+
+ //Load sound effects
+ XMLDoc track_list(gFilePath.sound_effect);
+ if (track_list.ready())
+ {
+ rapidxml::xml_node<char> *tnode = track_list.Doc()->first_node("effects");
+ if (NodeValid(tnode))
+ {
+ LoadNum(notify, "notify", tnode);
+ LoadNum(rep_inc, "rep_inc", tnode);
+ LoadNum(rep_dec, "rep_dec", tnode);
+
+ for (auto n = tnode->first_node(); n != NULL; n = n->next_sibling())
+ {
+ rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
+ if (id != NULL && path != NULL)
+ effect[StringToNumber<ChunkKey>(id->value())] = Mix_LoadWAV(path->value());
+ }
+ }
+ }
+
+ return true;
+}
+
+void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
+{
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sound");
+ child->append_attribute(doc.allocate_attribute("music", gStrPool.Get(Mix_VolumeMusic(-1))));
+ child->append_attribute(doc.allocate_attribute("effects", gStrPool.Get(Mix_Volume(0, -1))));
+ child->append_attribute(doc.allocate_attribute("frequency", gStrPool.Get(freq)));
+ child->append_attribute(doc.allocate_attribute("channels", gStrPool.Get(channels)));
+ child->append_attribute(doc.allocate_attribute("chunk_size", gStrPool.Get(chunksize)));
+ root->append_node(child);
+}
\ No newline at end of file
diff --git a/engines/crab/MusicManager.h b/engines/crab/MusicManager.h
new file mode 100644
index 00000000000..ce8f3cc2110
--- /dev/null
+++ b/engines/crab/MusicManager.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#include "common_header.h"
+#include "GameParam.h"
+#include "musicparam.h"
+
+namespace pyrodactyl
+{
+ namespace music
+ {
+ class MusicManager
+ {
+ //The background music for our current level
+ MusicData bg;
+
+ //The sound effects in the game
+ std::unordered_map<ChunkKey, Mix_Chunk*> effect;
+
+ //Data about the audio
+ int freq, channels, chunksize;
+
+ public:
+
+ //The notification sound
+ ChunkKey notify, rep_inc, rep_dec;
+
+ MusicManager()
+ {
+ freq = MIX_DEFAULT_FREQUENCY;
+ channels = MIX_DEFAULT_CHANNELS;
+ chunksize = 1024;
+
+ notify = -1;
+ rep_inc = -1;
+ rep_dec = -1;
+ }
+ ~MusicManager(){}
+
+ bool Load(rapidxml::xml_node<char> *node);
+
+ void PlayMusic(const MusicKey &id);
+ void PlayEffect(const ChunkKey &id, const int &loops);
+
+ static void Pause(){ Mix_PauseMusic(); }
+ static void Resume(){ Mix_ResumeMusic(); }
+ static void Stop(){ Mix_HaltMusic(); }
+
+ static void VolEffects(const int &volume){ Mix_Volume(-1, volume); }
+ static int VolEffects() { return Mix_Volume(0, -1); }
+
+ static void VolMusic(const int &volume) { Mix_VolumeMusic(volume); }
+ static int VolMusic() { return Mix_VolumeMusic(-1); }
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+
+ void FreeMusic();
+ void FreeChunk();
+ void Quit(){ FreeMusic(); FreeChunk(); }
+ };
+
+ extern MusicManager gMusicManager;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/OptionMenu.cpp b/engines/crab/OptionMenu.cpp
new file mode 100644
index 00000000000..a299a708155
--- /dev/null
+++ b/engines/crab/OptionMenu.cpp
@@ -0,0 +1,337 @@
+#include "stdafx.h"
+#include "OptionMenu.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+using namespace pyrodactyl::music;
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ OptionMenu gOptionMenu;
+ }
+}
+
+void OptionMenu::Load(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("option");
+ if (NodeValid(node))
+ {
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+
+ if (NodeValid("state", node))
+ {
+ menu.Load(node->first_node("state"));
+
+ if (!menu.element.empty())
+ menu.element.at(0).State(true);
+ }
+
+ if (NodeValid("keybind", node))
+ keybind.Load(node->first_node("keybind"));
+
+ if (NodeValid("controller", node))
+ conbind.Load(node->first_node("controller"));
+
+ if (NodeValid("graphics", node))
+ gfx.Load(node->first_node("graphics"));
+
+ if (NodeValid("general", node))
+ general.Load(node->first_node("general"));
+
+ if (NodeValid("change", node))
+ {
+ rapidxml::xml_node<char> *chanode = node->first_node("change");
+
+ if (NodeValid("accept", chanode))
+ accept.Load(chanode->first_node("accept"));
+
+ if (NodeValid("cancel", chanode))
+ cancel.Load(chanode->first_node("cancel"));
+
+ if (NodeValid("message", chanode))
+ notice_res.Load(chanode->first_node("message"));
+
+ if (NodeValid("width", chanode))
+ prompt_w.Load(chanode->first_node("width"));
+
+ if (NodeValid("height", chanode))
+ prompt_h.Load(chanode->first_node("height"));
+
+ if (NodeValid("countdown", chanode))
+ {
+ rapidxml::xml_node<char> *counode = chanode->first_node("countdown");
+ countdown.Load(counode);
+ timer.Load(counode, "time");
+ }
+
+ if (NodeValid("bg", chanode))
+ questionbox.Load(chanode->first_node("bg"));
+ }
+ }
+ }
+}
+
+void OptionMenu::Reset()
+{
+ keybind.Reset();
+ state = STATE_GENERAL;
+
+ for (unsigned i = 0; i < menu.element.size(); ++i)
+ menu.element.at(i).State(i == STATE_GENERAL);
+}
+
+void OptionMenu::Draw(Button &back)
+{
+ if (state < STATE_ENTER_W)
+ {
+ bg.Draw();
+
+ switch (state)
+ {
+ case STATE_GENERAL: general.Draw(); break;
+ case STATE_GRAPHICS: gfx.Draw(); break;
+ case STATE_KEYBOARD: keybind.Draw(); break;
+ case STATE_CONTROLLER: conbind.Draw(); break;
+ default:break;
+ }
+
+ menu.Draw();
+ back.Draw();
+ }
+ else
+ {
+ questionbox.Draw();
+
+ switch (state)
+ {
+ case STATE_ENTER_W: prompt_w.Draw(); break;
+ case STATE_ENTER_H: prompt_h.Draw(); break;
+ case STATE_CONFIRM:
+ notice_res.Draw();
+ countdown.Draw(NumberToString(timer.RemainingTicks() / 1000));
+ break;
+ default:break;
+ }
+
+ accept.Draw();
+ cancel.Draw();
+ }
+}
+
+bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event)
+{
+ if (state < STATE_ENTER_W)
+ {
+ bg.Draw();
+
+ switch (state)
+ {
+ case STATE_GENERAL: general.HandleEvents(Event); break;
+ case STATE_KEYBOARD: keybind.HandleEvents(Event); break;
+ case STATE_GRAPHICS:
+ {
+ int result = gfx.HandleEvents(Event);
+ if (result == 1)
+ {
+ state = STATE_CONFIRM;
+ timer.Start();
+ gScreenSettings.SetResolution();
+ gfx.SetInfo();
+ }
+ else if (result == 2)
+ state = STATE_ENTER_W;
+ }
+ break;
+ default:break;
+ }
+
+ return HandleTabs(back, Event);
+ }
+ else
+ {
+ questionbox.Draw();
+
+ switch (state)
+ {
+ case STATE_ENTER_W:
+ if (prompt_w.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ gScreenSettings.cur.w = StringToNumber<int>(prompt_w.text);
+ state = STATE_ENTER_H;
+ }
+ else if (cancel.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ gScreenSettings.RestoreBackup();
+ gfx.SetInfo();
+ state = STATE_GRAPHICS;
+ }
+ break;
+ case STATE_ENTER_H:
+ if (prompt_h.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ gScreenSettings.cur.h = StringToNumber<int>(prompt_h.text);
+ state = STATE_CONFIRM;
+ timer.Start();
+ gScreenSettings.SetResolution();
+ gfx.SetInfo();
+ }
+ else if (cancel.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ gScreenSettings.RestoreBackup();
+ gfx.SetInfo();
+ state = STATE_GRAPHICS;
+ }
+
+ break;
+ case STATE_CONFIRM:
+ if (accept.HandleEvents(Event))
+ {
+ state = STATE_GRAPHICS;
+ timer.Stop();
+ }
+ else if (cancel.HandleEvents(Event))
+ {
+ gScreenSettings.RestoreBackup();
+ gScreenSettings.SetResolution();
+ gfx.SetInfo();
+ state = STATE_GRAPHICS;
+ }
+ break;
+ default:break;
+ }
+
+ accept.Draw();
+ cancel.Draw();
+ }
+
+ return false;
+}
+
+bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event)
+{
+ if (back.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ Reset();
+ return true;
+ }
+
+ int choice = menu.HandleEvents(Event);
+ if (choice >= 0)
+ {
+ if (choice < 4)
+ for (unsigned i = 0; i < menu.element.size(); ++i)
+ menu.element.at(i).State(i == choice);
+
+ switch (choice)
+ {
+ case 0: state = STATE_GENERAL; break;
+ case 1: state = STATE_GRAPHICS; break;
+ case 2: state = STATE_KEYBOARD; break;
+ case 3: state = STATE_CONTROLLER; break;
+
+ case 4:
+ //Save settings to file
+ pyrodactyl::input::gInput.Save();
+ SaveState();
+ general.CreateBackup();
+ gScreenSettings.CreateBackup();
+ return true;
+
+ case 5:
+ //Revert all changes made to settings and exit
+ pyrodactyl::input::gInput.RestoreBackup();
+ keybind.SetCaption();
+ gScreenSettings.RestoreBackup();
+ general.RestoreBackup();
+
+ SDL_DisplayMode current;
+ if (SDL_GetCurrentDisplayMode(0, ¤t) == 0)
+ {
+ if (gScreenSettings.cur.w != current.w || gScreenSettings.cur.h != current.h)
+ gfx.SetInfo();
+ }
+
+ gScreenSettings.SetResolution();
+ return true;
+ default: break;
+ }
+ }
+
+ return false;
+}
+
+void OptionMenu::InternalEvents()
+{
+ //Since these states can be changed at any time, we just update it regularly
+ gfx.InternalEvents();
+ general.InternalEvents();
+
+ if (state == STATE_CONFIRM && timer.TargetReached())
+ {
+ gScreenSettings.RestoreBackup();
+ gScreenSettings.SetResolution();
+ gfx.SetInfo();
+ state = STATE_GRAPHICS;
+ }
+}
+
+void OptionMenu::SaveState()
+{
+ rapidxml::xml_document<char> doc;
+
+ // xml declaration
+ rapidxml::xml_node<char> *decl = doc.allocate_node(rapidxml::node_declaration);
+ decl->append_attribute(doc.allocate_attribute("version", "1.0"));
+ decl->append_attribute(doc.allocate_attribute("encoding", "utf-8"));
+ doc.append_node(decl);
+
+ // root node
+ rapidxml::xml_node<char> *root = doc.allocate_node(rapidxml::node_element, "settings");
+ gScreenSettings.SaveState(doc, root);
+ gMusicManager.SaveState(doc, root);
+
+ doc.append_node(root);
+ std::string xml_as_string;
+ rapidxml::print(std::back_inserter(xml_as_string), doc);
+
+ std::string settingpath = gFilePath.appdata;
+ settingpath += "settings.xml";
+
+ std::ofstream save(settingpath, std::ios::out);
+ if (save.is_open())
+ {
+ save << xml_as_string;
+ save.close();
+ }
+
+ doc.clear();
+}
+
+void OptionMenu::SetUI()
+{
+ bg.SetUI();
+ menu.SetUI();
+
+ keybind.SetUI();
+ conbind.SetUI();
+
+ gfx.SetUI();
+ general.SetUI();
+
+ notice_res.SetUI();
+
+ countdown.SetUI();
+ questionbox.SetUI();
+
+ prompt_w.SetUI();
+ prompt_h.SetUI();
+
+ accept.SetUI();
+ cancel.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/OptionMenu.h b/engines/crab/OptionMenu.h
new file mode 100644
index 00000000000..9a40774a176
--- /dev/null
+++ b/engines/crab/OptionMenu.h
@@ -0,0 +1,75 @@
+#pragma once
+
+#include "common_header.h"
+#include "slider.h"
+#include "ImageData.h"
+#include "KeyBindMenu.h"
+#include "StateButton.h"
+#include "ToggleButton.h"
+#include "GfxSettingMenu.h"
+#include "GeneralSettingMenu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class OptionMenu
+ {
+ //What overall state the menu is in
+ enum { STATE_GENERAL, STATE_GRAPHICS, STATE_KEYBOARD, STATE_CONTROLLER, STATE_ENTER_W, STATE_ENTER_H, STATE_CONFIRM } state;
+
+ //The overall menu for switching between states
+ //The second last button is save, the last button is cancel
+ Menu<StateButton> menu;
+
+ //The background image
+ ImageData bg;
+
+ //The graphical settings menu
+ GfxSettingMenu gfx;
+
+ //The general settings menu
+ GeneralSettingMenu general;
+
+ //Keyboard controls menu
+ KeyBindMenu keybind;
+
+ //The controller controls are just drawn in a single image, no reassign options
+ ImageData conbind;
+
+ //The UI for accepting/rejecting change in resolution
+ HoverInfo notice_res;
+ ImageData questionbox;
+ Button accept, cancel;
+
+ //If the user wants to input a custom resolution, these are used along with the question box
+ TextArea prompt_w, prompt_h;
+
+ //The countdown until the timer resets
+ TextData countdown;
+ Timer timer;
+
+ //Function to draw the main menu (controls, settings, save, cancel)
+ bool HandleTabs(Button &back, const SDL_Event &Event);
+
+ public:
+ bool loaded;
+
+ OptionMenu(void){ loaded = false; state = STATE_GENERAL; menu.UseKeyboard(true); }
+ ~OptionMenu(void){}
+
+ void Reset();
+ bool DisableHotkeys() { return keybind.DisableHotkeys(); }
+
+ void Load(const std::string &filename);
+ void Draw(Button &back);
+ bool HandleEvents(Button &back, const SDL_Event &Event);
+ void InternalEvents();
+
+ void SetUI();
+ void SaveState();
+ };
+
+ extern OptionMenu gOptionMenu;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/OptionSelect.cpp b/engines/crab/OptionSelect.cpp
new file mode 100644
index 00000000000..220fe09fa9a
--- /dev/null
+++ b/engines/crab/OptionSelect.cpp
@@ -0,0 +1,70 @@
+#include "stdafx.h"
+
+#include "OptionSelect.h"
+
+using namespace pyrodactyl::text;
+using namespace pyrodactyl::ui;
+
+void OptionSelect::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid(node))
+ {
+ option.data.Load(node);
+ prev.Load(node->first_node("prev"));
+ next.Load(node->first_node("next"));
+ cur = 0;
+
+ option.text.clear();
+ for (auto n = node->first_node("option"); n != NULL; n = n->next_sibling("option"))
+ {
+ std::string s;
+ LoadStr(s, "name", n);
+ option.text.push_back(s);
+ }
+
+ LoadBool(usekeyboard, "keyboard", node, false);
+ }
+}
+
+void OptionSelect::Draw()
+{
+ option.Draw(cur);
+
+ if (cur > 0)
+ prev.Draw();
+
+ if (cur < option.text.size() - 1)
+ next.Draw();
+}
+
+bool OptionSelect::HandleEvents(const SDL_Event &Event)
+{
+ using namespace pyrodactyl::input;
+
+ if (cur > 0)
+ {
+ if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_LEFT, Event) == SDL_PRESSED))
+ {
+ cur--;
+ return true;
+ }
+ }
+
+ if (cur < option.text.size() - 1)
+ {
+ if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED))
+ {
+ cur++;
+ return true;
+ }
+ }
+
+ return false;
+}
+
+void OptionSelect::SetUI()
+{
+ option.data.SetUI();
+ prev.SetUI();
+ next.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/OptionSelect.h b/engines/crab/OptionSelect.h
new file mode 100644
index 00000000000..7c7b569effc
--- /dev/null
+++ b/engines/crab/OptionSelect.h
@@ -0,0 +1,40 @@
+#pragma once
+#include "common_header.h"
+
+#include "button.h"
+#include "TextData.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class OptionSelect
+ {
+ struct
+ {
+ std::vector<std::string> text;
+ TextData data;
+
+ void Draw(const int &index)
+ {
+ if(index >= 0 && index < text.size())
+ data.Draw(text.at(index));
+ }
+ } option;
+
+ Button prev, next;
+ bool usekeyboard;
+
+ public:
+ int cur;
+
+ OptionSelect() { cur = 0; usekeyboard = false; }
+ void Load(rapidxml::xml_node<char> *node);
+
+ void Draw();
+ bool HandleEvents(const SDL_Event &Event);
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/PageMenu.h b/engines/crab/PageMenu.h
new file mode 100644
index 00000000000..cd70707a775
--- /dev/null
+++ b/engines/crab/PageMenu.h
@@ -0,0 +1,218 @@
+#pragma once
+
+#include "common_header.h"
+#include "menu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ //Sometimes we need multiple pages in a menu, this object does that
+ //Used in save, load, mod and quest menu
+ template <typename T>
+ class PageMenu
+ {
+ //The buttons for cycling between pages of the menu
+ Button prev, next;
+
+ //Each page is stored separately in a menu object
+ std::vector<Menu<T>> menu;
+
+ //Keep track of which page we are at, and how many elements we keep in a page
+ unsigned int current_page, elements_per_page, rows, cols;
+
+ //The image used for the elements
+ Button ref;
+
+ //This vector stores the increments in x,y for each new button
+ Vector2i inc;
+
+ //Display "Page 1 of 3" style information for the menu
+ TextData status;
+ std::string info;
+
+ public:
+ PageMenu(){ current_page = 0; elements_per_page = 1; rows = 1; cols = 1; Clear(); }
+ ~PageMenu(){}
+
+ void Reset()
+ {
+ for (auto m = menu.begin(); m != menu.end(); ++m)
+ m->Reset();
+ }
+
+ void Clear()
+ {
+ menu.resize(1);
+ menu.at(0).Clear();
+ menu.at(0).UseKeyboard(true);
+ }
+
+ //Get the elements per page
+ unsigned int ElementsPerPage() { return elements_per_page; }
+
+ //This is added to the result from HandleEvents to calculate the exact position
+ unsigned int Index() { return current_page * elements_per_page; }
+
+ //The end position of the elements
+ unsigned int IndexPlusOne() { return (current_page + 1) * elements_per_page; }
+
+ //Get the current page of the menu
+ unsigned int CurrentPage() { return current_page; }
+ void CurrentPage(int &val) { current_page = val; }
+
+ //Get the index of the hovered element in the menu
+ const int HoverIndex()
+ {
+ if (menu.at(current_page).HoverIndex() >= 0)
+ return (current_page * elements_per_page) + menu.at(current_page).HoverIndex();
+
+ return -1;
+ }
+
+ //Get the base position of the elements
+ const int BaseX(const int &count) { return ref.x + inc.x * (count % cols); }
+ const int BaseY(const int &count) { return ref.y + inc.y * (count / cols); }
+
+ //This is used to get the coordinates of a button
+ const int& CurX(const int& count) { return menu[current_page].element[count].x; }
+ const int& CurY(const int& count) { return menu[current_page].element[count].y; }
+
+ void Image(const int &slot, const int &page, ButtonImage &bi) { menu.at(page).element.at(slot).Img(bi); }
+
+ void AssignPaths()
+ {
+ for (auto m = menu.begin(); m != menu.end(); ++m)
+ m->AssignPaths();
+ }
+
+ void UseKeyboard(const bool &val)
+ {
+ for (auto m = menu.begin(); m != menu.end(); ++m)
+ m->UseKeyboard(val);
+ }
+
+ void SetUI()
+ {
+ prev.SetUI();
+ next.SetUI();
+ ref.SetUI();
+ status.SetUI();
+
+ for (auto m = menu.begin(); m != menu.end(); ++m)
+ m->SetUI();
+ }
+
+ void UpdateInfo() { info = NumberToString(current_page + 1) + " of " + NumberToString(menu.size()); }
+
+ void Load(rapidxml::xml_node<char> *node)
+ {
+ using namespace pyrodactyl::input;
+ if (NodeValid(node))
+ {
+ if (NodeValid("prev", node))
+ {
+ prev.Load(node->first_node("prev"));
+ prev.hotkey.Set(IU_PREV);
+ }
+
+ if (NodeValid("next", node))
+ {
+ next.Load(node->first_node("next"));
+ next.hotkey.Set(IU_NEXT);
+ }
+
+ if (NodeValid("reference", node))
+ ref.Load(node->first_node("reference"));
+
+ if (NodeValid("inc", node))
+ inc.Load(node->first_node("inc"));
+
+ if (NodeValid("status", node))
+ status.Load(node->first_node("status"));
+
+ if (NodeValid("dim", node))
+ {
+ rapidxml::xml_node<char> *dimnode = node->first_node("dim");
+ LoadNum(rows, "rows", dimnode);
+ LoadNum(cols, "cols", dimnode);
+ elements_per_page = rows * cols;
+ }
+ }
+ }
+
+ void Add(unsigned int &slot, unsigned int &page)
+ {
+ if (slot >= elements_per_page)
+ {
+ ++page;
+ slot = 0;
+ menu.resize(page + 1);
+ menu.at(page).UseKeyboard(true);
+ }
+
+ T b;
+ b.Init(ref, inc.x*(slot%cols), inc.y*(slot / cols));
+ menu[page].element.push_back(b);
+ ++slot;
+
+ AssignPaths();
+ UpdateInfo();
+ }
+
+ void Add()
+ {
+ unsigned int page = menu.size() - 1;
+ unsigned int slot = menu.at(page).element.size();
+ Add(slot, page);
+ }
+
+ void Erase()
+ {
+ unsigned int page = menu.size() - 1;
+ menu.at(page).element.pop_back();
+ AssignPaths();
+ UpdateInfo();
+ }
+
+ int HandleEvents(const SDL_Event &Event)
+ {
+ using namespace pyrodactyl::input;
+
+ if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ current_page--;
+ UpdateInfo();
+
+ if (current_page < 0)
+ current_page = 0;
+ }
+
+ if (current_page < menu.size() - 1 && next.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ current_page++;
+ UpdateInfo();
+
+ if (current_page >= menu.size())
+ current_page = menu.size() - 1;
+ }
+
+ return menu.at(current_page).HandleEvents(Event);
+ }
+
+ void Draw()
+ {
+ status.Draw(info);
+ menu.at(current_page).Draw();
+
+ if (current_page > 0)
+ prev.Draw();
+
+ if (current_page < menu.size() - 1)
+ next.Draw();
+ }
+ };
+
+ typedef PageMenu<Button> PageButtonMenu;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ParagraphData.cpp b/engines/crab/ParagraphData.cpp
new file mode 100644
index 00000000000..5dee850d0e9
--- /dev/null
+++ b/engines/crab/ParagraphData.cpp
@@ -0,0 +1,17 @@
+#include "stdafx.h"
+#include "ParagraphData.h"
+
+using namespace pyrodactyl::ui;
+
+bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo)
+{
+ if (NodeValid("line", node))
+ line.Load(node->first_node("line"));
+
+ return TextData::Load(node, parent, echo);
+}
+
+void ParagraphData::Draw(const std::string &val, const int &XOffset, const int &YOffset)
+{
+ pyrodactyl::text::gTextManager.Draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
+}
\ No newline at end of file
diff --git a/engines/crab/ParagraphData.h b/engines/crab/ParagraphData.h
new file mode 100644
index 00000000000..0e5812e13df
--- /dev/null
+++ b/engines/crab/ParagraphData.h
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "common_header.h"
+#include "TextData.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class ParagraphData : public TextData
+ {
+ public:
+ Vector2i line;
+
+ ParagraphData() : line(1, 1){}
+ ~ParagraphData(){}
+
+ bool Load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
+
+ void Draw(const std::string &val, const int &XOffset = 0, const int &YOffset = 0);
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
new file mode 100644
index 00000000000..9fb944ba7f1
--- /dev/null
+++ b/engines/crab/PathfindingAgent.cpp
@@ -0,0 +1,346 @@
+#include "stdafx.h"
+#include "PathfindingAgent.h"
+
+PathfindingAgent::PathfindingAgent(void) : nodeQueue(compareNodes)
+{
+ grid = NULL;
+
+ destinationSet = false;
+ destinationReachable = false;
+ nodeBufferDistance = 1.0f;
+ solutionFound = noSolution = false;
+
+ m_pStartTile = nullptr;
+ m_pGoalTile = nullptr;
+ m_pClickedTile = nullptr;
+}
+
+PathfindingAgent::~PathfindingAgent(void)
+{
+}
+
+void PathfindingAgent::initialize(PathfindingGrid* g)
+{
+ grid = g;
+
+ nodeBufferDistance = grid->GetCellSize().x / 2.0f;
+
+ nodeBufferDistance *= nodeBufferDistance;
+}
+
+void PathfindingAgent::SetDestination(Vector2i d, bool r)
+{
+ Vector2f iVec = Vector2f((float)d.x, (float)d.y);
+
+ SetDestination(iVec, r);
+}
+
+void PathfindingAgent::SetDestination(Vector2i d)
+{
+ SetDestination(d, true);
+}
+
+void PathfindingAgent::SetDestination(Vector2f d)
+{
+ SetDestination(d, true);
+}
+
+void PathfindingAgent::SetDestination(Vector2f d, bool r)
+{
+ if (grid == NULL)
+ return;
+
+ destination = d;
+
+ //TODO: This could be optimized to cache the route somehow... (SZ)
+ exit();
+
+ m_pStartTile = grid->GetNodeAtPoint(position);
+ //m_pGoalTile = grid->GetNodeAtPoint(d);
+
+ //I am now tracking the goal node and the clicked tile separately to solve problems
+ //with hangups and trying to reach un-reachable destinations.
+ m_pClickedTile = grid->GetNodeAtPoint(d);
+ m_pGoalTile = grid->GetNearestOpenNode(d, position);
+
+ PlannerNode* startingNode = new PlannerNode();
+ startingNode->SetLocation(m_pStartTile);
+ startingNode->SetHCost((position - destination).Magnitude());
+ startingNode->SetFinalCost((position - destination).Magnitude());
+ startingNode->SetGivenCost(0.0);
+
+ nodeQueue.push(startingNode);
+ m_mCreatedList[m_pStartTile] = (startingNode);
+
+ destinationSet = true;
+ solutionFound = noSolution = false;
+
+ destinationReachable = r;
+}
+
+void PathfindingAgent::Update(long timeslice)
+{
+ long prevTime = SDL_GetTicks();
+ long time = timeslice;
+
+ double dTempCost;
+
+ if (solutionFound)
+ {
+ if (m_vSolution.size() > 0)
+ {
+ float distSqr = (position - m_vSolution.back()->GetPosition()).MagSqr();
+ if (distSqr < nodeBufferDistance) //Have to find the right deadzone buffer
+ {
+ m_vSolution.pop_back();
+ }
+ }
+ if (m_vSolution.size() > 0)
+ {
+ immediateDest = Vector2i(m_vSolution.back()->GetPosition().x, m_vSolution.back()->GetPosition().y);
+ }
+ else
+ {
+ if (destinationReachable)
+ immediateDest = Vector2i((int)destination.x, (int)destination.y);
+ else
+ immediateDest = Vector2i((int)position.x, (int)position.y);
+ }
+
+ return;
+ }
+
+ //No nodes, no pathing.
+ if (nodeQueue.empty())
+ {
+ return;
+ }
+
+ std::map<PathfindingGraphNode*, PlannerNode*>::iterator currentIter;
+
+ do
+ {
+ PlannerNode* current = nodeQueue.front();
+ nodeQueue.pop();
+
+ if (current->GetLocation() == m_pGoalTile)
+ //|| //We're done.
+ {
+ //m_vSolution = getSolution();
+ m_vSolution = getPrunedSolution(NULL);
+ solutionFound = true;
+ return;
+ }
+ else if (current->GetLocation()->GetMovementCost() > 0 && current->GetLocation()->AdjacentToNode(m_pClickedTile) && m_pClickedTile->GetMovementCost() < 0)
+ {
+ m_vSolution = getPrunedSolution(current->GetLocation());
+ solutionFound = true;
+ return;
+ }
+
+ //PathfindingGraphNode* _checkTile;
+
+ //Find the successors
+ //for(int x = -1; x < 2; ++x)
+ //{
+ // for(int y = -1; y < 2; ++y)
+ // {
+ std::vector<PathfindingGraphNode*>::iterator i;
+
+ for (i = current->location->neighborNodes.begin(); i != current->location->neighborNodes.end(); ++i)
+ {
+ //Get the new tile to check
+ //_checkTile = m_pTileMap->getTile(current->GetLocation()->getRow() + x, current->GetLocation()->getColumn() + y);
+
+ if ((*i)->GetMovementCost() > 0)
+ {
+ //Compute the temp given cost
+ dTempCost = current->GetGivenCost() + ((*i)->GetMovementCost() * distExact((*i), current->GetLocation()));
+
+ //If it's a duplicate...
+ currentIter = m_mCreatedList.find((*i));
+ if (currentIter != m_mCreatedList.end())
+ {
+ if (dTempCost < currentIter->second->GetGivenCost())
+ {
+ //If the current planner node has already been added, but the current path is cheaper,
+ //replace it.
+
+ nodeQueue.remove(currentIter->second);
+
+ currentIter->second->SetGivenCost(dTempCost);
+ currentIter->second->SetFinalCost(
+ currentIter->second->GetHCost() * 1.1 +
+ currentIter->second->GetGivenCost());
+
+ currentIter->second->SetParent(current);
+
+ nodeQueue.push(currentIter->second);
+ }
+ }
+
+ //Otherwise...
+ else
+ {
+ PlannerNode* successor = new PlannerNode();
+ successor->SetLocation((*i));
+
+ //Set the new heuristic (distance from node to the goal)
+ successor->SetHCost(distExact((*i), m_pGoalTile));
+ successor->SetGivenCost(dTempCost);
+ //Final cost is the distance to goal (scaled by 10%) plus the distance of the path.
+ successor->SetFinalCost(successor->GetHCost() * 1.1 + successor->GetGivenCost());
+
+ successor->SetParent(current);
+
+ m_mCreatedList[(*i)] = (successor);
+ nodeQueue.push(successor); //When the node is pushed onto the PriorityQueue it ends up beings sorted cheapest -> most expensive
+ }
+ }
+ }
+ // }
+ //}
+
+ //Update the time
+ if (timeslice != 0)
+ {
+ time -= (SDL_GetTicks() - prevTime);
+ prevTime = SDL_GetTicks();
+ }
+ } while (!isDone() && (time >= 0 || timeslice == 0));
+
+ noSolution = true; //You can't get there from here (SZ)
+}
+
+bool PathfindingAgent::isDone() const
+{
+ if (nodeQueue.empty())
+ return true;
+
+ return false;
+}
+
+//Clear everything.
+void PathfindingAgent::exit()
+{
+ std::map<PathfindingGraphNode*, PlannerNode*>::iterator iter;
+ if (!m_mCreatedList.empty())
+ {
+ for (iter = m_mCreatedList.begin(); iter != m_mCreatedList.end(); ++iter)
+ {
+ delete (*iter).second;
+ }
+ }
+
+ nodeQueue.clear();
+ m_mCreatedList.clear();
+ m_vSolution.clear();
+
+ solutionFound = false;
+
+ m_pGoalTile = NULL;
+ m_pStartTile = NULL;
+}
+
+void PathfindingAgent::shutdown()
+{
+ exit();
+
+ grid = NULL;
+}
+
+std::vector<PathfindingGraphNode const*> const PathfindingAgent::getSolution(PathfindingGraphNode* destNode) const
+{
+ std::vector<PathfindingGraphNode const*> temp;
+
+ PlannerNode* current = NULL;
+
+ if (m_mCreatedList.find(m_pGoalTile) != m_mCreatedList.end())
+ {
+ current = m_mCreatedList.find(m_pGoalTile)->second;
+ }
+
+ //If the dest node passed in is not null, that means we did not reach the goal but came close
+ //so we should start with that node instead when we are constructing our path
+ else if (destNode != NULL)
+ {
+ current = m_mCreatedList.find(destNode)->second;
+ }
+
+ //Iterate through the planner nodes to create a vector to return.
+ while (current)
+ {
+ if (current->GetLocation() != m_pStartTile)
+ {
+ //You don't have to path to the start
+ if (current->GetLocation() != m_pStartTile)
+ temp.push_back(current->GetLocation());
+ }
+
+ current = current->GetParent();
+ }
+
+ return temp;
+}
+
+std::vector<PathfindingGraphNode const*> const PathfindingAgent::getPrunedSolution(PathfindingGraphNode* destNode)
+{
+ std::vector<PathfindingGraphNode const*> temp = getSolution(destNode);
+
+ std::vector<PathfindingGraphNode const*> returnVec = temp;
+
+ //Any node that is not adjacent to an obstacle or an obstacle corner can be removed.
+ for (int i = 0; i < temp.size(); ++i)
+ {
+ if (!temp[i]->AdjacentToObstacle())
+ {
+ if (i > 0 && i < temp.size() - 1)
+ {
+ //This check to see if the node is a "corner" to an obstacle that should not be pruned
+ //to prevent hanging on corners.
+ std::vector<PathfindingGraphNode*> corners = grid->CornerCheck(temp[i - 1], temp[i + 1]);
+
+ if (corners.size() == 0)
+ {
+ std::vector<PathfindingGraphNode const*>::iterator theEnd = std::remove(returnVec.begin(), returnVec.end(), temp[i]);
+ returnVec.erase(theEnd);
+ }
+ }
+ }
+ }
+
+ return returnVec;
+}
+
+double PathfindingAgent::distSquared(PathfindingGraphNode* tileA, PathfindingGraphNode* tileB)
+{
+ Vector2f vecTo = tileA->GetPosition() - tileB->GetPosition();
+
+ return vecTo.MagSqr();
+}
+
+double PathfindingAgent::distExact(PathfindingGraphNode* tileA, PathfindingGraphNode* tileB)
+{
+ Vector2f vecTo = tileA->GetPosition() - tileB->GetPosition();
+
+ return vecTo.Magnitude();
+}
+
+//This keeps the PriorityQueue organized based on the cost of the paths.
+bool compareNodes(PlannerNode const* nodeA, PlannerNode const* nodeB)
+{
+ return nodeA->GetFinalCost() > nodeB->GetFinalCost();
+}
+
+bool PathfindingAgent::AdjacentToGoal(PathfindingGraphNode* node)
+{
+ for (auto iter : node->neighborNodes)
+ {
+ if (iter == m_pGoalTile)
+ {
+ return true;
+ }
+ }
+
+ return false;
+}
\ No newline at end of file
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
new file mode 100644
index 00000000000..cc961b5d9d6
--- /dev/null
+++ b/engines/crab/PathfindingAgent.h
@@ -0,0 +1,128 @@
+#pragma once
+
+#include "PathfindingGrid.h"
+#include "PriorityQueue.h"
+#include "vectors.h"
+
+//This class represents the actual pathfinding and following agent that utilizes
+//the pathfinding grid
+class PlannerNode
+{
+ PlannerNode* parent;
+ PlannerNode* child;
+
+ double cost; //Heuristic cost equivalent to cost to reach goal from planner node's position.
+ double finalCost; //Final cost of route through the planner node. Used to determine optimal path.
+ double givenCost; //The current distance of the route.
+
+public:
+ PathfindingGraphNode* location;
+
+ PlannerNode(){ location = NULL; parent = NULL; child = NULL; cost = 0; finalCost = 0; givenCost = 0; }
+ ~PlannerNode(){}
+
+ PathfindingGraphNode* GetLocation(void) { return location; }
+ PlannerNode* GetParent(void) { return parent; }
+ PlannerNode* GetChild(void) { return child; }
+ double GetHCost(void) const { return cost; }
+ double GetFinalCost(void) const { return finalCost; }
+ double GetGivenCost(void) const { return givenCost; }
+
+ void SetLocation(PathfindingGraphNode* loc) { location = loc; }
+ void SetParent(PlannerNode* p) { parent = p; }
+ void SetChild(PlannerNode* c) { child = c; }
+ void SetHCost(double c) { cost = c; }
+ void SetFinalCost(double cost) { finalCost = cost; }
+ void SetGivenCost(double cost) { givenCost = cost; }
+};
+
+class PathfindingAgent
+{
+ Vector2f position;
+ Vector2f prevPosition; //Used to determine that we are making progress toward the goal
+ Vector2i immediateDest; //The next stop on the AI's path
+
+ bool destinationSet; //Was a destination specified.
+ bool destinationReachable; //Can the agent actually get to the destination?
+
+ float nodeBufferDistance; //How much leeway is there for reaching the destination
+
+public:
+ PathfindingAgent();
+ ~PathfindingAgent();
+
+ PathfindingGrid* grid;
+
+ Vector2f destination;
+
+ PathfindingGraphNode* m_pStartTile; //The system originally used tiles, but this one uses discreet points.
+ PathfindingGraphNode* m_pGoalTile; //The tile we are trying to reach. May not be the tile that was clicked if the clicked tile is blocked.
+ PathfindingGraphNode* m_pClickedTile; //The tile that was clicked. If it is open, it will be the goal node.
+
+ bool solutionFound;
+ bool noSolution;
+
+ std::vector<PathfindingGraphNode const*> m_vSolution;
+
+ void SetNodeBufferDistance(float w){ nodeBufferDistance = w; }
+ float GetNodeBufferDistance(){ return nodeBufferDistance; }
+
+ //Added for Greedy search
+ double distSquared(PathfindingGraphNode* tileA, PathfindingGraphNode* tileB);
+ //Added for A* search
+ double distExact(PathfindingGraphNode* tileA, PathfindingGraphNode* tileB);
+
+ PriorityQueue<PlannerNode> nodeQueue;
+
+ std::map<PathfindingGraphNode*, PlannerNode*> m_mCreatedList;
+
+ //void SetSprite(pyrodactyl::anim::Sprite* s){entitySprite = s;}
+
+ //! \brief Sets the tile map.
+ //!
+ //! Invoked when the user opens a tile map file.
+ //!
+ //! \param _tileMap the data structure that this algorithm will use
+ //! to access each tile's location and weight data.
+ void initialize(PathfindingGrid* g);
+
+ void SetDestination(Vector2f d);
+ void SetDestination(Vector2f d, bool r);
+ void SetDestination(Vector2i d);
+ void SetDestination(Vector2i d, bool r);
+
+ void SetPosition(Vector2f p){ position = p; }
+ void SetPrevPosition(Vector2f p){ prevPosition = p; }
+ Vector2f GetPosition(){ return position; }
+
+ bool PositionChanged(){ return position != prevPosition; }
+
+ Vector2i GetImmediateDest(){ return immediateDest; }
+
+ //! \brief Performs the main part of the algorithm until the specified time has elapsed or
+ //! no nodes are left open.
+ void Update(long timeslice);
+
+ //! \brief Returns <code>true</code> if and only if no nodes are left open.
+ //!
+ //! \return <code>true</code> if no nodes are left open, <code>false</code> otherwise.
+ bool isDone() const;
+
+ //! \brief Returns an unmodifiable view of the solution path found by this algorithm.
+ std::vector<PathfindingGraphNode const*> const getSolution(PathfindingGraphNode* destNode) const;
+
+ //Get the solution removing any nodes that are completely surrounded by open space.
+ //This will result in a more linear path to the goal.
+ std::vector<PathfindingGraphNode const*> const getPrunedSolution(PathfindingGraphNode* destNode);
+
+ //! \brief Resets the algorithm.
+ void exit();
+
+ //! \brief Uninitializes the algorithm before the tile map is unloaded.
+ void shutdown();
+
+ //Returns true if the node connects to the goal node
+ bool AdjacentToGoal(PathfindingGraphNode* node);
+};
+
+bool compareNodes(PlannerNode const* nodeA, PlannerNode const* nodeB);
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
new file mode 100644
index 00000000000..5bcbe1ff124
--- /dev/null
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -0,0 +1,81 @@
+#include "stdafx.h"
+#include "PathfindingGraphNode.h"
+
+PathfindingGraphNode::PathfindingGraphNode(void)
+{
+ id = -1;
+ movementCost = -1.0f;
+}
+
+PathfindingGraphNode::PathfindingGraphNode(Vector2f pos, int i) : position(pos)
+{
+ id = i;
+ movementCost = -1.0f;
+}
+
+PathfindingGraphNode::~PathfindingGraphNode(void)
+{
+}
+
+void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode* node)
+{
+ AddNeighbor(node, false);
+}
+
+void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode* node, bool ignoreDistance)
+{
+ //You can't be your own neighbor. Sorry.
+ if (node->id == this->id)
+ return;
+
+ //Make sure that the node is not already a neighbor (SZ)
+ for (int i = 0; i < neighborNodes.size(); ++i)
+ {
+ if (neighborNodes[i]->id == node->id)
+ {
+ return;
+ }
+ }
+
+ neighborNodes.push_back(node);
+
+ //Determine the cost.
+ if (ignoreDistance)
+ {
+ neighborCosts.push_back(node->movementCost);
+ }
+ else
+ {
+ Vector2f distVec = node->position - this->position;
+
+ neighborCosts.push_back(distVec.Magnitude() * node->movementCost);
+ }
+}
+
+bool PathfindingGraphNode::AdjacentToObstacle() const
+{
+ for (auto iter = neighborNodes.begin(); iter != neighborNodes.end(); ++iter)
+ {
+ if ((*iter)->GetMovementCost() < 0)
+ return true;
+ }
+
+ return false;
+}
+
+bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode* otherNode)
+{
+ for (int i = 0; i < neighborNodes.size(); ++i)
+ {
+ if (neighborNodes[i] == otherNode)
+ return true;
+ }
+
+ return false;
+}
+
+//
+//const std::vector< PathfindingGraphNode*>& PathfindingGraphNode::GetNeighbors() const
+//{
+// return neighborNodes;
+//}
\ No newline at end of file
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
new file mode 100644
index 00000000000..d8db10ea089
--- /dev/null
+++ b/engines/crab/PathfindingGraphNode.h
@@ -0,0 +1,52 @@
+#pragma once
+
+#include "vectors.h"
+#include "Rectangle.h"
+
+//This is the basic pathfinding node that will construct the pathfinding graph. (SZ)
+//Although Unrest is using a square grid based pathfinding map, this is made to be a general use pathfinding node.
+class PathfindingGraphNode
+{
+ friend class PathfindingGrid;
+
+ int id; //Each ID will be assigned when the pathfinding graph is generated and will identify each node.
+
+ float movementCost; //1 is open terrain, >1 is impeding terrain, <0 is completely obstructed
+
+ Vector2f position; //Position of the node
+
+ Rect collisionRect; //Represents spaced covered by the node.
+
+public:
+
+ std::vector<PathfindingGraphNode*> neighborNodes;
+ std::vector<float> neighborCosts; //The movement cost for the neighbor nodes (distance to the node X the nodes movement cost)
+ //This is stored to prevent having to recalculate each frame.
+
+ PathfindingGraphNode(void);
+ PathfindingGraphNode(Vector2f pos, int i);
+
+ ~PathfindingGraphNode(void);
+
+ float GetMovementCost(){return movementCost;}
+ Vector2f GetPosition() const {return position;}
+
+ //Adds node to neighbor vector and cost to neighbor costs
+ void AddNeighbor( PathfindingGraphNode* node);
+
+ //Same as above, but does not calculate distance. Used when all nodes
+ //are equidistant
+ void AddNeighbor( PathfindingGraphNode* node, bool ignoreDistance);
+
+ //const std::vector< PathfindingGraphNode*>& GetNeighbors() const;
+
+ Rect GetRect() const {return collisionRect;}
+
+ //Return true if the node is adjacent to a blocked node
+ bool AdjacentToObstacle() const;
+
+ //Return true if the node is adjacent to the otherNode
+ bool AdjacentToNode(PathfindingGraphNode* otherNode);
+
+};
+
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
new file mode 100644
index 00000000000..695bc9a77d5
--- /dev/null
+++ b/engines/crab/PathfindingGrid.cpp
@@ -0,0 +1,259 @@
+#include "stdafx.h"
+#include "PathfindingGrid.h"
+#include "TMXMap.h"
+
+using namespace TMX;
+
+PathfindingGrid::PathfindingGrid(void)
+{
+ blockedCost = BLOCKED;
+ openCost = OPEN;
+ stairsCost = STAIRS;
+ nodes = nullptr;
+}
+
+PathfindingGrid::~PathfindingGrid(void)
+{
+ for (int x = 0; x < dimensions.x; ++x)
+ {
+ delete[] nodes[x];
+ }
+
+ delete nodes;
+}
+
+void PathfindingGrid::SetupNodes(TMXMap map)
+{
+ dimensions.x = map.path_rows; //Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
+ dimensions.y = map.path_cols;
+
+ cellSize.x = (float)map.path_size.x;
+ cellSize.y = (float)map.path_size.y;
+
+ //Check to see if the costs have been loaded from the level file.
+ //If not, assign to defaults.
+ if (map.movementCosts.no_walk != 0)
+ {
+ blockedCost = map.movementCosts.no_walk;
+ }
+ if (map.movementCosts.open != 0)
+ {
+ openCost = map.movementCosts.open;
+ }
+ if (map.movementCosts.stairs != 0)
+ {
+ stairsCost = map.movementCosts.stairs;
+ }
+
+ nodes = new PathfindingGraphNode*[dimensions.x];
+
+ //Allocate some nodes!
+ //TODO: probably want to change this to a one chunk allocation...
+ for (int i = 0; i < dimensions.x; ++i)
+ {
+ nodes[i] = new PathfindingGraphNode[dimensions.y];
+ }
+
+ //Fill up those nodes!
+ int idCounter = 0;
+
+ Vector2f pos = Vector2f(0.0f, 0.0f);
+ Vector2f topLeftPos = pos;
+
+ //Initialize the nodes
+ for (int x = 0; x < dimensions.x; ++x)
+ {
+ for (int y = 0; y < dimensions.y; ++y)
+ {
+ //PathfindingGraphNode* newNode = new PathfindingGraphNode(pos, idCounter++);
+
+ //nodes[x][y] = *newNode;
+ nodes[x][y].collisionRect = Rect(pos.x, pos.y, cellSize.x, cellSize.y);
+
+ nodes[x][y].position.x = pos.x + cellSize.x / 2.0f;
+ nodes[x][y].position.y = pos.y + cellSize.y / 2.0f;
+ nodes[x][y].id = idCounter++;
+
+ nodes[x][y].movementCost = openCost;
+ nodes[x][y].neighborCosts.reserve(4); //since its a square based grid, 4 is the greatest number of costs and nodes possible.
+ nodes[x][y].neighborNodes.reserve(4);
+
+ pos.y += cellSize.y;
+
+ std::vector<Shape> noWalk = map.AreaNoWalk();
+
+ //Check if the square should count as blocked
+ for (auto i = noWalk.begin(); i != noWalk.end(); ++i)
+ {
+ if (i->Collide(nodes[x][y].collisionRect).intersect)
+ {
+ nodes[x][y].movementCost = (float)blockedCost;
+ break;
+ }
+ }
+
+ //Check for stairs if the cell isn't blocked
+ if (nodes[x][y].movementCost >= 0.0f)
+ {
+ std::vector<pyrodactyl::level::Stairs> stairs = map.AreaStairs();
+
+ for (auto i = stairs.begin(); i != stairs.end(); ++i)
+ {
+ if (i->Collide(nodes[x][y].collisionRect).intersect)
+ {
+ nodes[x][y].movementCost = (float)stairsCost;
+ break;
+ }
+ }
+ }
+
+ //More collision checks can be added for the node as long as it checks for the high cost objects first
+ //since the highest cost collider in any given tile would be used for the path cost. (SZ)
+ }
+
+ pos.x += cellSize.x;
+ pos.y = topLeftPos.y;
+ }
+
+ //Connect the nodes
+ for (int x = 0; x < dimensions.x; ++x)
+ {
+ for (int y = 0; y < dimensions.y; ++y)
+ {
+ //Check horizontal
+ if (x < dimensions.x - 1)
+ {
+ ConnectNodes(&nodes[x][y], &nodes[x + 1][y]);
+
+ //Check diagonals
+ //This causes hangups since the collider has a greater width to take into account when traveling
+ //diagonally compared to horizontal or vertical. (SZ)
+ /*if( y < dimensions.y - 2)
+ {
+ ConnectNodes(&nodes[x][y], &nodes[x + 1][y + 1]);
+
+ nodes[x][y].neighborCosts[nodes[x][y].neighborCosts.size() - 1] *= 1.41f;
+ nodes[x + 1][y + 1].movementCost *= 1.41f;
+ }
+
+ if(y > 0)
+ {
+ ConnectNodes(&nodes[x][y], &nodes[x + 1][y - 1]);
+
+ nodes[x][y].neighborCosts[nodes[x][y].neighborCosts.size() - 1] *= 1.41f;
+ nodes[x + 1][y - 1].movementCost *= 1.41f;
+ }*/
+ }
+ //Check vertical
+ if (y < dimensions.y - 1)
+ {
+ ConnectNodes(&nodes[x][y], &nodes[x][y + 1]);
+ }
+ }
+ }
+
+ ////Check for adjacencies
+ ////This could be used if additional weight should be applied to nodes adjacent to blocked nodes.
+ //for(int x = 0; x < dimensions.x; ++x)
+ //{
+ // for(int y = 0; y < dimensions.y; ++y)
+ // {
+ // for(int i = 0; i < nodes[x][y].neighborNodes.size(); ++i)
+ // {
+ // if(nodes[x][y].neighborNodes[i]->movementCost == blockedCost)
+ // {
+ // nodes[x][y].movementCost *= 2.0f;
+ // break;
+ // }
+ // }
+ // }
+ //}
+}
+
+void PathfindingGrid::ConnectNodes(PathfindingGraphNode* node1, PathfindingGraphNode* node2)
+{
+ node1->AddNeighbor(node2, true);
+ node2->AddNeighbor(node1, true);
+}
+
+PathfindingGraphNode* PathfindingGrid::GetNodeAtPoint(Vector2f point)
+{
+ int x = (int)floor(point.x / cellSize.x);
+ int y = (int)floor(point.y / cellSize.y);
+
+ return &nodes[x][y];
+}
+
+std::vector<PathfindingGraphNode*> PathfindingGrid::CornerCheck(const PathfindingGraphNode* node1, const PathfindingGraphNode* node2)
+{
+ std::vector<PathfindingGraphNode*> returnNodes;
+
+ //Iterat through both nodes neighbors. If a blocked neighbor is found that is shared between the two,
+ //It is a corner to them.
+ for (auto iter : node1->neighborNodes)
+ {
+ for (auto iter2 : node2->neighborNodes)
+ {
+ if (iter == iter2 && iter->movementCost < 0)
+ {
+ if (returnNodes.size() == 0 || (*(std::find(returnNodes.begin(), returnNodes.end(), iter))) == NULL)
+ returnNodes.push_back(iter);
+ }
+ }
+ }
+
+ return returnNodes;
+}
+
+PathfindingGraphNode* PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vector2f comparePos)
+{
+ PathfindingGraphNode* startNode = GetNodeAtPoint(nodePos);
+
+ if (startNode->GetMovementCost() > 0) //If the clicked node is open, we're done!
+ return startNode;
+
+ PathfindingGraphNode* returnNode = NULL;
+
+ float shortestDistance = 0.0f;
+
+ std::list<PathfindingGraphNode*> checkNodes;
+ checkNodes.push_back(startNode);
+
+ std::vector<PathfindingGraphNode*> allUsedNodes;
+ allUsedNodes.push_back(startNode);
+
+ //Iterate through the nodes, check if they are open then check their distance from the compare point.
+ while (!checkNodes.empty())
+ {
+ if (checkNodes.front()->GetMovementCost() > 0)
+ {
+ float distance = (comparePos - checkNodes.front()->GetPosition()).MagSqr();
+
+ if (shortestDistance == 0.0f || distance) //If this is the new shortest distance, this becomes the new return.
+ {
+ shortestDistance = distance;
+
+ returnNode = checkNodes.front();
+ }
+ }
+ else
+ {
+ for (int i = 0; i < checkNodes.front()->neighborNodes.size(); ++i)
+ {
+ //If the neighbor hasn't been checked yet, add it to the list to check.
+ if (std::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->neighborNodes[i]) == allUsedNodes.end())
+ {
+ allUsedNodes.push_back(checkNodes.front()->neighborNodes[i]);
+ checkNodes.push_back(checkNodes.front()->neighborNodes[i]);
+ }
+ }
+ }
+
+ if (returnNode != NULL) //If a node has been found, we are done. We don't want to continue iterating through neighbors since it would take us further from the clicked node.
+ return returnNode;
+
+ checkNodes.pop_front();
+ }
+
+ return NULL;
+}
\ No newline at end of file
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
new file mode 100644
index 00000000000..6ed49b0036f
--- /dev/null
+++ b/engines/crab/PathfindingGrid.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#include "common_header.h"
+#include "PathfindingGraphNode.h"
+#include <math.h>
+
+namespace TMX
+{
+ class TMXMap;
+}
+
+//This is the grid of pathfinding nodes that is formed for the level (SZ)
+class PathfindingGrid
+{
+ friend class PathfindingGraphNode;
+
+ PathfindingGraphNode** nodes; //2D array of nodes (size is [dimensions.x][dimensions.y]
+
+ Vector2i dimensions; //rows and columns of nodes.
+ Vector2f cellSize; //size of a cell in width and height
+
+ //Neighbor node1 to node2.
+ void ConnectNodes(PathfindingGraphNode* node1, PathfindingGraphNode* node2);
+
+public:
+
+ //these are the default graph node costs.
+ //they can be overwritten by values stored in the level's file.(SZ)
+ static const int BLOCKED = -1;
+ static const int OPEN = 1;
+ static const int STAIRS = 5;
+
+ //These are the actual data members used to assign costs. (SZ)
+ int blockedCost;
+ int openCost;
+ int stairsCost;
+
+ PathfindingGrid(void);
+ ~PathfindingGrid(void);
+
+ void SetupNodes(TMX::TMXMap map);
+
+ //Return the node at the given point (SZ)
+ PathfindingGraphNode* GetNodeAtPoint(Vector2f point);
+ //Return the node at the given coordinates (SZ)
+ PathfindingGraphNode* GetNodeAtCoords(int x, int y){ return &nodes[x][y]; }
+
+ Vector2i GetDimensions(){ return dimensions; }
+
+ Vector2f GetCellSize(){ return cellSize; }
+
+ //Returns the nearest open node to the compare spot, starting with the given nodePos
+ //and iterating through its neighbors. (SZ)
+ PathfindingGraphNode* GetNearestOpenNode(Vector2f nodePos, Vector2f comparePos);
+
+ //Return true if two nodes share and adjacency to the same blocked node.
+ //Can be used to find corners that shouldn't be cut.
+ std::vector<PathfindingGraphNode*> CornerCheck(const PathfindingGraphNode* node1, const PathfindingGraphNode* node2);
+};
\ No newline at end of file
diff --git a/engines/crab/PauseMenu.cpp b/engines/crab/PauseMenu.cpp
new file mode 100644
index 00000000000..1c263c89db7
--- /dev/null
+++ b/engines/crab/PauseMenu.cpp
@@ -0,0 +1,105 @@
+#include "stdafx.h"
+#include "PauseMenu.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+
+void PauseMenu::Load(rapidxml::xml_node<char> *node)
+{
+ menu.Load(node->first_node("menu"));
+ save.Load(node->first_node("save"));
+
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+}
+
+bool PauseMenu::Draw(Button &back)
+{
+ switch (state)
+ {
+ case STATE_NORMAL:
+ bg.Draw();
+ menu.Draw();
+ break;
+ case STATE_SAVE:
+ save.Draw();
+ back.Draw();
+ break;
+ case STATE_LOAD:
+ gLoadMenu.Draw();
+ back.Draw();
+ break;
+ case STATE_OPTION:
+ gOptionMenu.Draw(back);
+ return true;
+ default:break;
+ }
+
+ return false;
+}
+
+PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back)
+{
+ switch (state)
+ {
+ case STATE_NORMAL:
+ choice = menu.HandleEvents(Event);
+ if (choice == -1)
+ {
+ if (back.hotkey.HandleEvents(Event))
+ return PS_RESUME;
+ }
+ else
+ {
+ switch (choice)
+ {
+ case 0: state = STATE_NORMAL; return PS_RESUME;
+ case 1: state = STATE_SAVE; save.ScanDir(); break;
+ case 2: state = STATE_LOAD; gLoadMenu.ScanDir(); break;
+ case 3: state = STATE_OPTION; break;
+ case 4: return PS_HELP;
+ case 5: return PS_QUIT_MENU;
+ case 6: return PS_QUIT_GAME;
+ default: break;
+ }
+ }
+ break;
+ case STATE_SAVE:
+ if (save.HandleEvents(Event))
+ {
+ state = STATE_NORMAL;
+ return PS_SAVE;
+ }
+ else if (back.HandleEvents(Event) == BUAC_LCLICK && !save.DisableHotkeys())
+ state = STATE_NORMAL;
+ break;
+ case STATE_OPTION:
+ if (gOptionMenu.HandleEvents(back, Event))
+ {
+ gOptionMenu.Reset();
+ state = STATE_NORMAL;
+ }
+ break;
+ case STATE_LOAD:
+ if (gLoadMenu.HandleEvents(Event))
+ return PS_LOAD;
+ else if (back.HandleEvents(Event) == BUAC_LCLICK)
+ state = STATE_NORMAL;
+ break;
+ default:break;
+ }
+
+ return PS_NONE;
+}
+
+bool PauseMenu::DisableHotkeys()
+{
+ return (state == STATE_SAVE && save.DisableHotkeys()) || (state == STATE_OPTION && gOptionMenu.DisableHotkeys());
+}
+
+void PauseMenu::SetUI()
+{
+ bg.SetUI();
+ menu.SetUI();
+ save.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/PauseMenu.h b/engines/crab/PauseMenu.h
new file mode 100644
index 00000000000..cf8a887b214
--- /dev/null
+++ b/engines/crab/PauseMenu.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#include "common_header.h"
+#include "menu.h"
+#include "slider.h"
+#include "textarea.h"
+#include "FileMenu.h"
+#include "OptionMenu.h"
+#include "SlideShow.h"
+#include "GameEventInfo.h"
+#include "SaveGameMenu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ enum PauseSignal { PS_NONE, PS_RESUME, PS_SAVE, PS_LOAD, PS_HELP, PS_QUIT_MENU, PS_QUIT_GAME };
+
+ class PauseMenu
+ {
+ enum PauseState { STATE_NORMAL, STATE_SAVE, STATE_OPTION, STATE_LOAD } state;
+
+ //The pause menu background
+ ImageData bg;
+
+ //The buttons in the menu
+ ButtonMenu menu;
+
+ //Save game menu
+ GameSaveMenu save;
+
+ //The selected main menu button
+ int choice;
+
+ public:
+ PauseMenu(void){ state = STATE_NORMAL; choice = -1; }
+ ~PauseMenu(void){}
+
+ void UpdateMode(const bool &ironman){ menu.element.at(PS_SAVE - 1).visible = !ironman; menu.element.at(PS_LOAD - 1).visible = !ironman; }
+
+ void Load(rapidxml::xml_node<char> *node);
+ PauseSignal HandleEvents(const SDL_Event &Event, Button &back);
+
+ //Returns true if inside options menu, false otherwise
+ bool Draw(Button &back);
+
+ void Reset() { state = STATE_NORMAL; }
+ void ScanDir() { save.ScanDir(); }
+ std::string SaveFile() { return save.SelectedPath(); }
+ bool DisableHotkeys();
+
+ //Should we allow the pause key(default escape) to quit to main menu?
+ //This is done because esc is both the "go back on menu level" and the pause key
+ bool ShowLevel() { return state == STATE_NORMAL; }
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/PersonHandler.cpp b/engines/crab/PersonHandler.cpp
new file mode 100644
index 00000000000..02edebd2f91
--- /dev/null
+++ b/engines/crab/PersonHandler.cpp
@@ -0,0 +1,152 @@
+#include "stdafx.h"
+#include "PersonHandler.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::text;
+using namespace pyrodactyl::image;
+using namespace pyrodactyl::people;
+
+void PersonHandler::Load(rapidxml::xml_node<char> *node)
+{
+ if (NodeValid("dialog", node))
+ dlbox.Load(node->first_node("dialog"));
+
+ if (NodeValid("opinion", node))
+ {
+ rapidxml::xml_node<char> *opnode = node->first_node("opinion");
+
+ if (NodeValid("friendship", opnode))
+ opinion[OPI_LIKE].Load(opnode->first_node("friendship"));
+
+ if (NodeValid("respect", opnode))
+ opinion[OPI_RESPECT].Load(opnode->first_node("respect"));
+
+ if (NodeValid("fear", opnode))
+ opinion[OPI_FEAR].Load(opnode->first_node("fear"));
+ }
+
+ if (NodeValid("image", node))
+ {
+ rapidxml::xml_node<char> *imgnode = node->first_node("image");
+ img.Load(imgnode);
+
+ if (NodeValid("sprite_align", imgnode))
+ sprite_align.Load(imgnode->first_node("sprite_align"));
+ }
+
+ if (NodeValid("name", node))
+ name.Load(node->first_node("name"));
+
+ if (NodeValid("journal", node))
+ jb.Load(node->first_node("journal"));
+}
+
+void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const std::string &person_id,
+ const bool &player, pyrodactyl::anim::Sprite *s)
+{
+ //Draw the dialog box background
+ dlbox.Draw(player);
+
+ if (s != NULL)
+ {
+ Rect r = s->DialogClip(Event->state);
+ int x = img.x, y = img.y;
+
+ if (sprite_align.x == ALIGN_CENTER) x -= r.w / 2;
+ else if (sprite_align.x == ALIGN_RIGHT) x -= r.w;
+
+ if (sprite_align.y == ALIGN_CENTER) y -= r.h / 2;
+ else if (sprite_align.y == ALIGN_RIGHT) y -= r.h;
+
+ gImageManager.Draw(x, y, s->Img(), &r);
+ }
+
+ if (info.PersonValid(person_id))
+ {
+ name.Draw(info.PersonGet(person_id).name);
+
+ if (!player)
+ {
+ opinion[OPI_LIKE].Draw(info.PersonGet(person_id).opinion.val[OPI_LIKE], OPINION_MAX);
+ opinion[OPI_RESPECT].Draw(info.PersonGet(person_id).opinion.val[OPI_RESPECT], OPINION_MAX);
+ opinion[OPI_FEAR].Draw(info.PersonGet(person_id).opinion.val[OPI_FEAR], OPINION_MAX);
+ }
+ }
+
+ //Draw the journal button
+ jb.Draw();
+
+ //Draw the dialog box text
+ dlbox.Draw(info, Event->dialog);
+}
+
+bool PersonHandler::HandleCommonEvents(const SDL_Event &Event)
+{
+ opinion[OPI_LIKE].HandleEvents(Event);
+ opinion[OPI_RESPECT].HandleEvents(Event);
+ opinion[OPI_FEAR].HandleEvents(Event);
+
+ if (jb.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ //User wants to open their journal
+ show_journal = true;
+ return true;
+ }
+
+ return false;
+}
+
+bool PersonHandler::HandleDlboxEvents(const SDL_Event &Event)
+{
+ return dlbox.HandleEvents(Event);
+}
+
+void PersonHandler::InternalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s)
+{
+ if (s != NULL)
+ s->DialogUpdateClip(state);
+}
+
+void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const std::string &id, const pyrodactyl::people::OpinionType &type, const int &val)
+{
+ if (info.PersonValid(id))
+ {
+ //First, get the value of the object's opinion
+ int old = 0;
+ info.OpinionGet(id, type, old);
+
+ //Update the opinion value to the new one
+ info.OpinionChange(id, type, val);
+
+ //Then get the current value of the object's opinion
+ int value = 0;
+ info.OpinionGet(id, type, value);
+
+ //Now, send the new and old value of the object's opinion for drawing the change effect
+ opinion[type].Effect(value, old);
+
+ prev = id;
+ }
+}
+
+void PersonHandler::Reset(const std::string &id)
+{
+ if (prev != id)
+ {
+ using namespace pyrodactyl::people;
+ opinion[OPI_LIKE].Reset();
+ opinion[OPI_RESPECT].Reset();
+ opinion[OPI_FEAR].Reset();
+ }
+}
+
+void PersonHandler::SetUI()
+{
+ img.SetUI();
+ name.SetUI();
+ dlbox.SetUI();
+ jb.SetUI();
+
+ for (auto i = 0; i < pyrodactyl::people::OPI_TOTAL; ++i)
+ opinion[i].SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/PersonHandler.h b/engines/crab/PersonHandler.h
new file mode 100644
index 00000000000..77555cfe701
--- /dev/null
+++ b/engines/crab/PersonHandler.h
@@ -0,0 +1,78 @@
+#pragma once
+
+#include "common_header.h"
+#include "person.h"
+#include "sprite.h"
+#include "dialogbox.h"
+#include "gameevent.h"
+#include "ProgressBar.h"
+#include "GameEventInfo.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class PersonHandler
+ {
+ //The positions of various elements
+ //img = player image position
+ Element img;
+
+ //How the individual sprite clips are drawn
+ struct ImageAnchor
+ {
+ Align x, y;
+
+ ImageAnchor() { x = ALIGN_CENTER; y = ALIGN_RIGHT; }
+
+ void Load(rapidxml::xml_node<char> *node, const bool &echo = true)
+ {
+ LoadAlign(x, node, echo, "align_x");
+ LoadAlign(y, node, echo, "align_y");
+ }
+ } sprite_align;
+
+ //For drawing the name
+ TextData name;
+
+ //The dialog box used to draw dialog
+ pyrodactyl::ui::GameDialogBox dlbox;
+
+ //The three opinion bars
+ pyrodactyl::ui::ProgressBar opinion[pyrodactyl::people::OPI_TOTAL];
+
+ //The button for selecting the journal
+ Button jb;
+
+ //The person id of the changed opinion, we use this to reset bar
+ std::string prev;
+
+ public:
+ //Used by other objects to see if journal needs to be displayed or not
+ bool show_journal;
+
+ PersonHandler(){ show_journal = false; }
+ ~PersonHandler(){}
+
+ void Reset(const std::string &id);
+
+ void Load(rapidxml::xml_node<char> *node);
+
+ //Handle events for the three opinion bars and journal - used in both dialog box and reply events
+ bool HandleCommonEvents(const SDL_Event &Event);
+
+ //Handle events for the dialog box
+ bool HandleDlboxEvents(const SDL_Event &Event);
+
+ void InternalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s);
+
+ void Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const std::string &person_id,
+ const bool &player, pyrodactyl::anim::Sprite *s = nullptr);
+
+ void OpinionChange(pyrodactyl::event::Info &info, const std::string &id,
+ const pyrodactyl::people::OpinionType &type, const int &val);
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/PersonScreen.cpp b/engines/crab/PersonScreen.cpp
new file mode 100644
index 00000000000..69ca1c41089
--- /dev/null
+++ b/engines/crab/PersonScreen.cpp
@@ -0,0 +1,81 @@
+#include "stdafx.h"
+#include "PersonScreen.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::event;
+using namespace pyrodactyl::image;
+using namespace pyrodactyl::people;
+
+void PersonScreen::Load(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("character");
+ if (NodeValid(node))
+ {
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+
+ if (NodeValid("name", node))
+ name.Load(node->first_node("name"));
+
+ if (NodeValid("img", node))
+ img.Load(node->first_node("img"));
+
+ if (NodeValid("menu", node))
+ menu.Load(node->first_node("menu"));
+ }
+ }
+}
+
+void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const SDL_Event &Event)
+{
+ if (info.PersonValid(id))
+ menu.HandleEvents(&info.PersonGet(id), Event);
+ else
+ menu.HandleEvents(nullptr, Event);
+}
+
+void PersonScreen::InternalEvents()
+{
+ if (cur_sp != nullptr)
+ cur_sp->DialogUpdateClip(PST_NORMAL);
+}
+
+void PersonScreen::Draw(pyrodactyl::event::Info &info, const std::string &id)
+{
+ bg.Draw();
+
+ if (info.PersonValid(id))
+ {
+ name.Draw(info.PersonGet(id).name);
+ menu.Draw(&info.PersonGet(id));
+ }
+ else
+ menu.Draw(nullptr);
+
+ if (cur_sp != nullptr)
+ {
+ Rect clip = cur_sp->DialogClip(PST_NORMAL);
+ gImageManager.Draw(img.x, img.y, cur_sp->Img(), &clip);
+ }
+}
+
+void PersonScreen::Cache(Info &info, const std::string &id, pyrodactyl::level::Level &level)
+{
+ cur_sp = level.GetSprite(id);
+
+ if (info.PersonValid(id))
+ menu.Cache(info.PersonGet(id));
+ else
+ menu.Clear();
+}
+
+void PersonScreen::SetUI()
+{
+ bg.SetUI();
+ name.SetUI();
+ img.SetUI();
+ menu.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/PersonScreen.h b/engines/crab/PersonScreen.h
new file mode 100644
index 00000000000..db9dc7e6005
--- /dev/null
+++ b/engines/crab/PersonScreen.h
@@ -0,0 +1,47 @@
+#pragma once
+
+#include "ImageData.h"
+#include "person.h"
+#include "menu.h"
+#include "gameevent.h"
+#include "sprite.h"
+#include "GameEventInfo.h"
+#include "level.h"
+#include "TraitMenu.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class PersonScreen
+ {
+ //The background
+ ImageData bg;
+
+ //The name of the character
+ TextData name;
+
+ //The place where the sprite should be drawn
+ Element img;
+
+ //The buttons for drawing traits
+ TraitMenu menu;
+
+ //Store the current person sprite temporarily
+ pyrodactyl::anim::Sprite *cur_sp;
+
+ public:
+ PersonScreen(){ cur_sp = nullptr; }
+ ~PersonScreen(){}
+
+ void Load(const std::string &filename);
+ void Cache(pyrodactyl::event::Info &info, const std::string &id, pyrodactyl::level::Level &level);
+
+ void HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const SDL_Event &Event);
+ void InternalEvents();
+ void Draw(pyrodactyl::event::Info &info, const std::string &id);
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
new file mode 100644
index 00000000000..18f1db85a92
--- /dev/null
+++ b/engines/crab/Polygon.cpp
@@ -0,0 +1,246 @@
+#include "stdafx.h"
+#include "Polygon.h"
+
+// Calculate the distance between [minA, maxA] and [minB, maxB]
+// The distance will be negative if the intervals overlap
+float IntervalDistance(float minA, float maxA, float minB, float maxB)
+{
+ if (minA < minB) return minB - maxA;
+ return minA - maxB;
+}
+
+void Polygon2D::AddPoint(const Vector2f &ref, const std::string &x, const std::string &y, Vector2f &min, Vector2f &max)
+{
+ Vector2f p;
+ p.x = ref.x + StringToNumber<float>(x);
+ p.y = ref.y + StringToNumber<float>(y);
+
+ if (p.x < min.x) min.x = p.x;
+ if (p.x > max.x) max.x = p.x;
+
+ if (p.y < min.y) min.y = p.y;
+ if (p.y > max.y) max.y = p.y;
+
+ point.push_back(p);
+}
+
+void Polygon2D::Load(rapidxml::xml_node<char> *node, Rect &bounds)
+{
+ Vector2f ref;
+ ref.Load(node);
+
+ //Converting a polygon to an axis aligned bounding box is easy - just record the minimum and maximum values of x and y
+ //for the vertices of the polygon, then minimum = top left corner, max - min = dimensions
+ Vector2f min(std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
+ Vector2f max(-std::numeric_limits<float>::max(), -std::numeric_limits<float>::max());
+
+ point.clear();
+ rapidxml::xml_node<char> *polynode = node->first_node("polygon");
+ if (polynode != NULL)
+ {
+ std::string points, x, y;
+ LoadStr(points, "points", polynode);
+
+ bool comma = false;
+ for (auto i = points.begin(); i != points.end(); ++i)
+ {
+ if (*i == ',') comma = true;
+ else if (*i == ' ')
+ {
+ AddPoint(ref, x, y, min, max);
+ comma = false;
+ x.clear();
+ y.clear();
+ }
+ else if (comma) y.push_back(*i);
+ else x.push_back(*i);
+ }
+
+ AddPoint(ref, x, y, min, max);
+
+ bounds.x = min.x;
+ bounds.y = min.y;
+ bounds.w = max.x - min.x;
+ bounds.h = max.y - min.y;
+ }
+
+ SetEdge();
+}
+
+void Polygon2D::SetEdge()
+{
+ edge.clear();
+ Vector2f p1, p2, res;
+ for (int i = 0; i < point.size(); i++)
+ {
+ p1 = point[i];
+ if (i + 1 >= point.size())
+ p2 = point[0];
+ else
+ p2 = point[i + 1];
+
+ res.x = p2.x - p1.x;
+ res.y = p2.y - p1.y;
+ edge.push_back(res);
+ }
+}
+
+Vector2f Polygon2D::Center() const
+{
+ Vector2f total;
+ for (int i = 0; i < point.size(); i++)
+ {
+ total.x += point[i].x;
+ total.y += point[i].y;
+ }
+
+ Vector2f ret;
+ if (point.size() > 0)
+ {
+ ret.x = total.x / point.size();
+ ret.y = total.y / point.size();
+ }
+ return ret;
+}
+
+void Polygon2D::Offset(const float &x, const float &y)
+{
+ for (auto i = point.begin(); i != point.end(); ++i)
+ {
+ i->x += x;
+ i->y += y;
+ }
+}
+
+void Polygon2D::Project(const Vector2f &axis, float &min, float &max) const
+{
+ // To project a point on an axis use the dot product
+ float d = axis.DotProduct(point[0]);
+ min = d;
+ max = d;
+
+ for (auto i = point.begin(); i != point.end(); ++i)
+ {
+ d = i->DotProduct(axis);
+
+ if (d < min) min = d;
+ else if (d > max) max = d;
+ }
+}
+
+PolygonCollisionResult Polygon2D::Collide(const Rect &rect)
+{
+ Polygon2D polyB;
+ Vector2f p;
+ p.x = rect.x; p.y = rect.y; polyB.point.push_back(p);
+ p.x = rect.x + rect.w; p.y = rect.y; polyB.point.push_back(p);
+ p.x = rect.x + rect.w; p.y = rect.y + rect.h; polyB.point.push_back(p);
+ p.x = rect.x; p.y = rect.y + rect.h; polyB.point.push_back(p);
+ polyB.SetEdge();
+
+ return Collide(polyB);
+}
+
+PolygonCollisionResult Polygon2D::Collide(const Polygon2D &polyB)
+{
+ PolygonCollisionResult result;
+ result.intersect = true;
+
+ int edgeCountA = edge.size();
+ int edgeCountB = polyB.edge.size();
+ float minIntervalDistance = std::numeric_limits<float>::max();
+ Vector2f translationAxis;
+ Vector2f e;
+
+ // Loop through all the edges of both polygons
+ for (int edgeIndex = 0; edgeIndex < edgeCountA + edgeCountB; edgeIndex++)
+ {
+ if (edgeIndex < edgeCountA)
+ e = edge[edgeIndex];
+ else
+ e = polyB.edge[edgeIndex - edgeCountA];
+
+ // ===== 1. Find if the Polygon2Ds are currently intersecting =====
+
+ // Find the axis perpendicular to the current edge
+ Vector2f axis(-e.y, e.x);
+ axis.Normalize();
+
+ // Find the projection of the Polygon2D on the current axis
+ float minA = 0; float minB = 0; float maxA = 0; float maxB = 0;
+ Project(axis, minA, maxA);
+ polyB.Project(axis, minB, maxB);
+
+ // Check if the Polygon2D projections are currently intersecting
+ float intervalDistance = IntervalDistance(minA, maxA, minB, maxB);
+ if (intervalDistance > 0)
+ {
+ // If the Polygon2Ds are not intersecting and won't intersect, exit the loop
+ result.intersect = false;
+ break;
+ }
+
+ // Check if the current interval distance is the minimum one. If so store
+ // the interval distance and the current distance.
+ // This will be used to calculate the minimum translation vector
+ intervalDistance = abs(intervalDistance);
+ if (intervalDistance < minIntervalDistance)
+ {
+ minIntervalDistance = intervalDistance;
+ translationAxis = axis;
+
+ Vector2f d, ca, cb;
+ ca = Center();
+ cb = polyB.Center();
+
+ d.x = ca.x - cb.x;
+ d.y = ca.y - cb.y;
+
+ if (d.DotProduct(translationAxis) < 0)
+ {
+ translationAxis.x = -translationAxis.x;
+ translationAxis.y = -translationAxis.y;
+ }
+ }
+ }
+
+ // The minimum translation vector can be used to push the Polygon2Ds apart.
+ // First moves the Polygon2Ds by their velocity
+ // then move polyA by MinimumTranslationVector.
+ if (result.intersect)
+ {
+ result.mtv.x = translationAxis.x * minIntervalDistance;
+ result.mtv.y = translationAxis.y * minIntervalDistance;
+ }
+
+ return result;
+}
+
+bool Polygon2D::Contains(const float &X, const float &Y)
+{
+ bool result = false;
+
+ for (int i = 0, j = point.size() - 1; i < point.size(); j = i++)
+ {
+ if (((point[i].y > Y) != (point[j].y > Y)) &&
+ (X < (point[j].x - point[i].x) * (Y - point[i].y) / (point[j].y - point[i].y) + point[i].x))
+ result = !result;
+ }
+
+ return result;
+}
+
+void Polygon2D::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a)
+{
+ Vector2f p1, p2;
+ for (int i = 0; i < point.size(); i++)
+ {
+ p1 = point[i];
+ if (i + 1 >= point.size())
+ p2 = point[0];
+ else
+ p2 = point[i + 1];
+
+ DrawLine(p1.x + XOffset, p1.y + YOffset, p2.x + XOffset, p2.y + YOffset, r, g, b, a);
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
new file mode 100644
index 00000000000..ed0d77cf768
--- /dev/null
+++ b/engines/crab/Polygon.h
@@ -0,0 +1,63 @@
+#pragma once
+
+#include "common_header.h"
+#include "vectors.h"
+#include "Rectangle.h"
+
+//------------------------------------------------------------------------
+// Purpose: The result of a collision
+//------------------------------------------------------------------------
+struct PolygonCollisionResult
+{
+ //Are the Polygons currently intersecting?
+ bool intersect;
+
+ //The translation to apply to polygon A to push the polygons apart
+ //Also known as the minimum translation vector
+ Vector2f mtv;
+
+ PolygonCollisionResult() { intersect = false; }
+};
+
+//------------------------------------------------------------------------
+// Purpose: A simple 2D Polygon class
+//------------------------------------------------------------------------
+class Polygon2D
+{
+ void AddPoint(const Vector2f &ref, const std::string &x, const std::string &y, Vector2f &min, Vector2f &max);
+
+public:
+ //A list of all points
+ std::vector<Vector2f> point;
+
+ //A list of all edges
+ std::vector<Vector2f> edge;
+
+ Polygon2D(){}
+ Polygon2D(rapidxml::xml_node<char> *node, Rect &bounds){ Load(node, bounds); }
+
+ //Returns the approximate axis aligned bounding box of the polygon
+ void Load(rapidxml::xml_node<char> *node, Rect &bounds);
+
+ void SetEdge();
+
+ Vector2f Center() const;
+ void Offset(const float &x, const float &y);
+ void Offset(const Vector2f &v){ Offset(v.x, v.y); }
+
+ //Check if Polygon2D A is going to collide with Polygon2D B for the given velocity
+ //PolyA is this polygon
+ PolygonCollisionResult Collide(const Polygon2D &polyB);
+
+ //Code for collision with a rectangle
+ PolygonCollisionResult Collide(const Rect &rect);
+
+ //Find if a point is inside this polygon
+ bool Contains(const float &X, const float &Y);
+
+ // Calculate the projection of a polygon on an axis and returns it as a [min, max] interval
+ void Project(const Vector2f &axis, float &min, float &max) const;
+
+ void Draw(const int &XOffset = 0, const int &YOffset = 0,
+ const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0.0f, const Uint8 &a = 255);
+};
diff --git a/engines/crab/PopUp.cpp b/engines/crab/PopUp.cpp
new file mode 100644
index 00000000000..53e8c82801f
--- /dev/null
+++ b/engines/crab/PopUp.cpp
@@ -0,0 +1,121 @@
+#include "stdafx.h"
+#include "PopUp.h"
+
+using namespace pyrodactyl::anim;
+using namespace pyrodactyl::event;
+
+//------------------------------------------------------------------------
+// Purpose: Load from xml
+//------------------------------------------------------------------------
+void PopUp::Load(rapidxml::xml_node<char> *node)
+{
+ duration.Load(node, "duration", false);
+ delay.Load(node, "delay");
+ LoadStr(text, "text", node);
+ LoadNum(next, "next", node);
+
+ bool end = false;
+ LoadBool(end, "end", node, false);
+ if (end)
+ next = -1;
+
+ visible.Load(node);
+
+ effect.clear();
+ for (rapidxml::xml_node<char> *n = node->first_node("effect"); n != NULL; n = n->next_sibling("effect"))
+ {
+ Effect e;
+ e.Load(n);
+ effect.push_back(e);
+ }
+}
+
+void PopUpCollection::Load(rapidxml::xml_node<char> *node)
+{
+ LoadBool(loop, "loop", node);
+ for (auto n = node->first_node("dialog"); n != NULL; n = n->next_sibling("dialog"))
+ element.push_back(n);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Internal events
+//------------------------------------------------------------------------
+bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+ std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq)
+{
+ if (visible.Evaluate(info) || started_show)
+ {
+ if (delay.TargetReached())
+ {
+ if (duration.TargetReached(gScreenSettings.text_speed))
+ {
+ show = false;
+
+ for (auto &i : effect)
+ i.Execute(info, player_id, result, end_seq);
+
+ return true;
+ }
+ else
+ {
+ started_show = true;
+ show = true;
+ }
+ }
+ else
+ show = false;
+ }
+ else
+ show = false;
+
+ return false;
+}
+
+void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+ std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq)
+{
+ if (cur >= 0 && cur < element.size())
+ {
+ if (element.at(cur).InternalEvents(info, player_id, result, end_seq))
+ {
+ if (element.at(cur).next <= 0 || element.at(cur).next >= element.size())
+ {
+ //This means that this popup is the "end" node, we must loop back to start or end this
+ if (loop)
+ {
+ cur = 0;
+ element.at(cur).Reset();
+ }
+ else
+ cur = -1;
+ }
+ else
+ {
+ cur = element.at(cur).next;
+ element.at(cur).Reset();
+ }
+ }
+ }
+}
+
+//------------------------------------------------------------------------
+// Purpose: Draw functions
+//------------------------------------------------------------------------
+void PopUp::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera)
+{
+ if (show)
+ {
+ if (x + pop.x < camera.w / 3)
+ pyrodactyl::text::gTextManager.Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
+ else if (x + pop.x >(2 * camera.w) / 3)
+ pyrodactyl::text::gTextManager.Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
+ else
+ pyrodactyl::text::gTextManager.Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
+ }
+}
+
+void PopUpCollection::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera)
+{
+ if (cur >= 0 && cur < element.size())
+ element.at(cur).Draw(x, y, pop, camera);
+}
\ No newline at end of file
diff --git a/engines/crab/PopUp.h b/engines/crab/PopUp.h
new file mode 100644
index 00000000000..2dd60e030c9
--- /dev/null
+++ b/engines/crab/PopUp.h
@@ -0,0 +1,84 @@
+#pragma once
+
+#include "common_header.h"
+#include "triggerset.h"
+#include "TextManager.h"
+#include "GameEventInfo.h"
+#include "ParagraphData.h"
+#include "effect.h"
+
+namespace pyrodactyl
+{
+ namespace anim
+ {
+ struct PopUp
+ {
+ //The total time the popup stays on the screen
+ Timer duration;
+
+ //The time we wait before showing the trigger for the first time
+ Timer delay;
+
+ //Should we draw this or not? (Decided by internal events)
+ bool show;
+
+ //Popups with "talk key pressed" condition need to be shown once the key is pressed
+ bool started_show;
+
+ //Triggers for when you only want to display this in certain conditions
+ pyrodactyl::event::TriggerSet visible;
+
+ //Effects for changing variables and other related stuff
+ std::vector<pyrodactyl::event::Effect> effect;
+
+ //The text displayed
+ std::string text;
+
+ //The next popup we should go to, negative values means the end
+ int next;
+
+ PopUp() { next = -1; Reset(); }
+ PopUp(rapidxml::xml_node<char> *node) : PopUp() { Load(node); }
+
+ void Reset() { show = false; started_show = false; delay.Stop(); duration.Stop(); }
+
+ void Load(rapidxml::xml_node<char> *node);
+ void Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
+
+ //return true if we should proceed to next event, false otherwise
+ bool InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+ std::vector<pyrodactyl::event::EventResult> &result, std::vector<pyrodactyl::event::EventSeqInfo> &end_seq);
+ };
+
+ struct PopUpCollection
+ {
+ //Collection of environmental dialog
+ std::vector<PopUp> element;
+
+ //The current dialog being played
+ int cur;
+
+ //true if dialog needs to loop, false otherwise
+ bool loop;
+
+ PopUpCollection() { cur = 0; loop = true; }
+
+ //Return true if any of the popup dialog is visible, false otherwise
+ bool Show()
+ {
+ for (auto &i : element)
+ if (i.show)
+ return true;
+
+ return false;
+ }
+
+ void Load(rapidxml::xml_node<char> *node);
+
+ void InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+ std::vector<pyrodactyl::event::EventResult> &result, std::vector<pyrodactyl::event::EventSeqInfo> &end_seq);
+
+ void Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
+ };
+ }
+}
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
new file mode 100644
index 00000000000..40b4325dd1c
--- /dev/null
+++ b/engines/crab/PriorityQueue.h
@@ -0,0 +1,123 @@
+#pragma once
+
+#include <vector>
+#include <deque>
+#include <algorithm>
+
+//! \brief The open heap used by all cost-based search algorithms.
+//!
+//! This class template is basically a thin wrapper on top of both the <code>std::deque</code>
+//! class template and the <a href="http://www.sgi.com/tech/stl/">STL</a> heap operations.
+template <typename Node>
+class PriorityQueue
+{
+ std::deque<Node*> open;
+ bool(*compare)(Node const*, Node const*);
+
+public:
+ //! \brief Constructs a new <code>%PriorityQueue</code> that heap-sorts nodes
+ //! using the specified comparator.
+ explicit PriorityQueue(bool(*)(Node const*, Node const*));
+
+ //! \brief Returns <code>true</code> if the heap contains no nodes,
+ //! <code>false</code> otherwise.
+ bool empty() const;
+
+ //! \brief Removes all nodes from the heap.
+ //!
+ //! \post
+ //! - <code>empty()</code>
+ void clear();
+
+ //! \brief Returns the number of nodes currently in the heap.
+ std::size_t size() const;
+
+ //! \brief Pushes the specified node onto the heap.
+ //!
+ //! The heap will maintain the ordering of its nodes during this operation.
+ //!
+ //! \post
+ //! - <code>! empty()</code>
+ void push(Node* node);
+
+ //! \brief Returns the least costly node in the heap.
+ //!
+ //! \pre
+ //! - <code>! empty()</code>
+ Node* front() const;
+
+ //! \brief Removes the least costly node from the heap.
+ //!
+ //! The heap will maintain the ordering of its nodes during this operation.
+ //!
+ //! \pre
+ //! - <code>! empty()</code>
+ void pop();
+
+ //! \brief Removes all instances of the specified node from the heap.
+ void remove(Node const* node);
+
+ //! \brief Enumerates all nodes in the heap so far.
+ //!
+ //! \param sorted the container to which each node will be added.
+ //!
+ //! \pre
+ //! - There must be no <code>NULL</code> pointers in the heap.
+ //! \post
+ //! - All nodes should be sorted by this heap's comparator.
+ void enumerate(std::vector<Node const*>& sorted) const;
+};
+
+template <typename Node>
+PriorityQueue<Node>::PriorityQueue(bool(*c)(Node const*, Node const*)) : open(), compare(c)
+{
+}
+
+template <typename Node>
+bool PriorityQueue<Node>::empty() const
+{
+ return open.empty();
+}
+
+template <typename Node>
+void PriorityQueue<Node>::clear()
+{
+ open.clear();
+}
+
+template <typename Node>
+std::size_t PriorityQueue<Node>::size() const
+{
+ return open.size();
+}
+
+template <typename Node>
+void PriorityQueue<Node>::push(Node* node)
+{
+ open.insert(std::upper_bound(open.begin(), open.end(), node, compare), node);
+}
+
+template <typename Node>
+Node* PriorityQueue<Node>::front() const
+{
+ return open.back();
+}
+
+template <typename Node>
+void PriorityQueue<Node>::pop()
+{
+ open.pop_back();
+}
+
+template <typename Node>
+void PriorityQueue<Node>::remove(Node const* node)
+{
+ open.erase(std::remove(open.begin(), open.end(), node), open.end());
+}
+
+template <typename Node>
+void PriorityQueue<Node>::enumerate(std::vector<Node const*>& sorted) const
+{
+ sorted.resize(open.size());
+ std::copy(open.begin(), open.end(), sorted.begin());
+}
diff --git a/engines/crab/ProgressBar.cpp b/engines/crab/ProgressBar.cpp
new file mode 100644
index 00000000000..a8c3c994cfd
--- /dev/null
+++ b/engines/crab/ProgressBar.cpp
@@ -0,0 +1,101 @@
+#include "stdafx.h"
+#include "ProgressBar.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::image;
+
+void ProgressBar::Load(rapidxml::xml_node<char> *node)
+{
+ ClipButton::Load(node);
+ LoadNum(notify_rate, "notify", node);
+
+ if (NodeValid("effect", node))
+ {
+ rapidxml::xml_node<char> *effnode = node->first_node("effect");
+ LoadImgKey(inc, "inc", effnode);
+ LoadImgKey(dec, "dec", effnode);
+ offset.Load(effnode);
+ }
+
+ if (NodeValid("desc", node))
+ {
+ rapidxml::xml_node<char> *descnode = node->first_node("desc");
+ for (rapidxml::xml_node<char> *n = descnode->first_node("above"); n != NULL; n = n->next_sibling("above"))
+ ct.push_back(n);
+ }
+}
+
+void ProgressBar::Draw(const int &value, const int &max)
+{
+ //We don't want divide by zero errors
+ if (max == 0)
+ return;
+
+ //Figure out which text to draw as caption
+ for (auto &i : ct)
+ if (value > i.val)
+ {
+ caption.text = i.text;
+ break;
+ }
+
+ //If we don't have to draw animations for changing value, just draw the bar
+ if (!changed)
+ {
+ clip.w = (gImageManager.GetTexture(img.normal).W() * value) / max;
+ ClipButton::Draw();
+ }
+ else
+ {
+ clip.w = (gImageManager.GetTexture(img.normal).W() * cur) / max;
+ ClipButton::Draw();
+
+ switch (type)
+ {
+ case INCREASE:
+ gImageManager.Draw(x + clip.w + offset.x, y + offset.y, inc);
+ if (timer.TargetReached())
+ {
+ cur++;
+ timer.Start();
+ }
+ break;
+ case DECREASE:
+ gImageManager.Draw(x + clip.w + offset.x, y + offset.y, dec);
+ if (timer.TargetReached())
+ {
+ cur--;
+ timer.Start();
+ }
+ break;
+ default: break;
+ }
+
+ if (cur == value)
+ changed = false;
+ }
+}
+
+void ProgressBar::Effect(const int &value, const int &prev)
+{
+ old = prev;
+ cur = prev;
+
+ if (value > prev)
+ {
+ changed = true;
+ type = INCREASE;
+ timer.Target(notify_rate * (value - prev));
+ }
+ else if (value < prev)
+ {
+ changed = true;
+ type = DECREASE;
+ timer.Target(notify_rate * (prev - value));
+ }
+ else
+ {
+ changed = false;
+ type = NONE;
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/ProgressBar.h b/engines/crab/ProgressBar.h
new file mode 100644
index 00000000000..ef0cab055d4
--- /dev/null
+++ b/engines/crab/ProgressBar.h
@@ -0,0 +1,72 @@
+#pragma once
+
+#include "common_header.h"
+#include "timer.h"
+#include "ClipButton.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class ProgressBar : public ClipButton
+ {
+ //Whenever the progress bar value is changed, we display a glowing effect
+ Timer timer;
+
+ //The total time for which the change effect must be shown
+ Uint32 notify_rate;
+
+ //Are we currently displaying the effect?
+ bool changed;
+
+ //The effect also depends on if the change was positive or negative, so store the previous value
+ int old;
+
+ //If we are drawing an animation, we need to smoothly transition from old->value
+ //This stores the current progress
+ int cur;
+
+ //The type of effect being drawn
+ enum { NONE, INCREASE, DECREASE } type;
+
+ //We reuse the button images for the 2 types of effect
+ ImageKey inc, dec;
+
+ //Where to draw the effect
+ Vector2i offset;
+
+ //The caption text changes depending on the value of the progress bar - we store all possible text here
+ struct CaptionText
+ {
+ //The text to be drawn
+ std::string text;
+
+ //The above text is drawn only if the progress bar value is greater than this val
+ int val;
+
+ CaptionText(){ val = 0; }
+ CaptionText(rapidxml::xml_node<char> *node)
+ {
+ if (!LoadNum(val, "val", node))
+ val = 0;
+
+ if (!LoadStr(text, "text", node))
+ text = "";
+ }
+ };
+
+ std::vector<CaptionText> ct;
+
+ public:
+ ProgressBar(){ old = 0; cur = 0; inc = 0; dec = 0; notify_rate = 5; Reset(); }
+ ~ProgressBar(){}
+
+ //Reset the effect
+ void Reset() { changed = false; type = NONE; }
+ void Load(rapidxml::xml_node<char> *node);
+
+ void Draw(const int &value, const int &max);
+ void Effect(const int &value, const int &prev);
+ };
+ }
+}
diff --git a/engines/crab/QuestText.cpp b/engines/crab/QuestText.cpp
new file mode 100644
index 00000000000..93343c05779
--- /dev/null
+++ b/engines/crab/QuestText.cpp
@@ -0,0 +1,143 @@
+#include "stdafx.h"
+#include "QuestText.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::text;
+using namespace pyrodactyl::input;
+
+void QuestText::Load(rapidxml::xml_node<char> *node)
+{
+ ParagraphData::Load(node);
+ LoadNum(col_s, "color_s", node);
+
+ if (NodeValid("line", node))
+ LoadNum(lines_per_page, "page", node->first_node("line"));
+
+ if (NodeValid("inc", node))
+ inc.Load(node->first_node("inc"));
+
+ if (NodeValid("img", node))
+ img.Load(node->first_node("img"));
+
+ if (NodeValid("prev", node))
+ {
+ prev.Load(node->first_node("prev"));
+ prev.hotkey.Set(IU_PAGE_PREV);
+ }
+
+ if (NodeValid("next", node))
+ {
+ next.Load(node->first_node("next"));
+ next.hotkey.Set(IU_PAGE_NEXT);
+ }
+
+ if (NodeValid("status", node))
+ status.Load(node->first_node("status"));
+}
+
+void QuestText::Draw(pyrodactyl::event::Quest &q)
+{
+ //First, we must scan and find the part of the quest text we should draw
+
+ //Assign default values to start and stop
+ start = 0;
+ stop = q.text.size();
+
+ //Keep count of lines and pages - remember a single entry can take more than one line
+ int page_count = 0, page_start = 0;
+
+ //Start from line 0, page 0 and scan the list of entries
+ for (int i = 0, line_count = 0; i < q.text.size(); ++i)
+ {
+ //Increment the number of lines by one text entry
+ line_count += (q.text[i].size() / line.x) + 1;
+
+ //If we go over the quota for lines per page, go to next page and reset line counter to 0
+ if (line_count > lines_per_page)
+ {
+ //We are about to go to next page, stop at this entry
+ if (page_count == current_page)
+ {
+ start = page_start;
+ stop = i;
+ }
+
+ page_count++;
+ line_count = 0;
+
+ //This is the start of the next page
+ page_start = i;
+ }
+ }
+
+ //Used for the final page, because the page count won't be incremented for the last one
+ if (page_count == current_page)
+ {
+ start = page_start;
+ stop = q.text.size();
+ }
+
+ //Find out how many pages the lines need
+ total_page = page_count + 1;
+
+ //Update the text
+ status.text = NumberToString(current_page + 1) + " of " + NumberToString(total_page);
+
+ //Now, start drawing the quest
+ status.Draw();
+
+ if (current_page > 0)
+ prev.Draw();
+
+ if (current_page < total_page - 1)
+ next.Draw();
+
+ //Draw the current page of quest text
+ if (!q.text.empty())
+ {
+ //Count the number of lines, because a single entry can take more than one line
+ int count = 0;
+
+ for (unsigned int i = start; i < stop; ++i)
+ {
+ img.Draw(inc.x * count, inc.y * count);
+
+ //Draw first entry in selected color, and older quest entries in standard color
+ if (i == 0)
+ gTextManager.Draw(x, y, q.text[i], col_s, font, align, line.x, line.y);
+ else
+ ParagraphData::Draw(q.text[i], inc.x * count, inc.y * count);
+
+ //Count is reduced extra by the amount of lines it takes for the message to be drawn
+ count += (q.text[i].size() / line.x) + 1;
+ }
+ }
+}
+
+void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event)
+{
+ if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ current_page--;
+
+ if (current_page < 0)
+ current_page = 0;
+ }
+
+ if (current_page < total_page - 1 && next.HandleEvents(Event) == BUAC_LCLICK)
+ {
+ current_page++;
+
+ if (current_page >= total_page)
+ current_page = total_page - 1;
+ }
+}
+
+void QuestText::SetUI()
+{
+ ParagraphData::SetUI();
+ img.SetUI();
+ prev.SetUI();
+ next.SetUI();
+ status.SetUI();
+}
\ No newline at end of file
diff --git a/engines/crab/QuestText.h b/engines/crab/QuestText.h
new file mode 100644
index 00000000000..36586562499
--- /dev/null
+++ b/engines/crab/QuestText.h
@@ -0,0 +1,54 @@
+#pragma once
+
+#include "common_header.h"
+#include "ImageData.h"
+#include "ParagraphData.h"
+#include "quest.h"
+#include "button.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class QuestText : public ParagraphData
+ {
+ protected:
+ //How much the text and bullet positions change per line
+ Vector2i inc;
+
+ //Color of the highlighted quest
+ int col_s;
+
+ //The coordinates for drawing image, which is like bullet points in the form of <Bullet> <Text>
+ ImageData img;
+
+ //The lines per page, we split the quest text into multiple pages if we have to draw more than that
+ unsigned int lines_per_page;
+
+ //Keep track of which page we are at, and total pages
+ unsigned int current_page, total_page;
+
+ //The quest entries we start and stop the drawing at
+ int start, stop;
+
+ //The buttons for cycling between pages of the menu
+ Button prev, next;
+
+ //Display "Page 1 of 3" style information for the menu
+ HoverInfo status;
+
+ public:
+ QuestText() { col_s = 0; current_page = 0; start = 0; stop = 0; total_page = 1; lines_per_page = 10; }
+
+ void Load(rapidxml::xml_node<char> *node);
+
+ //Reset the value of current page
+ void Reset() { current_page = 0; }
+
+ void HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event);
+ void Draw(pyrodactyl::event::Quest &q);
+
+ void SetUI();
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/RadioButton.h b/engines/crab/RadioButton.h
new file mode 100644
index 00000000000..80a9437afe0
--- /dev/null
+++ b/engines/crab/RadioButton.h
@@ -0,0 +1,25 @@
+#pragma once
+
+#include "ToggleButton.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class RadioButton : public ToggleButton
+ {
+ public:
+ //The value associated with the radio button
+ float val;
+
+ RadioButton(){ val = 0.0f; }
+ ~RadioButton(){}
+
+ void Load(rapidxml::xml_node<char> * node)
+ {
+ ToggleButton::Load(node);
+ LoadNum(val, "val", node);
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/RadioButtonMenu.h b/engines/crab/RadioButtonMenu.h
new file mode 100644
index 00000000000..d9f70005d0f
--- /dev/null
+++ b/engines/crab/RadioButtonMenu.h
@@ -0,0 +1,59 @@
+#pragma once
+
+#include "menu.h"
+#include "RadioButton.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ class RadioButtonMenu : public Menu < RadioButton >
+ {
+ //The description of the menu
+ HoverInfo desc;
+
+ //The selected radio button
+ int select;
+
+ public:
+ RadioButtonMenu() { select = 0; }
+ ~RadioButtonMenu() {}
+
+ void Load(rapidxml::xml_node<char> *node)
+ {
+ if (NodeValid("desc", node))
+ desc.Load(node->first_node("desc"));
+
+ if (NodeValid("menu", node))
+ Menu::Load(node->first_node("menu"));
+ }
+
+ void Draw(const int &XOffset = 0, const int &YOffset = 0)
+ {
+ desc.Draw(XOffset, YOffset);
+ Menu::Draw(XOffset, YOffset);
+ }
+
+ int HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0)
+ {
+ int result = Menu::HandleEvents(Event, XOffset, YOffset);
+
+ if (result >= 0)
+ {
+ select = result;
+
+ for (int i = 0; i < element.size(); ++i)
+ element.at(i).state = (i == result);
+ }
+
+ return result;
+ }
+
+ void SetUI()
+ {
+ Menu::SetUI();
+ desc.SetUI();
+ }
+ };
+ }
+}
\ No newline at end of file
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
new file mode 100644
index 00000000000..d34937a9112
--- /dev/null
+++ b/engines/crab/Rectangle.cpp
@@ -0,0 +1,79 @@
+#include "stdafx.h"
+#include "Rectangle.h"
+
+bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const std::string &x_name, const std::string &y_name,
+ const std::string &w_name, const std::string &h_name)
+{
+ return LoadNum(x, x_name, node, echo)
+ && LoadNum(y, y_name, node, echo)
+ && LoadNum(w, w_name, node, echo)
+ && LoadNum(h, h_name, node, echo);
+}
+
+bool Rect::Collide(Rect box)
+{
+ if (box.x + box.w < x) return false; //just checking if their
+ if (box.x > x + w) return false; //bounding boxes even touch
+ if (box.y + box.h < y) return false;
+ if (box.y > y + h) return false;
+
+ return true; //bounding boxes intersect
+}
+
+Direction Rect::ResolveX(Rect collider)
+{
+ //Check left edge of collider
+ if (x < collider.x && collider.x < x + w)
+ return DIRECTION_RIGHT;
+
+ //Check right edge of collider
+ if (x < collider.x + collider.w && collider.x + collider.w < x + w)
+ return DIRECTION_LEFT;
+
+ return DIRECTION_NONE;
+}
+
+Direction Rect::ResolveY(Rect collider)
+{
+ //Check top edge of collider
+ if (y < collider.y && collider.y < y + h)
+ return DIRECTION_DOWN;
+
+ //Check bottom edge of collider
+ if (y < collider.y + collider.h && collider.y + collider.h < y + h)
+ return DIRECTION_UP;
+
+ return DIRECTION_NONE;
+}
+
+void Rect::Flip(const TextureFlipType &flip, const Vector2i &axis)
+{
+ if (flip == FLIP_NONE)
+ return;
+
+ if (flip == FLIP_X || flip == FLIP_XY)
+ x = 2 * axis.x - x - w;
+
+ if (flip == FLIP_Y || flip == FLIP_XY)
+ y = 2 * axis.y - y - h;
+}
+
+void Rect::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a)
+{
+ int X = x + XOffset, Y = y + YOffset;
+
+ DrawLine(X, Y, X + w, Y, r, g, b, a);
+ DrawLine(X, Y, X, Y + h, r, g, b, a);
+ DrawLine(X + w, Y, X + w, Y + h, r, g, b, a);
+ DrawLine(X, Y + h, X + w, Y + h, r, g, b, a);
+}
+
+void Rect::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char* name)
+{
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
+ child->append_attribute(doc.allocate_attribute("x", gStrPool.Get(x)));
+ child->append_attribute(doc.allocate_attribute("y", gStrPool.Get(y)));
+ child->append_attribute(doc.allocate_attribute("w", gStrPool.Get(w)));
+ child->append_attribute(doc.allocate_attribute("h", gStrPool.Get(h)));
+ root->append_node(child);
+}
\ No newline at end of file
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
new file mode 100644
index 00000000000..2ea5ed731d5
--- /dev/null
+++ b/engines/crab/Rectangle.h
@@ -0,0 +1,49 @@
+#pragma once
+
+#include "common_header.h"
+#include "Line.h"
+#include "vectors.h"
+
+//------------------------------------------------------------------------
+// Purpose: A simple rectangle class
+//------------------------------------------------------------------------
+class Rect : public SDL_Rect
+{
+public:
+
+ Rect(int X = 0, int Y = 0, int W = 0, int H = 0){ x = X; y = Y; w = W; h = H; }
+
+ bool Load(rapidxml::xml_node<char> *node, const bool &echo = true, const std::string &x_name = "x",
+ const std::string &y_name = "y", const std::string &w_name = "w", const std::string &h_name = "h");
+
+ //Is this rectangle colliding with another rectangle?
+ bool Collide(Rect box);
+
+ //Resolving a collision means we need to correct the position of the target rectangle to just outside of the reference rectangle
+ //To do this, first we need to determine which edges of the rectangles are colliding
+
+ //Resolve a collision in the X plane
+ Direction ResolveX(Rect collider);
+
+ //Resolve a collision in the Y plane
+ Direction ResolveY(Rect collider);
+
+ //Does this rectangle contain a point?
+ bool Contains(int X, int Y){ return (X > x && X < x + w && Y > y && Y < y + h); }
+ bool Contains(Vector2i v){ return Contains(v.x, v.y); }
+
+ //Does this rectangle contain another rectangle?
+ bool Contains(Rect box){ return (x < box.x && x + w > box.x + box.w && y < box.y && y + h > box.y + box.h); }
+
+ //Flip a rectangle with respect to an axis
+ void Flip(const TextureFlipType &flip, const Vector2i &axis);
+
+ //Draw the borders of the rectangle
+ void Draw(const int &XOffset = 0, const int &YOffset = 0, const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0, const Uint8 &a = 255);
+
+ //Check if a rectangle is the same as another
+ bool operator==(const Rect &r) { return r.x == x && r.y == y && r.w == w && r.h == h; }
+
+ //Save to file
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char* name);
+};
diff --git a/engines/crab/ReplyButton.cpp b/engines/crab/ReplyButton.cpp
new file mode 100644
index 00000000000..d8fda3b9eae
--- /dev/null
+++ b/engines/crab/ReplyButton.cpp
@@ -0,0 +1,60 @@
+#include "stdafx.h"
+#include "ReplyButton.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::text;
+using namespace pyrodactyl::image;
+
+void ReplyButton::Load(rapidxml::xml_node<char> * node)
+{
+ Button::Load(node);
+ orig = *this;
+
+ if (NodeValid("text", node))
+ {
+ rapidxml::xml_node<char> * tenode = node->first_node("text");
+
+ LoadColor(col_b, tenode->first_node("col_b"));
+ LoadColor(col_s, tenode->first_node("col_s"));
+ LoadColor(col_h, tenode->first_node("col_h"));
+ LoadNum(font, "font", tenode);
+ LoadAlign(align, tenode);
+
+ if (NodeValid("line_size", tenode))
+ line_size.Load(tenode->first_node("line_size"));
+ }
+}
+
+void ReplyButton::Draw(const int &XOffset, const int &YOffset)
+{
+ if (visible)
+ {
+ if (mousepressed)
+ gTextManager.Draw(x + XOffset, y + YOffset, text, col_s, font, align, line_size.x, line_size.y);
+ else if (hover_mouse || hover_key)
+ gTextManager.Draw(x + XOffset, y + YOffset, text, col_h, font, align, line_size.x, line_size.y);
+ else
+ gTextManager.Draw(x + XOffset, y + YOffset, text, col_b, font, align, line_size.x, line_size.y);
+ }
+}
+
+void ReplyButton::Cache(const std::string &val, const int &spacing, const int &bottom_edge, Rect *parent)
+{
+ text = val;
+
+ //Find out about the font
+ int width = 0, height = 0;
+ TTF_SizeText(gTextManager.GetFont(font), val.c_str(), &width, &height);
+
+ //Find out how many line sizes will the text take
+ int lines = ((text.length() - 1) / line_size.x) + 1;
+
+ x = orig.x;
+ y = orig.y;
+ w = width;
+ h = height * lines;
+ SetUI(parent);
+
+ if (orig.y < bottom_edge)
+ y = bottom_edge + spacing;
+}
\ No newline at end of file
diff --git a/engines/crab/ReplyButton.h b/engines/crab/ReplyButton.h
new file mode 100644
index 00000000000..32a8fd1e5a1
--- /dev/null
+++ b/engines/crab/ReplyButton.h
@@ -0,0 +1,41 @@
+#pragma once
+
+#include "common_header.h"
+#include "button.h"
+
+namespace pyrodactyl
+{
+ namespace ui
+ {
+ //This button is used to draw multiple lines of text instead of an image
+ class ReplyButton : public Button
+ {
+ //Information about drawing reply options
+ int col_b, col_s, col_h;
+ FontKey font;
+ Align align;
+ Vector2D<unsigned int> line_size;
+
+ //Reply options get moved around a lot, this remembers their actual position
+ Rect orig;
+
+ //The text for this button
+ std::string text;
+
+ public:
+ //The object it points to
+ int index;
+
+ ReplyButton(){ index = 0; col_b = 0; col_s = 0; col_h = 0; font = 0; align = ALIGN_LEFT; }
+ ~ReplyButton(){}
+
+ void Load(rapidxml::xml_node<char> * node);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
+
+ //Used to calculate size and set the string
+ //Spacing is the minimum space between buttons added in case of overflow
+ //Bottom edge is the y+h value of the previous choice
+ void Cache(const std::string &val, const int &spacing, const int &bottom_edge, Rect *parent);
+ };
+ }
+}
diff --git a/engines/crab/ReplyMenu.cpp b/engines/crab/ReplyMenu.cpp
new file mode 100644
index 00000000000..fa7c3d93b10
--- /dev/null
+++ b/engines/crab/ReplyMenu.cpp
@@ -0,0 +1,129 @@
+#include "stdafx.h"
+#include "ReplyMenu.h"
+
+using namespace pyrodactyl::ui;
+using namespace pyrodactyl::text;
+using namespace pyrodactyl::image;
+using namespace pyrodactyl::input;
+using namespace pyrodactyl::music;
+using namespace pyrodactyl::event;
+using namespace pyrodactyl::people;
+
+void ReplyMenu::Load(const std::string &filename)
+{
+ XMLDoc conf(filename);
+ if (conf.ready())
+ {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("conversation");
+ if (NodeValid(node))
+ {
+ if (NodeValid("tone", node))
+ tone.Load(node->first_node("tone"));
+
+ if (NodeValid("reply", node))
+ {
+ rapidxml::xml_node<char> *replynode = node->first_node("reply");
+ Menu<ReplyButton>::Load(replynode->first_node("menu"));
+ tone.value.resize(element.size());
+
+ bg.Load(replynode->first_node("bg"));
+ LoadNum(spacing, "spacing", replynode);
+ }
+ }
+ }
+}
+
+int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string &cur_id, PersonHandler &oh, const SDL_Event &Event)
+{
+ //After that, check if the user has clicked on any reply option
+ int choice = Menu<ReplyButton>::HandleEvents(Event);
+ if (choice >= 0 && choice < dat.reply.size())
+ {
+ bool play_sound = false;
+
+ //Loop through any opinion changes required
+ for (auto &i : dat.reply[element.at(choice).index].change)
+ {
+ if (i.id == cur_id)
+ {
+ //This is a special case because we also need to update the opinion bars
+ oh.OpinionChange(info, i.id, OPI_LIKE, i.val[OPI_LIKE]);
+ oh.OpinionChange(info, i.id, OPI_RESPECT, i.val[OPI_RESPECT]);
+ oh.OpinionChange(info, i.id, OPI_FEAR, i.val[OPI_FEAR]);
+ play_sound = true;
+ }
+ else
+ {
+ info.OpinionChange(i.id, OPI_LIKE, i.val[OPI_LIKE]);
+ info.OpinionChange(i.id, OPI_RESPECT, i.val[OPI_RESPECT]);
+ info.OpinionChange(i.id, OPI_FEAR, i.val[OPI_FEAR]);
+ play_sound = true;
+ }
+ }
+
+ //Right now we play sound randomly
+ if (play_sound)
+ {
+ if (gRandom.Num() % 2 == 1)
+ info.sound.rep_dec = true;
+ else
+ info.sound.rep_inc = true;
+ }
+
+ return dat.reply[element.at(choice).index].nextid;
+ }
+
+ return -1;
+}
+
+void ReplyMenu::Draw()
+{
+ bg.Draw();
+ tone.Draw(hover_index);
+
+ //Draw the reply options
+ Menu<ReplyButton>::Draw();
+}
+
+void ReplyMenu::Cache(Info &info, ConversationData &dat)
+{
+ //Some replies are locked, which means the other replies move up and take their place -
+ //which is why we need two count variables
+ unsigned int reply_count = 0, element_count = 0;
+
+ for (auto i = dat.reply.begin(); i != dat.reply.end() && reply_count < dat.reply.size(); ++i, ++reply_count)
+ {
+ if (i->unlock.Evaluate(info))
+ {
+ element.at(element_count).visible = true;
+ element.at(element_count).index = reply_count;
+
+ tone.value.at(element_count) = dat.reply.at(reply_count).tone;
+
+ std::string text = SDL_GetScancodeName(gInput.iv[IU_REPLY_0 + element_count].key);
+ text += ". " + i->text;
+ info.InsertName(text);
+
+ if (element_count == 0)
+ element.at(element_count).Cache(text, spacing, 0, &bg);
+ else
Commit: dca60a00bb3819b012f45619678dbe0eb9b84ab2
https://github.com/scummvm/scummvm/commit/dca60a00bb3819b012f45619678dbe0eb9b84ab2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rewrite various utility classes related to XML loading
Changed paths:
engines/crab/XMLDoc.cpp
engines/crab/XMLDoc.h
engines/crab/common_header.h
engines/crab/gametype.h
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/numstr.h
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index 4bad80c9fd0..d70638d20cc 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -1,8 +1,9 @@
-#include "stdafx.h"
-#include "XMLDoc.h"
+#include "engines/crab/common_header.h"
+#include "engines/crab/XMLDoc.h"
-void XMLDoc::Load(const std::string &filename)
-{
+namespace Crab {
+
+void XMLDoc::Load(const Common::String &filename) {
if (ready())
doc.clear();
@@ -11,10 +12,11 @@ void XMLDoc::Load(const std::string &filename)
doc.parse<0>(text);
}
-const rapidxml::xml_document<>* XMLDoc::Doc() const
-{
+const rapidxml::xml_document<>* XMLDoc::Doc() const {
if (text != NULL)
return &doc;
else
return NULL;
-}
\ No newline at end of file
+}
+
+} // End of namespace Crab
diff --git a/engines/crab/XMLDoc.h b/engines/crab/XMLDoc.h
index 95f2ef7debb..58aee88cf80 100644
--- a/engines/crab/XMLDoc.h
+++ b/engines/crab/XMLDoc.h
@@ -1,7 +1,9 @@
#pragma once
-#include "common_header.h"
-#include "filesystem.h"
+#include "engines/crab/common_header.h"
+#include "engines/crab/filesystem.h"
+
+namespace Crab {
class XMLDoc
{
@@ -10,16 +12,18 @@ class XMLDoc
public:
XMLDoc(){ text = NULL; }
- XMLDoc(const std::string &filename){ text = NULL; Load(filename); }
+ XMLDoc(const Common::String &filename){ text = NULL; Load(filename); }
~XMLDoc() { delete[] text; }
//Load the text from the specified file into the rapidxml format
//Each function that references it must parse it there
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
//Check if document is ready for parsing
bool ready() const { return text != NULL; }
const rapidxml::xml_document<>* Doc() const;
-};
\ No newline at end of file
+};
+
+} // End of namespace Crab
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index a093de98dfb..a2bd036da79 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -1,5 +1,6 @@
#pragma once
+#if 0
#include <string>
#include <vector>
#include <unordered_map>
@@ -17,10 +18,10 @@
#include <SDL2/SDL_mixer.h>
#include <SDL2/SDL_ttf.h>
#include <SDL2/SDL_image.h>
+#endif
-#include "rapidxml/rapidxml.hpp"
-#include "rapidxml/rapidxml_print.hpp"
-
-#include </filesystem.hpp>
+#include "common/str.h"
+#include "common/path.h"
-//#include <steam/steam_api.h>
\ No newline at end of file
+#define RAPIDXML_NO_EXCEPTIONS
+#include "rapidxml/rapidxml.hpp"
diff --git a/engines/crab/gametype.h b/engines/crab/gametype.h
index 4e0b07dd30c..60a08bdfd0e 100644
--- a/engines/crab/gametype.h
+++ b/engines/crab/gametype.h
@@ -1,5 +1,7 @@
#pragma once
+namespace Crab {
+
#define STATNAME_HEALTH "health"
#define STATNAME_ATTACK "attack"
#define STATNAME_DEFENSE "defense"
@@ -7,27 +9,27 @@
//#define STATNAME_CHARISMA "charisma"
//#define STATNAME_INTELLIGENCE "intelligence"
-namespace pyrodactyl
-{
- namespace stat
- {
- enum StatType
- {
- STAT_HEALTH,
- STAT_ATTACK,
- STAT_DEFENSE,
- STAT_SPEED,
- /*STAT_CHARISMA,
- STAT_INTELLIGENCE,*/
- STAT_TOTAL
- };
- }
-}
+namespace pyrodactyl {
+
+namespace stat {
+
+enum StatType {
+ STAT_HEALTH,
+ STAT_ATTACK,
+ STAT_DEFENSE,
+ STAT_SPEED,
+ /*STAT_CHARISMA,
+ STAT_INTELLIGENCE,*/
+ STAT_TOTAL
+ };
+
+} // End of namespace stat
+
+} // End of namespace pyrodactyl
enum Align { ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT };
-enum Direction
-{
+enum Direction {
//An invalid direction, used for collisions
DIRECTION_NONE = -1,
@@ -47,8 +49,7 @@ enum Direction
DIRECTION_TOTAL
};
-enum TextureFlipType
-{
+enum TextureFlipType {
//Draw texture normally
FLIP_NONE,
@@ -73,3 +74,5 @@ enum TextureFlipType
//Flipped anti-diagonally and horizontally and vertically - MAXIMUM FLIP
FLIP_XYD
};
+
+} // End of namespace Crab
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 720f0d90734..8f4c4899d19 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -1,12 +1,9 @@
-#include "stdafx.h"
#include "loaders.h"
-using namespace pyrodactyl;
+namespace Crab {
-bool NodeValid(rapidxml::xml_node<char> *node, const bool &echo)
-{
- if (node == NULL)
- {
+bool NodeValid(rapidxml::xml_node<char> *node, const bool &echo) {
+ if (node == NULL) {
/*if (echo)
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", "node not found", NULL);*/
@@ -16,10 +13,8 @@ bool NodeValid(rapidxml::xml_node<char> *node, const bool &echo)
return true;
}
-bool NodeValid(const std::string &name, rapidxml::xml_node<char> *parent_node, const bool &echo)
-{
- if (parent_node == NULL)
- {
+bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node, const bool &echo) {
+ if (parent_node == NULL) {
/*if (echo)
{
std::string error_msg = "parent node of " + name + " not found \n";
@@ -27,8 +22,7 @@ bool NodeValid(const std::string &name, rapidxml::xml_node<char> *parent_node, c
}*/
return false;
}
- else if (parent_node->first_node(name.c_str()) == NULL)
- {
+ else if (parent_node->first_node(name.c_str()) == NULL) {
/*if (echo)
{
std::string error_msg = "child node " + name + " of parent node " + parent_node->name() + " not found \n";
@@ -40,12 +34,10 @@ bool NodeValid(const std::string &name, rapidxml::xml_node<char> *parent_node, c
return true;
}
-bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo)
-{
+bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo) {
if (node->first_attribute(name.c_str()) != NULL)
val = node->first_attribute(name.c_str())->value();
- else
- {
+ else {
/*if (echo)
{
std::string error_msg = "string " + name + " not found in " + node->name() + "\n";
@@ -57,8 +49,10 @@ bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char>
return true;
}
+#if 0
+
bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
- const std::string &x_name, const std::string &y_name, const std::string &w_name, const std::string &h_name)
+ const Common::String &x_name, const Common::String &y_name, const Common::String &w_name, const Common::String &h_name)
{
if (LoadNum(rect.x, x_name, node, echo) && LoadNum(rect.y, y_name, node, echo)
&& LoadNum(rect.w, w_name, node, echo) && LoadNum(rect.h, h_name, node, echo))
@@ -67,7 +61,7 @@ bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
}
bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo,
- const std::string &r_name, const std::string &g_name, const std::string &b_name)
+ const Common::String &r_name, const Common::String &g_name, const Common::String &b_name)
{
int r = 0, g = 0, b = 0;
@@ -82,16 +76,15 @@ bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo,
return false;
}
-bool LoadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo)
-{
+#endif
+
+bool LoadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo) {
return LoadNum(col, "color", node, echo);
}
-bool LoadBool(bool &var, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo)
-{
- std::string str;
- if (LoadStr(str, name, node, echo))
- {
+bool LoadBool(bool &var, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo) {
+ Common::String str;
+ if (LoadStr(str, name, node, echo)) {
if (str == "true")
var = true;
else
@@ -103,20 +96,17 @@ bool LoadBool(bool &var, const std::string &name, rapidxml::xml_node<char> *node
return false;
}
-void SaveBool(const bool &var, const char *name, rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
+void SaveBool(const bool &var, const char *name, rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
if (var)
root->append_attribute(doc.allocate_attribute(name, "true"));
else
root->append_attribute(doc.allocate_attribute(name, "false"));
}
-bool LoadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *node, const bool &echo)
-{
+bool LoadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *node, const bool &echo) {
using namespace pyrodactyl::stat;
- std::string str;
- if (LoadStr(str, "type", node, echo))
- {
+ Common::String str;
+ if (LoadStr(str, "type", node, echo)) {
if (str == STATNAME_HEALTH) type = STAT_HEALTH;
else if (str == STATNAME_ATTACK) type = STAT_ATTACK;
else if (str == STATNAME_DEFENSE) type = STAT_DEFENSE;
@@ -131,8 +121,7 @@ bool LoadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *no
return false;
}
-bool LoadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo, const std::string &name)
-{
+bool LoadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo, const Common::String &name) {
int num = 0;
if (LoadNum(num, name, node, echo))
{
@@ -143,11 +132,9 @@ bool LoadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo, c
return false;
}
-bool LoadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &echo, const std::string &name)
-{
- std::string str;
- if (LoadStr(str, name, node, echo))
- {
+bool LoadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &echo, const Common::String &name) {
+ Common::String str;
+ if (LoadStr(str, name, node, echo)) {
if (str == "left")
dir = DIRECTION_LEFT;
else if (str == "right")
@@ -163,11 +150,9 @@ bool LoadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &e
return false;
}
-bool LoadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node, const bool &echo)
-{
- std::string str;
- if (LoadStr(str, "flip", node, echo))
- {
+bool LoadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node, const bool &echo) {
+ Common::String str;
+ if (LoadStr(str, "flip", node, echo)) {
if (str == "x")
flip = FLIP_X;
else if (str == "y")
@@ -183,17 +168,18 @@ bool LoadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node,
return false;
}
-unsigned int Version(const std::string &filename)
+unsigned int Version(const Common::String &filename)
{
unsigned int version = 0;
XMLDoc doc(filename);
- if (doc.ready())
- {
+ if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.Doc()->first_node();
if (NodeValid(node))
LoadNum(version, "version", node);
}
return version;
-}
\ No newline at end of file
+}
+
+} // End of namespace Crab
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index d78de703d79..c824e824aaa 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -1,30 +1,30 @@
#pragma once
-#include "common_header.h"
-#include "numstr.h"
-#include "gametype.h"
-#include "XMLDoc.h"
+#include "engines/crab/common_header.h"
+#include "engines/crab/numstr.h"
+#include "engines/crab/gametype.h"
+#include "engines/crab/XMLDoc.h"
+
+namespace Crab {
//Function to check if node is valid
//return true for valid, false otherwise
bool NodeValid(rapidxml::xml_node<char> *node, const bool &echo = true);
-bool NodeValid(const std::string &name, rapidxml::xml_node<char> *parent_node, const bool &echo = true);
+bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node, const bool &echo = true);
//Functions to load attributes from xml files
//return true on success, false on failure
-bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true);
+bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
//Used for loading numerical types
template <typename T>
-bool LoadNum(T &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true)
-{
+bool LoadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
if (node->first_attribute(name.c_str()) != NULL)
val = StringToNumber<T>(node->first_attribute(name.c_str())->value());
- else
- {
+ else {
/*if (echo)
{
- std::string error_msg = "attribute " + name + " not found in node " + node->parent()->name() + " -> " + node->name();
+ Common::String error_msg = "attribute " + name + " not found in node " + node->parent()->name() + " -> " + node->name();
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
}*/
return false;
@@ -35,12 +35,10 @@ bool LoadNum(T &val, const std::string &name, rapidxml::xml_node<char> *node, co
//Used for loading enumerator types that are integers
template <typename T>
-bool LoadEnum(T &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true)
-{
+bool LoadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
if (node->first_attribute(name.c_str()) != NULL)
val = static_cast<T>(StringToNumber<int>(node->first_attribute(name.c_str())->value()));
- else
- {
+ else {
/*if (echo)
{
std::string error_msg = "attribute " + name + " not found in node " + node->parent()->name() + " -> " + node->name();
@@ -52,21 +50,24 @@ bool LoadEnum(T &val, const std::string &name, rapidxml::xml_node<char> *node, c
return true;
}
+#if 0
+
//Load Rectangle
bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo = true,
- const std::string &x_name = "x", const std::string &y_name = "y", const std::string &w_name = "w", const std::string &h_name = "h");
+ const Common::String &x_name = "x", const Common::String &y_name = "y", const Common::String &w_name = "w", const Common::String &h_name = "h");
//Load Color
bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo = true,
- const std::string &r_name = "r", const std::string &g_name = "g", const std::string &b_name = "b");
+ const Common::String &r_name = "r", const Common::String &g_name = "g", const Common::String &b_name = "b");
//Shortcut to load integer color index to a number
bool LoadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo = true);
+#endif
+
//Load two dimensional coordinates
template <typename T>
-bool LoadXY(T &x, T &y, rapidxml::xml_node<char> *node, const bool &echo = true)
-{
+bool LoadXY(T &x, T &y, rapidxml::xml_node<char> *node, const bool &echo = true) {
bool result = LoadNum(x, "x", node, echo);
result = LoadNum(y, "y", node, echo) && result;
@@ -75,8 +76,7 @@ bool LoadXY(T &x, T &y, rapidxml::xml_node<char> *node, const bool &echo = true)
//Load three dimensional coordinates
template <typename T>
-bool LoadXYZ(T &x, T &y, T &z, rapidxml::xml_node<char> *node, const bool &echo = true)
-{
+bool LoadXYZ(T &x, T &y, T &z, rapidxml::xml_node<char> *node, const bool &echo = true) {
bool result = LoadNum(x, "x", node, echo);
result = LoadNum(y, "y", node, echo) && result;
result = LoadNum(z, "z", node, echo) && result;
@@ -85,7 +85,7 @@ bool LoadXYZ(T &x, T &y, T &z, rapidxml::xml_node<char> *node, const bool &echo
}
//Load Boolean variable
-bool LoadBool(bool &var, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true);
+bool LoadBool(bool &var, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
//Write Boolean variable to file
void SaveBool(const bool &var, const char *name, rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
@@ -93,10 +93,12 @@ void SaveBool(const bool &var, const char *name, rapidxml::xml_document<> &doc,
//Functions to load various type of objects
bool LoadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *node, const bool &echo = true);
-bool LoadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo = true, const std::string &name = "align");
-bool LoadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &echo = true, const std::string &name = "dir");
+bool LoadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &name = "align");
+bool LoadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &name = "dir");
bool LoadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node, const bool &echo = true);
//Check the version of a file
-unsigned int Version(const std::string &filename);
\ No newline at end of file
+unsigned int Version(const Common::String &filename);
+
+} // End of namespace Crab
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 7066f41c293..c1f481859a2 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -1,35 +1,62 @@
#pragma once
#include "common_header.h"
+namespace Crab {
+
template <typename T>
-std::string NumberToString ( T Number )
-{
- std::stringstream ss;
- ss << Number;
- return ss.str();
+Common::String NumberToString(T Number) {
+ Common::String res;
+ const T Num = Number;
+
+ if (Number == 0) {
+ return "0";
+ }
+
+ if (Number < 0)
+ Number = -Number;
+
+ while (Number > 0) {
+ T d = Number % 10;
+ res += ('0' + d);
+ Number /= 10;
+ }
+
+ if (Num < 0)
+ res += "-";
+
+ // reverse string
+ Common::String revStr;
+ for (int i = res.size() - 1; i >= 0; i--)
+ revStr += res[i];
+
+ return revStr;
}
template <typename T>
-T StringToNumber ( char *Text )//Text not by const reference so that the function can be used with a
-{ //character array as argument
- std::stringstream ss(Text);
- T result;
- return (ss >> result) ? result : 0;
+T StringToNumber(char *Text) {
+ T result = 0;
+ char *num = Text;
+
+ if (Text[0] == '-')
+ num++;
+
+ for (int i = 0; num[i]; i++)
+ result = (result * 10) + (num[i] - '0');
+
+ return Text[0] == '-' ? -result : result;
}
template <typename T>
-T StringToNumber (const std::string &Text )
-{
- std::stringstream ss(Text.c_str());
- T result;
- return (ss >> result) ? result : 0;
+T StringToNumber(const Common::String &Text) {
+ return StringToNumber<T>(const_cast<char*>(Text.c_str()));
}
template <typename T>
-void GetPoint(T &v, std::string& coords )
-{
- int comma = coords.find_first_of(',');
+void GetPoint(T &v, Common::String& coords) {
+ int comma = coords.findFirstOf(',');
v.x = StringToNumber<int>( coords.substr(0,comma) );
v.y = StringToNumber<int>( coords.substr(comma+1));
-}
\ No newline at end of file
+}
+
+} // End of namespace Crab
Commit: 40723d0ec5aad77983322dc3a6ea042ddb0f6aec
https://github.com/scummvm/scummvm/commit/40723d0ec5aad77983322dc3a6ea042ddb0f6aec
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::File to open files
Changed paths:
engines/crab/XMLDoc.cpp
engines/crab/filesystem.cpp
engines/crab/filesystem.h
engines/crab/module.mk
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index d70638d20cc..e2f4dd7203b 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -4,10 +4,12 @@
namespace Crab {
void XMLDoc::Load(const Common::String &filename) {
+ const Common::Path path(filename);
+
if (ready())
doc.clear();
- if (FileOpen(filename.c_str(), text))
+ if (FileOpen(path, text))
if (text != NULL)
doc.parse<0>(text);
}
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index fb1359a5993..488dcebe502 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -1,56 +1,37 @@
-#include "stdafx.h"
-#include "filesystem.h"
+#include "common/file.h"
+#include "engines/crab/filesystem.h"
-using namespace boost::filesystem;
+namespace Crab {
-#ifdef __GNUC__
-int fopen_s(FILE** file, const char * filename, const char * mode)
-{
- if(file)
- {
- *file = fopen(filename,mode);
- return *file == NULL;
- }
-
- return 0;
-}
-#endif
-
-bool FileOpen(const char *path, char* &data)
+bool FileOpen(const Common::Path &path, char* &data)
{
if (data != NULL)
delete[] data;
- FILE* file;
- if (fopen_s(&file, path, "rb"))
- {
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to open file", path, NULL);
+ Common::File file;
+ if (!file.open(path)) {
+ warning("Unable to open file %s", path.toString().c_str());
data = NULL;
+ return false;
}
- else
- {
- fseek(file, 0L, SEEK_END);
- long int length = ftell(file);
- data = new char[length + 1];
- data[length] = '\0';
-
- fseek(file, 0L, SEEK_SET);
- long int nread = fread(data, 1, length, file);
- fclose(file);
-
- if (nread < length) // An error has occurred
- {
- delete[] data;
- data = NULL;
- }
- else
- return true;
- }
- return false;
+ // allocate data
+ int64 len = file.size();
+ data = new char[len + 1];
+ data[len] = '\0';
+
+ // read the file into data
+ file.read(data, len);
+ file.close();
+
+ return true;
}
+#if 0
bool PathCompare(const path &p1, const path &p2)
{
return last_write_time(p1) > last_write_time(p2);
-}
\ No newline at end of file
+}
+#endif
+
+} // namespace Crab
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index 48114b41687..6d05f6fd475 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -1,10 +1,9 @@
#pragma once
#include "common_header.h"
-#ifdef __GNUC__
-int fopen_s(FILE** file, const char * filename, const char * mode);
+namespace Crab {
+ bool FileOpen(const Common::Path &path, char* &data);
+#if 0
+ bool PathCompare(const boost::filesystem::path &p1, const boost::filesystem::path &p2);
#endif
-
-bool FileOpen(const char *path, char* &data);
-
-bool PathCompare(const boost::filesystem::path &p1, const boost::filesystem::path &p2);
\ No newline at end of file
+} // End of namespace Crab
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index a1128a843b6..48d881bfb2b 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -3,7 +3,10 @@ MODULE := engines/crab
MODULE_OBJS = \
crab.o \
console.o \
- metaengine.o
+ metaengine.o \
+ filesystem.o \
+ XMLDoc.o \
+ loaders.o
# This module can be built as a plugin
ifeq ($(ENABLE_CRAB), DYNAMIC_PLUGIN)
Commit: 1c4fac39ce55c6522e91ca64ba932c21001ad95f
https://github.com/scummvm/scummvm/commit/1c4fac39ce55c6522e91ca64ba932c21001ad95f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Run clang-format
Changed paths:
engines/crab/AlphaImage.cpp
engines/crab/AlphaImage.h
engines/crab/AnimationEffect.h
engines/crab/AnimationFrame.cpp
engines/crab/AnimationFrame.h
engines/crab/Caption.cpp
engines/crab/Caption.h
engines/crab/ChapterIntro.cpp
engines/crab/ChapterIntro.h
engines/crab/ClipButton.cpp
engines/crab/ClipButton.h
engines/crab/CreditScreen.cpp
engines/crab/CreditScreen.h
engines/crab/DevConsole.cpp
engines/crab/DevConsole.h
engines/crab/EventSeqGroup.cpp
engines/crab/EventSeqGroup.h
engines/crab/EventSequence.cpp
engines/crab/EventSequence.h
engines/crab/FileData.cpp
engines/crab/FileData.h
engines/crab/FileMenu.cpp
engines/crab/FileMenu.h
engines/crab/GameClock.h
engines/crab/GameEventInfo.cpp
engines/crab/GameEventInfo.h
engines/crab/GameOverMenu.cpp
engines/crab/GameOverMenu.h
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/GeneralSettingMenu.cpp
engines/crab/GeneralSettingMenu.h
engines/crab/GfxSettingMenu.cpp
engines/crab/GfxSettingMenu.h
engines/crab/HealthIndicator.cpp
engines/crab/HealthIndicator.h
engines/crab/HoverInfo.cpp
engines/crab/HoverInfo.h
engines/crab/Image.cpp
engines/crab/Image.h
engines/crab/ImageData.cpp
engines/crab/ImageData.h
engines/crab/ImageManager.cpp
engines/crab/ImageManager.h
engines/crab/Inventory.cpp
engines/crab/Inventory.h
engines/crab/Item.cpp
engines/crab/Item.h
engines/crab/ItemCollection.cpp
engines/crab/ItemCollection.h
engines/crab/ItemDesc.h
engines/crab/ItemMenu.cpp
engines/crab/ItemMenu.h
engines/crab/ItemSlot.cpp
engines/crab/ItemSlot.h
engines/crab/KeyBindMenu.cpp
engines/crab/KeyBindMenu.h
engines/crab/LevelExit.cpp
engines/crab/LevelExit.h
engines/crab/LevelResult.h
engines/crab/Line.cpp
engines/crab/Line.h
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/MapData.cpp
engines/crab/MapData.h
engines/crab/MapMarkerMenu.cpp
engines/crab/MapMarkerMenu.h
engines/crab/ModMenu.cpp
engines/crab/ModMenu.h
engines/crab/MusicArea.cpp
engines/crab/MusicArea.h
engines/crab/MusicManager.cpp
engines/crab/MusicManager.h
engines/crab/OptionMenu.cpp
engines/crab/OptionMenu.h
engines/crab/OptionSelect.cpp
engines/crab/OptionSelect.h
engines/crab/PageMenu.h
engines/crab/ParagraphData.cpp
engines/crab/ParagraphData.h
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGraphNode.h
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/PauseMenu.cpp
engines/crab/PauseMenu.h
engines/crab/PersonHandler.cpp
engines/crab/PersonHandler.h
engines/crab/PersonScreen.cpp
engines/crab/PersonScreen.h
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/PopUp.cpp
engines/crab/PopUp.h
engines/crab/PriorityQueue.h
engines/crab/ProgressBar.cpp
engines/crab/ProgressBar.h
engines/crab/QuestText.cpp
engines/crab/QuestText.h
engines/crab/RadioButton.h
engines/crab/RadioButtonMenu.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/ReplyButton.cpp
engines/crab/ReplyButton.h
engines/crab/ReplyMenu.cpp
engines/crab/ReplyMenu.h
engines/crab/ResolutionMenu.cpp
engines/crab/ResolutionMenu.h
engines/crab/SaveGameMenu.cpp
engines/crab/SaveGameMenu.h
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/SectionHeader.cpp
engines/crab/SectionHeader.h
engines/crab/Shape.cpp
engines/crab/Shape.h
engines/crab/SlideShow.cpp
engines/crab/SlideShow.h
engines/crab/SpriteConstant.cpp
engines/crab/SpriteConstant.h
engines/crab/Stairs.cpp
engines/crab/Stairs.h
engines/crab/Stat.cpp
engines/crab/Stat.h
engines/crab/StatDrawHelper.cpp
engines/crab/StatDrawHelper.h
engines/crab/StatPreview.cpp
engines/crab/StatPreview.h
engines/crab/StatTemplate.cpp
engines/crab/StatTemplate.h
engines/crab/StateButton.cpp
engines/crab/StateButton.h
engines/crab/TMXLayer.cpp
engines/crab/TMXLayer.h
engines/crab/TMXMap.cpp
engines/crab/TMXMap.h
engines/crab/TMXTileSet.cpp
engines/crab/TMXTileSet.h
engines/crab/TextData.h
engines/crab/TextManager.cpp
engines/crab/TextManager.h
engines/crab/TileInfo.h
engines/crab/ToggleButton.cpp
engines/crab/ToggleButton.h
engines/crab/TraitButton.cpp
engines/crab/TraitButton.h
engines/crab/TraitMenu.cpp
engines/crab/TraitMenu.h
engines/crab/XMLDoc.cpp
engines/crab/XMLDoc.h
engines/crab/animation.cpp
engines/crab/animation.h
engines/crab/animframe.cpp
engines/crab/animframe.h
engines/crab/animset.cpp
engines/crab/animset.h
engines/crab/app.cpp
engines/crab/app.h
engines/crab/bonus.h
engines/crab/button.cpp
engines/crab/button.h
engines/crab/changeval.h
engines/crab/collision.cpp
engines/crab/collision.h
engines/crab/color.cpp
engines/crab/color.h
engines/crab/common_header.h
engines/crab/console.cpp
engines/crab/console.h
engines/crab/conversationdata.cpp
engines/crab/conversationdata.h
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/cursor.cpp
engines/crab/cursor.h
engines/crab/detection.cpp
engines/crab/detection.h
engines/crab/detection_tables.h
engines/crab/dialogbox.cpp
engines/crab/dialogbox.h
engines/crab/effect.cpp
engines/crab/effect.h
engines/crab/element.cpp
engines/crab/element.h
engines/crab/emotion.cpp
engines/crab/emotion.h
engines/crab/eventstore.cpp
engines/crab/eventstore.h
engines/crab/fightanim.cpp
engines/crab/fightanim.h
engines/crab/fightinput.cpp
engines/crab/fightinput.h
engines/crab/fightmove.cpp
engines/crab/fightmove.h
engines/crab/fightmoves.cpp
engines/crab/fightmoves.h
engines/crab/filesystem.cpp
engines/crab/filesystem.h
engines/crab/fm_ai_data.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gameevent.cpp
engines/crab/gameevent.h
engines/crab/gameeventmanager.cpp
engines/crab/gameeventmanager.h
engines/crab/gamestate_container.h
engines/crab/gamestates.h
engines/crab/gametype.h
engines/crab/hotkey.cpp
engines/crab/hotkey.h
engines/crab/hud.cpp
engines/crab/hud.h
engines/crab/imageeffect.cpp
engines/crab/imageeffect.h
engines/crab/input.cpp
engines/crab/input.h
engines/crab/inputval.cpp
engines/crab/inputval.h
engines/crab/journal.cpp
engines/crab/journal.h
engines/crab/level.cpp
engines/crab/level.h
engines/crab/level_ai.cpp
engines/crab/level_collide.cpp
engines/crab/level_draw.cpp
engines/crab/level_load.cpp
engines/crab/level_objects.cpp
engines/crab/level_objects.h
engines/crab/levelpaths.h
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/main.cpp
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/map.cpp
engines/crab/map.h
engines/crab/mapbutton.h
engines/crab/menu.h
engines/crab/metaengine.cpp
engines/crab/moveeffect.cpp
engines/crab/moveeffect.h
engines/crab/movement.cpp
engines/crab/movement.h
engines/crab/musicparam.h
engines/crab/numstr.h
engines/crab/opinion.cpp
engines/crab/opinion.h
engines/crab/person.cpp
engines/crab/person.h
engines/crab/personbase.cpp
engines/crab/personbase.h
engines/crab/quest.cpp
engines/crab/quest.h
engines/crab/questmenu.cpp
engines/crab/questmenu.h
engines/crab/range.h
engines/crab/shadow.h
engines/crab/slider.cpp
engines/crab/slider.h
engines/crab/splash.cpp
engines/crab/splash.h
engines/crab/sprite.cpp
engines/crab/sprite.h
engines/crab/spriteai.cpp
engines/crab/spriteai.h
engines/crab/talknotify.cpp
engines/crab/talknotify.h
engines/crab/textarea.cpp
engines/crab/textarea.h
engines/crab/textdata.cpp
engines/crab/timer.cpp
engines/crab/timer.h
engines/crab/trait.cpp
engines/crab/trait.h
engines/crab/trigger.cpp
engines/crab/trigger.h
engines/crab/triggerset.cpp
engines/crab/triggerset.h
engines/crab/url.cpp
engines/crab/vectors.h
engines/crab/walkframes.cpp
engines/crab/walkframes.h
diff --git a/engines/crab/AlphaImage.cpp b/engines/crab/AlphaImage.cpp
index 28ec692cce7..ee39ff7b6e1 100644
--- a/engines/crab/AlphaImage.cpp
+++ b/engines/crab/AlphaImage.cpp
@@ -1,12 +1,11 @@
-#include "stdafx.h"
#include "AlphaImage.h"
#include "TextManager.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void AlphaImage::Load(rapidxml::xml_node<char> *node, const bool &echo)
-{
+void AlphaImage::Load(rapidxml::xml_node<char> *node, const bool &echo) {
pos.Load(node, echo);
LoadImgKey(img, "img", node, echo);
@@ -17,22 +16,16 @@ void AlphaImage::Load(rapidxml::xml_node<char> *node, const bool &echo)
alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
}
-void AlphaImage::InternalEvents()
-{
- if (alpha.inc)
- {
+void AlphaImage::InternalEvents() {
+ if (alpha.inc) {
alpha.cur += alpha.change;
- if (alpha.cur >= alpha.max)
- {
+ if (alpha.cur >= alpha.max) {
alpha.cur = alpha.max;
alpha.inc = false;
}
- }
- else
- {
+ } else {
alpha.cur -= alpha.change;
- if (alpha.cur <= alpha.min)
- {
+ if (alpha.cur <= alpha.min) {
alpha.cur = alpha.min;
alpha.inc = true;
}
@@ -42,8 +35,7 @@ void AlphaImage::InternalEvents()
gImageManager.GetTexture(img).Alpha(alpha.cur);
}
-void AlphaImage::Draw(const int &XOffset, const int &YOffset)
-{
+void AlphaImage::Draw(const int &XOffset, const int &YOffset) {
if (gImageManager.ValidTexture(img))
gImageManager.GetTexture(img).Draw(pos.x + XOffset, pos.y + YOffset);
}
\ No newline at end of file
diff --git a/engines/crab/AlphaImage.h b/engines/crab/AlphaImage.h
index 9f454dc8056..a4b4726043e 100644
--- a/engines/crab/AlphaImage.h
+++ b/engines/crab/AlphaImage.h
@@ -1,50 +1,52 @@
#pragma once
-#include "common_header.h"
#include "ImageManager.h"
+#include "common_header.h"
#include "element.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class AlphaImage
- {
- //The image used - we don't use the image manager
- //because we don't change the alpha for those images
- ImageKey img;
+namespace pyrodactyl {
+namespace ui {
+class AlphaImage {
+ // The image used - we don't use the image manager
+ // because we don't change the alpha for those images
+ ImageKey img;
- //The information for drawing the image
- Element pos;
+ // The information for drawing the image
+ Element pos;
- //The information related to alpha modulation of the image
- struct AlphaVal
- {
- int cur, min, max;
+ // The information related to alpha modulation of the image
+ struct AlphaVal {
+ int cur, min, max;
- //Are we increasing or decreasing the alpha
- bool inc;
+ // Are we increasing or decreasing the alpha
+ bool inc;
- //By how much do we change the alpha every update
- int change;
+ // By how much do we change the alpha every update
+ int change;
- AlphaVal() { cur = 255; min = 255; max = 255; inc = true; change = 0; }
- } alpha;
+ AlphaVal() {
+ cur = 255;
+ min = 255;
+ max = 255;
+ inc = true;
+ change = 0;
+ }
+ } alpha;
- public:
- AlphaImage(){}
- AlphaImage(rapidxml::xml_node<char> *node){ Load(node); }
+public:
+ AlphaImage() {}
+ AlphaImage(rapidxml::xml_node<char> *node) { Load(node); }
- ~AlphaImage(){}
+ ~AlphaImage() {}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
- //This is used to vary the alpha
- void InternalEvents();
+ // This is used to vary the alpha
+ void InternalEvents();
- void SetUI(){ pos.SetUI(); }
- };
- }
-}
\ No newline at end of file
+ void SetUI() { pos.SetUI(); }
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/AnimationEffect.h b/engines/crab/AnimationEffect.h
index 3ee7f8760da..ac88419cbc0 100644
--- a/engines/crab/AnimationEffect.h
+++ b/engines/crab/AnimationEffect.h
@@ -3,50 +3,60 @@
#include "common_header.h"
#include "loaders.h"
-namespace pyrodactyl
-{
- namespace anim
- {
- //Types of fade effects
- enum FadeType { FADE_NONE, FADE_IN, FADE_OUT };
-
- //Sometimes we need to stop drawing the game for proper fade effects
- //Use DRAW_STOP to stop drawing the game until DRAW_START is called. DRAW_SAME doesn't change anything
- enum DrawType { DRAW_SAME, DRAW_STOP, DRAW_START };
-
- struct AnimationEffect
- {
- //What sort of effect do we apply to the image
- FadeType type;
-
- //The duration of the effect relative to the start of this animation
- Uint32 start, finish;
-
- //Warning: the only way to start drawing the game again is having another animation event with DRAW_START
- DrawType draw_game;
-
- AnimationEffect() { type = FADE_NONE; draw_game = DRAW_SAME; start = 0; finish = 0; }
-
- AnimationEffect(rapidxml::xml_node<char> *node)
- {
- if (NodeValid("effect", node))
- {
- rapidxml::xml_node<char> *effnode = node->first_node("effect");
- LoadNum(start, "start", effnode);
- LoadNum(finish, "finish", effnode);
-
- std::string str;
- LoadStr(str, "type", effnode);
- if (str == "fade_in") type = FADE_IN;
- else if (str == "fade_out") type = FADE_OUT;
- else type = FADE_NONE;
-
- LoadStr(str, "game_draw", effnode);
- if (str == "start") draw_game = DRAW_START;
- else if (str == "stop") draw_game = DRAW_STOP;
- else draw_game = DRAW_SAME;
- }
- }
- };
+namespace pyrodactyl {
+namespace anim {
+// Types of fade effects
+enum FadeType { FADE_NONE,
+ FADE_IN,
+ FADE_OUT };
+
+// Sometimes we need to stop drawing the game for proper fade effects
+// Use DRAW_STOP to stop drawing the game until DRAW_START is called. DRAW_SAME doesn't change anything
+enum DrawType { DRAW_SAME,
+ DRAW_STOP,
+ DRAW_START };
+
+struct AnimationEffect {
+ // What sort of effect do we apply to the image
+ FadeType type;
+
+ // The duration of the effect relative to the start of this animation
+ Uint32 start, finish;
+
+ // Warning: the only way to start drawing the game again is having another animation event with DRAW_START
+ DrawType draw_game;
+
+ AnimationEffect() {
+ type = FADE_NONE;
+ draw_game = DRAW_SAME;
+ start = 0;
+ finish = 0;
}
-}
\ No newline at end of file
+
+ AnimationEffect(rapidxml::xml_node<char> *node) {
+ if (NodeValid("effect", node)) {
+ rapidxml::xml_node<char> *effnode = node->first_node("effect");
+ LoadNum(start, "start", effnode);
+ LoadNum(finish, "finish", effnode);
+
+ std::string str;
+ LoadStr(str, "type", effnode);
+ if (str == "fade_in")
+ type = FADE_IN;
+ else if (str == "fade_out")
+ type = FADE_OUT;
+ else
+ type = FADE_NONE;
+
+ LoadStr(str, "game_draw", effnode);
+ if (str == "start")
+ draw_game = DRAW_START;
+ else if (str == "stop")
+ draw_game = DRAW_STOP;
+ else
+ draw_game = DRAW_SAME;
+ }
+ }
+};
+} // End of namespace anim
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/AnimationFrame.cpp b/engines/crab/AnimationFrame.cpp
index 6111ed48b95..8639069a3d7 100644
--- a/engines/crab/AnimationFrame.cpp
+++ b/engines/crab/AnimationFrame.cpp
@@ -1,11 +1,10 @@
-#include "stdafx.h"
#include "AnimationFrame.h"
+#include "stdafx.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
-AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : eff(node)
-{
+AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : eff(node) {
Vector2i::Load(node);
LoadImgKey(img, "img", node);
LoadNum(start, "start", node);
@@ -18,22 +17,24 @@ AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : eff(node)
Reset();
}
-void AnimationFrame::Reset()
-{
- switch (eff.type)
- {
- case FADE_IN: col.a = 0; break;
- case FADE_OUT: col.a = 255; break;
- default: col.a = 255; break;
+void AnimationFrame::Reset() {
+ switch (eff.type) {
+ case FADE_IN:
+ col.a = 0;
+ break;
+ case FADE_OUT:
+ col.a = 255;
+ break;
+ default:
+ col.a = 255;
+ break;
}
}
-void AnimationFrame::Draw(const Uint32 ×tamp)
-{
- //Only draw the frame in the specified duration
- if (timestamp >= start && timestamp <= finish)
- {
- //Fill the screen with the color indicated
+void AnimationFrame::Draw(const Uint32 ×tamp) {
+ // Only draw the frame in the specified duration
+ if (timestamp >= start && timestamp <= finish) {
+ // Fill the screen with the color indicated
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, col.r, col.g, col.b, col.a);
SDL_RenderFillRect(gRenderer, NULL);
@@ -43,17 +44,19 @@ void AnimationFrame::Draw(const Uint32 ×tamp)
}
}
-DrawType AnimationFrame::InternalEvents(const Uint32 ×tamp)
-{
- //Vary alpha according to the effect values in the variation time frame
- if (timestamp >= eff.start && timestamp <= eff.finish)
- {
- //These equations courtesy of linear algebra
- switch (eff.type)
- {
- case FADE_IN: col.a = (255 * (timestamp - eff.start)) / (eff.finish - eff.start); break;
- case FADE_OUT: col.a = (255 * (eff.finish - timestamp)) / (eff.finish - eff.start); break;
- default: break;
+DrawType AnimationFrame::InternalEvents(const Uint32 ×tamp) {
+ // Vary alpha according to the effect values in the variation time frame
+ if (timestamp >= eff.start && timestamp <= eff.finish) {
+ // These equations courtesy of linear algebra
+ switch (eff.type) {
+ case FADE_IN:
+ col.a = (255 * (timestamp - eff.start)) / (eff.finish - eff.start);
+ break;
+ case FADE_OUT:
+ col.a = (255 * (eff.finish - timestamp)) / (eff.finish - eff.start);
+ break;
+ default:
+ break;
}
return eff.draw_game;
diff --git a/engines/crab/AnimationFrame.h b/engines/crab/AnimationFrame.h
index f4c03c0ca20..a4044ffcd7b 100644
--- a/engines/crab/AnimationFrame.h
+++ b/engines/crab/AnimationFrame.h
@@ -1,38 +1,43 @@
#pragma once
-#include "common_header.h"
#include "AnimationEffect.h"
+#include "HoverInfo.h"
#include "ImageManager.h"
#include "TextManager.h"
-#include "HoverInfo.h"
-
-namespace pyrodactyl
-{
- namespace anim
- {
- struct AnimationFrame : public Vector2i
- {
- //The image drawn in this frame
- ImageKey img;
+#include "common_header.h"
- //This is the time in we draw the frame milliseconds relative to the start of the entire animation
- Uint32 start, finish;
+namespace pyrodactyl {
+namespace anim {
+struct AnimationFrame : public Vector2i {
+ // The image drawn in this frame
+ ImageKey img;
- //The effect applied to the image
- AnimationEffect eff;
+ // This is the time in we draw the frame milliseconds relative to the start of the entire animation
+ Uint32 start, finish;
- //In case we want to display any words during the animation
- pyrodactyl::ui::HoverInfo text;
+ // The effect applied to the image
+ AnimationEffect eff;
- //The color drawn on the screen
- SDL_Color col;
+ // In case we want to display any words during the animation
+ pyrodactyl::ui::HoverInfo text;
- AnimationFrame(){ img = 0; start = 0; finish = 0; col.r = 0; col.g = 0; col.b = 0; col.a = 255; }
- AnimationFrame(rapidxml::xml_node<char> *node);
+ // The color drawn on the screen
+ SDL_Color col;
- void Reset();
- void Draw(const Uint32 ×tamp);
- DrawType InternalEvents(const Uint32 ×tamp);
- };
+ AnimationFrame() {
+ img = 0;
+ start = 0;
+ finish = 0;
+ col.r = 0;
+ col.g = 0;
+ col.b = 0;
+ col.a = 255;
}
-}
\ No newline at end of file
+ AnimationFrame(rapidxml::xml_node<char> *node);
+
+ void Reset();
+ void Draw(const Uint32 ×tamp);
+ DrawType InternalEvents(const Uint32 ×tamp);
+};
+} // End of namespace anim
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/Caption.cpp b/engines/crab/Caption.cpp
index 06f7fd9982a..02146c89213 100644
--- a/engines/crab/Caption.cpp
+++ b/engines/crab/Caption.cpp
@@ -5,28 +5,23 @@
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
-void Caption :: Init(const Caption &c, const int &XOffset, const int &YOffset)
-{
+void Caption::Init(const Caption &c, const int &XOffset, const int &YOffset) {
*this = c;
x += XOffset;
y += YOffset;
}
-void Caption :: Load(rapidxml::xml_node<char> *node, Rect *parent)
-{
- if(TextData::Load(node,parent,false))
- {
+void Caption::Load(rapidxml::xml_node<char> *node, Rect *parent) {
+ if (TextData::Load(node, parent, false)) {
LoadStr(text, "text", node);
- LoadNum(col_s,"color_s",node,false);
+ LoadNum(col_s, "color_s", node, false);
enabled = true;
}
}
-void Caption :: Draw(bool selected, const int &XOffset, const int &YOffset)
-{
- if(enabled)
- {
- if(selected)
+void Caption::Draw(bool selected, const int &XOffset, const int &YOffset) {
+ if (enabled) {
+ if (selected)
TextData::DrawColor(text, col_s, XOffset, YOffset);
else
TextData::Draw(text, XOffset, YOffset);
diff --git a/engines/crab/Caption.h b/engines/crab/Caption.h
index cf382a383e0..edb7b78885c 100644
--- a/engines/crab/Caption.h
+++ b/engines/crab/Caption.h
@@ -3,26 +3,26 @@
#include "TextData.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- //Caption for buttons
- class Caption : public TextData
- {
- public:
- bool enabled;
- int col_s;
+namespace pyrodactyl {
+namespace ui {
+// Caption for buttons
+class Caption : public TextData {
+public:
+ bool enabled;
+ int col_s;
- std::string text;
+ std::string text;
- Caption(void){ col_s = 0; enabled = false; }
- ~Caption(void){}
+ Caption(void) {
+ col_s = 0;
+ enabled = false;
+ }
+ ~Caption(void) {}
- void Init(const Caption &c, const int &XOffset = 0, const int &YOffset = 0);
+ void Init(const Caption &c, const int &XOffset = 0, const int &YOffset = 0);
- void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
- void Draw(bool selected, const int &XOffset = 0, const int &YOffset = 0);
- };
- }
-}
\ No newline at end of file
+ void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
+ void Draw(bool selected, const int &XOffset = 0, const int &YOffset = 0);
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/ChapterIntro.cpp b/engines/crab/ChapterIntro.cpp
index f28eb257f5a..e18a471b209 100644
--- a/engines/crab/ChapterIntro.cpp
+++ b/engines/crab/ChapterIntro.cpp
@@ -1,11 +1,10 @@
-#include "stdafx.h"
#include "ChapterIntro.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void ChapterIntro::Load(rapidxml::xml_node<char> *node)
-{
+void ChapterIntro::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("dialog", node))
dialog.Load(node->first_node("dialog"));
@@ -16,8 +15,7 @@ void ChapterIntro::Load(rapidxml::xml_node<char> *node)
traits.Load(node->first_node("trait"));
}
-bool ChapterIntro::HandleEvents(SDL_Event &Event)
-{
+bool ChapterIntro::HandleEvents(SDL_Event &Event) {
if (traits.HandleEvents(Event))
show_traits = true;
@@ -25,15 +23,13 @@ bool ChapterIntro::HandleEvents(SDL_Event &Event)
}
void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
- pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state)
-{
+ pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state) {
dialog.Draw(false);
dialog.Draw(info, text);
traits.Draw();
- if (cur_sp != nullptr)
- {
+ if (cur_sp != nullptr) {
Rect clip = cur_sp->DialogClip(state);
gImageManager.Draw(pos.x, pos.y, cur_sp->Img(), &clip);
}
diff --git a/engines/crab/ChapterIntro.h b/engines/crab/ChapterIntro.h
index 4bde3e52d71..43f29c036f8 100644
--- a/engines/crab/ChapterIntro.h
+++ b/engines/crab/ChapterIntro.h
@@ -1,35 +1,32 @@
#pragma once
+#include "GameEventInfo.h"
#include "button.h"
#include "dialogbox.h"
-#include "GameEventInfo.h"
#include "sprite.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class ChapterIntro
- {
- //This contains the background image info and start button
- GameDialogBox dialog;
+namespace pyrodactyl {
+namespace ui {
+class ChapterIntro {
+ // This contains the background image info and start button
+ GameDialogBox dialog;
- //This is where the sprite is drawn
- Element pos;
+ // This is where the sprite is drawn
+ Element pos;
- //The traits button
- Button traits;
+ // The traits button
+ Button traits;
- public:
- //Should we show the traits screen
- bool show_traits;
+public:
+ // Should we show the traits screen
+ bool show_traits;
- ChapterIntro(){ show_traits = false; }
+ ChapterIntro() { show_traits = false; }
- void Load(rapidxml::xml_node<char> *node);
- bool HandleEvents(SDL_Event &Event);
- void Draw(pyrodactyl::event::Info &info, std::string &text,
- pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state);
- };
- }
-}
+ void Load(rapidxml::xml_node<char> *node);
+ bool HandleEvents(SDL_Event &Event);
+ void Draw(pyrodactyl::event::Info &info, std::string &text,
+ pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state);
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ClipButton.cpp b/engines/crab/ClipButton.cpp
index c35209c9d11..b8a215669de 100644
--- a/engines/crab/ClipButton.cpp
+++ b/engines/crab/ClipButton.cpp
@@ -5,14 +5,12 @@
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void ClipButton :: Load(rapidxml::xml_node<char> * node, const bool &echo)
-{
+void ClipButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
Button::Load(node, echo);
- if(NodeValid("clip", node, false))
+ if (NodeValid("clip", node, false))
clip.Load(node->first_node("clip"));
- else
- {
+ else {
clip.x = 0;
clip.y = 0;
clip.w = gImageManager.GetTexture(img.normal).W();
@@ -20,7 +18,6 @@ void ClipButton :: Load(rapidxml::xml_node<char> * node, const bool &echo)
}
}
-void ClipButton :: Draw(const int &XOffset, const int &YOffset)
-{
+void ClipButton::Draw(const int &XOffset, const int &YOffset) {
Button::Draw(XOffset, YOffset, &clip);
}
\ No newline at end of file
diff --git a/engines/crab/ClipButton.h b/engines/crab/ClipButton.h
index 3387d3d892f..50792e8ce03 100644
--- a/engines/crab/ClipButton.h
+++ b/engines/crab/ClipButton.h
@@ -1,23 +1,20 @@
#pragma once
-#include "common_header.h"
#include "button.h"
+#include "common_header.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- //Sometimes we need to display a clipped version of the button image
- class ClipButton : public Button
- {
- public:
- //The clip rectangle
- Rect clip;
+namespace pyrodactyl {
+namespace ui {
+// Sometimes we need to display a clipped version of the button image
+class ClipButton : public Button {
+public:
+ // The clip rectangle
+ Rect clip;
- ClipButton(){}
- ~ClipButton(){}
+ ClipButton() {}
+ ~ClipButton() {}
- void Load(rapidxml::xml_node<char> * node, const bool &echo = true);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
- };
- }
-}
+ void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
diff --git a/engines/crab/CreditScreen.cpp b/engines/crab/CreditScreen.cpp
index 9e5425d7614..e76ec290eeb 100644
--- a/engines/crab/CreditScreen.cpp
+++ b/engines/crab/CreditScreen.cpp
@@ -1,23 +1,20 @@
-#include "stdafx.h"
#include "CreditScreen.h"
+#include "stdafx.h"
#include "url.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
-void CreditScreen::Reset()
-{
+void CreditScreen::Reset() {
start.x = gScreenSettings.cur.w / 2 - 150;
start.y = gScreenSettings.cur.h + 20;
cur.x = start.x;
speed.cur = speed.slow;
}
-void CreditScreen::Load(const std::string &filename)
-{
+void CreditScreen::Load(const std::string &filename) {
XMLDoc conf(filename);
- if (conf.ready())
- {
+ if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("credits");
if (NodeValid("bg", node))
@@ -41,22 +38,19 @@ void CreditScreen::Load(const std::string &filename)
if (NodeValid("twitter", node))
back.Load(node->first_node("back"));
- if (NodeValid("fast", node))
- {
+ if (NodeValid("fast", node)) {
rapidxml::xml_node<char> *fnode = node->first_node("fast");
fast.Load(fnode);
LoadNum(speed.fast, "val", fnode);
}
- if (NodeValid("slow", node))
- {
+ if (NodeValid("slow", node)) {
rapidxml::xml_node<char> *snode = node->first_node("slow");
slow.Load(snode);
LoadNum(speed.slow, "val", snode);
}
- if (NodeValid("reverse", node))
- {
+ if (NodeValid("reverse", node)) {
rapidxml::xml_node<char> *rnode = node->first_node("reverse");
reverse.Load(rnode);
LoadNum(speed.reverse, "val", rnode);
@@ -67,11 +61,9 @@ void CreditScreen::Load(const std::string &filename)
if (NodeValid("pause", node))
pause.Load(node->first_node("pause"));
- if (NodeValid("text", node))
- {
+ if (NodeValid("text", node)) {
rapidxml::xml_node<char> *tnode = node->first_node("text");
- for (rapidxml::xml_node<char> *n = tnode->first_node(); n != NULL; n = n->next_sibling())
- {
+ for (rapidxml::xml_node<char> *n = tnode->first_node(); n != NULL; n = n->next_sibling()) {
CreditText t;
t.text = n->value();
t.heading = (n->name()[0] == 'h');
@@ -81,8 +73,7 @@ void CreditScreen::Load(const std::string &filename)
}
}
-bool CreditScreen::HandleEvents(SDL_Event& Event)
-{
+bool CreditScreen::HandleEvents(SDL_Event &Event) {
if (slow.HandleEvents(Event) == BUAC_LCLICK)
speed.cur = speed.slow;
else if (fast.HandleEvents(Event) == BUAC_LCLICK)
@@ -100,8 +91,7 @@ bool CreditScreen::HandleEvents(SDL_Event& Event)
return (back.HandleEvents(Event) == BUAC_LCLICK);
}
-void CreditScreen::Draw()
-{
+void CreditScreen::Draw() {
bg.Draw();
slow.Draw();
@@ -117,35 +107,31 @@ void CreditScreen::Draw()
cur.y = start.y;
- for (auto i = list.begin(); i != list.end(); ++i)
- {
+ for (auto i = list.begin(); i != list.end(); ++i) {
cur.y += paragraph.inc;
- if (i->heading)
- {
+ if (i->heading) {
cur.y += heading.inc;
- if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40) //Only draw text if it is actually visible on screen
+ if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40) // Only draw text if it is actually visible on screen
gTextManager.Draw(cur.x, cur.y, i->text, heading.color, heading.font, heading.align);
- }
- else if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40)
+ } else if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40)
gTextManager.Draw(cur.x, cur.y, i->text, paragraph.color, paragraph.font, paragraph.align);
- //If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
+ // If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
if (cur.y > gScreenSettings.cur.h + 40)
break;
}
start.y -= speed.cur;
- //Sanity check so that we don't scroll too high or low
+ // Sanity check so that we don't scroll too high or low
if (start.y > gScreenSettings.cur.h + 40)
start.y = gScreenSettings.cur.h + 40;
else if (start.y < INT_MIN + 10)
start.y = INT_MIN + 10;
}
-void CreditScreen::SetUI()
-{
+void CreditScreen::SetUI() {
bg.SetUI();
back.SetUI();
diff --git a/engines/crab/CreditScreen.h b/engines/crab/CreditScreen.h
index ee87cf7c44e..d00304559e8 100644
--- a/engines/crab/CreditScreen.h
+++ b/engines/crab/CreditScreen.h
@@ -1,87 +1,90 @@
#pragma once
-#include "common_header.h"
#include "ImageData.h"
#include "TextData.h"
#include "TextManager.h"
-#include "timer.h"
#include "button.h"
+#include "common_header.h"
+#include "timer.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class CreditScreen
- {
- //Text and formatting information
- struct CreditText
- {
- //Title of the section (stuff like programmer, designer etc)
- std::string text;
-
- //The style it should be drawn in
- bool heading;
- };
-
- //The background image and company logo
- pyrodactyl::ui::ImageData bg, logo;
-
- //The names displayed in the credits
- std::vector<CreditText> list;
-
- //The starting position
- Vector2i start;
-
- //The current position
- Vector2D<long> cur;
-
- //Text parameters
- struct TextParam
- {
- int inc, color;
- FontKey font;
- Align align;
-
- TextParam(){ inc = 30; color = 0; font = 1; align = ALIGN_CENTER; }
-
- void Load(rapidxml::xml_node<char> *node)
- {
- LoadNum(inc, "inc", node);
- LoadNum(color, "color", node);
- LoadFontKey(font, "font", node);
- LoadAlign(align, node);
- }
- } heading, paragraph;
-
- //All speed levels at which credits can scroll through
- struct ScrollSpeed
- {
- //The current speed
- float cur;
-
- //Various levels
- float slow, fast, reverse;
-
- ScrollSpeed(){ slow = 1.0f; fast = 4.0f; reverse = -2.0f; cur = slow; }
- } speed;
-
- //Speed controls for credits
- Button fast, slow, reverse, pause;
-
- //The back button, website and twitter buttons
- Button back, website, twitter;
-
- public:
- CreditScreen(){ Reset(); }
- ~CreditScreen(){}
-
- void Load(const std::string &filename);
- void Reset();
-
- bool HandleEvents(SDL_Event& Event);
- void Draw();
-
- void SetUI();
- };
- }
-}
\ No newline at end of file
+namespace pyrodactyl {
+namespace ui {
+class CreditScreen {
+ // Text and formatting information
+ struct CreditText {
+ // Title of the section (stuff like programmer, designer etc)
+ std::string text;
+
+ // The style it should be drawn in
+ bool heading;
+ };
+
+ // The background image and company logo
+ pyrodactyl::ui::ImageData bg, logo;
+
+ // The names displayed in the credits
+ std::vector<CreditText> list;
+
+ // The starting position
+ Vector2i start;
+
+ // The current position
+ Vector2D<long> cur;
+
+ // Text parameters
+ struct TextParam {
+ int inc, color;
+ FontKey font;
+ Align align;
+
+ TextParam() {
+ inc = 30;
+ color = 0;
+ font = 1;
+ align = ALIGN_CENTER;
+ }
+
+ void Load(rapidxml::xml_node<char> *node) {
+ LoadNum(inc, "inc", node);
+ LoadNum(color, "color", node);
+ LoadFontKey(font, "font", node);
+ LoadAlign(align, node);
+ }
+ } heading, paragraph;
+
+ // All speed levels at which credits can scroll through
+ struct ScrollSpeed {
+ // The current speed
+ float cur;
+
+ // Various levels
+ float slow, fast, reverse;
+
+ ScrollSpeed() {
+ slow = 1.0f;
+ fast = 4.0f;
+ reverse = -2.0f;
+ cur = slow;
+ }
+ } speed;
+
+ // Speed controls for credits
+ Button fast, slow, reverse, pause;
+
+ // The back button, website and twitter buttons
+ Button back, website, twitter;
+
+public:
+ CreditScreen() { Reset(); }
+ ~CreditScreen() {}
+
+ void Load(const std::string &filename);
+ void Reset();
+
+ bool HandleEvents(SDL_Event &Event);
+ void Draw();
+
+ void SetUI();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/DevConsole.cpp b/engines/crab/DevConsole.cpp
index 040d90d969e..256b823c577 100644
--- a/engines/crab/DevConsole.cpp
+++ b/engines/crab/DevConsole.cpp
@@ -1,21 +1,17 @@
-#include "stdafx.h"
#include "DevConsole.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
-void DebugConsole::Load(const std::string &filename)
-{
+void DebugConsole::Load(const std::string &filename) {
XMLDoc conf(filename);
- if (conf.ready())
- {
+ if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("debug");
- if (NodeValid(node))
- {
+ if (NodeValid(node)) {
if (NodeValid("menu", node))
menu.Load(node->first_node("menu"));
- if (NodeValid("variable", node))
- {
+ if (NodeValid("variable", node)) {
rapidxml::xml_node<char> *varnode = node->first_node("variable");
if (NodeValid("bg", varnode))
@@ -37,10 +33,8 @@ void DebugConsole::Load(const std::string &filename)
}
}
-void DebugConsole::Draw(pyrodactyl::event::Info &info)
-{
- switch (state)
- {
+void DebugConsole::Draw(pyrodactyl::event::Info &info) {
+ switch (state) {
case STATE_NORMAL:
menu.Draw();
break;
@@ -59,33 +53,28 @@ void DebugConsole::Draw(pyrodactyl::event::Info &info)
}
break;
- default:break;
+ default:
+ break;
}
}
-void DebugConsole::HandleEvents(const SDL_Event &Event)
-{
- switch (state)
- {
- case STATE_NORMAL:
- {
+void DebugConsole::HandleEvents(const SDL_Event &Event) {
+ switch (state) {
+ case STATE_NORMAL: {
int choice = menu.HandleEvents(Event);
if (choice == 0)
state = STATE_VAR;
- }
- break;
+ } break;
case STATE_VAR:
text_field.HandleEvents(Event);
if (check.HandleEvents(Event))
var_name = text_field.text;
- //Control+V pastes clipboard text into text field
- if (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_V && Event.key.keysym.mod & KMOD_CTRL)
- {
- if (SDL_HasClipboardText() == SDL_TRUE)
- {
- char* temp = SDL_GetClipboardText();
+ // Control+V pastes clipboard text into text field
+ if (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_V && Event.key.keysym.mod & KMOD_CTRL) {
+ if (SDL_HasClipboardText() == SDL_TRUE) {
+ char *temp = SDL_GetClipboardText();
text_field.text = temp;
SDL_free(temp);
}
@@ -95,10 +84,10 @@ void DebugConsole::HandleEvents(const SDL_Event &Event)
state = STATE_NORMAL;
break;
- default:break;
+ default:
+ break;
}
}
-void DebugConsole::InternalEvents()
-{
+void DebugConsole::InternalEvents() {
}
\ No newline at end of file
diff --git a/engines/crab/DevConsole.h b/engines/crab/DevConsole.h
index d26c0c977b9..bb81f48c3ab 100644
--- a/engines/crab/DevConsole.h
+++ b/engines/crab/DevConsole.h
@@ -1,42 +1,40 @@
#pragma once
-#include "common_header.h"
#include "GameEventInfo.h"
+#include "common_header.h"
#include "textarea.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class DebugConsole
- {
- //The state of the menu
- enum { STATE_NORMAL, STATE_VAR } state;
-
- //The overarching menu that is the starting point for all functions
- ButtonMenu menu;
-
- //The dialog box UI - used to check value of a variable
- ImageData bg;
- Button check, back;
- TextData value;
- TextArea text_field;
-
- //The variable name we're tracking
- std::string var_name;
-
- public:
- DebugConsole(){ state = STATE_NORMAL; }
- ~DebugConsole(){}
-
- //Only restrict input when we're in variable state
- bool RestrictInput() { return (state == STATE_VAR || menu.HoverIndex() != -1); }
-
- void Load(const std::string &filename);
- void Draw(pyrodactyl::event::Info &info);
-
- void HandleEvents(const SDL_Event &Event);
- void InternalEvents();
- };
- }
-}
\ No newline at end of file
+namespace pyrodactyl {
+namespace ui {
+class DebugConsole {
+ // The state of the menu
+ enum { STATE_NORMAL,
+ STATE_VAR } state;
+
+ // The overarching menu that is the starting point for all functions
+ ButtonMenu menu;
+
+ // The dialog box UI - used to check value of a variable
+ ImageData bg;
+ Button check, back;
+ TextData value;
+ TextArea text_field;
+
+ // The variable name we're tracking
+ std::string var_name;
+
+public:
+ DebugConsole() { state = STATE_NORMAL; }
+ ~DebugConsole() {}
+
+ // Only restrict input when we're in variable state
+ bool RestrictInput() { return (state == STATE_VAR || menu.HoverIndex() != -1); }
+
+ void Load(const std::string &filename);
+ void Draw(pyrodactyl::event::Info &info);
+
+ void HandleEvents(const SDL_Event &Event);
+ void InternalEvents();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/EventSeqGroup.cpp b/engines/crab/EventSeqGroup.cpp
index 3c4bbdbac79..375cbbe3013 100644
--- a/engines/crab/EventSeqGroup.cpp
+++ b/engines/crab/EventSeqGroup.cpp
@@ -4,44 +4,36 @@
using namespace pyrodactyl::event;
-void EventSeqGroup::EndSeq(const unsigned int &id)
-{
+void EventSeqGroup::EndSeq(const unsigned int &id) {
seq.erase(id);
end.push_back(id);
}
-void EventSeqGroup::AddSeq(const unsigned int &id, std::string &path)
-{
+void EventSeqGroup::AddSeq(const unsigned int &id, std::string &path) {
seq[id].Load(path);
}
-bool EventSeqGroup::EventInProgress(const unsigned int &id)
-{
+bool EventSeqGroup::EventInProgress(const unsigned int &id) {
return seq.count(id) > 0 && seq.at(id).EventInProgress();
}
-GameEvent* EventSeqGroup::CurEvent(const unsigned int &id)
-{
+GameEvent *EventSeqGroup::CurEvent(const unsigned int &id) {
return seq.at(id).CurrentEvent();
}
void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const std::string &player_id,
- std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq, const int choice)
-{
+ std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq, const int choice) {
return seq.at(id).NextEvent(info, player_id, result, end_seq, choice);
}
-void EventSeqGroup::InternalEvents(Info &info)
-{
+void EventSeqGroup::InternalEvents(Info &info) {
for (auto it = seq.begin(); it != seq.end(); ++it)
it->second.InternalEvents(info);
}
-bool EventSeqGroup::ActiveSeq(unsigned int &active_seq)
-{
+bool EventSeqGroup::ActiveSeq(unsigned int &active_seq) {
for (auto i = seq.begin(); i != seq.end(); ++i)
- if (i->second.EventInProgress())
- {
+ if (i->second.EventInProgress()) {
active_seq = i->first;
return true;
}
@@ -50,10 +42,8 @@ bool EventSeqGroup::ActiveSeq(unsigned int &active_seq)
return false;
}
-void EventSeqGroup::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
- for (auto i = end.begin(); i != end.end(); ++i)
- {
+void EventSeqGroup::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ for (auto i = end.begin(); i != end.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "end");
child->value(gStrPool.Get(*i));
root->append_node(child);
@@ -63,14 +53,12 @@ void EventSeqGroup::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<
i->second.SaveState(doc, root, gStrPool.Get(i->first));
}
-void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node)
-{
+void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *i = node->first_node("end"); i != NULL; i = i->next_sibling("end"))
EndSeq(StringToNumber<unsigned int>(i->value()));
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set"))
- if (n->first_attribute("name") != NULL)
- {
+ if (n->first_attribute("name") != NULL) {
unsigned int id = StringToNumber<unsigned int>(n->first_attribute("name")->value());
if (seq.count(id) > 0)
seq[id].LoadState(n);
diff --git a/engines/crab/EventSeqGroup.h b/engines/crab/EventSeqGroup.h
index f9620a008f3..c04436cc0b2 100644
--- a/engines/crab/EventSeqGroup.h
+++ b/engines/crab/EventSeqGroup.h
@@ -3,37 +3,34 @@
#include "EventSequence.h"
-namespace pyrodactyl
-{
- namespace event
- {
- class EventSeqGroup
- {
- typedef std::unordered_map<unsigned int, EventSequence> SeqMap;
-
- //The event sequences in this group
- SeqMap seq;
-
- //The sequences that have ended in this group
- std::vector<unsigned int> end;
-
- public:
- EventSeqGroup(void){}
- ~EventSeqGroup(void){}
-
- void AddSeq(const unsigned int &id, std::string &path);
- void EndSeq(const unsigned int &id);
- bool EventInProgress(const unsigned int &id);
- bool ActiveSeq(unsigned int &active_seq);
-
- GameEvent* CurEvent(const unsigned int &id);
- void NextEvent(const unsigned int &id, Info &info, const std::string &player_id, std::vector<EventResult> &result,
- std::vector<EventSeqInfo> &end_seq, const int choice = -1);
-
- void InternalEvents(Info &info);
-
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
- };
- }
-}
\ No newline at end of file
+namespace pyrodactyl {
+namespace event {
+class EventSeqGroup {
+ typedef std::unordered_map<unsigned int, EventSequence> SeqMap;
+
+ // The event sequences in this group
+ SeqMap seq;
+
+ // The sequences that have ended in this group
+ std::vector<unsigned int> end;
+
+public:
+ EventSeqGroup(void) {}
+ ~EventSeqGroup(void) {}
+
+ void AddSeq(const unsigned int &id, std::string &path);
+ void EndSeq(const unsigned int &id);
+ bool EventInProgress(const unsigned int &id);
+ bool ActiveSeq(unsigned int &active_seq);
+
+ GameEvent *CurEvent(const unsigned int &id);
+ void NextEvent(const unsigned int &id, Info &info, const std::string &player_id, std::vector<EventResult> &result,
+ std::vector<EventSeqInfo> &end_seq, const int choice = -1);
+
+ void InternalEvents(Info &info);
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+};
+} // End of namespace event
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/EventSequence.cpp b/engines/crab/EventSequence.cpp
index 0da747c4e77..aa445695149 100644
--- a/engines/crab/EventSequence.cpp
+++ b/engines/crab/EventSequence.cpp
@@ -7,14 +7,11 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void EventSequence::Load(const std::string &filename)
-{
+void EventSequence::Load(const std::string &filename) {
XMLDoc conf(filename);
- if (conf.ready())
- {
+ if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("events");
- for (auto n = node->first_node("event"); n != NULL; n = n->next_sibling("event"))
- {
+ for (auto n = node->first_node("event"); n != NULL; n = n->next_sibling("event")) {
GameEvent e(n);
events.push_back(e);
}
@@ -24,13 +21,10 @@ void EventSequence::Load(const std::string &filename)
//------------------------------------------------------------------------
// Purpose: Check for events happening
//------------------------------------------------------------------------
-void EventSequence::InternalEvents(pyrodactyl::event::Info &info)
-{
+void EventSequence::InternalEvents(pyrodactyl::event::Info &info) {
for (auto nxe = next.begin(); nxe != next.end(); ++nxe)
- if (*nxe < events.size())
- {
- if (events[*nxe].trig.Evaluate(info))
- {
+ if (*nxe < events.size()) {
+ if (events[*nxe].trig.Evaluate(info)) {
event_in_progress = true;
cur = *nxe;
break;
@@ -42,42 +36,42 @@ void EventSequence::InternalEvents(pyrodactyl::event::Info &info)
// Purpose: Go to next event
//------------------------------------------------------------------------
void EventSequence::NextEvent(pyrodactyl::event::Info &info, const std::string &player_id, std::vector<EventResult> &result,
- std::vector<EventSeqInfo> &end_seq, int NextEventChoice)
-{
+ std::vector<EventSeqInfo> &end_seq, int NextEventChoice) {
bool sync = false;
event_in_progress = false;
- //Execute all effects associated with the event
+ // Execute all effects associated with the event
for (auto i = events[cur].effect.begin(); i != events[cur].effect.end(); ++i)
if (i->Execute(info, player_id, result, end_seq))
sync = true;
- //Play a notification sound
+ // Play a notification sound
using namespace pyrodactyl::music;
- if (info.sound.rep_dec) gMusicManager.PlayEffect(gMusicManager.rep_dec, 0);
- else if (info.sound.rep_inc) gMusicManager.PlayEffect(gMusicManager.rep_inc, 0);
- else if (info.sound.notify) gMusicManager.PlayEffect(gMusicManager.notify, 0);
+ if (info.sound.rep_dec)
+ gMusicManager.PlayEffect(gMusicManager.rep_dec, 0);
+ else if (info.sound.rep_inc)
+ gMusicManager.PlayEffect(gMusicManager.rep_inc, 0);
+ else if (info.sound.notify)
+ gMusicManager.PlayEffect(gMusicManager.notify, 0);
info.sound.notify = false;
info.sound.rep_dec = false;
info.sound.rep_inc = false;
- if (!result.empty() || sync)
- {
+ if (!result.empty() || sync) {
EventResult r;
r.type = ER_SYNC;
result.push_back(r);
}
- //Clear the next event list
+ // Clear the next event list
next.clear();
- //Add the next event to the event list
+ // Add the next event to the event list
if (NextEventChoice != -1)
next.push_back(NextEventChoice);
- else
- {
+ else {
for (auto i = events[cur].next.begin(); i != events[cur].next.end(); ++i)
next.push_back(*i);
}
@@ -86,17 +80,15 @@ void EventSequence::NextEvent(pyrodactyl::event::Info &info, const std::string &
//------------------------------------------------------------------------
// Purpose: Save the state of the object
//------------------------------------------------------------------------
-void EventSequence::SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char* name)
-{
+void EventSequence::SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *seqnode = doc.allocate_node(rapidxml::node_element, "set");
- //Write current event id and name to node
+ // Write current event id and name to node
seqnode->append_attribute(doc.allocate_attribute("name", name));
seqnode->append_attribute(doc.allocate_attribute("current", gStrPool.Get(cur)));
- //Prepare strings of next events and write them
- for (unsigned int i = 0; i < next.size(); i++)
- {
+ // Prepare strings of next events and write them
+ for (unsigned int i = 0; i < next.size(); i++) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "next");
child->value(gStrPool.Get(next[i]));
seqnode->append_node(child);
@@ -108,8 +100,7 @@ void EventSequence::SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
//------------------------------------------------------------------------
// Purpose: Load the state of the object
//------------------------------------------------------------------------
-void EventSequence::LoadState(rapidxml::xml_node<char> *node)
-{
+void EventSequence::LoadState(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *curid = node->first_attribute("current");
if (curid != NULL)
cur = StringToNumber<unsigned int>(curid->value());
diff --git a/engines/crab/EventSequence.h b/engines/crab/EventSequence.h
index 323a30b84b2..96bc26c26c5 100644
--- a/engines/crab/EventSequence.h
+++ b/engines/crab/EventSequence.h
@@ -1,49 +1,49 @@
#pragma once
#include "common_header.h"
-#include "ImageManager.h"
#include "GameEventInfo.h"
+#include "ImageManager.h"
+#include "Inventory.h"
#include "gameevent.h"
#include "journal.h"
-#include "Inventory.h"
-
-namespace pyrodactyl
-{
- namespace event
- {
- class EventSequence
- {
- std::vector<GameEvent> events;
- bool event_in_progress;
- //The event currently in execution - updated only when all trigger conditions are met in InternalEvents
- unsigned int cur;
-
- //The events that can happen next - these are updated when the cur event is over
- //This means cur and next operate in an alternating way
- //scan next until find event, make it cur, end cur and update next, repeat
- std::vector<unsigned int> next;
-
- public:
-
- EventSequence(){ event_in_progress = false; next.push_back(0); cur = 0; }
- ~EventSequence(){}
+namespace pyrodactyl {
+namespace event {
+class EventSequence {
+ std::vector<GameEvent> events;
+ bool event_in_progress;
+
+ // The event currently in execution - updated only when all trigger conditions are met in InternalEvents
+ unsigned int cur;
+
+ // The events that can happen next - these are updated when the cur event is over
+ // This means cur and next operate in an alternating way
+ // scan next until find event, make it cur, end cur and update next, repeat
+ std::vector<unsigned int> next;
+
+public:
+ EventSequence() {
+ event_in_progress = false;
+ next.push_back(0);
+ cur = 0;
+ }
+ ~EventSequence() {}
- GameEvent* CurrentEvent() { return &events[cur]; }
+ GameEvent *CurrentEvent() { return &events[cur]; }
- //See if we should trigger any event
- void InternalEvents(pyrodactyl::event::Info &info);
- void NextEvent(Info &info, const std::string &player_id, std::vector<EventResult> &result,
- std::vector<EventSeqInfo> &end_seq, int NextEventChoice = -1);
+ // See if we should trigger any event
+ void InternalEvents(pyrodactyl::event::Info &info);
+ void NextEvent(Info &info, const std::string &player_id, std::vector<EventResult> &result,
+ std::vector<EventSeqInfo> &end_seq, int NextEventChoice = -1);
- bool EventInProgress() { return event_in_progress; }
- void EventInProgress(bool val) { event_in_progress = val; }
+ bool EventInProgress() { return event_in_progress; }
+ void EventInProgress(bool val) { event_in_progress = val; }
- //Load and save
- void Load(const std::string &filename);
+ // Load and save
+ void Load(const std::string &filename);
- void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char* name);
- void LoadState(rapidxml::xml_node<char> *node);
- };
- }
-}
\ No newline at end of file
+ void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
+ void LoadState(rapidxml::xml_node<char> *node);
+};
+} // End of namespace event
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/FileData.cpp b/engines/crab/FileData.cpp
index 7f594b9dccc..81fbab32680 100644
--- a/engines/crab/FileData.cpp
+++ b/engines/crab/FileData.cpp
@@ -1,13 +1,11 @@
-#include "stdafx.h"
#include "FileData.h"
+#include "stdafx.h"
#include <iomanip>
using namespace pyrodactyl::ui;
-FileData::FileData(const boost::filesystem::path &filepath)
-{
- if (boost::filesystem::exists(filepath))
- {
+FileData::FileData(const boost::filesystem::path &filepath) {
+ if (boost::filesystem::exists(filepath)) {
name = boost::filesystem::basename(filepath);
path = filepath.string();
@@ -15,28 +13,23 @@ FileData::FileData(const boost::filesystem::path &filepath)
std::time_t temp = boost::filesystem::last_write_time(filepath);
last_modified = NumberToString(std::put_time(std::localtime(&temp), "%d %b %Y %H:%M:%S"));
#else
- //Workaround for GNU C++ not having implemented std::put_time
+ // Workaround for GNU C++ not having implemented std::put_time
std::time_t temp = boost::filesystem::last_write_time(filepath);
char timestr[100];
std::strftime(timestr, sizeof(timestr), "%d %b %Y %H:%M:%S", std::localtime(&temp));
last_modified = timestr;
#endif
- }
- else
+ } else
name = "New Save";
}
-SaveFileData::SaveFileData(const boost::filesystem::path &filepath) : FileData(filepath)
-{
- if (boost::filesystem::exists(filepath))
- {
+SaveFileData::SaveFileData(const boost::filesystem::path &filepath) : FileData(filepath) {
+ if (boost::filesystem::exists(filepath)) {
XMLDoc conf(filepath.string());
- if (conf.ready())
- {
- rapidxml::xml_node<char> * node = conf.Doc()->first_node("save");
- if (NodeValid(node))
- {
+ if (conf.ready()) {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
+ if (NodeValid(node)) {
LoadStr(diff, "diff", node);
LoadStr(loc_id, "loc_id", node);
LoadStr(loc_name, "loc_name", node);
@@ -49,16 +42,12 @@ SaveFileData::SaveFileData(const boost::filesystem::path &filepath) : FileData(f
}
}
-ModFileData::ModFileData(boost::filesystem::path filepath) : FileData(filepath)
-{
- if (boost::filesystem::exists(filepath))
- {
+ModFileData::ModFileData(boost::filesystem::path filepath) : FileData(filepath) {
+ if (boost::filesystem::exists(filepath)) {
XMLDoc conf(filepath.string());
- if (conf.ready())
- {
- rapidxml::xml_node<char> * node = conf.Doc()->first_node("config");
- if (NodeValid(node))
- {
+ if (conf.ready()) {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("config");
+ if (NodeValid(node)) {
LoadStr(author, "author", node);
LoadStr(version, "version", node);
LoadStr(info, "info", node);
diff --git a/engines/crab/FileData.h b/engines/crab/FileData.h
index 3fc83499bff..1d7c5cc9d74 100644
--- a/engines/crab/FileData.h
+++ b/engines/crab/FileData.h
@@ -1,45 +1,48 @@
#pragma once
+#include "XMLDoc.h"
#include "common_header.h"
#include "loaders.h"
-#include "XMLDoc.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class FileData
- {
- public:
- std::string name, path, last_modified;
- FileData(const boost::filesystem::path &filepath);
- };
-
- class SaveFileData : public FileData
- {
- public:
- std::string loc_id, loc_name, char_name, diff, time, preview;
-
- //This is to account for the first save slot, called "New Save", which doesn't actually have a file
- bool blank;
-
- SaveFileData(const boost::filesystem::path &filepath);
- SaveFileData(const bool empty);
- };
-
- class ModFileData : public FileData
- {
- public:
- std::string author, version, info, website, preview;
- ModFileData(boost::filesystem::path filepath);
- };
-
- //The types of data shown about the save file
- enum { DATA_SAVENAME, DATA_LASTMODIFIED, DATA_BUTTON_TOTAL };
-
- //Both of these are capped at DATA_HOVER_TOTAL
- enum { DATA_LOCNAME, DATA_DIFFICULTY, DATA_TIMEPLAYED, DATA_PLAYERNAME };
- enum { DATA_AUTHOR, DATA_VERSION, DATA_INFO, DATA_WEBSITE };
- const int DATA_HOVER_TOTAL = 4;
- }
-}
\ No newline at end of file
+namespace pyrodactyl {
+namespace ui {
+class FileData {
+public:
+ std::string name, path, last_modified;
+ FileData(const boost::filesystem::path &filepath);
+};
+
+class SaveFileData : public FileData {
+public:
+ std::string loc_id, loc_name, char_name, diff, time, preview;
+
+ // This is to account for the first save slot, called "New Save", which doesn't actually have a file
+ bool blank;
+
+ SaveFileData(const boost::filesystem::path &filepath);
+ SaveFileData(const bool empty);
+};
+
+class ModFileData : public FileData {
+public:
+ std::string author, version, info, website, preview;
+ ModFileData(boost::filesystem::path filepath);
+};
+
+// The types of data shown about the save file
+enum { DATA_SAVENAME,
+ DATA_LASTMODIFIED,
+ DATA_BUTTON_TOTAL };
+
+// Both of these are capped at DATA_HOVER_TOTAL
+enum { DATA_LOCNAME,
+ DATA_DIFFICULTY,
+ DATA_TIMEPLAYED,
+ DATA_PLAYERNAME };
+enum { DATA_AUTHOR,
+ DATA_VERSION,
+ DATA_INFO,
+ DATA_WEBSITE };
+const int DATA_HOVER_TOTAL = 4;
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/FileMenu.cpp b/engines/crab/FileMenu.cpp
index a9ff4b6ca65..7ba1862a800 100644
--- a/engines/crab/FileMenu.cpp
+++ b/engines/crab/FileMenu.cpp
@@ -1,10 +1,8 @@
-#include "stdafx.h"
#include "FileMenu.h"
+#include "stdafx.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- FileMenu<SaveFileData> gLoadMenu;
- }
-}
\ No newline at end of file
+namespace pyrodactyl {
+namespace ui {
+FileMenu<SaveFileData> gLoadMenu;
+}
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/FileMenu.h b/engines/crab/FileMenu.h
index 40f1a3b09ac..77536076ede 100644
--- a/engines/crab/FileMenu.h
+++ b/engines/crab/FileMenu.h
@@ -1,236 +1,224 @@
#pragma once
-#include "common_header.h"
+#include "FileData.h"
+#include "ImageData.h"
#include "PageMenu.h"
#include "TextData.h"
-#include "ImageData.h"
-#include "FileData.h"
+#include "common_header.h"
+
+namespace pyrodactyl {
+namespace ui {
+// Used for menus that are responsible for reading multiple files from disk
+template<typename FileType>
+class FileMenu {
+protected:
+ // The background of the menu
+ ImageData bg;
+
+ // The collection of buttons
+ PageButtonMenu menu;
+
+ // The final filename that is selected
+ std::string selected;
+
+ // The extension and directory used by this menu
+ std::string extension, directory;
+
+ // The save information for each slot
+ std::vector<FileType> slot_info;
+ TextData td_b[DATA_BUTTON_TOTAL];
-namespace pyrodactyl
-{
- namespace ui
+ // The titles for loc_name, difficulty, time_played and player_name
+ HoverInfo hov[DATA_HOVER_TOTAL];
+ TextData td_h[DATA_HOVER_TOTAL];
+
+ // The preview picture details
+ struct
{
- //Used for menus that are responsible for reading multiple files from disk
- template <typename FileType>
- class FileMenu
- {
- protected:
- //The background of the menu
- ImageData bg;
-
- //The collection of buttons
- PageButtonMenu menu;
-
- //The final filename that is selected
- std::string selected;
-
- //The extension and directory used by this menu
- std::string extension, directory;
-
- //The save information for each slot
- std::vector<FileType> slot_info;
- TextData td_b[DATA_BUTTON_TOTAL];
-
- //The titles for loc_name, difficulty, time_played and player_name
- HoverInfo hov[DATA_HOVER_TOTAL];
- TextData td_h[DATA_HOVER_TOTAL];
-
- //The preview picture details
- struct
- {
- //We load only the current preview image instead of all of them
- pyrodactyl::image::Image preview;
-
- //Fallback path if there is no preview image or if we fail to load it
- std::string no_preview_path;
-
- //Position of image
- Element pos;
-
- //Is the image loaded
- bool loaded;
- } img;
-
- //Are we hovering over a button right now?
- bool hover;
-
- //The previously hover button
- int prev_hover;
-
- public:
- FileMenu()
- {
- img.loaded = false;
- hover = false;
- prev_hover = -1;
- }
+ // We load only the current preview image instead of all of them
+ pyrodactyl::image::Image preview;
- ~FileMenu(){ if (img.loaded) img.preview.Delete(); }
- void Reset() { if (img.loaded) img.preview.Delete(); img.loaded = false; hover = false; }
+ // Fallback path if there is no preview image or if we fail to load it
+ std::string no_preview_path;
- std::string SelectedPath() { return selected; }
- void SelectedPath(const std::string &val) { selected = val; }
+ // Position of image
+ Element pos;
- void ScanDir()
- {
- using namespace boost::filesystem;
+ // Is the image loaded
+ bool loaded;
+ } img;
- slot_info.clear();
- menu.Clear();
+ // Are we hovering over a button right now?
+ bool hover;
- path filedir(directory);
- if (exists(filedir) && is_directory(filedir))
- {
- directory_iterator dir_it(filedir);
- std::vector<path> file_in_dir;
+ // The previously hover button
+ int prev_hover;
- std::copy(directory_iterator(filedir), directory_iterator(), std::back_inserter(file_in_dir));
- std::sort(file_in_dir.begin(), file_in_dir.end(), PathCompare);
+public:
+ FileMenu() {
+ img.loaded = false;
+ hover = false;
+ prev_hover = -1;
+ }
- //First, we must load all the files with the same extension as our save file
- unsigned int count_slot = 0, count_menu = 0;
- for (auto i = file_in_dir.begin(); i != file_in_dir.end(); ++i)
- if (is_regular_file(*i) && i->extension().string() == extension)
- {
- slot_info.push_back(FileType(*i));
- menu.Add(count_slot, count_menu);
- }
- }
- else
- create_directories(filedir);
+ ~FileMenu() {
+ if (img.loaded)
+ img.preview.Delete();
+ }
+ void Reset() {
+ if (img.loaded)
+ img.preview.Delete();
+ img.loaded = false;
+ hover = false;
+ }
- menu.AssignPaths();
- }
+ std::string SelectedPath() { return selected; }
+ void SelectedPath(const std::string &val) { selected = val; }
- void Load(rapidxml::xml_node<char> *node)
- {
- if (NodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ void ScanDir() {
+ using namespace boost::filesystem;
- if (NodeValid("menu", node))
- menu.Load(node->first_node("menu"));
+ slot_info.clear();
+ menu.Clear();
- if (NodeValid("preview", node))
- {
- auto prnode = node->first_node("preview");
- img.pos.Load(prnode);
- LoadStr(img.no_preview_path, "path", prnode);
- }
+ path filedir(directory);
+ if (exists(filedir) && is_directory(filedir)) {
+ directory_iterator dir_it(filedir);
+ std::vector<path> file_in_dir;
- if (NodeValid("offset", node))
- {
- rapidxml::xml_node<char> *offnode = node->first_node("offset");
-
- //Stuff displayed on the slot button
- td_b[DATA_SAVENAME].Load(offnode->first_node("save_name"));
- td_b[DATA_LASTMODIFIED].Load(offnode->first_node("last_modified"));
-
- //Stuff displayed when you hover over a slot button
- td_h[DATA_LOCNAME].Load(offnode->first_node("loc_name"));
- td_h[DATA_DIFFICULTY].Load(offnode->first_node("difficulty"));
- td_h[DATA_TIMEPLAYED].Load(offnode->first_node("time_played"));
- td_h[DATA_PLAYERNAME].Load(offnode->first_node("player_name"));
-
- //Titles for the stuff displayed when you hover over a slot button
- hov[DATA_LOCNAME].Load(offnode->first_node("loc_name_title"));
- hov[DATA_DIFFICULTY].Load(offnode->first_node("difficulty_title"));
- hov[DATA_TIMEPLAYED].Load(offnode->first_node("time_played_title"));
- hov[DATA_PLAYERNAME].Load(offnode->first_node("player_name_title"));
+ std::copy(directory_iterator(filedir), directory_iterator(), std::back_inserter(file_in_dir));
+ std::sort(file_in_dir.begin(), file_in_dir.end(), PathCompare);
+
+ // First, we must load all the files with the same extension as our save file
+ unsigned int count_slot = 0, count_menu = 0;
+ for (auto i = file_in_dir.begin(); i != file_in_dir.end(); ++i)
+ if (is_regular_file(*i) && i->extension().string() == extension) {
+ slot_info.push_back(FileType(*i));
+ menu.Add(count_slot, count_menu);
}
+ } else
+ create_directories(filedir);
- extension = gFilePath.save_ext;
- directory = gFilePath.appdata + gFilePath.save_dir;
- ScanDir();
- }
+ menu.AssignPaths();
+ }
- bool HandleEvents(const SDL_Event &Event)
- {
- int choice = menu.HandleEvents(Event);
- if (choice >= 0)
- {
- menu.Reset();
- selected = slot_info[menu.Index() + choice].path;
- Reset();
- return true;
- }
+ void Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid("bg", node))
+ bg.Load(node->first_node("bg"));
+
+ if (NodeValid("menu", node))
+ menu.Load(node->first_node("menu"));
+
+ if (NodeValid("preview", node)) {
+ auto prnode = node->first_node("preview");
+ img.pos.Load(prnode);
+ LoadStr(img.no_preview_path, "path", prnode);
+ }
+
+ if (NodeValid("offset", node)) {
+ rapidxml::xml_node<char> *offnode = node->first_node("offset");
+
+ // Stuff displayed on the slot button
+ td_b[DATA_SAVENAME].Load(offnode->first_node("save_name"));
+ td_b[DATA_LASTMODIFIED].Load(offnode->first_node("last_modified"));
+
+ // Stuff displayed when you hover over a slot button
+ td_h[DATA_LOCNAME].Load(offnode->first_node("loc_name"));
+ td_h[DATA_DIFFICULTY].Load(offnode->first_node("difficulty"));
+ td_h[DATA_TIMEPLAYED].Load(offnode->first_node("time_played"));
+ td_h[DATA_PLAYERNAME].Load(offnode->first_node("player_name"));
+
+ // Titles for the stuff displayed when you hover over a slot button
+ hov[DATA_LOCNAME].Load(offnode->first_node("loc_name_title"));
+ hov[DATA_DIFFICULTY].Load(offnode->first_node("difficulty_title"));
+ hov[DATA_TIMEPLAYED].Load(offnode->first_node("time_played_title"));
+ hov[DATA_PLAYERNAME].Load(offnode->first_node("player_name_title"));
+ }
+
+ extension = gFilePath.save_ext;
+ directory = gFilePath.appdata + gFilePath.save_dir;
+ ScanDir();
+ }
- return false;
- }
+ bool HandleEvents(const SDL_Event &Event) {
+ int choice = menu.HandleEvents(Event);
+ if (choice >= 0) {
+ menu.Reset();
+ selected = slot_info[menu.Index() + choice].path;
+ Reset();
+ return true;
+ }
- void Draw()
- {
- bg.Draw();
- menu.Draw();
- for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++)
- {
- auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
- td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
- td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
- }
+ return false;
+ }
- DrawHover();
- }
+ void Draw() {
+ bg.Draw();
+ menu.Draw();
+ for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++) {
+ auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
+ td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
+ td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
+ }
- void DrawHover()
- {
- if (menu.HoverIndex() >= 0)
- {
- int i = menu.HoverIndex();
-
- if (!img.loaded || prev_hover != i)
- {
- img.loaded = true;
- prev_hover = i;
- if (!img.preview.Load(slot_info[i].preview))
- img.preview.Load(img.no_preview_path);
- }
-
- hover = true;
- img.preview.Draw(img.pos.x, img.pos.y);
-
- td_h[DATA_LOCNAME].Draw(slot_info[i].loc_name);
- td_h[DATA_DIFFICULTY].Draw(slot_info[i].diff);
- td_h[DATA_TIMEPLAYED].Draw(slot_info[i].time);
- td_h[DATA_PLAYERNAME].Draw(slot_info[i].char_name);
-
- for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
- hov[num].Draw();
- }
- else if (hover)
- Reset();
+ DrawHover();
+ }
+
+ void DrawHover() {
+ if (menu.HoverIndex() >= 0) {
+ int i = menu.HoverIndex();
+
+ if (!img.loaded || prev_hover != i) {
+ img.loaded = true;
+ prev_hover = i;
+ if (!img.preview.Load(slot_info[i].preview))
+ img.preview.Load(img.no_preview_path);
}
- bool Empty() { ScanDir(); return slot_info.empty(); }
+ hover = true;
+ img.preview.Draw(img.pos.x, img.pos.y);
- bool SelectNewestFile()
- {
- if (slot_info.size() > 0)
- {
- selected = slot_info[0].path;
- return true;
- }
+ td_h[DATA_LOCNAME].Draw(slot_info[i].loc_name);
+ td_h[DATA_DIFFICULTY].Draw(slot_info[i].diff);
+ td_h[DATA_TIMEPLAYED].Draw(slot_info[i].time);
+ td_h[DATA_PLAYERNAME].Draw(slot_info[i].char_name);
- return false;
- }
+ for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
+ hov[num].Draw();
+ } else if (hover)
+ Reset();
+ }
- void SetUI()
- {
- bg.SetUI();
- menu.SetUI();
- ScanDir();
- img.pos.SetUI();
+ bool Empty() {
+ ScanDir();
+ return slot_info.empty();
+ }
- for (int i = 0; i < DATA_BUTTON_TOTAL; ++i)
- td_b[i].SetUI();
+ bool SelectNewestFile() {
+ if (slot_info.size() > 0) {
+ selected = slot_info[0].path;
+ return true;
+ }
- for (int i = 0; i < DATA_HOVER_TOTAL; ++i)
- {
- td_h[i].SetUI();
- hov[i].SetUI();
- }
- }
- };
+ return false;
+ }
+
+ void SetUI() {
+ bg.SetUI();
+ menu.SetUI();
+ ScanDir();
+ img.pos.SetUI();
- extern FileMenu<SaveFileData> gLoadMenu;
+ for (int i = 0; i < DATA_BUTTON_TOTAL; ++i)
+ td_b[i].SetUI();
+
+ for (int i = 0; i < DATA_HOVER_TOTAL; ++i) {
+ td_h[i].SetUI();
+ hov[i].SetUI();
+ }
}
-}
\ No newline at end of file
+};
+
+extern FileMenu<SaveFileData> gLoadMenu;
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 29696e7485f..89672e1665a 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -3,39 +3,34 @@
#include "common_header.h"
#include "timer.h"
-class GameClock
-{
+class GameClock {
Timer timer;
Uint32 start;
std::string seperator;
public:
- GameClock() : seperator(" : "){ start = 0; }
+ GameClock() : seperator(" : ") { start = 0; }
- void Start(Uint32 initial_time = 0)
- {
+ void Start(Uint32 initial_time = 0) {
start = initial_time;
timer.Start();
}
- void Start(const std::string &str)
- {
+ void Start(const std::string &str) {
Uint32 ms = 0, hr = 0, min = 0, sec = 0;
std::string str_hrs, str_min, str_sec;
std::size_t found_1 = str.find_first_of(seperator);
- if(found_1 > 0 && found_1 != std::string::npos)
- {
- str_hrs = str.substr(0,found_1);
+ if (found_1 > 0 && found_1 != std::string::npos) {
+ str_hrs = str.substr(0, found_1);
hr = StringToNumber<Uint32>(str_hrs);
std::size_t found_2 = str.find_last_of(seperator);
- if(found_2 > 0 && found_2 != std::string::npos)
- {
- str_sec = str.substr(found_2+1,std::string::npos);
+ if (found_2 > 0 && found_2 != std::string::npos) {
+ str_sec = str.substr(found_2 + 1, std::string::npos);
sec = StringToNumber<Uint32>(str_sec);
- str_min = str.substr(found_1+seperator.length(), found_2-(2*seperator.length()));
+ str_min = str.substr(found_1 + seperator.length(), found_2 - (2 * seperator.length()));
min = StringToNumber<Uint32>(str_min);
}
}
@@ -44,8 +39,7 @@ public:
Start(ms);
}
- std::string GetTime()
- {
+ std::string GetTime() {
Uint32 ms = start + timer.Ticks();
Uint32 x = ms / 1000;
diff --git a/engines/crab/GameEventInfo.cpp b/engines/crab/GameEventInfo.cpp
index 70616139173..95e96a8b2e4 100644
--- a/engines/crab/GameEventInfo.cpp
+++ b/engines/crab/GameEventInfo.cpp
@@ -1,17 +1,14 @@
-#include "stdafx.h"
#include "GameEventInfo.h"
#include "eventstore.h"
+#include "stdafx.h"
-namespace pyrodactyl
-{
- namespace event
- {
- bool IsChar(char c)
- {
- return !isdigit(c);
- }
- }
+namespace pyrodactyl {
+namespace event {
+bool IsChar(char c) {
+ return !isdigit(c);
}
+} // End of namespace event
+} // End of namespace pyrodactyl
using namespace pyrodactyl::people;
using namespace pyrodactyl::event;
@@ -19,20 +16,16 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Load from xml
//------------------------------------------------------------------------
-void Info::Load(rapidxml::xml_node<char> *node)
-{
- if (NodeValid("people", node))
- {
+void Info::Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid("people", node)) {
rapidxml::xml_node<char> *pnode = node->first_node("people");
stem.Load(pnode->first_attribute("templates")->value());
XMLDoc conf(pnode->first_attribute("list")->value());
- if (conf.ready())
- {
+ if (conf.ready()) {
rapidxml::xml_node<char> *cnode = conf.Doc()->first_node("characters");
- if (NodeValid(cnode))
- {
+ if (NodeValid(cnode)) {
LoadNum(OPINION_MIN, "op_min", cnode);
LoadNum(OPINION_MAX, "op_max", cnode);
@@ -45,8 +38,7 @@ void Info::Load(rapidxml::xml_node<char> *node)
if (NodeValid("objective", node))
journal.Load(node->first_node("objective")->first_attribute("layout")->value());
- if (NodeValid("inventory", node))
- {
+ if (NodeValid("inventory", node)) {
rapidxml::xml_node<char> *inode = node->first_node("inventory");
inv.Load(inode->first_attribute("layout")->value());
}
@@ -55,16 +47,12 @@ void Info::Load(rapidxml::xml_node<char> *node)
inv.ItemFile(node->first_node("item")->first_attribute("list")->value());
}
-void Info::LoadPeople(const std::string &filename)
-{
+void Info::LoadPeople(const std::string &filename) {
XMLDoc conf(filename);
- if (conf.ready())
- {
+ if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("people");
- if (NodeValid(node))
- {
- for (auto n = node->first_node(); n != NULL; n = n->next_sibling())
- {
+ if (NodeValid(node)) {
+ for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
std::string str;
LoadStr(str, "id", n);
people[str].Load(n, stem);
@@ -76,14 +64,12 @@ void Info::LoadPeople(const std::string &filename)
//------------------------------------------------------------------------
// Purpose: Get/Set information about object type
//------------------------------------------------------------------------
-void Info::Type(const std::string &id, const PersonType &val)
-{
+void Info::Type(const std::string &id, const PersonType &val) {
if (people.count(id) > 0)
people.at(id).type = val;
}
-PersonType Info::Type(const std::string &id)
-{
+PersonType Info::Type(const std::string &id) {
if (people.count(id) > 0)
return people.at(id).type;
@@ -93,14 +79,12 @@ PersonType Info::Type(const std::string &id)
//------------------------------------------------------------------------
// Purpose: Get/Set information about object state
//------------------------------------------------------------------------
-void Info::State(const std::string &id, const PersonState &val)
-{
+void Info::State(const std::string &id, const PersonState &val) {
if (people.count(id) > 0)
people.at(id).state = val;
}
-PersonState Info::State(const std::string &id)
-{
+PersonState Info::State(const std::string &id) {
if (people.count(id) > 0)
return people.at(id).state;
@@ -110,8 +94,7 @@ PersonState Info::State(const std::string &id)
//------------------------------------------------------------------------
// Purpose: Get/Set information about variables
//------------------------------------------------------------------------
-bool Info::VarGet(const std::string &name, int &val)
-{
+bool Info::VarGet(const std::string &name, int &val) {
if (var.count(name) == 0)
return false;
else
@@ -119,8 +102,7 @@ bool Info::VarGet(const std::string &name, int &val)
return true;
}
-void Info::VarSet(const std::string &name, const std::string &val)
-{
+void Info::VarSet(const std::string &name, const std::string &val) {
int var_val = 0;
bool assign_to_var = std::find_if(val.begin(), val.end(), IsChar) != val.end();
@@ -132,53 +114,47 @@ void Info::VarSet(const std::string &name, const std::string &val)
var[name] = var_val;
}
-void Info::VarAdd(const std::string &name, const int &val)
-{
+void Info::VarAdd(const std::string &name, const int &val) {
if (var.count(name) == 0)
VarSet(name, 0);
var.at(name) += val;
}
-void Info::VarSub(const std::string &name, const int &val)
-{
+void Info::VarSub(const std::string &name, const int &val) {
if (var.count(name) == 0)
VarSet(name, 0);
var.at(name) -= val;
}
-void Info::VarMul(const std::string &name, const int &val)
-{
+void Info::VarMul(const std::string &name, const int &val) {
if (var.count(name) == 0)
VarSet(name, 0);
var.at(name) *= val;
}
-void Info::VarDiv(const std::string &name, const int &val)
-{
+void Info::VarDiv(const std::string &name, const int &val) {
if (var.count(name) == 0)
VarSet(name, 0);
var.at(name) /= val;
}
-void Info::VarDel(const std::string &name)
-{
+void Info::VarDel(const std::string &name) {
var.erase(name);
}
//------------------------------------------------------------------------
// Purpose: Get/Set person traits
//------------------------------------------------------------------------
-void Info::TraitAdd(const std::string &per_id, const int &trait_id)
-{
- if (PersonValid(per_id)) //Valid person id
+void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
+ if (PersonValid(per_id)) // Valid person id
{
- if (trait_id >= 0 && trait_id < gEventStore.trait.size()) //Valid trait id
+ if (trait_id >= 0 && trait_id < gEventStore.trait.size()) // Valid trait id
{
- //Check for duplicate traits, DONT award anything if duplicate found
+ // Check for duplicate traits, DONT award anything if duplicate found
Person *p = &PersonGet(per_id);
for (auto i = p->trait.begin(); i != p->trait.end(); ++i)
@@ -192,18 +168,15 @@ void Info::TraitAdd(const std::string &per_id, const int &trait_id)
}
}
-void Info::TraitDel(const std::string &per_id, const int &trait_id)
-{
- if (PersonValid(per_id)) //Valid person id
+void Info::TraitDel(const std::string &per_id, const int &trait_id) {
+ if (PersonValid(per_id)) // Valid person id
{
- if (trait_id > 0 && trait_id < gEventStore.trait.size()) //Valid trait id
+ if (trait_id > 0 && trait_id < gEventStore.trait.size()) // Valid trait id
{
Person *p = &PersonGet(per_id);
- for (auto j = p->trait.begin(); j != p->trait.end(); ++j)
- {
- if (j->id == trait_id)
- {
+ for (auto j = p->trait.begin(); j != p->trait.end(); ++j) {
+ if (j->id == trait_id) {
p->trait.erase(j);
break;
}
@@ -215,8 +188,7 @@ void Info::TraitDel(const std::string &per_id, const int &trait_id)
//------------------------------------------------------------------------
// Purpose: Get/Set information about object opinion
//------------------------------------------------------------------------
-bool Info::OpinionGet(const std::string &name, const pyrodactyl::people::OpinionType &type, int &val)
-{
+bool Info::OpinionGet(const std::string &name, const pyrodactyl::people::OpinionType &type, int &val) {
if (people.count(name) == 0)
return false;
@@ -224,14 +196,12 @@ bool Info::OpinionGet(const std::string &name, const pyrodactyl::people::Opinion
return true;
}
-void Info::OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val)
-{
+void Info::OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val) {
if (people.count(name) > 0)
people.at(name).opinion.Change(type, val);
}
-void Info::OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val)
-{
+void Info::OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val) {
if (people.count(name) > 0)
people.at(name).opinion.Set(type, val);
}
@@ -239,8 +209,7 @@ void Info::OpinionSet(const std::string &name, const pyrodactyl::people::Opinion
//------------------------------------------------------------------------
// Purpose: Get/Set information about object stats
//------------------------------------------------------------------------
-bool Info::StatGet(const std::string &name, const pyrodactyl::stat::StatType &type, int &num)
-{
+bool Info::StatGet(const std::string &name, const pyrodactyl::stat::StatType &type, int &num) {
if (people.count(name) == 0)
return false;
@@ -248,14 +217,12 @@ bool Info::StatGet(const std::string &name, const pyrodactyl::stat::StatType &ty
return true;
}
-void Info::StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num)
-{
+void Info::StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num) {
if (people.count(name) > 0)
people.at(name).stat.Set(type, num);
}
-void Info::StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num)
-{
+void Info::StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num) {
if (people.count(name) > 0)
people.at(name).stat.Change(type, num);
}
@@ -263,8 +230,7 @@ void Info::StatChange(const std::string &name, const pyrodactyl::stat::StatType
//------------------------------------------------------------------------
// Purpose: Get person object
//------------------------------------------------------------------------
-bool Info::PersonGet(const std::string &id, pyrodactyl::people::Person &p)
-{
+bool Info::PersonGet(const std::string &id, pyrodactyl::people::Person &p) {
if (people.count(id) == 0)
return false;
@@ -272,22 +238,18 @@ bool Info::PersonGet(const std::string &id, pyrodactyl::people::Person &p)
return true;
}
-bool Info::PersonValid(const std::string &id)
-{
+bool Info::PersonValid(const std::string &id) {
return people.count(id) > 0;
}
-pyrodactyl::people::Person& Info::PersonGet(const std::string &id)
-{
- //Make sure to check PersonValid before doing this!
- //Only use this to change parts of an object
+pyrodactyl::people::Person &Info::PersonGet(const std::string &id) {
+ // Make sure to check PersonValid before doing this!
+ // Only use this to change parts of an object
return people.at(id);
}
-bool Info::CollideWithTrigger(const std::string &id, int rect_index)
-{
- if (people.count(id) > 0)
- {
+bool Info::CollideWithTrigger(const std::string &id, int rect_index) {
+ if (people.count(id) > 0) {
for (auto i = people.at(id).trig.begin(); i != people.at(id).trig.end(); ++i)
if (*i == rect_index)
return true;
@@ -299,29 +261,25 @@ bool Info::CollideWithTrigger(const std::string &id, int rect_index)
//------------------------------------------------------------------------
// Purpose: Replace all #values with their appropriate names in a string
//------------------------------------------------------------------------
-void Info::InsertName(std::string &msg)
-{
- //We scan the dialog for #id values, which we convert to actual NPC names
- for (unsigned int i = 0; i < msg.size(); ++i)
- {
- //The # symbol indicates that the next string until an end character needs to be replaced by the name
- if (msg.at(i) == '#')
- {
- //The position we want to start from, and the length of the substring
+void Info::InsertName(std::string &msg) {
+ // We scan the dialog for #id values, which we convert to actual NPC names
+ for (unsigned int i = 0; i < msg.size(); ++i) {
+ // The # symbol indicates that the next string until an end character needs to be replaced by the name
+ if (msg.at(i) == '#') {
+ // The position we want to start from, and the length of the substring
unsigned int start = i, end = i + 1, len = 0;
- //First make sure # wasn't the end of the string
+ // First make sure # wasn't the end of the string
for (; end < msg.size(); ++end, ++len)
if (msg.at(end) == ',' || msg.at(end) == '.' || msg.at(end) == '!' || msg.at(end) == ' ' ||
msg.at(end) == '?' || msg.at(end) == '-' || msg.at(end) == '\'' || msg.at(end) == '\"')
break;
- if (end < msg.size())
- {
- //We use start+1 here because # isn't part of the id
+ if (end < msg.size()) {
+ // We use start+1 here because # isn't part of the id
std::string s = msg.substr(start + 1, len);
- //We use length+1 here because otherwise it lets the last character stay in dialog
+ // We use length+1 here because otherwise it lets the last character stay in dialog
if (PersonValid(s))
msg.replace(start, len + 1, PersonGet(s).name);
}
@@ -329,8 +287,7 @@ void Info::InsertName(std::string &msg)
}
}
-std::string Info::GetName(const std::string &id)
-{
+std::string Info::GetName(const std::string &id) {
if (PersonValid(id))
return PersonGet(id).name;
@@ -340,10 +297,8 @@ std::string Info::GetName(const std::string &id)
//------------------------------------------------------------------------
// Purpose: Save and load object state
//------------------------------------------------------------------------
-void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
- for (auto v = var.begin(); v != var.end(); ++v)
- {
+void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ for (auto v = var.begin(); v != var.end(); ++v) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
child->append_attribute(doc.allocate_attribute("id", v->first.c_str()));
child->append_attribute(doc.allocate_attribute("val", gStrPool.Get(v->second)));
@@ -374,20 +329,17 @@ void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
inv.SaveState(doc, root);
}
-void Info::LoadState(rapidxml::xml_node<char> *node)
-{
+void Info::LoadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *v = node->first_node("var"); v != NULL; v = v->next_sibling("var"))
var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
- for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object"))
- {
+ for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object")) {
std::string id;
LoadStr(id, "id", p);
people[id].LoadState(p);
}
- if (NodeValid("unread", node))
- {
+ if (NodeValid("unread", node)) {
rapidxml::xml_node<char> *unrnode = node->first_node("unread");
LoadBool(unread.inventory, "inventory", unrnode);
LoadBool(unread.journal, "journal", unrnode);
@@ -408,8 +360,7 @@ void Info::LoadState(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Calculate UI positions after change in screen size
//------------------------------------------------------------------------
-void Info::SetUI()
-{
+void Info::SetUI() {
journal.SetUI();
inv.SetUI();
}
\ No newline at end of file
diff --git a/engines/crab/GameEventInfo.h b/engines/crab/GameEventInfo.h
index 837c0e1f36c..c6d49c23983 100644
--- a/engines/crab/GameEventInfo.h
+++ b/engines/crab/GameEventInfo.h
@@ -1,169 +1,175 @@
#pragma once
-#include "common_header.h"
-#include "person.h"
-#include "journal.h"
#include "Inventory.h"
#include "StatTemplate.h"
+#include "common_header.h"
+#include "journal.h"
+#include "person.h"
-namespace pyrodactyl
-{
- namespace event
- {
- bool IsChar(char c);
+namespace pyrodactyl {
+namespace event {
+bool IsChar(char c);
- class Info
- {
- //The characters in the game
- pyrodactyl::people::PersonMap people;
+class Info {
+ // The characters in the game
+ pyrodactyl::people::PersonMap people;
- //The stat templates used in declaring person objects
- pyrodactyl::stat::StatTemplates stem;
+ // The stat templates used in declaring person objects
+ pyrodactyl::stat::StatTemplates stem;
- //The variables set by the events so far
- typedef std::unordered_map<std::string, int> VarMap;
- VarMap var;
+ // The variables set by the events so far
+ typedef std::unordered_map<std::string, int> VarMap;
+ VarMap var;
- //The last object player interacted with
- std::string lastobj;
+ // The last object player interacted with
+ std::string lastobj;
- //Is the game Iron Man or not?
- //Iron man means only one save - no reloading
- bool ironman;
+ // Is the game Iron Man or not?
+ // Iron man means only one save - no reloading
+ bool ironman;
- //The player's current location
- struct PlayerLoc
- {
- //id of the player's current location
- std::string id;
+ // The player's current location
+ struct PlayerLoc {
+ // id of the player's current location
+ std::string id;
- //The name of the player's current location
- std::string name;
+ // The name of the player's current location
+ std::string name;
- PlayerLoc() : id(""), name(""){}
- } loc;
+ PlayerLoc() : id(""), name("") {}
+ } loc;
- //This image changes to reflect the playable character
- int player_img;
+ // This image changes to reflect the playable character
+ int player_img;
- void LoadPeople(const std::string &filename);
+ void LoadPeople(const std::string &filename);
- public:
- //The player's one stop shop for objectives and lore
- pyrodactyl::ui::Journal journal;
+public:
+ // The player's one stop shop for objectives and lore
+ pyrodactyl::ui::Journal journal;
- //The current player inventory
- pyrodactyl::ui::Inventory inv;
+ // The current player inventory
+ pyrodactyl::ui::Inventory inv;
- //This structure keeps track of unread indicators
- struct UnreadData
- {
- bool inventory, journal, trait, map;
+ // This structure keeps track of unread indicators
+ struct UnreadData {
+ bool inventory, journal, trait, map;
- UnreadData(){ inventory = false; journal = false; trait = true; map = false; }
- } unread;
+ UnreadData() {
+ inventory = false;
+ journal = false;
+ trait = true;
+ map = false;
+ }
+ } unread;
- //This is the variable corresponding to money that is drawn
- std::string money_var;
-
- //Has the player pressed the talk key
- bool TalkKeyDown;
-
- //Used so we only play one sound per event
- struct NotifySounds
- {
- bool notify, rep_inc, rep_dec;
-
- NotifySounds(){ notify = false; rep_inc = false; rep_dec = false; }
- } sound;
-
- Info(){ Init(); }
- ~Info(){}
-
- void Init() { lastobj = ""; ironman = false; player_img = 0; TalkKeyDown = false; }
- void Load(rapidxml::xml_node<char> *node);
-
- //Person related stuff
- void Type(const std::string &id, const pyrodactyl::people::PersonType &val);
- pyrodactyl::people::PersonType Type(const std::string &id);
-
- void State(const std::string &id, const pyrodactyl::people::PersonState &val);
- pyrodactyl::people::PersonState State(const std::string &id);
-
- //Opinion
- bool OpinionGet(const std::string &name, const pyrodactyl::people::OpinionType &type, int &val);
- void OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val);
- void OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val);
-
- //Stats
- bool StatGet(const std::string &name, const pyrodactyl::stat::StatType &type, int &num);
- void StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num);
- void StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num);
-
- //Variables
- bool VarGet(const std::string &name, int &val);
- void VarSet(const std::string &name, const std::string &val);
- void VarAdd(const std::string &name, const int &val);
- void VarSub(const std::string &name, const int &val);
- void VarMul(const std::string &name, const int &val);
- void VarDiv(const std::string &name, const int &val);
- void VarDel(const std::string &name);
-
- //The trait functions
- void TraitAdd(const std::string &per_id, const int &trait_id);
- void TraitDel(const std::string &per_id, const int &trait_id);
-
- //Player character button
- void PlayerImg(const int &val) { player_img = val; }
- int PlayerImg() { return player_img; }
+ // This is the variable corresponding to money that is drawn
+ std::string money_var;
- std::string CurLocID() { return loc.id; }
- void CurLocID(const std::string &id){ loc.id = id; }
+ // Has the player pressed the talk key
+ bool TalkKeyDown;
- std::string CurLocName() { return loc.name; }
- void CurLocName(const std::string &name) { loc.name = name; }
+ // Used so we only play one sound per event
+ struct NotifySounds {
+ bool notify, rep_inc, rep_dec;
- //Player stuff
- std::string LastPerson() { return lastobj; }
- void LastPerson(const std::string &name) { lastobj = name; }
+ NotifySounds() {
+ notify = false;
+ rep_inc = false;
+ rep_dec = false;
+ }
+ } sound;
- //Return the variable map for stuff like visibility checks
- VarMap &MapGet() { return var; }
- bool PersonGet(const std::string &id, pyrodactyl::people::Person &p);
+ Info() { Init(); }
+ ~Info() {}
- bool PersonValid(const std::string &id);
- pyrodactyl::people::Person& PersonGet(const std::string &id);
-
- //Is an object colliding with a trigger area
- bool CollideWithTrigger(const std::string &id, int rect_index);
+ void Init() {
+ lastobj = "";
+ ironman = false;
+ player_img = 0;
+ TalkKeyDown = false;
+ }
+ void Load(rapidxml::xml_node<char> *node);
+
+ // Person related stuff
+ void Type(const std::string &id, const pyrodactyl::people::PersonType &val);
+ pyrodactyl::people::PersonType Type(const std::string &id);
+
+ void State(const std::string &id, const pyrodactyl::people::PersonState &val);
+ pyrodactyl::people::PersonState State(const std::string &id);
+
+ // Opinion
+ bool OpinionGet(const std::string &name, const pyrodactyl::people::OpinionType &type, int &val);
+ void OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val);
+ void OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val);
+
+ // Stats
+ bool StatGet(const std::string &name, const pyrodactyl::stat::StatType &type, int &num);
+ void StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num);
+ void StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num);
+
+ // Variables
+ bool VarGet(const std::string &name, int &val);
+ void VarSet(const std::string &name, const std::string &val);
+ void VarAdd(const std::string &name, const int &val);
+ void VarSub(const std::string &name, const int &val);
+ void VarMul(const std::string &name, const int &val);
+ void VarDiv(const std::string &name, const int &val);
+ void VarDel(const std::string &name);
+
+ // The trait functions
+ void TraitAdd(const std::string &per_id, const int &trait_id);
+ void TraitDel(const std::string &per_id, const int &trait_id);
+
+ // Player character button
+ void PlayerImg(const int &val) { player_img = val; }
+ int PlayerImg() { return player_img; }
+
+ std::string CurLocID() { return loc.id; }
+ void CurLocID(const std::string &id) { loc.id = id; }
+
+ std::string CurLocName() { return loc.name; }
+ void CurLocName(const std::string &name) { loc.name = name; }
+
+ // Player stuff
+ std::string LastPerson() { return lastobj; }
+ void LastPerson(const std::string &name) { lastobj = name; }
+
+ // Return the variable map for stuff like visibility checks
+ VarMap &MapGet() { return var; }
+ bool PersonGet(const std::string &id, pyrodactyl::people::Person &p);
+
+ bool PersonValid(const std::string &id);
+ pyrodactyl::people::Person &PersonGet(const std::string &id);
+
+ // Is an object colliding with a trigger area
+ bool CollideWithTrigger(const std::string &id, int rect_index);
+
+ // Replace all #values with their appropriate names in a string
+ void InsertName(std::string &msg);
+ std::string GetName(const std::string &id);
+
+ // Draw the inventory
+ void InvDraw(const std::string &id) {
+ if (var.count(money_var) > 0)
+ inv.Draw(people.at(id), var.at(money_var));
+ else
+ inv.Draw(people.at(id), 0);
+ }
- //Replace all #values with their appropriate names in a string
- void InsertName(std::string &msg);
- std::string GetName(const std::string &id);
-
- //Draw the inventory
- void InvDraw(const std::string &id)
- {
- if (var.count(money_var) > 0)
- inv.Draw(people.at(id), var.at(money_var));
- else
- inv.Draw(people.at(id), 0);
- }
-
- //Get whether game is iron man or not
- const bool IronMan() { return ironman; }
- void IronMan(const bool &val) { ironman = val; }
- void LoadIronMan(rapidxml::xml_node<char> *node)
- {
- std::string str;
- LoadStr(str, "diff", node);
- ironman = (str == "Iron Man");
- }
-
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
-
- void SetUI();
- };
+ // Get whether game is iron man or not
+ const bool IronMan() { return ironman; }
+ void IronMan(const bool &val) { ironman = val; }
+ void LoadIronMan(rapidxml::xml_node<char> *node) {
+ std::string str;
+ LoadStr(str, "diff", node);
+ ironman = (str == "Iron Man");
}
-}
\ No newline at end of file
+
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+
+ void SetUI();
+};
+} // End of namespace event
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/GameOverMenu.cpp b/engines/crab/GameOverMenu.cpp
index cb15b9c007e..5fe2d957fbf 100644
--- a/engines/crab/GameOverMenu.cpp
+++ b/engines/crab/GameOverMenu.cpp
@@ -5,20 +5,16 @@
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void GameOverMenu::Load(rapidxml::xml_node<char> *node)
-{
- if (NodeValid(node))
- {
+void GameOverMenu::Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid(node)) {
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("title", node))
- {
+ if (NodeValid("title", node)) {
rapidxml::xml_node<char> *tinode = node->first_node("title");
title.Load(tinode);
- for (auto n = tinode->first_node("quote"); n != NULL; n = n->next_sibling("quote"))
- {
+ for (auto n = tinode->first_node("quote"); n != NULL; n = n->next_sibling("quote")) {
std::string str;
LoadStr(str, "text", n);
quote.push_back(str);
@@ -29,13 +25,11 @@ void GameOverMenu::Load(rapidxml::xml_node<char> *node)
}
}
-int GameOverMenu::HandleEvents(const SDL_Event &Event)
-{
+int GameOverMenu::HandleEvents(const SDL_Event &Event) {
return menu.HandleEvents(Event);
}
-void GameOverMenu::Draw()
-{
+void GameOverMenu::Draw() {
bg.Draw();
if (cur < quote.size())
title.Draw(quote.at(cur));
@@ -43,8 +37,7 @@ void GameOverMenu::Draw()
menu.Draw();
}
-void GameOverMenu::SetUI()
-{
+void GameOverMenu::SetUI() {
bg.SetUI();
title.SetUI();
menu.SetUI();
diff --git a/engines/crab/GameOverMenu.h b/engines/crab/GameOverMenu.h
index e5844445062..1abb27407d1 100644
--- a/engines/crab/GameOverMenu.h
+++ b/engines/crab/GameOverMenu.h
@@ -1,42 +1,39 @@
#pragma once
+#include "ImageData.h"
+#include "TextData.h"
#include "common_header.h"
#include "menu.h"
-#include "TextData.h"
-#include "ImageData.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class GameOverMenu
- {
- //Background image
- ImageData bg;
+namespace pyrodactyl {
+namespace ui {
+class GameOverMenu {
+ // Background image
+ ImageData bg;
- //The selection of quotes, we pick one out of these
- std::vector<std::string> quote;
+ // The selection of quotes, we pick one out of these
+ std::vector<std::string> quote;
- //The current picked quote
- unsigned int cur;
+ // The current picked quote
+ unsigned int cur;
- //How to draw the quote
- TextData title;
+ // How to draw the quote
+ TextData title;
- //The menu for actions we can take
- ButtonMenu menu;
+ // The menu for actions we can take
+ ButtonMenu menu;
- public:
- GameOverMenu(void){ cur = 0; }
- ~GameOverMenu(void){}
+public:
+ GameOverMenu(void) { cur = 0; }
+ ~GameOverMenu(void) {}
- void Reset() { cur = gRandom.Num() % quote.size(); }
+ void Reset() { cur = gRandom.Num() % quote.size(); }
- void Load(rapidxml::xml_node<char> *node);
- int HandleEvents(const SDL_Event &Event);
- void Draw();
+ void Load(rapidxml::xml_node<char> *node);
+ int HandleEvents(const SDL_Event &Event);
+ void Draw();
- void SetUI();
- };
- }
-}
\ No newline at end of file
+ void SetUI();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index 1b93b959468..a43712bd7f5 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -1,38 +1,36 @@
-#include "stdafx.h"
#include "GameParam.h"
+#include "stdafx.h"
-//Temporary values go here
+// Temporary values go here
TempValue gTemp;
-//The global file path object
+// The global file path object
FilePaths gFilePath;
-//Are we in debug mode or not?
+// Are we in debug mode or not?
bool GameDebug = false;
-//A temporary list of strings we use when storing numbers in a file
+// A temporary list of strings we use when storing numbers in a file
StringPool gStrPool;
-//Generate random numbers using this
+// Generate random numbers using this
RandomNumberGen gRandom;
-FilePaths::FilePaths() :
-common("res/levels/common.xml"),
-mod_path("mods/"),
-mod_ext(".unrmod"),
-mod_cur("res/default.xml"),
-mainmenu_l("res/layout/main_menu_l.xml"),
-mainmenu_r("res/layout/main_menu_r.xml"),
-sound_effect("res/sounds/effects.xml"),
-sound_music("res/sounds/music.xml"),
-font("res/fonts/fonts.xml"),
-icon("res/gfx/icon.bmp"),
-save_dir("save/"),
-save_ext(".unr"),
-shaders("res/shaders/list.xml"),
-colors("res/gfx/colors.xml"),
-current_r("res/layout/main_menu_r.xml")
-{
+FilePaths::FilePaths() : common("res/levels/common.xml"),
+ mod_path("mods/"),
+ mod_ext(".unrmod"),
+ mod_cur("res/default.xml"),
+ mainmenu_l("res/layout/main_menu_l.xml"),
+ mainmenu_r("res/layout/main_menu_r.xml"),
+ sound_effect("res/sounds/effects.xml"),
+ sound_music("res/sounds/music.xml"),
+ font("res/fonts/fonts.xml"),
+ icon("res/gfx/icon.bmp"),
+ save_dir("save/"),
+ save_ext(".unr"),
+ shaders("res/shaders/list.xml"),
+ colors("res/gfx/colors.xml"),
+ current_r("res/layout/main_menu_r.xml") {
level.clear();
loaded = false;
@@ -41,16 +39,13 @@ current_r("res/layout/main_menu_r.xml")
SDL_free(path);
}
-void FilePaths::LoadLevel(const std::string &filename)
-{
+void FilePaths::LoadLevel(const std::string &filename) {
level.clear();
XMLDoc lev_list(filename);
- if (lev_list.ready())
- {
+ if (lev_list.ready()) {
rapidxml::xml_node<char> *node = lev_list.Doc()->first_node("world");
- for (rapidxml::xml_node<char> * n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc"))
- {
+ for (rapidxml::xml_node<char> *n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
LevelPath l;
l.Load(n);
@@ -62,82 +57,68 @@ void FilePaths::LoadLevel(const std::string &filename)
}
}
-void FilePaths::Load(const std::string &filename)
-{
+void FilePaths::Load(const std::string &filename) {
XMLDoc settings(filename);
- if (settings.ready())
- {
+ if (settings.ready()) {
rapidxml::xml_node<char> *node = settings.Doc()->first_node("paths");
- if (NodeValid(node) && !loaded)
- {
- if (NodeValid("icon", node))
- {
+ if (NodeValid(node) && !loaded) {
+ if (NodeValid("icon", node)) {
rapidxml::xml_node<char> *iconode = node->first_node("icon");
icon = iconode->value();
}
- if (NodeValid("common", node))
- {
+ if (NodeValid("common", node)) {
rapidxml::xml_node<char> *commonnode = node->first_node("common");
common = commonnode->value();
}
- if (NodeValid("font", node))
- {
+ if (NodeValid("font", node)) {
rapidxml::xml_node<char> *fontnode = node->first_node("font");
font = fontnode->value();
}
- if (NodeValid("shader", node))
- {
+ if (NodeValid("shader", node)) {
rapidxml::xml_node<char> *shadnode = node->first_node("shader");
shaders = shadnode->value();
}
- if (NodeValid("color", node))
- {
+ if (NodeValid("color", node)) {
rapidxml::xml_node<char> *colnode = node->first_node("color");
colors = colnode->value();
}
- if (NodeValid("mod", node))
- {
+ if (NodeValid("mod", node)) {
rapidxml::xml_node<char> *modnode = node->first_node("mod");
LoadStr(mod_path, "path", modnode);
LoadStr(mod_ext, "ext", modnode);
LoadStr(mod_cur, "cur", modnode);
}
- if (NodeValid("main_menu", node))
- {
+ if (NodeValid("main_menu", node)) {
rapidxml::xml_node<char> *menunode = node->first_node("main_menu");
LoadStr(mainmenu_l, "l", menunode);
LoadStr(mainmenu_r, "r", menunode);
current_r = mainmenu_r;
}
- if (NodeValid("sound", node))
- {
+ if (NodeValid("sound", node)) {
rapidxml::xml_node<char> *soundnode = node->first_node("sound");
LoadStr(sound_effect, "effect", soundnode);
LoadStr(sound_music, "music", soundnode);
}
- if (NodeValid("save", node))
- {
+ if (NodeValid("save", node)) {
rapidxml::xml_node<char> *savenode = node->first_node("save");
LoadStr(save_dir, "dir", savenode);
LoadStr(save_ext, "ext", savenode);
std::string custom_path;
- if (LoadStr(custom_path, "custom", savenode))
- {
+ if (LoadStr(custom_path, "custom", savenode)) {
using namespace boost::filesystem;
path customdir(custom_path);
- if (exists(customdir) && is_directory(customdir))
- {
+ if (exists(customdir) && is_directory(customdir)) {
appdata = custom_path;
}
}
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 06cd5ac52ce..a60ffd97f12 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -1,65 +1,62 @@
#pragma once
-#include "common_header.h"
#include "XMLDoc.h"
+#include "common_header.h"
#include "loaders.h"
-//The index for all levels in the game
-struct LevelPath
-{
- //The file paths
+// The index for all levels in the game
+struct LevelPath {
+ // The file paths
std::string layout, asset;
- //The name of the level
+ // The name of the level
std::string name;
LevelPath() : layout(""), asset(""), name("") {}
- void Load(rapidxml::xml_node<char> *node)
- {
+ void Load(rapidxml::xml_node<char> *node) {
LoadStr(name, "name", node);
LoadStr(layout, "layout", node);
LoadStr(asset, "res", node);
}
};
-//Stores all layout paths for the game
-struct FilePaths
-{
- //Resources common to all levels and states
+// Stores all layout paths for the game
+struct FilePaths {
+ // Resources common to all levels and states
std::string common;
- //Mod file location, current mod and their extension
+ // Mod file location, current mod and their extension
std::string mod_path, mod_ext, mod_cur;
- //Main menu resources
+ // Main menu resources
std::string mainmenu_l, mainmenu_r;
- //Sounds
+ // Sounds
std::string sound_effect, sound_music;
- //Fonts and window icon file
+ // Fonts and window icon file
std::string font, icon;
- //Save directory and extension
+ // Save directory and extension
std::string save_dir, save_ext;
- //The location of the shader index file
+ // The location of the shader index file
std::string shaders;
- //The location of the color index file
+ // The location of the color index file
std::string colors;
- //The list of levels in the game
+ // The list of levels in the game
std::unordered_map<std::string, LevelPath> level;
- //The file path of the current resource file
+ // The file path of the current resource file
std::string current_r;
- //The application data path (where saves and settings are stored)
+ // The application data path (where saves and settings are stored)
std::string appdata;
- //Has this been loaded?
+ // Has this been loaded?
bool loaded;
FilePaths();
@@ -67,15 +64,13 @@ struct FilePaths
void LoadLevel(const std::string &filename);
};
-//Storage pool used for saving numbers as strings
-class StringPool
-{
- //Store integer strings here
+// Storage pool used for saving numbers as strings
+class StringPool {
+ // Store integer strings here
std::unordered_map<int, std::string> pool_i;
- //Store floating point strings here
- struct FloatString
- {
+ // Store floating point strings here
+ struct FloatString {
float val;
std::string str;
@@ -85,18 +80,19 @@ class StringPool
std::list<FloatString> pool_f;
public:
- StringPool() { pool_i.clear(); pool_f.clear(); }
+ StringPool() {
+ pool_i.clear();
+ pool_f.clear();
+ }
- const char* Get(const int &num)
- {
+ const char *Get(const int &num) {
if (pool_i.count(num) == 0)
pool_i[num] = NumberToString<int>(num);
return pool_i.at(num).c_str();
}
- const char* FGet(const float &num)
- {
+ const char *FGet(const float &num) {
for (auto &i : pool_f)
if (i.val == num)
return i.str.c_str();
@@ -111,9 +107,8 @@ public:
}
};
-//Our source of random numbers
-class RandomNumberGen
-{
+// Our source of random numbers
+class RandomNumberGen {
std::random_device rd;
std::default_random_engine dre;
@@ -123,37 +118,39 @@ public:
int Num() { return dre(); }
};
-struct TempValue
-{
- //Differences between normal mode and iron man mode
- //save button - iron man saves in existing file
- //load button - hidden in iron man
- //exit - saves and exits in iron man
- //quick save and quick load - operate on the iron man file in iron man mode
+struct TempValue {
+ // Differences between normal mode and iron man mode
+ // save button - iron man saves in existing file
+ // load button - hidden in iron man
+ // exit - saves and exits in iron man
+ // quick save and quick load - operate on the iron man file in iron man mode
bool ironman;
- //This is the filename a player chose when selecting "new game" + iron man mode
+ // This is the filename a player chose when selecting "new game" + iron man mode
std::string filename;
- //We use this to see whether the player is exiting to main menu or to credits
+ // We use this to see whether the player is exiting to main menu or to credits
bool credits;
- TempValue() : filename("No IronMan"){ ironman = false; credits = false; }
+ TempValue() : filename("No IronMan") {
+ ironman = false;
+ credits = false;
+ }
};
-//Our global objects
+// Our global objects
-//Where we store some temporary data used in between GameState swapping
+// Where we store some temporary data used in between GameState swapping
extern TempValue gTemp;
-//Whether to draw debug outlines on polygons
+// Whether to draw debug outlines on polygons
extern bool GameDebug;
-//Paths of all files
+// Paths of all files
extern FilePaths gFilePath;
-//Strings are stored here to avoid duplicates and invalid values when writing to XML
+// Strings are stored here to avoid duplicates and invalid values when writing to XML
extern StringPool gStrPool;
-//Generate random numbers using this
+// Generate random numbers using this
extern RandomNumberGen gRandom;
\ No newline at end of file
diff --git a/engines/crab/GeneralSettingMenu.cpp b/engines/crab/GeneralSettingMenu.cpp
index bc6e1ece21e..58c968dad86 100644
--- a/engines/crab/GeneralSettingMenu.cpp
+++ b/engines/crab/GeneralSettingMenu.cpp
@@ -1,5 +1,5 @@
-#include "stdafx.h"
#include "GeneralSettingMenu.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::music;
@@ -7,10 +7,8 @@ using namespace pyrodactyl::music;
//------------------------------------------------------------------------
// Purpose: Load components from file
//------------------------------------------------------------------------
-void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node)
-{
- if (NodeValid("volume", node))
- {
+void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid("volume", node)) {
rapidxml::xml_node<char> *musnode = node->first_node("volume");
if (NodeValid("desc", musnode))
@@ -32,7 +30,7 @@ void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node)
if (NodeValid("text_speed", node))
text_speed.Load(node->first_node("text_speed"));
- //Sync popup text value with actual value
+ // Sync popup text value with actual value
for (auto &i : text_speed.element)
i.state = (i.val == gScreenSettings.text_speed);
}
@@ -40,20 +38,18 @@ void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-void GeneralSettingMenu::HandleEvents(const SDL_Event &Event)
-{
+void GeneralSettingMenu::HandleEvents(const SDL_Event &Event) {
if (vol_music.HandleEvents(Event))
gMusicManager.VolMusic(vol_music.Value());
if (vol_effects.HandleEvents(Event))
gMusicManager.VolEffects(vol_effects.Value());
- //No need to change screen here
+ // No need to change screen here
if (save_on_exit.HandleEvents(Event))
gScreenSettings.save_on_exit = !gScreenSettings.save_on_exit;
- if (mouse_trap.HandleEvents(Event))
- {
+ if (mouse_trap.HandleEvents(Event)) {
gScreenSettings.mouse_trap = !gScreenSettings.mouse_trap;
gScreenSettings.SetMouseTrap();
}
@@ -66,8 +62,7 @@ void GeneralSettingMenu::HandleEvents(const SDL_Event &Event)
//------------------------------------------------------------------------
// Purpose: Sync our buttons with screen settings
//------------------------------------------------------------------------
-void GeneralSettingMenu::InternalEvents()
-{
+void GeneralSettingMenu::InternalEvents() {
save_on_exit.state = gScreenSettings.save_on_exit;
mouse_trap.state = gScreenSettings.mouse_trap;
}
@@ -75,26 +70,24 @@ void GeneralSettingMenu::InternalEvents()
//------------------------------------------------------------------------
// Purpose: Draw stuff
//------------------------------------------------------------------------
-void GeneralSettingMenu::Draw()
-{
- //Draw volume sliders
+void GeneralSettingMenu::Draw() {
+ // Draw volume sliders
notice_volume.Draw();
vol_music.Draw();
vol_effects.Draw();
- //Draw the auto-save on exit option
+ // Draw the auto-save on exit option
save_on_exit.Draw();
mouse_trap.Draw();
- //Text speed radio button menu
+ // Text speed radio button menu
text_speed.Draw();
}
//------------------------------------------------------------------------
// Purpose: Revert to previously backed up settings
//------------------------------------------------------------------------
-void GeneralSettingMenu::RestoreBackup()
-{
+void GeneralSettingMenu::RestoreBackup() {
vol_music.RestoreBackup();
gMusicManager.VolMusic(vol_music.Value());
@@ -105,8 +98,7 @@ void GeneralSettingMenu::RestoreBackup()
//------------------------------------------------------------------------
// Purpose: Set UI positioned on screen size change
//------------------------------------------------------------------------
-void GeneralSettingMenu::SetUI()
-{
+void GeneralSettingMenu::SetUI() {
save_on_exit.SetUI();
mouse_trap.SetUI();
diff --git a/engines/crab/GeneralSettingMenu.h b/engines/crab/GeneralSettingMenu.h
index 4adbf00ebeb..e2260cb410a 100644
--- a/engines/crab/GeneralSettingMenu.h
+++ b/engines/crab/GeneralSettingMenu.h
@@ -1,44 +1,40 @@
#pragma once
+#include "RadioButtonMenu.h"
+#include "ToggleButton.h"
#include "common_header.h"
#include "slider.h"
-#include "ToggleButton.h"
-#include "RadioButtonMenu.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class GeneralSettingMenu
- {
- //The volume sliders and their caption
- Slider vol_music, vol_effects;
- HoverInfo notice_volume;
-
- //Other settings
- ToggleButton save_on_exit, mouse_trap;
-
- //The menu for select pop-up text speed
- RadioButtonMenu text_speed;
-
- public:
- GeneralSettingMenu(){}
- ~GeneralSettingMenu(){}
-
- void Load(rapidxml::xml_node<char> *node);
- void HandleEvents(const SDL_Event &Event);
- void InternalEvents();
-
- void Draw();
- void SetUI();
-
- void CreateBackup()
- {
- vol_music.CreateBackup();
- vol_effects.CreateBackup();
- }
-
- void RestoreBackup();
- };
+namespace pyrodactyl {
+namespace ui {
+class GeneralSettingMenu {
+ // The volume sliders and their caption
+ Slider vol_music, vol_effects;
+ HoverInfo notice_volume;
+
+ // Other settings
+ ToggleButton save_on_exit, mouse_trap;
+
+ // The menu for select pop-up text speed
+ RadioButtonMenu text_speed;
+
+public:
+ GeneralSettingMenu() {}
+ ~GeneralSettingMenu() {}
+
+ void Load(rapidxml::xml_node<char> *node);
+ void HandleEvents(const SDL_Event &Event);
+ void InternalEvents();
+
+ void Draw();
+ void SetUI();
+
+ void CreateBackup() {
+ vol_music.CreateBackup();
+ vol_effects.CreateBackup();
}
-}
+
+ void RestoreBackup();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
diff --git a/engines/crab/GfxSettingMenu.cpp b/engines/crab/GfxSettingMenu.cpp
index 4024dc9dd42..3ec8dd991a4 100644
--- a/engines/crab/GfxSettingMenu.cpp
+++ b/engines/crab/GfxSettingMenu.cpp
@@ -1,13 +1,12 @@
-#include "stdafx.h"
#include "GfxSettingMenu.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
// Purpose: Load components from file
//------------------------------------------------------------------------
-void GfxSettingMenu::Load(rapidxml::xml_node<char> *node)
-{
+void GfxSettingMenu::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("resolution", node))
resolution.Load(node->first_node("resolution"));
@@ -20,8 +19,7 @@ void GfxSettingMenu::Load(rapidxml::xml_node<char> *node)
if (NodeValid("border", node))
border.Load(node->first_node("border"));
- if (NodeValid("quality", node))
- {
+ if (NodeValid("quality", node)) {
rapidxml::xml_node<char> *qnode = node->first_node("quality");
quality.Load(qnode);
@@ -36,65 +34,56 @@ void GfxSettingMenu::Load(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Draw stuff
//------------------------------------------------------------------------
-void GfxSettingMenu::Draw()
-{
- //Window border doesn't matter if you are in fullscreen
+void GfxSettingMenu::Draw() {
+ // Window border doesn't matter if you are in fullscreen
if (!gScreenSettings.fullscreen)
border.Draw();
- //Draw toggle buttons
+ // Draw toggle buttons
brightness.Draw();
fullscreen.Draw();
vsync.Draw();
- //Quality and resolution can only be changed in the main menu
- if (!gScreenSettings.in_game)
- {
- //Tree quality button
+ // Quality and resolution can only be changed in the main menu
+ if (!gScreenSettings.in_game) {
+ // Tree quality button
quality.Draw();
- }
- else
- notice_quality.Draw();//Notice about quality settings
+ } else
+ notice_quality.Draw(); // Notice about quality settings
- //Draw resolution menu
+ // Draw resolution menu
resolution.Draw();
}
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
-int GfxSettingMenu::HandleEvents(const SDL_Event &Event)
-{
- if (fullscreen.HandleEvents(Event))
- {
- //Setting video flags is necessary when toggling fullscreen
+int GfxSettingMenu::HandleEvents(const SDL_Event &Event) {
+ if (fullscreen.HandleEvents(Event)) {
+ // Setting video flags is necessary when toggling fullscreen
gScreenSettings.fullscreen = !gScreenSettings.fullscreen;
gScreenSettings.SetFullscreen();
}
- //Vsync doesn't need to set the change value
- if (vsync.HandleEvents(Event))
- {
+ // Vsync doesn't need to set the change value
+ if (vsync.HandleEvents(Event)) {
gScreenSettings.vsync = !gScreenSettings.vsync;
gScreenSettings.SetVsync();
}
- //Quality and resolution can only be changed in the main menu
- if (!gScreenSettings.in_game)
- {
+ // Quality and resolution can only be changed in the main menu
+ if (!gScreenSettings.in_game) {
if (quality.HandleEvents(Event))
gScreenSettings.quality = !gScreenSettings.quality;
}
- //Window border doesn't matter if you are in fullscreen
- if (border.HandleEvents(Event) && !gScreenSettings.fullscreen)
- {
+ // Window border doesn't matter if you are in fullscreen
+ if (border.HandleEvents(Event) && !gScreenSettings.fullscreen) {
gScreenSettings.border = !gScreenSettings.border;
gScreenSettings.SetWindowBorder();
}
- if (brightness.HandleEvents(Event))
- {
+ if (brightness.HandleEvents(Event)) {
gScreenSettings.gamma = static_cast<float>(brightness.Value()) / 100.0f;
gScreenSettings.SetGamma();
}
@@ -105,8 +94,7 @@ int GfxSettingMenu::HandleEvents(const SDL_Event &Event)
//------------------------------------------------------------------------
// Purpose: Keep button settings synced with our screen settings
//------------------------------------------------------------------------
-void GfxSettingMenu::InternalEvents()
-{
+void GfxSettingMenu::InternalEvents() {
fullscreen.state = gScreenSettings.fullscreen;
vsync.state = gScreenSettings.vsync;
border.state = gScreenSettings.border;
@@ -116,8 +104,7 @@ void GfxSettingMenu::InternalEvents()
//------------------------------------------------------------------------
// Purpose: Rearrange UI when resolution changes
//------------------------------------------------------------------------
-void GfxSettingMenu::SetUI()
-{
+void GfxSettingMenu::SetUI() {
resolution.SetUI();
fullscreen.SetUI();
diff --git a/engines/crab/GfxSettingMenu.h b/engines/crab/GfxSettingMenu.h
index b9c46ddce7e..9dbd3371a17 100644
--- a/engines/crab/GfxSettingMenu.h
+++ b/engines/crab/GfxSettingMenu.h
@@ -1,42 +1,39 @@
#pragma once
-#include "common_header.h"
-#include "slider.h"
#include "ImageData.h"
+#include "ResolutionMenu.h"
#include "StateButton.h"
#include "ToggleButton.h"
-#include "ResolutionMenu.h"
+#include "common_header.h"
+#include "slider.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class GfxSettingMenu
- {
- //The brightness slider
- Slider brightness;
+namespace pyrodactyl {
+namespace ui {
+class GfxSettingMenu {
+ // The brightness slider
+ Slider brightness;
- //The button to toggle between full and windowed, and turn vsync on/off, window borders or not, game quality
- ToggleButton fullscreen, vsync, border, quality;
+ // The button to toggle between full and windowed, and turn vsync on/off, window borders or not, game quality
+ ToggleButton fullscreen, vsync, border, quality;
- //The buttons and menus for changing resolution
- ResolutionMenu resolution;
+ // The buttons and menus for changing resolution
+ ResolutionMenu resolution;
- //Notice that quality setting can only be changed outside the game
- HoverInfo notice_quality;
+ // Notice that quality setting can only be changed outside the game
+ HoverInfo notice_quality;
- public:
- GfxSettingMenu(){}
- ~GfxSettingMenu(){}
+public:
+ GfxSettingMenu() {}
+ ~GfxSettingMenu() {}
- void Load(rapidxml::xml_node<char> *node);
- int HandleEvents(const SDL_Event &Event);
- void InternalEvents();
+ void Load(rapidxml::xml_node<char> *node);
+ int HandleEvents(const SDL_Event &Event);
+ void InternalEvents();
- void Draw();
- void SetUI();
+ void Draw();
+ void SetUI();
- void SetInfo() { resolution.SetInfo(); }
- };
- }
-}
\ No newline at end of file
+ void SetInfo() { resolution.SetInfo(); }
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/HealthIndicator.cpp b/engines/crab/HealthIndicator.cpp
index 68f070a8b1f..6623af8286f 100644
--- a/engines/crab/HealthIndicator.cpp
+++ b/engines/crab/HealthIndicator.cpp
@@ -4,14 +4,11 @@
using namespace pyrodactyl::ui;
-void HealthIndicator :: Load(rapidxml::xml_node<char> *node)
-{
- if(NodeValid(node))
- {
+void HealthIndicator::Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid(node)) {
LoadXY(x, y, node);
- for(auto n = node->first_node("img"); n != NULL; n = n->next_sibling("img"))
- {
+ for (auto n = node->first_node("img"); n != NULL; n = n->next_sibling("img")) {
HealthImage hi;
LoadImgKey(hi.normal, "normal", n);
LoadImgKey(hi.glow, "glow", n);
@@ -22,26 +19,21 @@ void HealthIndicator :: Load(rapidxml::xml_node<char> *node)
}
}
-void HealthIndicator :: Draw(int num)
-{
- for(auto i = img.begin(); i != img.end(); ++i)
- if(num == i->val)
- {
+void HealthIndicator::Draw(int num) {
+ for (auto i = img.begin(); i != img.end(); ++i)
+ if (num == i->val) {
using namespace pyrodactyl::image;
gImageManager.Draw(x, y, i->normal);
gImageManager.GetTexture(i->glow).Alpha(alpha);
gImageManager.Draw(x, y, i->glow);
- if(inc)
- {
+ if (inc) {
alpha += 2;
- if(alpha >= 250)
+ if (alpha >= 250)
inc = false;
- }
- else
- {
+ } else {
alpha -= 2;
- if(alpha < 4)
+ if (alpha < 4)
inc = true;
}
diff --git a/engines/crab/HealthIndicator.h b/engines/crab/HealthIndicator.h
index 0702c3bfcd8..88893e347f8 100644
--- a/engines/crab/HealthIndicator.h
+++ b/engines/crab/HealthIndicator.h
@@ -3,31 +3,32 @@
#include "ImageManager.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class HealthIndicator
- {
- struct HealthImage
- {
- ImageKey normal, glow;
- int val;
- };
+namespace pyrodactyl {
+namespace ui {
+class HealthIndicator {
+ struct HealthImage {
+ ImageKey normal, glow;
+ int val;
+ };
- int x, y;
- std::vector<HealthImage> img;
+ int x, y;
+ std::vector<HealthImage> img;
- //Related to the pulse effect
- Uint8 alpha;
- bool inc;
+ // Related to the pulse effect
+ Uint8 alpha;
+ bool inc;
- public:
- HealthIndicator(){ x = 0; y = 0; alpha = 0; inc = true; }
- ~HealthIndicator(){}
-
- void Load(rapidxml::xml_node<char> *node);
- void Draw(int num);
- };
+public:
+ HealthIndicator() {
+ x = 0;
+ y = 0;
+ alpha = 0;
+ inc = true;
}
-}
\ No newline at end of file
+ ~HealthIndicator() {}
+
+ void Load(rapidxml::xml_node<char> *node);
+ void Draw(int num);
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/HoverInfo.cpp b/engines/crab/HoverInfo.cpp
index 02daca446d3..0c75561e247 100644
--- a/engines/crab/HoverInfo.cpp
+++ b/engines/crab/HoverInfo.cpp
@@ -5,24 +5,20 @@
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
-void HoverInfo :: Init(const HoverInfo &h, const int &XOffset, const int &YOffset)
-{
+void HoverInfo::Init(const HoverInfo &h, const int &XOffset, const int &YOffset) {
*this = h;
x += XOffset;
y += YOffset;
}
-void HoverInfo :: Load(rapidxml::xml_node<char> *node, Rect *parent)
-{
- if(TextData::Load(node,parent,false))
- {
+void HoverInfo::Load(rapidxml::xml_node<char> *node, Rect *parent) {
+ if (TextData::Load(node, parent, false)) {
LoadStr(text, "text", node);
enabled = true;
}
}
-void HoverInfo :: Draw(const int &XOffset, const int &YOffset)
-{
- if(enabled)
+void HoverInfo::Draw(const int &XOffset, const int &YOffset) {
+ if (enabled)
TextData::Draw(text, XOffset, YOffset);
}
\ No newline at end of file
diff --git a/engines/crab/HoverInfo.h b/engines/crab/HoverInfo.h
index d5fb356ad90..d76d83ea79b 100644
--- a/engines/crab/HoverInfo.h
+++ b/engines/crab/HoverInfo.h
@@ -3,24 +3,21 @@
#include "TextData.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- //Tooltip for buttons
- class HoverInfo : public TextData
- {
- public:
- bool enabled;
- std::string text;
+namespace pyrodactyl {
+namespace ui {
+// Tooltip for buttons
+class HoverInfo : public TextData {
+public:
+ bool enabled;
+ std::string text;
- HoverInfo(void){ enabled = false; }
- ~HoverInfo(void){}
+ HoverInfo(void) { enabled = false; }
+ ~HoverInfo(void) {}
- void Init(const HoverInfo &h, const int &XOffset = 0, const int &YOffset = 0);
+ void Init(const HoverInfo &h, const int &XOffset = 0, const int &YOffset = 0);
- void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
- };
- }
-}
\ No newline at end of file
+ void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/Image.cpp b/engines/crab/Image.cpp
index 4b13e900239..b7fd31f9fc8 100644
--- a/engines/crab/Image.cpp
+++ b/engines/crab/Image.cpp
@@ -1,63 +1,55 @@
-#include "stdafx.h"
#include "Image.h"
+#include "stdafx.h"
using namespace pyrodactyl::image;
//------------------------------------------------------------------------
// Purpose: Load a texture
//------------------------------------------------------------------------
-bool Image::Load(SDL_Surface *surface)
-{
- //Create texture from surface pixels
+bool Image::Load(SDL_Surface *surface) {
+ // Create texture from surface pixels
texture = SDL_CreateTextureFromSurface(gRenderer, surface);
- if (texture == NULL)
- {
+ if (texture == NULL) {
fprintf(stderr, "Unable to create texture from SDL_Surface! SDL Error: %s\n", SDL_GetError());
return false;
}
- //Get image dimensions
+ // Get image dimensions
w = surface->w;
h = surface->h;
return true;
}
-bool Image::Load(const std::string &path)
-{
- //Get rid of preexisting texture
+bool Image::Load(const std::string &path) {
+ // Get rid of preexisting texture
Delete();
- //Load image at specified path
- SDL_Surface* loadedSurface = IMG_Load(path.c_str());
- if (loadedSurface == NULL)
- {
+ // Load image at specified path
+ SDL_Surface *loadedSurface = IMG_Load(path.c_str());
+ if (loadedSurface == NULL) {
fprintf(stderr, "Unable to load image %s! SDL_image Error: %s\n", path.c_str(), IMG_GetError());
- }
- else
- {
- //Create texture from surface pixels
+ } else {
+ // Create texture from surface pixels
texture = SDL_CreateTextureFromSurface(gRenderer, loadedSurface);
if (texture == NULL)
fprintf(stderr, "Unable to create texture from %s! SDL Error: %s\n", path.c_str(), SDL_GetError());
- else
- {
- //Get image dimensions
+ else {
+ // Get image dimensions
w = loadedSurface->w;
h = loadedSurface->h;
}
- //Get rid of old loaded surface
+ // Get rid of old loaded surface
SDL_FreeSurface(loadedSurface);
}
- //Return success
+ // Return success
return texture != NULL;
}
-bool Image::Load(rapidxml::xml_node<char> *node, const char* name)
-{
+bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
if (node->first_attribute(name) != NULL)
return Load(node->first_attribute(name)->value());
@@ -67,67 +59,63 @@ bool Image::Load(rapidxml::xml_node<char> *node, const char* name)
//------------------------------------------------------------------------
// Purpose: Draw a texture to the screen without cropping
//------------------------------------------------------------------------
-void Image::Draw(const int &x, const int &y, SDL_Rect *clip, const TextureFlipType &flip)
-{
- //Set rendering space and render to screen
- SDL_Rect renderQuad = { x, y, w, h };
+void Image::Draw(const int &x, const int &y, SDL_Rect *clip, const TextureFlipType &flip) {
+ // Set rendering space and render to screen
+ SDL_Rect renderQuad = {x, y, w, h};
- //Set clip rendering dimensions
- if (clip != NULL)
- {
+ // Set clip rendering dimensions
+ if (clip != NULL) {
renderQuad.w = clip->w;
renderQuad.h = clip->h;
}
- switch (flip)
- {
+ switch (flip) {
case FLIP_NONE:
- //Render to screen
+ // Render to screen
SDL_RenderCopy(gRenderer, texture, clip, &renderQuad);
break;
case FLIP_X:
- //Bottom right <-> Bottom left
- //Top right <-> Top left
+ // Bottom right <-> Bottom left
+ // Top right <-> Top left
SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 0, NULL, SDL_FLIP_HORIZONTAL);
break;
case FLIP_Y:
- //Top right <-> Bottom right
- //Top left <-> Bottom left
+ // Top right <-> Bottom right
+ // Top left <-> Bottom left
SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 0, NULL, SDL_FLIP_VERTICAL);
break;
case FLIP_XY:
- //Top right <-> Bottom left
- //Top left <-> Bottom right
+ // Top right <-> Bottom left
+ // Top left <-> Bottom right
SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 180, NULL, SDL_FLIP_NONE);
break;
case FLIP_D:
- //Top left <-> Bottom right
+ // Top left <-> Bottom right
SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_HORIZONTAL);
break;
case FLIP_DX:
- //Rotate 90 degrees clockwise
+ // Rotate 90 degrees clockwise
SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 90, NULL, SDL_FLIP_NONE);
break;
case FLIP_DY:
- //Rotate 270 degrees clockwise
+ // Rotate 270 degrees clockwise
SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_NONE);
break;
case FLIP_XYD:
- //This is just flipping across the diagonal, instead of the anti-diagonal
- //Top right <-> Bottom left
+ // This is just flipping across the diagonal, instead of the anti-diagonal
+ // Top right <-> Bottom left
SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_VERTICAL);
break;
- default: break;
+ default:
+ break;
}
}
//------------------------------------------------------------------------
// Purpose: Delete texture data
//------------------------------------------------------------------------
-void Image::Delete()
-{
- if (texture != nullptr)
- {
+void Image::Delete() {
+ if (texture != nullptr) {
SDL_DestroyTexture(texture);
texture = nullptr;
w = 0;
diff --git a/engines/crab/Image.h b/engines/crab/Image.h
index b4f146c9a45..3afe02c7621 100644
--- a/engines/crab/Image.h
+++ b/engines/crab/Image.h
@@ -1,51 +1,52 @@
#pragma once
-#include "common_header.h"
#include "ScreenSettings.h"
+#include "common_header.h"
-namespace pyrodactyl
-{
- namespace image
- {
- //Image data used in Asset Manager
- class Image
- {
- //The dimensions of the image
- int w, h;
+namespace pyrodactyl {
+namespace image {
+// Image data used in Asset Manager
+class Image {
+ // The dimensions of the image
+ int w, h;
- //The actual hardware texture
- SDL_Texture* texture;
+ // The actual hardware texture
+ SDL_Texture *texture;
- public:
- Image() : texture(nullptr), w(0), h(0){}
- ~Image(){}
+public:
+ Image() : texture(nullptr), w(0), h(0) {}
+ ~Image() {}
- //Set color modulation
- void Color(const Uint8 &r, const Uint8 &g, const Uint8 &b){ SDL_SetTextureColorMod(texture, r, g, b); }
+ // Set color modulation
+ void Color(const Uint8 &r, const Uint8 &g, const Uint8 &b) { SDL_SetTextureColorMod(texture, r, g, b); }
- //Set blending
- void BlendMode(const SDL_BlendMode &mode){ SDL_SetTextureBlendMode(texture, mode); }
+ // Set blending
+ void BlendMode(const SDL_BlendMode &mode) { SDL_SetTextureBlendMode(texture, mode); }
- //Set alpha modulation
- int Alpha(const Uint8 &alpha){ return SDL_SetTextureAlphaMod(texture, alpha); }
+ // Set alpha modulation
+ int Alpha(const Uint8 &alpha) { return SDL_SetTextureAlphaMod(texture, alpha); }
- //Get alpha modulation
- Uint8 Alpha(){ Uint8 res = 255; SDL_GetTextureAlphaMod(texture, &res); return res; }
+ // Get alpha modulation
+ Uint8 Alpha() {
+ Uint8 res = 255;
+ SDL_GetTextureAlphaMod(texture, &res);
+ return res;
+ }
- //Load the image
- bool Load(const std::string &path);
- bool Load(rapidxml::xml_node<char> *node, const char* name);
- bool Load(SDL_Surface *surface);
+ // Load the image
+ bool Load(const std::string &path);
+ bool Load(rapidxml::xml_node<char> *node, const char *name);
+ bool Load(SDL_Surface *surface);
- //Draw the openGL texture
- void Draw(const int &x, const int &y, SDL_Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+ // Draw the openGL texture
+ void Draw(const int &x, const int &y, SDL_Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
- //Delete the openGL texture
- void Delete();
+ // Delete the openGL texture
+ void Delete();
- const int W() { return w; }
- const int H() { return h; }
- const bool Valid() { return texture != nullptr; }
- };
- }
-}
\ No newline at end of file
+ const int W() { return w; }
+ const int H() { return h; }
+ const bool Valid() { return texture != nullptr; }
+};
+} // End of namespace image
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/ImageData.cpp b/engines/crab/ImageData.cpp
index 84c68de8906..81e8b4caeaf 100644
--- a/engines/crab/ImageData.cpp
+++ b/engines/crab/ImageData.cpp
@@ -1,11 +1,10 @@
-#include "stdafx.h"
#include "ImageData.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo)
-{
+void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo) {
LoadImgKey(key, "img", node, echo);
LoadBool(crop, "crop", node, false);
@@ -15,8 +14,7 @@ void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo)
Element::Load(node, key, echo);
}
-void ImageData::Draw(const int &XOffset, const int &YOffset)
-{
+void ImageData::Draw(const int &XOffset, const int &YOffset) {
if (crop)
gImageManager.Draw(x + XOffset, y + YOffset, key, &clip);
else
diff --git a/engines/crab/ImageData.h b/engines/crab/ImageData.h
index 5206c7f68c1..2366165abd4 100644
--- a/engines/crab/ImageData.h
+++ b/engines/crab/ImageData.h
@@ -1,30 +1,30 @@
#pragma once
-#include "common_header.h"
#include "ImageManager.h"
+#include "common_header.h"
#include "element.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class ImageData : public Element
- {
- //The image
- ImageKey key;
+namespace pyrodactyl {
+namespace ui {
+class ImageData : public Element {
+ // The image
+ ImageKey key;
- //Should we clip the image? (usually used for large background images)
- bool crop;
+ // Should we clip the image? (usually used for large background images)
+ bool crop;
- //The clip rectangle, used only when clip is true
- Rect clip;
+ // The clip rectangle, used only when clip is true
+ Rect clip;
- public:
- ImageData(){ key = 0; crop = false; }
- ~ImageData(){}
-
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
- };
+public:
+ ImageData() {
+ key = 0;
+ crop = false;
}
-}
\ No newline at end of file
+ ~ImageData() {}
+
+ void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0);
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/ImageManager.cpp b/engines/crab/ImageManager.cpp
index 4274df8609a..1f50518fda1 100644
--- a/engines/crab/ImageManager.cpp
+++ b/engines/crab/ImageManager.cpp
@@ -2,42 +2,36 @@
// Author: Arvind
// Purpose: Contains the image manager class - used to manage in-game images
//=============================================================================
-#include "stdafx.h"
#include "ImageManager.h"
#include "XMLDoc.h"
+#include "stdafx.h"
using namespace pyrodactyl::image;
-//Stuff we use throughout the game
-namespace pyrodactyl
-{
- namespace image
- {
- ImageManager gImageManager;
- }
+// Stuff we use throughout the game
+namespace pyrodactyl {
+namespace image {
+ImageManager gImageManager;
}
+} // End of namespace pyrodactyl
//------------------------------------------------------------------------
// Purpose: Load assets here.
//------------------------------------------------------------------------
-void ImageManager::LoadMap(const std::string &filename, const MapID &mapid)
-{
+void ImageManager::LoadMap(const std::string &filename, const MapID &mapid) {
for (auto it = map[mapid].begin(); it != map[mapid].end(); ++it)
it->second.Delete();
map[mapid].clear();
XMLDoc image_list(filename);
- if (image_list.ready())
- {
+ if (image_list.ready()) {
rapidxml::xml_node<char> *node = image_list.Doc()->first_node("res");
- for (auto n = node->first_node("image"); n != NULL; n = n->next_sibling("image"))
- {
+ for (auto n = node->first_node("image"); n != NULL; n = n->next_sibling("image")) {
ImageKey key;
- if (LoadImgKey(key, "name", n))
- {
- //Load different images depending on image quality setting
- //Check if there is a low quality image specified for the asset id
- //if yes, load it - if no, just load the higher quality one
+ if (LoadImgKey(key, "name", n)) {
+ // Load different images depending on image quality setting
+ // Check if there is a low quality image specified for the asset id
+ // if yes, load it - if no, just load the higher quality one
bool valid = false;
std::string path;
@@ -55,8 +49,7 @@ void ImageManager::LoadMap(const std::string &filename, const MapID &mapid)
}
}
- if (NodeValid("mouse", node, false))
- {
+ if (NodeValid("mouse", node, false)) {
using namespace pyrodactyl::input;
gMouse.Quit();
gMouse.Load(node->first_node("mouse"));
@@ -64,15 +57,14 @@ void ImageManager::LoadMap(const std::string &filename, const MapID &mapid)
}
}
-bool ImageManager::Init()
-{
- //First, delete everything that exists
+bool ImageManager::Init() {
+ // First, delete everything that exists
Quit();
- //Load common assets
+ // Load common assets
LoadMap(gFilePath.common, MAP_COMMON);
- //Load main menu assets
+ // Load main menu assets
LoadMap(gFilePath.current_r, MAP_CURRENT);
invalid_img = map[MAP_COMMON][0];
@@ -83,8 +75,7 @@ bool ImageManager::Init()
//------------------------------------------------------------------------
// Purpose: Add texture to image map
//------------------------------------------------------------------------
-void ImageManager::AddTexture(const ImageKey &id, SDL_Surface* surface, int mapindex)
-{
+void ImageManager::AddTexture(const ImageKey &id, SDL_Surface *surface, int mapindex) {
if (map[mapindex].count(id) > 0)
FreeTexture(id, mapindex);
@@ -95,8 +86,7 @@ void ImageManager::AddTexture(const ImageKey &id, SDL_Surface* surface, int mapi
//------------------------------------------------------------------------
// Purpose: Get texture for a particular id
//------------------------------------------------------------------------
-void ImageManager::GetTexture(const ImageKey &id, Image &data)
-{
+void ImageManager::GetTexture(const ImageKey &id, Image &data) {
if (map[MAP_CURRENT].count(id) > 0)
data = map[MAP_CURRENT][id];
else if (map[MAP_COMMON].count(id) > 0)
@@ -105,8 +95,7 @@ void ImageManager::GetTexture(const ImageKey &id, Image &data)
data = invalid_img;
}
-Image& ImageManager::GetTexture(const ImageKey &id)
-{
+Image &ImageManager::GetTexture(const ImageKey &id) {
if (map[MAP_CURRENT].count(id) > 0)
return map[MAP_CURRENT][id];
else if (map[MAP_COMMON].count(id) > 0)
@@ -115,8 +104,7 @@ Image& ImageManager::GetTexture(const ImageKey &id)
return invalid_img;
}
-bool ImageManager::ValidTexture(const ImageKey &id)
-{
+bool ImageManager::ValidTexture(const ImageKey &id) {
if (id != 0 && (map[MAP_CURRENT].count(id) > 0 || map[MAP_COMMON].count(id) > 0))
return true;
@@ -126,24 +114,21 @@ bool ImageManager::ValidTexture(const ImageKey &id)
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Rect* clip,
- const TextureFlipType &flip)
-{
+void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Rect *clip,
+ const TextureFlipType &flip) {
GetTexture(id).Draw(x, y, clip, flip);
}
//------------------------------------------------------------------------
// Purpose: Dim the screen by drawing a 128 alpha black rectangle over it
//------------------------------------------------------------------------
-void ImageManager::DimScreen()
-{
+void ImageManager::DimScreen() {
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 128);
SDL_RenderFillRect(gRenderer, NULL);
}
-void ImageManager::BlackScreen()
-{
+void ImageManager::BlackScreen() {
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 255);
SDL_RenderFillRect(gRenderer, NULL);
@@ -151,10 +136,8 @@ void ImageManager::BlackScreen()
//------------------------------------------------------------------------
// Purpose: free resources
//------------------------------------------------------------------------
-void ImageManager::Quit()
-{
- for (int i = 0; i < MAP_TOTAL; i++)
- {
+void ImageManager::Quit() {
+ for (int i = 0; i < MAP_TOTAL; i++) {
for (auto it = map[i].begin(); it != map[i].end(); ++it)
it->second.Delete();
diff --git a/engines/crab/ImageManager.h b/engines/crab/ImageManager.h
index 2dc379171ff..0b7a95be7ed 100644
--- a/engines/crab/ImageManager.h
+++ b/engines/crab/ImageManager.h
@@ -4,79 +4,77 @@
//=============================================================================
#pragma once
-#include "common_header.h"
-#include "Image.h"
-#include "loaders.h"
#include "GameParam.h"
+#include "Image.h"
#include "LoadingScreen.h"
-#include "cursor.h"
#include "TMXTileSet.h"
+#include "common_header.h"
+#include "cursor.h"
+#include "loaders.h"
-//We use this object as the key for all image assets
+// We use this object as the key for all image assets
typedef unsigned int ImageKey;
-//Since we use unsigned int as a key for images, our LoadImgKey function is LoadNum
+// Since we use unsigned int as a key for images, our LoadImgKey function is LoadNum
#define LoadImgKey LoadNum
-namespace pyrodactyl
-{
- namespace image
- {
- //We store images here
- typedef std::unordered_map<ImageKey, Image> TextureMap;
+namespace pyrodactyl {
+namespace image {
+// We store images here
+typedef std::unordered_map<ImageKey, Image> TextureMap;
- //Two image maps are used in the game - current (changes with level) and common
- enum MapID { MAP_CURRENT, MAP_COMMON, MAP_TOTAL };
+// Two image maps are used in the game - current (changes with level) and common
+enum MapID { MAP_CURRENT,
+ MAP_COMMON,
+ MAP_TOTAL };
- class ImageManager
- {
- //Assets are stored in images
- //Common is stuff used everywhere - this is only loaded once
- TextureMap map[MAP_TOTAL];
+class ImageManager {
+ // Assets are stored in images
+ // Common is stuff used everywhere - this is only loaded once
+ TextureMap map[MAP_TOTAL];
- //The default image for all invalid image names
- Image invalid_img;
+ // The default image for all invalid image names
+ Image invalid_img;
- public:
- //The tile sets used in the level
- TMX::TileSetGroup tileset;
+public:
+ // The tile sets used in the level
+ TMX::TileSetGroup tileset;
- //This image is used to notify player about changes to quests and inventory
- ImageKey notify;
+ // This image is used to notify player about changes to quests and inventory
+ ImageKey notify;
- ImageManager(){ notify = 0; }
- ~ImageManager(){}
+ ImageManager() { notify = 0; }
+ ~ImageManager() {}
- void Quit();
+ void Quit();
- bool Init();
- void LoadPaths();
+ bool Init();
+ void LoadPaths();
- //image related stuff
+ // image related stuff
- //Load all images specified in an xml file in a map
- void LoadMap(const std::string &filename, const MapID &mapid = MAP_CURRENT);
+ // Load all images specified in an xml file in a map
+ void LoadMap(const std::string &filename, const MapID &mapid = MAP_CURRENT);
- void AddTexture(const ImageKey &id, SDL_Surface* surface, int mapindex = MAP_COMMON);
- void FreeTexture(const ImageKey &id, int mapindex = MAP_COMMON) { map[mapindex][id].Delete(); }
- void GetTexture(const ImageKey &id, Image &data);
- Image& GetTexture(const ImageKey &id);
- bool ValidTexture(const ImageKey &id);
+ void AddTexture(const ImageKey &id, SDL_Surface *surface, int mapindex = MAP_COMMON);
+ void FreeTexture(const ImageKey &id, int mapindex = MAP_COMMON) { map[mapindex][id].Delete(); }
+ void GetTexture(const ImageKey &id, Image &data);
+ Image &GetTexture(const ImageKey &id);
+ bool ValidTexture(const ImageKey &id);
- void Draw(const int &x, const int &y, const ImageKey &id,
- Rect* clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+ void Draw(const int &x, const int &y, const ImageKey &id,
+ Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
- void DimScreen();
- void BlackScreen();
+ void DimScreen();
+ void BlackScreen();
- //Draw the notification icon
- void NotifyDraw(const int &x, const int &y)
- {
- auto *k = &GetTexture(notify);
- Draw(x - k->W() / 2, y - k->H() / 2, notify);
- }
- };
-
- extern ImageManager gImageManager;
+ // Draw the notification icon
+ void NotifyDraw(const int &x, const int &y) {
+ auto *k = &GetTexture(notify);
+ Draw(x - k->W() / 2, y - k->H() / 2, notify);
}
-}
\ No newline at end of file
+};
+
+extern ImageManager gImageManager;
+} // End of namespace image
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/Inventory.cpp b/engines/crab/Inventory.cpp
index 6017bb17ef1..c9c72034d1b 100644
--- a/engines/crab/Inventory.cpp
+++ b/engines/crab/Inventory.cpp
@@ -1,5 +1,5 @@
-#include "stdafx.h"
#include "Inventory.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -9,14 +9,11 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load layout
//------------------------------------------------------------------------
-void Inventory::Load(const std::string &filename)
-{
+void Inventory::Load(const std::string &filename) {
XMLDoc conf(filename);
- if (conf.ready())
- {
- rapidxml::xml_node<char> * node = conf.Doc()->first_node("inventory");
- if (NodeValid(node))
- {
+ if (conf.ready()) {
+ rapidxml::xml_node<char> *node = conf.Doc()->first_node("inventory");
+ if (NodeValid(node)) {
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
@@ -31,18 +28,14 @@ void Inventory::Load(const std::string &filename)
}
}
-void Inventory::LoadItem(const std::string &char_id, const std::string &id)
-{
+void Inventory::LoadItem(const std::string &char_id, const std::string &id) {
Item i;
XMLDoc item_list(itemfile);
- if (item_list.ready())
- {
+ if (item_list.ready()) {
rapidxml::xml_node<char> *node = item_list.Doc()->first_node("items");
- for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item"))
- {
+ for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item")) {
std::string str = n->first_attribute("id")->value();
- if (id == str)
- {
+ if (id == str) {
i.Load(n);
AddItem(char_id, i);
break;
@@ -51,29 +44,25 @@ void Inventory::LoadItem(const std::string &char_id, const std::string &id)
}
}
-void Inventory::DelItem(const std::string &char_id, const std::string &item_id)
-{
+void Inventory::DelItem(const std::string &char_id, const std::string &item_id) {
collection.Del(char_id, item_id);
}
-void Inventory::AddItem(const std::string &char_id, Item &item)
-{
+void Inventory::AddItem(const std::string &char_id, Item &item) {
collection.Add(char_id, item);
}
-bool Inventory::HasItem(const std::string &char_id, const std::string &container, const std::string &item_id)
-{
+bool Inventory::HasItem(const std::string &char_id, const std::string &container, const std::string &item_id) {
return collection.Has(char_id, container, item_id);
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Inventory::Draw(Person &obj, const int &money_val)
-{
+void Inventory::Draw(Person &obj, const int &money_val) {
bg.Draw();
- //helper.DrawInfo(obj);
- collection.Draw(obj.id/*, helper*/);
+ // helper.DrawInfo(obj);
+ collection.Draw(obj.id /*, helper*/);
money.caption.text = NumberToString(money_val);
money.Draw();
@@ -82,8 +71,7 @@ void Inventory::Draw(Person &obj, const int &money_val)
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Inventory::HandleEvents(const std::string &char_id, const SDL_Event &Event)
-{
+void Inventory::HandleEvents(const std::string &char_id, const SDL_Event &Event) {
collection.HandleEvents(char_id, Event);
money.HandleEvents(Event);
}
@@ -91,14 +79,12 @@ void Inventory::HandleEvents(const std::string &char_id, const SDL_Event &Event)
//------------------------------------------------------------------------
// Purpose: Load and save items
//------------------------------------------------------------------------
-void Inventory::LoadState(rapidxml::xml_node<char> *node)
-{
+void Inventory::LoadState(rapidxml::xml_node<char> *node) {
if (NodeValid("items", node))
collection.LoadState(node->first_node("items"));
}
-void Inventory::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
+void Inventory::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "items");
collection.SaveState(doc, child);
root->append_node(child);
@@ -107,8 +93,7 @@ void Inventory::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char
//------------------------------------------------------------------------
// Purpose: Set UI positions after screen size change
//------------------------------------------------------------------------
-void Inventory::SetUI()
-{
+void Inventory::SetUI() {
bg.SetUI();
collection.SetUI();
money.SetUI();
diff --git a/engines/crab/Inventory.h b/engines/crab/Inventory.h
index 07483f4433a..d5ab455fab4 100644
--- a/engines/crab/Inventory.h
+++ b/engines/crab/Inventory.h
@@ -1,54 +1,51 @@
#pragma once
-#include "common_header.h"
-#include "ItemCollection.h"
#include "ImageData.h"
+#include "ItemCollection.h"
#include "ItemSlot.h"
#include "Stat.h"
#include "button.h"
+#include "common_header.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class Inventory
- {
- //The background image and location
- ImageData bg;
+namespace pyrodactyl {
+namespace ui {
+class Inventory {
+ // The background image and location
+ ImageData bg;
- //The equipment and storage space, stored according to the player character id
- pyrodactyl::item::ItemCollection collection;
+ // The equipment and storage space, stored according to the player character id
+ pyrodactyl::item::ItemCollection collection;
- //To draw the player stats
- //pyrodactyl::stat::StatDrawHelper helper;
+ // To draw the player stats
+ // pyrodactyl::stat::StatDrawHelper helper;
- //The file where all the item information is stored
- std::string itemfile;
+ // The file where all the item information is stored
+ std::string itemfile;
- //Used to draw the money value
- Button money;
+ // Used to draw the money value
+ Button money;
- public:
- Inventory(){}
- ~Inventory(){}
+public:
+ Inventory() {}
+ ~Inventory() {}
- void Init(const std::string &char_id) { collection.Init(char_id); }
+ void Init(const std::string &char_id) { collection.Init(char_id); }
- void LoadItem(const std::string &char_id, const std::string &name);
- void AddItem(const std::string &char_id, pyrodactyl::item::Item &item);
- void DelItem(const std::string &char_id, const std::string &item_id);
- bool HasItem(const std::string &char_id, const std::string &container, const std::string &item_id);
+ void LoadItem(const std::string &char_id, const std::string &name);
+ void AddItem(const std::string &char_id, pyrodactyl::item::Item &item);
+ void DelItem(const std::string &char_id, const std::string &item_id);
+ bool HasItem(const std::string &char_id, const std::string &container, const std::string &item_id);
- void Load(const std::string &filename);
- void Draw(pyrodactyl::people::Person &obj, const int &money_val);
- void HandleEvents(const std::string &char_id, const SDL_Event &Event);
+ void Load(const std::string &filename);
+ void Draw(pyrodactyl::people::Person &obj, const int &money_val);
+ void HandleEvents(const std::string &char_id, const SDL_Event &Event);
- void LoadState(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void ItemFile(const std::string &filename) { itemfile = filename; }
+ void ItemFile(const std::string &filename) { itemfile = filename; }
- void SetUI();
- };
- }
-}
\ No newline at end of file
+ void SetUI();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/Item.cpp b/engines/crab/Item.cpp
index 3150eab597f..a677e9a0714 100644
--- a/engines/crab/Item.cpp
+++ b/engines/crab/Item.cpp
@@ -1,5 +1,5 @@
-#include "stdafx.h"
#include "Item.h"
+#include "stdafx.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::item;
@@ -9,10 +9,8 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void Item::Load(rapidxml::xml_node<char> *node)
-{
- if (NodeValid(node))
- {
+void Item::Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid(node)) {
LoadStr(id, "id", node);
LoadStr(name, "name", node);
LoadStr(type, "type", node);
@@ -20,8 +18,7 @@ void Item::Load(rapidxml::xml_node<char> *node)
LoadImgKey(img, "img", node);
bonus.clear();
- for (auto n = node->first_node("bonus"); n != NULL; n = n->next_sibling("bonus"))
- {
+ for (auto n = node->first_node("bonus"); n != NULL; n = n->next_sibling("bonus")) {
Bonus b;
b.Load(n);
bonus.push_back(b);
@@ -29,8 +26,7 @@ void Item::Load(rapidxml::xml_node<char> *node)
}
}
-void Item::Clear()
-{
+void Item::Clear() {
id = "";
name = "";
type = "";
@@ -43,26 +39,32 @@ void Item::Clear()
//------------------------------------------------------------------------
// Purpose: Save and load state
//------------------------------------------------------------------------
-void Item::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
+void Item::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("id", id.c_str()));
root->append_attribute(doc.allocate_attribute("name", name.c_str()));
root->append_attribute(doc.allocate_attribute("type", type.c_str()));
root->append_attribute(doc.allocate_attribute("img", gStrPool.Get(img)));
root->append_attribute(doc.allocate_attribute("desc", desc.c_str()));
- for (auto i = bonus.begin(); i != bonus.end(); ++i)
- {
+ for (auto i = bonus.begin(); i != bonus.end(); ++i) {
auto n = doc.allocate_node(rapidxml::node_element, "bonus");
- switch (i->type)
- {
- case STAT_HEALTH:n->append_attribute(doc.allocate_attribute("type", STATNAME_HEALTH)); break;
- case STAT_ATTACK:n->append_attribute(doc.allocate_attribute("type", STATNAME_ATTACK)); break;
- case STAT_DEFENSE:n->append_attribute(doc.allocate_attribute("type", STATNAME_DEFENSE)); break;
- case STAT_SPEED:n->append_attribute(doc.allocate_attribute("type", STATNAME_SPEED)); break;
+ switch (i->type) {
+ case STAT_HEALTH:
+ n->append_attribute(doc.allocate_attribute("type", STATNAME_HEALTH));
+ break;
+ case STAT_ATTACK:
+ n->append_attribute(doc.allocate_attribute("type", STATNAME_ATTACK));
+ break;
+ case STAT_DEFENSE:
+ n->append_attribute(doc.allocate_attribute("type", STATNAME_DEFENSE));
+ break;
+ case STAT_SPEED:
+ n->append_attribute(doc.allocate_attribute("type", STATNAME_SPEED));
+ break;
/*case STAT_CHARISMA:n->append_attribute(doc.allocate_attribute("type", STATNAME_CHARISMA)); break;
case STAT_INTELLIGENCE:n->append_attribute(doc.allocate_attribute("type", STATNAME_INTELLIGENCE)); break;*/
- default:break;
+ default:
+ break;
}
n->append_attribute(doc.allocate_attribute("val", gStrPool.Get(i->val)));
@@ -73,8 +75,7 @@ void Item::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
//------------------------------------------------------------------------
// Purpose: Calculate effect of item on stats
//------------------------------------------------------------------------
-void Item::StatChange(Person &obj, bool increase)
-{
+void Item::StatChange(Person &obj, bool increase) {
for (auto i = bonus.begin(); i != bonus.end(); ++i)
if (increase)
obj.stat.Change(i->type, i->val);
@@ -82,7 +83,6 @@ void Item::StatChange(Person &obj, bool increase)
obj.stat.Change(i->type, -i->val);
}
-void Item::Draw(const int &x, const int &y)
-{
+void Item::Draw(const int &x, const int &y) {
gImageManager.Draw(x, y, img);
}
\ No newline at end of file
diff --git a/engines/crab/Item.h b/engines/crab/Item.h
index 03c9e7eb2e3..493a2baf251 100644
--- a/engines/crab/Item.h
+++ b/engines/crab/Item.h
@@ -1,41 +1,38 @@
#pragma once
-#include "common_header.h"
#include "ImageManager.h"
-#include "person.h"
#include "bonus.h"
+#include "common_header.h"
+#include "person.h"
-namespace pyrodactyl
-{
- namespace item
- {
- struct Item
- {
- //The id, name and description of the item
- std::string id, name, desc;
+namespace pyrodactyl {
+namespace item {
+struct Item {
+ // The id, name and description of the item
+ std::string id, name, desc;
- //The image for the item
- ImageKey img;
+ // The image for the item
+ ImageKey img;
- //The type of item
- std::string type;
+ // The type of item
+ std::string type;
- //The stat bonuses provided by the item
- std::vector<pyrodactyl::stat::Bonus> bonus;
+ // The stat bonuses provided by the item
+ std::vector<pyrodactyl::stat::Bonus> bonus;
- //The price
- unsigned int value;
+ // The price
+ unsigned int value;
- Item(){ Clear(); }
- ~Item(){}
+ Item() { Clear(); }
+ ~Item() {}
- void Clear();
- void StatChange(pyrodactyl::people::Person &obj, bool increase);
+ void Clear();
+ void StatChange(pyrodactyl::people::Person &obj, bool increase);
- void Load(rapidxml::xml_node<char> *node);
- void Draw(const int &x, const int &y);
+ void Load(rapidxml::xml_node<char> *node);
+ void Draw(const int &x, const int &y);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- };
- }
-}
\ No newline at end of file
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+};
+} // End of namespace item
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/ItemCollection.cpp b/engines/crab/ItemCollection.cpp
index 8572dda41f4..ecfbf67ef12 100644
--- a/engines/crab/ItemCollection.cpp
+++ b/engines/crab/ItemCollection.cpp
@@ -1,5 +1,5 @@
-#include "stdafx.h"
#include "ItemCollection.h"
+#include "stdafx.h"
using namespace pyrodactyl::people;
using namespace pyrodactyl::item;
@@ -8,19 +8,17 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
// Purpose: Load the reference information
//------------------------------------------------------------------------
-void ItemCollection :: Load(rapidxml::xml_node<char> *node)
-{
- if(NodeValid("info",node))
+void ItemCollection::Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid("info", node))
item_info.Load(node->first_node("info"));
- if(NodeValid("ref", node))
+ if (NodeValid("ref", node))
ref.Load(node->first_node("ref"));
- if(NodeValid("inc", node))
+ if (NodeValid("inc", node))
inc.Load(node->first_node("inc"));
- if(NodeValid("dim",node))
- {
+ if (NodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
LoadNum(rows, "rows", dimnode);
LoadNum(cols, "cols", dimnode);
@@ -32,46 +30,41 @@ void ItemCollection :: Load(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Add a character's inventory if not added already
//------------------------------------------------------------------------
-void ItemCollection :: Init(const std::string &char_id)
-{
- if(item.count(char_id) == 0)
+void ItemCollection::Init(const std::string &char_id) {
+ if (item.count(char_id) == 0)
item[char_id].Init(ref, inc, rows, cols, usekeyboard);
}
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void ItemCollection :: HandleEvents(const std::string &char_id, const SDL_Event &Event)
-{
- if(item.count(char_id) > 0)
+void ItemCollection::HandleEvents(const std::string &char_id, const SDL_Event &Event) {
+ if (item.count(char_id) > 0)
item[char_id].HandleEvents(Event);
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ItemCollection :: Draw(const std::string &char_id)
-{
- if(item.count(char_id) > 0)
+void ItemCollection::Draw(const std::string &char_id) {
+ if (item.count(char_id) > 0)
item[char_id].Draw(item_info);
}
//------------------------------------------------------------------------
// Purpose: Delete an item from a character's inventory
//------------------------------------------------------------------------
-void ItemCollection :: Del(const std::string &char_id, const std::string &item_id)
-{
- if(item.count(char_id) > 0)
+void ItemCollection::Del(const std::string &char_id, const std::string &item_id) {
+ if (item.count(char_id) > 0)
item[char_id].Del(item_id);
}
//------------------------------------------------------------------------
// Purpose: Add an item to a character's inventory
//------------------------------------------------------------------------
-void ItemCollection :: Add(const std::string &char_id, Item &item_data)
-{
- //We might want to give a player character not yet encountered an item before we ever meet them
- //Which is why we add a new inventory in case the character inventory does not exist yet
+void ItemCollection::Add(const std::string &char_id, Item &item_data) {
+ // We might want to give a player character not yet encountered an item before we ever meet them
+ // Which is why we add a new inventory in case the character inventory does not exist yet
Init(char_id);
item[char_id].Equip(item_data);
@@ -80,9 +73,8 @@ void ItemCollection :: Add(const std::string &char_id, Item &item_data)
//------------------------------------------------------------------------
// Purpose: Find if a character has an item
//------------------------------------------------------------------------
-bool ItemCollection :: Has(const std::string &char_id, const std::string &container, const std::string &item_id)
-{
- if(item.count(char_id) > 0)
+bool ItemCollection::Has(const std::string &char_id, const std::string &container, const std::string &item_id) {
+ if (item.count(char_id) > 0)
return item[char_id].Has(container, item_id);
return false;
@@ -91,11 +83,9 @@ bool ItemCollection :: Has(const std::string &char_id, const std::string &contai
//------------------------------------------------------------------------
// Purpose: Load items from save file
//------------------------------------------------------------------------
-void ItemCollection :: LoadState(rapidxml::xml_node<char> *node)
-{
- for(auto n = node->first_node(); n != NULL; n = n->next_sibling())
- {
- //Add all characters in the save file, whether we have them in the inventory or not
+void ItemCollection::LoadState(rapidxml::xml_node<char> *node) {
+ for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
+ // Add all characters in the save file, whether we have them in the inventory or not
Init(n->name());
item[n->name()].LoadState(n);
}
@@ -104,12 +94,10 @@ void ItemCollection :: LoadState(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Write items to save file
//------------------------------------------------------------------------
-void ItemCollection :: SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
- for(auto i = item.begin(); i != item.end(); ++i)
- {
+void ItemCollection::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ for (auto i = item.begin(); i != item.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, i->first.c_str());
- i->second.SaveState(doc,child);
+ i->second.SaveState(doc, child);
root->append_node(child);
}
}
@@ -117,10 +105,9 @@ void ItemCollection :: SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_no
//------------------------------------------------------------------------
// Purpose: Reset UI elements when resolution changes
//------------------------------------------------------------------------
-void ItemCollection :: SetUI()
-{
+void ItemCollection::SetUI() {
item_info.SetUI();
- for(auto i = item.begin(); i != item.end(); ++i)
+ for (auto i = item.begin(); i != item.end(); ++i)
i->second.SetUI();
}
\ No newline at end of file
diff --git a/engines/crab/ItemCollection.h b/engines/crab/ItemCollection.h
index acc6be90044..d40d4581ac4 100644
--- a/engines/crab/ItemCollection.h
+++ b/engines/crab/ItemCollection.h
@@ -1,59 +1,60 @@
#pragma once
-#include "common_header.h"
-#include "StatDrawHelper.h"
#include "ItemMenu.h"
+#include "StatDrawHelper.h"
+#include "common_header.h"
-namespace pyrodactyl
-{
- namespace item
- {
- //All the items owned by characters controlled by the player
- class ItemCollection
- {
- //The items for all player characters
- std::unordered_map<std::string, ItemMenu> item;
+namespace pyrodactyl {
+namespace item {
+// All the items owned by characters controlled by the player
+class ItemCollection {
+ // The items for all player characters
+ std::unordered_map<std::string, ItemMenu> item;
- //The reference information for these menus used to display these items
+ // The reference information for these menus used to display these items
- //The reference item slot
- ItemSlot ref;
+ // The reference item slot
+ ItemSlot ref;
- //This vector stores the increments in x,y for each new slot
- Vector2i inc;
+ // This vector stores the increments in x,y for each new slot
+ Vector2i inc;
- //The dimensions of the menu
- unsigned int rows, cols;
+ // The dimensions of the menu
+ unsigned int rows, cols;
- //Draw item description when user clicks an item to select it
- pyrodactyl::ui::ItemDesc item_info;
+ // Draw item description when user clicks an item to select it
+ pyrodactyl::ui::ItemDesc item_info;
- //Should we enable keyboard for the menus
- bool usekeyboard;
+ // Should we enable keyboard for the menus
+ bool usekeyboard;
- public:
- ItemCollection(){ rows = 1; cols = 1; usekeyboard = true; }
- ~ItemCollection(){}
+public:
+ ItemCollection() {
+ rows = 1;
+ cols = 1;
+ usekeyboard = true;
+ }
+ ~ItemCollection() {}
- void Load(rapidxml::xml_node<char> *node);
- void HandleEvents(const std::string &char_id, const SDL_Event &Event);
+ void Load(rapidxml::xml_node<char> *node);
+ void HandleEvents(const std::string &char_id, const SDL_Event &Event);
- void Init(const std::string &char_id);
- void Draw(const std::string &char_id);
+ void Init(const std::string &char_id);
+ void Draw(const std::string &char_id);
- //Requires: id of the character, the item information
- void Add(const std::string &char_id, Item &item_data);
+ // Requires: id of the character, the item information
+ void Add(const std::string &char_id, Item &item_data);
- //Requires: id of the character from which to remove the item, and id of the item
- void Del(const std::string &char_id, const std::string &item_id);
+ // Requires: id of the character from which to remove the item, and id of the item
+ void Del(const std::string &char_id, const std::string &item_id);
- //Requires: id of the character, the name of the container and name of the item
- bool Has(const std::string &char_id, const std::string &container, const std::string &item_id);
+ // Requires: id of the character, the name of the container and name of the item
+ bool Has(const std::string &char_id, const std::string &container, const std::string &item_id);
- void LoadState(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void SetUI();
- };
- }
-}
\ No newline at end of file
+ void SetUI();
+};
+} // End of namespace item
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/ItemDesc.h b/engines/crab/ItemDesc.h
index 82ad2355cb2..de9f5f4b8a1 100644
--- a/engines/crab/ItemDesc.h
+++ b/engines/crab/ItemDesc.h
@@ -1,45 +1,39 @@
#pragma once
+#include "Item.h"
#include "ParagraphData.h"
#include "SectionHeader.h"
-#include "Item.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class ItemDesc
- {
- //The name of the item
- TextData name;
-
- //The description of the item
- ParagraphData desc;
-
- public:
- ItemDesc(){}
- ~ItemDesc(){}
-
- void Load(rapidxml::xml_node<char> *node)
- {
- if (NodeValid("name", node))
- name.Load(node->first_node("name"));
-
- if (NodeValid("desc", node))
- desc.Load(node->first_node("desc"));
- }
-
- void Draw(pyrodactyl::item::Item &item)
- {
- name.Draw(item.name);
- desc.Draw(item.desc);
- }
-
- void SetUI()
- {
- name.SetUI();
- desc.SetUI();
- }
- };
+namespace pyrodactyl {
+namespace ui {
+class ItemDesc {
+ // The name of the item
+ TextData name;
+
+ // The description of the item
+ ParagraphData desc;
+
+public:
+ ItemDesc() {}
+ ~ItemDesc() {}
+
+ void Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid("name", node))
+ name.Load(node->first_node("name"));
+
+ if (NodeValid("desc", node))
+ desc.Load(node->first_node("desc"));
+ }
+
+ void Draw(pyrodactyl::item::Item &item) {
+ name.Draw(item.name);
+ desc.Draw(item.desc);
+ }
+
+ void SetUI() {
+ name.SetUI();
+ desc.SetUI();
}
-}
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ItemMenu.cpp b/engines/crab/ItemMenu.cpp
index da75622f8ff..4614e5036f1 100644
--- a/engines/crab/ItemMenu.cpp
+++ b/engines/crab/ItemMenu.cpp
@@ -1,5 +1,5 @@
-#include "stdafx.h"
#include "ItemMenu.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::item;
@@ -9,13 +9,11 @@ using namespace pyrodactyl::people;
// Purpose: Load the layout and items
//------------------------------------------------------------------------
void ItemMenu::Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows, const unsigned int &cols,
- const bool &keyboard)
-{
+ const bool &keyboard) {
unsigned int size = rows * cols;
- for (unsigned int i = 0; i < size; ++i)
- {
+ for (unsigned int i = 0; i < size; ++i) {
ItemSlot b;
- b.Init(ref, inc.x*(i%cols), inc.y*(i / cols));
+ b.Init(ref, inc.x * (i % cols), inc.y * (i / cols));
element.push_back(b);
}
@@ -26,8 +24,7 @@ void ItemMenu::Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int
//------------------------------------------------------------------------
// Purpose: Load items from file
//------------------------------------------------------------------------
-void ItemMenu::LoadState(rapidxml::xml_node<char> *node)
-{
+void ItemMenu::LoadState(rapidxml::xml_node<char> *node) {
unsigned int count = 0;
for (auto n = node->first_node(); n != NULL && count < element.size(); n = n->next_sibling(), ++count)
element[count].LoadState(n);
@@ -36,8 +33,7 @@ void ItemMenu::LoadState(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Save to file
//------------------------------------------------------------------------
-void ItemMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
+void ItemMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = element.begin(); i != element.end(); ++i)
i->SaveState(doc, root);
}
@@ -45,11 +41,9 @@ void ItemMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
//------------------------------------------------------------------------
// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
//------------------------------------------------------------------------
-void ItemMenu::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset)
-{
+void ItemMenu::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
int result = Menu<ItemSlot>::HandleEvents(Event);
- if (result != -1)
- {
+ if (result != -1) {
select_index = result;
for (unsigned int i = 0; i < element.size(); ++i)
element.at(i).State(i == select_index);
@@ -59,8 +53,7 @@ void ItemMenu::HandleEvents(const SDL_Event &Event, const int &XOffset, const in
//------------------------------------------------------------------------
// Purpose: Draw the slot backgrounds first, then the items
//------------------------------------------------------------------------
-void ItemMenu::Draw(ItemDesc &item_info)
-{
+void ItemMenu::Draw(ItemDesc &item_info) {
if (select_index != -1)
item_info.Draw(element[select_index].item);
@@ -71,8 +64,7 @@ void ItemMenu::Draw(ItemDesc &item_info)
//------------------------------------------------------------------------
// Purpose: Equip an item at the first available location (used in events)
//------------------------------------------------------------------------
-bool ItemMenu::Equip(Item &item)
-{
+bool ItemMenu::Equip(Item &item) {
for (auto i = element.begin(); i != element.end(); ++i)
if (i->category == SLOT_STORAGE && i->Equip(item))
return true;
@@ -83,13 +75,11 @@ bool ItemMenu::Equip(Item &item)
//------------------------------------------------------------------------
// Purpose: Remove all instances of an item
//------------------------------------------------------------------------
-bool ItemMenu::Del(const std::string &id)
-{
+bool ItemMenu::Del(const std::string &id) {
bool result = false;
for (auto &i : element)
- if (i.item.id == id)
- {
+ if (i.item.id == id) {
i.empty = true;
i.item.Clear();
i.unread = false;
@@ -103,22 +93,16 @@ bool ItemMenu::Del(const std::string &id)
//------------------------------------------------------------------------
// Purpose: Find out if we have an item with a name
//------------------------------------------------------------------------
-bool ItemMenu::Has(const std::string &container, const std::string &id)
-{
+bool ItemMenu::Has(const std::string &container, const std::string &id) {
for (auto i = element.begin(); i != element.end(); ++i)
- if (i->item.id == id)
- {
- if (container == "equip")
- {
+ if (i->item.id == id) {
+ if (container == "equip") {
if (i->category == SLOT_EQUIP)
return true;
- }
- else if (container == "storage")
- {
+ } else if (container == "storage") {
if (i->category == SLOT_STORAGE)
return true;
- }
- else
+ } else
return true;
}
@@ -128,27 +112,22 @@ bool ItemMenu::Has(const std::string &container, const std::string &id)
//------------------------------------------------------------------------
// Purpose: Swap an item with another item menu
//------------------------------------------------------------------------
-bool ItemMenu::Swap(ItemMenu &target, int index)
-{
- //We need to scan the slots first for an empty slot to store the item.
- //If no empty slot is found, then swap with a filled slot of same type
- //If no slot of type is found, don't swap items at all
+bool ItemMenu::Swap(ItemMenu &target, int index) {
+ // We need to scan the slots first for an empty slot to store the item.
+ // If no empty slot is found, then swap with a filled slot of same type
+ // If no slot of type is found, don't swap items at all
int found_index = -1, cur_index = 0;
for (auto i = element.begin(); i != element.end(); ++i, ++cur_index)
- if (i->item_type == target.element[index].item_type)
- {
- if (i->empty)
- {
+ if (i->item_type == target.element[index].item_type) {
+ if (i->empty) {
i->Swap(target.element[index]);
return true;
- }
- else
+ } else
found_index = cur_index;
}
- if (found_index != -1)
- {
+ if (found_index != -1) {
element[found_index].Swap(target.element[index]);
return true;
}
diff --git a/engines/crab/ItemMenu.h b/engines/crab/ItemMenu.h
index e0eb5832d68..5ac124acfe7 100644
--- a/engines/crab/ItemMenu.h
+++ b/engines/crab/ItemMenu.h
@@ -1,54 +1,55 @@
#pragma once
-#include "common_header.h"
-#include "menu.h"
-#include "person.h"
+#include "ItemDesc.h"
#include "ItemSlot.h"
#include "StatDrawHelper.h"
#include "StatPreview.h"
-#include "ItemDesc.h"
+#include "common_header.h"
+#include "menu.h"
+#include "person.h"
-namespace pyrodactyl
-{
- namespace item
- {
- //The menu is used to handle interactions like the player clicking on an item to equip it
- class ItemMenu : public pyrodactyl::ui::Menu<ItemSlot>
- {
- protected:
- int preview_index, select_index;
+namespace pyrodactyl {
+namespace item {
+// The menu is used to handle interactions like the player clicking on an item to equip it
+class ItemMenu : public pyrodactyl::ui::Menu<ItemSlot> {
+protected:
+ int preview_index, select_index;
- //Variable to determine if stats of object need updating
- bool update;
+ // Variable to determine if stats of object need updating
+ bool update;
- public:
- //The preview for selected item and hovered item
- //StatPreview select, hover;
+public:
+ // The preview for selected item and hovered item
+ // StatPreview select, hover;
- ItemMenu(){ preview_index = -1; select_index = -1; update = false; }
- ~ItemMenu(){}
+ ItemMenu() {
+ preview_index = -1;
+ select_index = -1;
+ update = false;
+ }
+ ~ItemMenu() {}
- int HoverIndex() { return hover_index; }
+ int HoverIndex() { return hover_index; }
- void Draw(pyrodactyl::ui::ItemDesc &item_info);
- /*pyrodactyl::people::Person &obj, pyrodactyl::stat::StatDrawHelper &helper*/
+ void Draw(pyrodactyl::ui::ItemDesc &item_info);
+ /*pyrodactyl::people::Person &obj, pyrodactyl::stat::StatDrawHelper &helper*/
- void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
- const unsigned int &cols, const bool &keyboard);
+ void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
+ const unsigned int &cols, const bool &keyboard);
- void HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
- /* pyrodactyl::people::Person &obj,*/
+ void HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ /* pyrodactyl::people::Person &obj,*/
- bool Swap(ItemMenu &target, int index);
- bool Equip(Item &item);
- bool Del(const std::string &id);
- bool Has(const std::string &container, const std::string &id);
+ bool Swap(ItemMenu &target, int index);
+ bool Equip(Item &item);
+ bool Del(const std::string &id);
+ bool Has(const std::string &container, const std::string &id);
- //Used to calculate enabled slots
- //void SetEnable();
+ // Used to calculate enabled slots
+ // void SetEnable();
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
- };
- }
-}
\ No newline at end of file
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+};
+} // End of namespace item
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/ItemSlot.cpp b/engines/crab/ItemSlot.cpp
index 3a57131d3ec..e424a32544e 100644
--- a/engines/crab/ItemSlot.cpp
+++ b/engines/crab/ItemSlot.cpp
@@ -1,5 +1,5 @@
-#include "stdafx.h"
#include "ItemSlot.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::item;
@@ -10,14 +10,12 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void ItemSlot::Load(rapidxml::xml_node<char> *node)
-{
+void ItemSlot::Load(rapidxml::xml_node<char> *node) {
StateButton::Load(node);
if (node->first_attribute("slot") == NULL)
no_type = true;
- else
- {
+ else {
LoadStr(item_type, "slot", node);
no_type = false;
}
@@ -32,8 +30,7 @@ void ItemSlot::Load(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Initialize from reference item slot
//------------------------------------------------------------------------
-void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset)
-{
+void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset) {
StateButton::Init(ref, XOffset, YOffset);
canmove = ref.canmove;
no_type = ref.no_type;
@@ -44,8 +41,7 @@ void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset)
//------------------------------------------------------------------------
// Purpose: Save state to file
//------------------------------------------------------------------------
-void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
+void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child;
if (category == SLOT_EQUIP)
@@ -62,8 +58,7 @@ void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
//------------------------------------------------------------------------
// Purpose: Load state from file
//------------------------------------------------------------------------
-void ItemSlot::LoadState(rapidxml::xml_node<char> *node)
-{
+void ItemSlot::LoadState(rapidxml::xml_node<char> *node) {
item.Load(node);
LoadBool(unread, "unread", node);
@@ -76,8 +71,7 @@ void ItemSlot::LoadState(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ItemSlot::Draw()
-{
+void ItemSlot::Draw() {
StateButton::Draw();
if (!empty)
@@ -90,8 +84,7 @@ void ItemSlot::Draw()
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-ButtonAction ItemSlot::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset)
-{
+ButtonAction ItemSlot::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
ButtonAction ac = StateButton::HandleEvents(Event, XOffset, YOffset);
if (ac == BUAC_LCLICK || ac == BUAC_RCLICK)
unread = false;
@@ -103,10 +96,8 @@ ButtonAction ItemSlot::HandleEvents(const SDL_Event &Event, const int &XOffset,
// Purpose: Exchange items with another slot
// this object is the current slot, parameter object is target slot
//------------------------------------------------------------------------
-bool ItemSlot::Swap(ItemSlot &target)
-{
- if (CanSwap(target))
- {
+bool ItemSlot::Swap(ItemSlot &target) {
+ if (CanSwap(target)) {
Item temp = item;
item = target.item;
target.item = temp;
@@ -124,10 +115,8 @@ bool ItemSlot::Swap(ItemSlot &target)
//------------------------------------------------------------------------
// Purpose: Equip an item
//------------------------------------------------------------------------
-bool ItemSlot::Equip(Item &i)
-{
- if ((item_type == i.type || no_type) && empty)
- {
+bool ItemSlot::Equip(Item &i) {
+ if ((item_type == i.type || no_type) && empty) {
item = i;
empty = false;
unread = true;
@@ -140,8 +129,7 @@ bool ItemSlot::Equip(Item &i)
//------------------------------------------------------------------------
// Purpose: Change stats based on item
//------------------------------------------------------------------------
-void ItemSlot::StatChange(Person &obj, bool increase)
-{
+void ItemSlot::StatChange(Person &obj, bool increase) {
if (enabled)
item.StatChange(obj, increase);
}
\ No newline at end of file
diff --git a/engines/crab/ItemSlot.h b/engines/crab/ItemSlot.h
index 66778ea157e..669801654c5 100644
--- a/engines/crab/ItemSlot.h
+++ b/engines/crab/ItemSlot.h
@@ -1,57 +1,61 @@
#pragma once
-#include "common_header.h"
#include "ImageManager.h"
#include "Item.h"
#include "StateButton.h"
+#include "common_header.h"
-namespace pyrodactyl
-{
- namespace item
- {
- enum SlotType { SLOT_EQUIP, SLOT_STORAGE };
+namespace pyrodactyl {
+namespace item {
+enum SlotType { SLOT_EQUIP,
+ SLOT_STORAGE };
- class ItemSlot : public pyrodactyl::ui::StateButton
- {
- //Ignore the type of item check
- bool no_type;
+class ItemSlot : public pyrodactyl::ui::StateButton {
+ // Ignore the type of item check
+ bool no_type;
- public:
- //The type of item allowed in this slot (can be overridden by item_type)
- std::string item_type;
+public:
+ // The type of item allowed in this slot (can be overridden by item_type)
+ std::string item_type;
- //Is the slot empty?
- bool empty;
+ // Is the slot empty?
+ bool empty;
- //Is the slot enabled? (used for stat calculation)
- bool enabled;
+ // Is the slot enabled? (used for stat calculation)
+ bool enabled;
- //Is this a new item? Draw the unread notification icon if so
- bool unread;
+ // Is this a new item? Draw the unread notification icon if so
+ bool unread;
- //The type of the item slot
- SlotType category;
+ // The type of the item slot
+ SlotType category;
- //The item contained in the slot
- Item item;
+ // The item contained in the slot
+ Item item;
- ItemSlot() { empty = true; enabled = true; category = SLOT_STORAGE; no_type = false; unread = false; }
- ~ItemSlot() {}
+ ItemSlot() {
+ empty = true;
+ enabled = true;
+ category = SLOT_STORAGE;
+ no_type = false;
+ unread = false;
+ }
+ ~ItemSlot() {}
- void Init(const ItemSlot &ref, const int &XOffset = 0, const int &YOffset = 0);
- void Load(rapidxml::xml_node<char> *node);
+ void Init(const ItemSlot &ref, const int &XOffset = 0, const int &YOffset = 0);
+ void Load(rapidxml::xml_node<char> *node);
- void Draw();
- pyrodactyl::ui::ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ void Draw();
+ pyrodactyl::ui::ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
- bool CanSwap(ItemSlot &target){ return target.no_type || item.type == target.item_type; }
- bool Swap(ItemSlot &target);
- bool Equip(Item &i);
+ bool CanSwap(ItemSlot &target) { return target.no_type || item.type == target.item_type; }
+ bool Swap(ItemSlot &target);
+ bool Equip(Item &i);
- void StatChange(pyrodactyl::people::Person &obj, bool increase);
+ void StatChange(pyrodactyl::people::Person &obj, bool increase);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
- };
- }
-}
\ No newline at end of file
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+};
+} // End of namespace item
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/KeyBindMenu.cpp b/engines/crab/KeyBindMenu.cpp
index 884da025cb7..0d3c35d1601 100644
--- a/engines/crab/KeyBindMenu.cpp
+++ b/engines/crab/KeyBindMenu.cpp
@@ -1,17 +1,14 @@
-#include "stdafx.h"
#include "KeyBindMenu.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
using namespace pyrodactyl::input;
-void KeyBindMenu::Load(rapidxml::xml_node<char> *node)
-{
- if (NodeValid(node))
- {
- if (NodeValid("menu", node))
- {
+void KeyBindMenu::Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid(node)) {
+ if (NodeValid("menu", node)) {
rapidxml::xml_node<char> *menode = node->first_node("menu");
if (NodeValid("primary", menode))
@@ -36,7 +33,7 @@ void KeyBindMenu::Load(rapidxml::xml_node<char> *node)
desc.Load(menode->first_node("desc"));
}
- //Initialize the menus
+ // Initialize the menus
InitMenu(CON_GAME);
InitMenu(CON_UI);
@@ -45,27 +42,30 @@ void KeyBindMenu::Load(rapidxml::xml_node<char> *node)
}
}
-void KeyBindMenu::StartAndSize(const int &type, int &start, int &size)
-{
- switch (type)
- {
- case CON_GAME: start = IG_START; size = IG_SIZE; break;
- case CON_UI: start = IU_START; size = IU_SIZE; break;
- default: break;
+void KeyBindMenu::StartAndSize(const int &type, int &start, int &size) {
+ switch (type) {
+ case CON_GAME:
+ start = IG_START;
+ size = IG_SIZE;
+ break;
+ case CON_UI:
+ start = IU_START;
+ size = IU_SIZE;
+ break;
+ default:
+ break;
}
}
-void KeyBindMenu::InitMenu(const int &type)
-{
+void KeyBindMenu::InitMenu(const int &type) {
int start = 0, size = 0;
StartAndSize(type, start, size);
- //Initialize the menu
+ // Initialize the menu
menu[type].element.resize(size * 2);
- for (int i = 0; i < size * 2; i += 2)
- {
- int xoffset = inc.x*(i / 2) + divide.x*((i / 2) / dim.x);
- int yoffset = inc.y* ((i / 2) % dim.x) + divide.y*((i / 2) / dim.x);
+ for (int i = 0; i < size * 2; i += 2) {
+ int xoffset = inc.x * (i / 2) + divide.x * ((i / 2) / dim.x);
+ int yoffset = inc.y * ((i / 2) % dim.x) + divide.y * ((i / 2) / dim.x);
menu[type].element.at(i).Init(prim, xoffset, yoffset);
menu[type].element.at(i).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].key);
@@ -75,13 +75,11 @@ void KeyBindMenu::InitMenu(const int &type)
}
}
-void KeyBindMenu::DrawDesc(const int &type)
-{
+void KeyBindMenu::DrawDesc(const int &type) {
int start = 0, size = 0;
StartAndSize(type, start, size);
- for (int i = 0; i < size; i++)
- {
+ for (int i = 0; i < size; i++) {
int xoffset = inc.x * i + divide.x * (i / dim.x);
int yoffset = inc.y * (i % dim.x) + divide.y * (i / dim.x);
@@ -89,37 +87,31 @@ void KeyBindMenu::DrawDesc(const int &type)
}
}
-void KeyBindMenu::Draw()
-{
+void KeyBindMenu::Draw() {
sel_controls.Draw();
menu[sel_controls.cur].Draw();
DrawDesc(sel_controls.cur);
}
-void KeyBindMenu::SetCaption()
-{
+void KeyBindMenu::SetCaption() {
int start = 0, size = 0;
StartAndSize(sel_controls.cur, start, size);
- for (int i = 0; i < size * 2; i += 2)
- {
+ for (int i = 0; i < size * 2; i += 2) {
menu[sel_controls.cur].element.at(i).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].key);
menu[sel_controls.cur].element.at(i + 1).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].alt);
}
}
-void KeyBindMenu::HandleEvents(const SDL_Event &Event)
-{
+void KeyBindMenu::HandleEvents(const SDL_Event &Event) {
if (sel_controls.HandleEvents(Event))
SetCaption();
- switch (state)
- {
+ switch (state) {
case STATE_NORMAL:
choice = menu[sel_controls.cur].HandleEvents(Event);
- if (choice >= 0)
- {
+ if (choice >= 0) {
prompt.Swap(menu[sel_controls.cur].element.at(choice).caption);
state = STATE_KEY;
break;
@@ -127,33 +119,28 @@ void KeyBindMenu::HandleEvents(const SDL_Event &Event)
break;
case STATE_KEY:
- if (Event.type == SDL_KEYDOWN)
- {
+ if (Event.type == SDL_KEYDOWN) {
SwapKey(Event.key.keysym.scancode);
SetCaption();
menu[sel_controls.cur].element.at(choice).caption.col = prompt.col_prev;
state = STATE_NORMAL;
}
break;
- default:break;
+ default:
+ break;
}
}
-void KeyBindMenu::SwapKey(const SDL_Scancode &find)
-{
+void KeyBindMenu::SwapKey(const SDL_Scancode &find) {
int start = 0, size = 0;
StartAndSize(sel_controls.cur, start, size);
int pos = start + (choice / 2);
- for (int i = start; i < start + size; ++i)
- {
- if (gInput.iv[i].key == find)
- {
+ for (int i = start; i < start + size; ++i) {
+ if (gInput.iv[i].key == find) {
gInput.iv[i].key = gInput.iv[pos].key;
break;
- }
- else if (gInput.iv[i].alt == find)
- {
+ } else if (gInput.iv[i].alt == find) {
gInput.iv[i].alt = gInput.iv[pos].key;
break;
}
@@ -165,12 +152,11 @@ void KeyBindMenu::SwapKey(const SDL_Scancode &find)
gInput.iv[pos].alt = find;
}
-void KeyBindMenu::SetUI()
-{
+void KeyBindMenu::SetUI() {
menu[CON_GAME].Clear();
menu[CON_UI].Clear();
- //Initialize the menus
+ // Initialize the menus
prim.SetUI();
alt.SetUI();
InitMenu(CON_GAME);
diff --git a/engines/crab/KeyBindMenu.h b/engines/crab/KeyBindMenu.h
index 3adf28d1df3..75c06033e52 100644
--- a/engines/crab/KeyBindMenu.h
+++ b/engines/crab/KeyBindMenu.h
@@ -1,87 +1,89 @@
#pragma once
-#include "common_header.h"
-#include "menu.h"
#include "ImageData.h"
#include "OptionSelect.h"
+#include "common_header.h"
+#include "menu.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class KeyBindMenu
- {
- //The keyboard controls menu has 2 types of inputs
- enum Controls { CON_GAME, CON_UI, CON_TOTAL };
-
- //Each menu can be in these 2 states
- enum States { STATE_NORMAL, STATE_KEY } state;
-
- //This button swaps between sub-sections "Gameplay" and "Interface"
- OptionSelect sel_controls;
-
- //These two buttons are the template buttons for the menu
- Button prim, alt;
-
- //This is the template text info
- TextData desc;
-
- //inc tells us what to add to the reference buttons to get multiple buttons
- //Divide is the space between two columns
- Vector2i inc, divide;
-
- //The number of rows and columns
- Vector2i dim;
-
- //The menu for the keyboard options in both sub categories
- //all control types have equal entries so we just need to change the text displayed
- ButtonMenu menu[CON_TOTAL];
-
- //The selected button in the current menu
- int choice;
-
- struct PromptInfo
- {
- int col, col_prev;
- std::string text;
-
- PromptInfo(){ col = 0; col_prev = 0; }
-
- void Load(rapidxml::xml_node<char> *node)
- {
- if(NodeValid(node))
- {
- LoadStr(text, "text", node);
- LoadNum(col,"color",node);
- }
- }
-
- void Swap(Caption &c)
- {
- col_prev = c.col;
- c.text = text;
- c.col = col;
- }
- } prompt;
-
- void StartAndSize(const int &type, int &start, int &size);
- void InitMenu(const int &type);
- void DrawDesc(const int &type);
-
- public:
- KeyBindMenu(){ Reset(); choice = -1; }
- ~KeyBindMenu(){}
-
- void Reset(){ state = STATE_NORMAL; }
- void SwapKey(const SDL_Scancode &find);
- bool DisableHotkeys() { return state != STATE_NORMAL; }
-
- void Load(rapidxml::xml_node<char> *node);
- void HandleEvents(const SDL_Event &Event);
- void SetCaption();
-
- void Draw();
- void SetUI();
- };
+namespace pyrodactyl {
+namespace ui {
+class KeyBindMenu {
+ // The keyboard controls menu has 2 types of inputs
+ enum Controls { CON_GAME,
+ CON_UI,
+ CON_TOTAL };
+
+ // Each menu can be in these 2 states
+ enum States { STATE_NORMAL,
+ STATE_KEY } state;
+
+ // This button swaps between sub-sections "Gameplay" and "Interface"
+ OptionSelect sel_controls;
+
+ // These two buttons are the template buttons for the menu
+ Button prim, alt;
+
+ // This is the template text info
+ TextData desc;
+
+ // inc tells us what to add to the reference buttons to get multiple buttons
+ // Divide is the space between two columns
+ Vector2i inc, divide;
+
+ // The number of rows and columns
+ Vector2i dim;
+
+ // The menu for the keyboard options in both sub categories
+ // all control types have equal entries so we just need to change the text displayed
+ ButtonMenu menu[CON_TOTAL];
+
+ // The selected button in the current menu
+ int choice;
+
+ struct PromptInfo {
+ int col, col_prev;
+ std::string text;
+
+ PromptInfo() {
+ col = 0;
+ col_prev = 0;
+ }
+
+ void Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid(node)) {
+ LoadStr(text, "text", node);
+ LoadNum(col, "color", node);
+ }
+ }
+
+ void Swap(Caption &c) {
+ col_prev = c.col;
+ c.text = text;
+ c.col = col;
+ }
+ } prompt;
+
+ void StartAndSize(const int &type, int &start, int &size);
+ void InitMenu(const int &type);
+ void DrawDesc(const int &type);
+
+public:
+ KeyBindMenu() {
+ Reset();
+ choice = -1;
}
-}
\ No newline at end of file
+ ~KeyBindMenu() {}
+
+ void Reset() { state = STATE_NORMAL; }
+ void SwapKey(const SDL_Scancode &find);
+ bool DisableHotkeys() { return state != STATE_NORMAL; }
+
+ void Load(rapidxml::xml_node<char> *node);
+ void HandleEvents(const SDL_Event &Event);
+ void SetCaption();
+
+ void Draw();
+ void SetUI();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/LevelExit.cpp b/engines/crab/LevelExit.cpp
index fe417a831e4..8603367a8db 100644
--- a/engines/crab/LevelExit.cpp
+++ b/engines/crab/LevelExit.cpp
@@ -1,28 +1,22 @@
-#include "stdafx.h"
#include "LevelExit.h"
+#include "stdafx.h"
using namespace pyrodactyl::level;
-void Exit :: Load(rapidxml::xml_node<char> *node)
-{
+void Exit::Load(rapidxml::xml_node<char> *node) {
dim.Load(node);
LoadStr(name, "name", node);
- if(NodeValid("properties",node))
- {
+ if (NodeValid("properties", node)) {
rapidxml::xml_node<char> *propertynode = node->first_node("properties");
- for(auto n = propertynode->first_node("property"); n != NULL; n = n->next_sibling("property"))
- {
+ for (auto n = propertynode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
std::string node_name;
LoadStr(node_name, "name", n);
- if(node_name == "entry_x")
- {
- if(!LoadNum(entry.x, "value", n))
+ if (node_name == "entry_x") {
+ if (!LoadNum(entry.x, "value", n))
entry.x = -1;
- }
- else if(node_name == "entry_y")
- {
- if(!LoadNum(entry.y, "value", n))
+ } else if (node_name == "entry_y") {
+ if (!LoadNum(entry.y, "value", n))
entry.y = -1;
}
}
diff --git a/engines/crab/LevelExit.h b/engines/crab/LevelExit.h
index 5e46ebd0e60..a0ee40eaa8d 100644
--- a/engines/crab/LevelExit.h
+++ b/engines/crab/LevelExit.h
@@ -1,24 +1,21 @@
#pragma once
-#include "common_header.h"
-#include "ImageManager.h"
#include "GameEventInfo.h"
+#include "ImageManager.h"
#include "Shape.h"
+#include "common_header.h"
-namespace pyrodactyl
-{
- namespace level
- {
- struct Exit
- {
- std::string name;
- Shape dim;
- Vector2i entry;
+namespace pyrodactyl {
+namespace level {
+struct Exit {
+ std::string name;
+ Shape dim;
+ Vector2i entry;
- Exit() : entry(-1,-1) {}
- Exit(rapidxml::xml_node<char> *node){ Load(node); }
+ Exit() : entry(-1, -1) {}
+ Exit(rapidxml::xml_node<char> *node) { Load(node); }
- void Load(rapidxml::xml_node<char> *node);
- };
- }
-}
\ No newline at end of file
+ void Load(rapidxml::xml_node<char> *node);
+};
+} // End of namespace level
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index 57610f62325..e54b84b4a5f 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -3,16 +3,16 @@
#include "ImageManager.h"
-enum LevelResultType { LR_NONE, LR_LEVEL, LR_GAMEOVER };
+enum LevelResultType { LR_NONE,
+ LR_LEVEL,
+ LR_GAMEOVER };
-struct LevelResult
-{
+struct LevelResult {
LevelResultType type;
std::string val;
- int x,y;
+ int x, y;
- LevelResult() : val("")
- {
+ LevelResult() : val("") {
type = LR_NONE;
x = -1;
y = -1;
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index 3b1a2072dde..6759e20f16e 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -1,12 +1,11 @@
-#include "stdafx.h"
#include "Line.h"
+#include "stdafx.h"
//------------------------------------------------------------------------
// Purpose: Draw a line from start to end
//------------------------------------------------------------------------
void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
- const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a)
-{
+ const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a) {
SDL_SetRenderDrawColor(gRenderer, r, g, b, a);
SDL_RenderDrawLine(gRenderer, x1, y1, x2, y2);
}
\ No newline at end of file
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index 72125723d8c..e83b9e5d696 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -1,29 +1,28 @@
#pragma once
-#include "common_header.h"
#include "ScreenSettings.h"
+#include "common_header.h"
#include "vectors.h"
-//Find if 2 lines intersect and store the point of intersection
-template <typename T>
-bool CollideLine(const T& p0_x, const T& p0_y, const T& p1_x, const T& p1_y,
- const T& p2_x, const T& p2_y, const T& p3_x, const T& p3_y,
- T *x = NULL, T *y = NULL)
-{
+// Find if 2 lines intersect and store the point of intersection
+template<typename T>
+bool CollideLine(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y,
+ const T &p2_x, const T &p2_y, const T &p3_x, const T &p3_y,
+ T *x = NULL, T *y = NULL) {
Vector2D<T> s1, s2;
- s1.x = p1_x - p0_x; s1.y = p1_y - p0_y;
- s2.x = p3_x - p2_x; s2.y = p3_y - p2_y;
+ s1.x = p1_x - p0_x;
+ s1.y = p1_y - p0_y;
+ s2.x = p3_x - p2_x;
+ s2.y = p3_y - p2_y;
float d = (-s2.x * s1.y + s1.x * s2.y);
- if (d != 0)
- {
+ if (d != 0) {
float s, t;
s = (-s1.y * (p0_x - p2_x) + s1.x * (p0_y - p2_y)) / d;
t = (s2.x * (p0_y - p2_y) - s2.y * (p0_x - p2_x)) / d;
- if (s >= 0 && s <= 1 && t >= 0 && t <= 1)
- {
+ if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
// Collision detected
if (x != NULL)
*x = p0_x + (t * s1.x);
@@ -37,6 +36,6 @@ bool CollideLine(const T& p0_x, const T& p0_y, const T& p1_x, const T& p1_y,
return false; // No collision
}
-//Draw a line OpenGL style
+// Draw a line OpenGL style
void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
- const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a);
\ No newline at end of file
+ const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a);
\ No newline at end of file
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 2a41184cf19..dc835a3bd8b 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -1,18 +1,14 @@
-#include "stdafx.h"
#include "LoadingScreen.h"
#include "XMLDoc.h"
+#include "stdafx.h"
-void LoadingScreen::Load()
-{
+void LoadingScreen::Load() {
const std::string &filename = "res/layout/loading.xml";
XMLDoc doc(filename);
- if (doc.ready())
- {
+ if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.Doc()->first_node("loading");
- if (NodeValid(node))
- {
- if (NodeValid("screens", node))
- {
+ if (NodeValid(node)) {
+ if (NodeValid("screens", node)) {
rapidxml::xml_node<char> *scrnode = node->first_node("screens");
for (auto n = scrnode->first_node("screen"); n != NULL; n = n->next_sibling("screen"))
screen.push_back(n);
@@ -24,36 +20,33 @@ void LoadingScreen::Load()
}
}
-void LoadingScreen::Draw()
-{
- //Change to a random screen
+void LoadingScreen::Draw() {
+ // Change to a random screen
Change();
- //Draw the current screen
+ // Draw the current screen
if (cur < screen.size())
screen.at(cur).Draw();
- //Draw the loading text
+ // Draw the loading text
text.Draw((gScreenSettings.cur.w - text.W()) / 2, (gScreenSettings.cur.h - text.H()) / 2);
- //Update the screen
+ // Update the screen
SDL_RenderPresent(gRenderer);
}
-void LoadingScreen::Dim()
-{
- //This is used when starting or loading a game from the main menu in order to dim the screen
- //until an actual loading screen is drawn
+void LoadingScreen::Dim() {
+ // This is used when starting or loading a game from the main menu in order to dim the screen
+ // until an actual loading screen is drawn
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 200);
SDL_RenderFillRect(gRenderer, NULL);
- //Update the screen
+ // Update the screen
SDL_RenderPresent(gRenderer);
}
-void LoadingScreen::Quit()
-{
+void LoadingScreen::Quit() {
text.Delete();
for (auto i = screen.begin(); i != screen.end(); ++i)
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index dadc344c397..58fd91db5a9 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -1,36 +1,34 @@
#pragma once
+#include "Image.h"
#include "common_header.h"
-#include "vectors.h"
#include "timer.h"
-#include "Image.h"
+#include "vectors.h"
-class LoadingScreen
-{
- struct Screen
- {
- //The background image
+class LoadingScreen {
+ struct Screen {
+ // The background image
pyrodactyl::image::Image bg;
Screen(rapidxml::xml_node<char> *node) { bg.Load(node, "bg"); }
void Delete() { bg.Delete(); }
- void Draw(){ bg.Draw((gScreenSettings.cur.w - bg.W()) / 2, (gScreenSettings.cur.h - bg.H()) / 2); }
+ void Draw() { bg.Draw((gScreenSettings.cur.w - bg.W()) / 2, (gScreenSettings.cur.h - bg.H()) / 2); }
};
- //The different loading screens
+ // The different loading screens
std::vector<Screen> screen;
- //The current loading screen
+ // The current loading screen
unsigned int cur;
- //The text image (says loading)
+ // The text image (says loading)
pyrodactyl::image::Image text;
public:
- LoadingScreen(){ cur = 0; };
+ LoadingScreen() { cur = 0; };
~LoadingScreen(){};
- void Change(){ cur = gRandom.Num() % screen.size(); }
+ void Change() { cur = gRandom.Num() % screen.size(); }
void Load();
void Draw();
diff --git a/engines/crab/MapData.cpp b/engines/crab/MapData.cpp
index 7ce44cb6a8f..1aa2766c97c 100644
--- a/engines/crab/MapData.cpp
+++ b/engines/crab/MapData.cpp
@@ -1,16 +1,14 @@
-#include "stdafx.h"
#include "MapData.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
-void MapData::Load(rapidxml::xml_node<char> *node)
-{
+void MapData::Load(rapidxml::xml_node<char> *node) {
LoadStr(path_bg, "bg", node);
LoadStr(path_overlay, "overlay", node);
}
-void MapData::DestAdd(const std::string &name, const int &x, const int &y)
-{
+void MapData::DestAdd(const std::string &name, const int &x, const int &y) {
MarkerData md;
md.name = name;
md.pos.x = x;
@@ -18,16 +16,14 @@ void MapData::DestAdd(const std::string &name, const int &x, const int &y)
dest.push_back(md);
}
-void MapData::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
+void MapData::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child_clip = doc.allocate_node(rapidxml::node_element, "clip");
for (auto c = reveal.begin(); c != reveal.end(); ++c)
c->SaveState(doc, child_clip, "rect");
root->append_node(child_clip);
rapidxml::xml_node<char> *child_dest = doc.allocate_node(rapidxml::node_element, "dest");
- for (auto d = dest.begin(); d != dest.end(); ++d)
- {
+ for (auto d = dest.begin(); d != dest.end(); ++d) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "pos");
child->append_attribute(doc.allocate_attribute("name", d->name.c_str()));
child->append_attribute(doc.allocate_attribute("x", gStrPool.Get(d->pos.x)));
@@ -37,14 +33,11 @@ void MapData::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
root->append_node(child_dest);
}
-void MapData::LoadState(rapidxml::xml_node<char> *node)
-{
+void MapData::LoadState(rapidxml::xml_node<char> *node) {
reveal.clear();
- if (NodeValid("clip", node))
- {
+ if (NodeValid("clip", node)) {
rapidxml::xml_node<char> *clipnode = node->first_node("clip");
- for (rapidxml::xml_node<char> *n = clipnode->first_node("rect"); n != NULL; n = n->next_sibling("rect"))
- {
+ for (rapidxml::xml_node<char> *n = clipnode->first_node("rect"); n != NULL; n = n->next_sibling("rect")) {
Rect r;
r.Load(n);
reveal.push_back(r);
@@ -52,11 +45,9 @@ void MapData::LoadState(rapidxml::xml_node<char> *node)
}
dest.clear();
- if (NodeValid("dest", node))
- {
+ if (NodeValid("dest", node)) {
rapidxml::xml_node<char> *destnode = node->first_node("dest");
- for (rapidxml::xml_node<char> *n = destnode->first_node("pos"); n != NULL; n = n->next_sibling("pos"))
- {
+ for (rapidxml::xml_node<char> *n = destnode->first_node("pos"); n != NULL; n = n->next_sibling("pos")) {
MarkerData md;
LoadStr(md.name, "name", n);
md.pos.Load(n);
diff --git a/engines/crab/MapData.h b/engines/crab/MapData.h
index 299c68e2e59..267503f1239 100644
--- a/engines/crab/MapData.h
+++ b/engines/crab/MapData.h
@@ -1,41 +1,37 @@
#pragma once
-#include "common_header.h"
#include "Rectangle.h"
+#include "common_header.h"
+
+namespace pyrodactyl {
+namespace ui {
+struct MapData {
+ // The paths of set of map images - background and the fully revealed map overlay
+ std::string path_bg, path_overlay;
+
+ // The places the player has revealed in this world map
+ std::vector<Rect> reveal;
+
+ struct MarkerData {
+ // The name of the marker, same name as the quest
+ std::string name;
+
+ // Position of the marker
+ Vector2i pos;
+ };
+
+ // The set of destinations currently active
+ std::vector<MarkerData> dest;
+
+ MapData() {}
+ MapData(rapidxml::xml_node<char> *node) { Load(node); }
+ ~MapData() {}
+
+ void Load(rapidxml::xml_node<char> *node);
+ void DestAdd(const std::string &name, const int &x, const int &y);
-namespace pyrodactyl
-{
- namespace ui
- {
- struct MapData
- {
- //The paths of set of map images - background and the fully revealed map overlay
- std::string path_bg, path_overlay;
-
- //The places the player has revealed in this world map
- std::vector<Rect> reveal;
-
- struct MarkerData
- {
- //The name of the marker, same name as the quest
- std::string name;
-
- //Position of the marker
- Vector2i pos;
- };
-
- //The set of destinations currently active
- std::vector<MarkerData> dest;
-
- MapData(){}
- MapData(rapidxml::xml_node<char> *node){ Load(node); }
- ~MapData(){}
-
- void Load(rapidxml::xml_node<char> *node);
- void DestAdd(const std::string &name, const int &x, const int &y);
-
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
- };
- }
-}
\ No newline at end of file
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void LoadState(rapidxml::xml_node<char> *node);
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/MapMarkerMenu.cpp b/engines/crab/MapMarkerMenu.cpp
index da2a599cbd9..92ace3e49e9 100644
--- a/engines/crab/MapMarkerMenu.cpp
+++ b/engines/crab/MapMarkerMenu.cpp
@@ -1,21 +1,19 @@
-#include "stdafx.h"
#include "MapMarkerMenu.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void MapMarkerMenu::Load(rapidxml::xml_node<char> *node)
-{
+void MapMarkerMenu::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("ref", node))
ref.Load(node->first_node("ref"));
if (NodeValid("player", node))
player.Load(node->first_node("player"));
- if (NodeValid("offset", node))
- {
+ if (NodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
if (NodeValid("marker", offnode))
@@ -31,19 +29,18 @@ void MapMarkerMenu::Load(rapidxml::xml_node<char> *node)
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void MapMarkerMenu::Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera)
-{
- //Calculate all offsets
+void MapMarkerMenu::Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera) {
+ // Calculate all offsets
Vector2i offset_p(pos.x + player_pos.x + offset.player.x - camera.x, pos.y + player_pos.y + offset.player.y - camera.y);
Vector2i offset_m(pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
- //Only draw the image - captions drawn later to prevent drawing another button over caption
+ // Only draw the image - captions drawn later to prevent drawing another button over caption
player.ImageCaptionOnlyDraw(offset_p.x, offset_p.y);
for (auto &i : menu.element)
i.ImageCaptionOnlyDraw(offset_m.x, offset_m.y);
- //Now draw the tool-tips for everything combined
+ // Now draw the tool-tips for everything combined
player.HoverInfoOnlyDraw(offset_p.x, offset_p.y);
for (auto &i : menu.element)
@@ -53,18 +50,15 @@ void MapMarkerMenu::Draw(const Element &pos, const Vector2i &player_pos, const R
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event)
-{
+void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event) {
if (player_pos.x >= camera.x && player_pos.y >= camera.y)
player.HandleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
int choice = menu.HandleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
- if (choice != -1)
- {
+ if (choice != -1) {
int c = 0;
- for (auto &i : menu.element)
- {
- if (c == choice) //For an already selected marker, clicking it toggles the selection state
+ for (auto &i : menu.element) {
+ if (c == choice) // For an already selected marker, clicking it toggles the selection state
i.State(!i.State());
else
i.State(false);
@@ -77,26 +71,24 @@ void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos,
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
-void MapMarkerMenu::InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds)
-{
- //Find if the player marker is visible or not
+void MapMarkerMenu::InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds) {
+ // Find if the player marker is visible or not
{
Rect r(pos.x + player_pos.x - offset.marker.x - camera.x,
- pos.y + player_pos.y - offset.marker.y - camera.y,
- player.w + offset.marker.x,
- player.h + offset.marker.y);
+ pos.y + player_pos.y - offset.marker.y - camera.y,
+ player.w + offset.marker.x,
+ player.h + offset.marker.y);
player.visible = bounds.Contains(r);
}
- //Redefine p for marker buttons
+ // Redefine p for marker buttons
Vector2i p(pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
- //Calculate visibility for each marker
- for (auto &i : menu.element)
- {
+ // Calculate visibility for each marker
+ for (auto &i : menu.element) {
Rect r(i.x + p.x - offset.marker.x, i.y + p.y - offset.marker.y,
- i.w + offset.marker.x, i.h + offset.marker.y);
+ i.w + offset.marker.x, i.h + offset.marker.y);
i.visible = bounds.Contains(r);
}
@@ -105,8 +97,7 @@ void MapMarkerMenu::InternalEvents(const Element &pos, const Vector2i &player_po
//------------------------------------------------------------------------
// Purpose: Reposition UI
//------------------------------------------------------------------------
-void MapMarkerMenu::SetUI()
-{
+void MapMarkerMenu::SetUI() {
player.SetUI();
menu.SetUI();
}
\ No newline at end of file
diff --git a/engines/crab/MapMarkerMenu.h b/engines/crab/MapMarkerMenu.h
index d371bca3cd8..d6101a13d6c 100644
--- a/engines/crab/MapMarkerMenu.h
+++ b/engines/crab/MapMarkerMenu.h
@@ -1,68 +1,62 @@
#pragma once
-#include "common_header.h"
#include "StateButton.h"
+#include "common_header.h"
#include "menu.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class MapMarkerMenu
- {
- //The reference map marker
- StateButton ref;
+namespace pyrodactyl {
+namespace ui {
+class MapMarkerMenu {
+ // The reference map marker
+ StateButton ref;
- //The menu containing all the map markers
- Menu<StateButton> menu;
+ // The menu containing all the map markers
+ Menu<StateButton> menu;
- //The offset at which every map marker is drawn (used to compensate for icon design width)
- struct { Vector2i marker, player; } offset;
+ // The offset at which every map marker is drawn (used to compensate for icon design width)
+ struct {
+ Vector2i marker, player;
+ } offset;
- //The button for the player's current position
- Button player;
+ // The button for the player's current position
+ Button player;
- public:
- MapMarkerMenu(){}
- ~MapMarkerMenu(){}
+public:
+ MapMarkerMenu() {}
+ ~MapMarkerMenu() {}
- void AddButton(const std::string &name, const int &x, const int &y)
- {
- StateButton b;
- b.Init(ref, x, y);
- b.tooltip.text = name;
- menu.element.push_back(b);
- }
+ void AddButton(const std::string &name, const int &x, const int &y) {
+ StateButton b;
+ b.Init(ref, x, y);
+ b.tooltip.text = name;
+ menu.element.push_back(b);
+ }
- void Clear(){ menu.element.clear(); }
- void AssignPaths() { menu.AssignPaths(); }
+ void Clear() { menu.element.clear(); }
+ void AssignPaths() { menu.AssignPaths(); }
- void SelectDest(const std::string &name)
- {
- for (auto &i : menu.element)
- i.State(i.tooltip.text == name);
- }
+ void SelectDest(const std::string &name) {
+ for (auto &i : menu.element)
+ i.State(i.tooltip.text == name);
+ }
- void Erase(const std::string &name)
- {
- for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
- {
- if (i->tooltip.text == name)
- {
- menu.element.erase(i);
- AssignPaths();
- break;
- }
- }
+ void Erase(const std::string &name) {
+ for (auto i = menu.element.begin(); i != menu.element.end(); ++i) {
+ if (i->tooltip.text == name) {
+ menu.element.erase(i);
+ AssignPaths();
+ break;
}
+ }
+ }
- void Load(rapidxml::xml_node<char> *node);
+ void Load(rapidxml::xml_node<char> *node);
- void Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
- void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
- void InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
+ void Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
+ void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
+ void InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
- void SetUI();
- };
- }
-}
\ No newline at end of file
+ void SetUI();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/ModMenu.cpp b/engines/crab/ModMenu.cpp
index 4733c4f29b0..f237552ceb5 100644
--- a/engines/crab/ModMenu.cpp
+++ b/engines/crab/ModMenu.cpp
@@ -1,13 +1,11 @@
-#include "stdafx.h"
#include "ModMenu.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
-void ModMenu::Load(const std::string &filename)
-{
+void ModMenu::Load(const std::string &filename) {
XMLDoc conf(filename);
- if (conf.ready())
- {
+ if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("mod_menu");
if (NodeValid("bg", node))
@@ -16,28 +14,26 @@ void ModMenu::Load(const std::string &filename)
if (NodeValid("menu", node))
menu.Load(node->first_node("menu"));
- if (NodeValid("preview", node))
- {
+ if (NodeValid("preview", node)) {
auto prnode = node->first_node("preview");
img.pos.Load(prnode);
LoadStr(img.no_preview_path, "path", prnode);
}
- if (NodeValid("offset", node))
- {
+ if (NodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
- //Stuff displayed on the slot button
+ // Stuff displayed on the slot button
td_b[DATA_SAVENAME].Load(offnode->first_node("mod_name"));
td_b[DATA_LASTMODIFIED].Load(offnode->first_node("last_modified"));
- //Stuff displayed when you hover over a slot button
+ // Stuff displayed when you hover over a slot button
td_h[DATA_AUTHOR].Load(offnode->first_node("author"));
td_h[DATA_VERSION].Load(offnode->first_node("version"));
td_h[DATA_INFO].Load(offnode->first_node("info"));
td_h[DATA_WEBSITE].Load(offnode->first_node("website"));
- //Titles for the stuff displayed when you hover over a slot button
+ // Titles for the stuff displayed when you hover over a slot button
hov[DATA_AUTHOR].Load(offnode->first_node("author_title"));
hov[DATA_VERSION].Load(offnode->first_node("info_title"));
hov[DATA_INFO].Load(offnode->first_node("version_title"));
@@ -50,11 +46,9 @@ void ModMenu::Load(const std::string &filename)
}
}
-bool ModMenu::HandleEvents(const SDL_Event &Event)
-{
+bool ModMenu::HandleEvents(const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
- if (choice >= 0)
- {
+ if (choice >= 0) {
gFilePath.mod_cur = slot_info[menu.Index() + choice].path;
return true;
}
@@ -62,23 +56,19 @@ bool ModMenu::HandleEvents(const SDL_Event &Event)
return false;
}
-void ModMenu::Draw()
-{
+void ModMenu::Draw() {
bg.Draw();
menu.Draw();
- for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++)
- {
+ for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++) {
auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
}
- if (menu.HoverIndex() >= 0)
- {
+ if (menu.HoverIndex() >= 0) {
int i = menu.HoverIndex();
- if (!img.loaded || prev_hover != i)
- {
+ if (!img.loaded || prev_hover != i) {
img.loaded = true;
prev_hover = i;
if (!img.preview.Load(slot_info[i].preview))
@@ -95,7 +85,6 @@ void ModMenu::Draw()
for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
hov[num].Draw();
- }
- else if (hover)
+ } else if (hover)
Reset();
}
\ No newline at end of file
diff --git a/engines/crab/ModMenu.h b/engines/crab/ModMenu.h
index 7a528bffb7d..8fd82ae6267 100644
--- a/engines/crab/ModMenu.h
+++ b/engines/crab/ModMenu.h
@@ -1,22 +1,18 @@
#pragma once
-#include "common_header.h"
#include "FileMenu.h"
+#include "common_header.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class ModMenu : public FileMenu<ModFileData>
- {
- public:
-
- ModMenu(){}
- ~ModMenu(){}
+namespace pyrodactyl {
+namespace ui {
+class ModMenu : public FileMenu<ModFileData> {
+public:
+ ModMenu() {}
+ ~ModMenu() {}
- void Load(const std::string &filename);
- bool HandleEvents(const SDL_Event &Event);
- void Draw();
- };
- }
-}
\ No newline at end of file
+ void Load(const std::string &filename);
+ bool HandleEvents(const SDL_Event &Event);
+ void Draw();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/MusicArea.cpp b/engines/crab/MusicArea.cpp
index 2ec1231e709..4987be2654c 100644
--- a/engines/crab/MusicArea.cpp
+++ b/engines/crab/MusicArea.cpp
@@ -1,23 +1,22 @@
-#include "stdafx.h"
#include "MusicArea.h"
+#include "stdafx.h"
using namespace pyrodactyl::level;
-void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo)
-{
+void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo) {
Shape::Load(node, echo);
- if (NodeValid("properties", node, echo))
- {
+ if (NodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
- for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property"))
- {
+ for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
std::string name;
- if (LoadStr(name, "name", n, echo))
- {
- if (name == "music") LoadBool(track, "value", n, echo);
- else if (name == "id") LoadNum(id, "value", n, echo);
- else if (name == "loops") LoadNum(loops, "value", n, echo);
+ if (LoadStr(name, "name", n, echo)) {
+ if (name == "music")
+ LoadBool(track, "value", n, echo);
+ else if (name == "id")
+ LoadNum(id, "value", n, echo);
+ else if (name == "loops")
+ LoadNum(loops, "value", n, echo);
}
}
}
diff --git a/engines/crab/MusicArea.h b/engines/crab/MusicArea.h
index 59862ed2343..373a79d1281 100644
--- a/engines/crab/MusicArea.h
+++ b/engines/crab/MusicArea.h
@@ -1,36 +1,35 @@
#pragma once
+#include "Shape.h"
#include "common_header.h"
#include "musicparam.h"
-#include "Shape.h"
-
-namespace pyrodactyl
-{
- namespace level
- {
- struct MusicInfo
- {
- //Are we playing a sound effect or a music track
- bool track;
-
- //The id of the music track or sound effect being played
- int id;
-
- //The amount of loops
- int loops;
- MusicInfo(){ track = false; id = -1; loops = -1; }
- ~MusicInfo(){}
- };
+namespace pyrodactyl {
+namespace level {
+struct MusicInfo {
+ // Are we playing a sound effect or a music track
+ bool track;
- class MusicArea : public Shape, public MusicInfo
- {
- public:
+ // The id of the music track or sound effect being played
+ int id;
- MusicArea(){}
- ~MusicArea(){}
+ // The amount of loops
+ int loops;
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
- };
+ MusicInfo() {
+ track = false;
+ id = -1;
+ loops = -1;
}
-}
\ No newline at end of file
+ ~MusicInfo() {}
+};
+
+class MusicArea : public Shape, public MusicInfo {
+public:
+ MusicArea() {}
+ ~MusicArea() {}
+
+ void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+};
+} // End of namespace level
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/MusicManager.cpp b/engines/crab/MusicManager.cpp
index c8dc1b6a654..b181be6d43e 100644
--- a/engines/crab/MusicManager.cpp
+++ b/engines/crab/MusicManager.cpp
@@ -6,24 +6,20 @@
using namespace pyrodactyl::music;
-namespace pyrodactyl
-{
- namespace music
- {
- MusicManager gMusicManager;
- }
+namespace pyrodactyl {
+namespace music {
+MusicManager gMusicManager;
}
+} // End of namespace pyrodactyl
//------------------------------------------------------------------------
// Purpose: Clear stored data
//------------------------------------------------------------------------
-void MusicManager::FreeMusic()
-{
+void MusicManager::FreeMusic() {
Mix_FreeMusic(bg.track);
}
-void MusicManager::FreeChunk()
-{
+void MusicManager::FreeChunk() {
for (auto i = effect.begin(); i != effect.end(); ++i)
Mix_FreeChunk(i->second);
}
@@ -31,19 +27,14 @@ void MusicManager::FreeChunk()
//------------------------------------------------------------------------
// Purpose: Play or queue music
//------------------------------------------------------------------------
-void MusicManager::PlayMusic(const MusicKey &id)
-{
- if (bg.id != id)
- {
+void MusicManager::PlayMusic(const MusicKey &id) {
+ if (bg.id != id) {
XMLDoc track_list(gFilePath.sound_music);
- if (track_list.ready())
- {
+ if (track_list.ready()) {
rapidxml::xml_node<char> *node = track_list.Doc()->first_node("music");
- for (auto n = node->first_node(); n != NULL; n = n->next_sibling())
- {
+ for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *att = n->first_attribute("id");
- if (att != NULL && id == StringToNumber<MusicKey>(att->value()))
- {
+ if (att != NULL && id == StringToNumber<MusicKey>(att->value())) {
bg.Load(n);
break;
}
@@ -58,8 +49,7 @@ void MusicManager::PlayMusic(const MusicKey &id)
//------------------------------------------------------------------------
// Purpose: Play or queue sound effects
//------------------------------------------------------------------------
-void MusicManager::PlayEffect(const ChunkKey &id, const int &loops)
-{
+void MusicManager::PlayEffect(const ChunkKey &id, const int &loops) {
if (effect.count(id) > 0)
Mix_PlayChannel(-1, effect[id], loops);
}
@@ -67,13 +57,11 @@ void MusicManager::PlayEffect(const ChunkKey &id, const int &loops)
//------------------------------------------------------------------------
// Purpose: Initialize the music subsystem (currently SDL_mixer) and load sound effects
//------------------------------------------------------------------------
-bool MusicManager::Load(rapidxml::xml_node<char> *node)
-{
- //Initialize music parameters
+bool MusicManager::Load(rapidxml::xml_node<char> *node) {
+ // Initialize music parameters
int volume_mus = 100, volume_eff = 100;
- if (NodeValid("sound", node))
- {
+ if (NodeValid("sound", node)) {
rapidxml::xml_node<char> *volnode = node->first_node("sound");
LoadNum(volume_mus, "music", volnode);
LoadNum(volume_eff, "effects", volnode);
@@ -84,35 +72,30 @@ bool MusicManager::Load(rapidxml::xml_node<char> *node)
// Start up audio
const int audioflags = MIX_INIT_OGG;
- if ((Mix_Init(audioflags) & audioflags) != audioflags)
- {
+ if ((Mix_Init(audioflags) & audioflags) != audioflags) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to initialize audio mixer", "Please install libsdl2_mixer", NULL);
return false;
}
- if (Mix_OpenAudio(freq, MIX_DEFAULT_FORMAT, channels, chunksize) == -1)
- {
+ if (Mix_OpenAudio(freq, MIX_DEFAULT_FORMAT, channels, chunksize) == -1) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to open audio channels", "Please check settings", NULL);
return false;
}
- //Set the volume from the settings
+ // Set the volume from the settings
VolEffects(volume_eff);
VolMusic(volume_mus);
- //Load sound effects
+ // Load sound effects
XMLDoc track_list(gFilePath.sound_effect);
- if (track_list.ready())
- {
+ if (track_list.ready()) {
rapidxml::xml_node<char> *tnode = track_list.Doc()->first_node("effects");
- if (NodeValid(tnode))
- {
+ if (NodeValid(tnode)) {
LoadNum(notify, "notify", tnode);
LoadNum(rep_inc, "rep_inc", tnode);
LoadNum(rep_dec, "rep_dec", tnode);
- for (auto n = tnode->first_node(); n != NULL; n = n->next_sibling())
- {
+ for (auto n = tnode->first_node(); n != NULL; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
if (id != NULL && path != NULL)
effect[StringToNumber<ChunkKey>(id->value())] = Mix_LoadWAV(path->value());
@@ -123,8 +106,7 @@ bool MusicManager::Load(rapidxml::xml_node<char> *node)
return true;
}
-void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root)
-{
+void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sound");
child->append_attribute(doc.allocate_attribute("music", gStrPool.Get(Mix_VolumeMusic(-1))));
child->append_attribute(doc.allocate_attribute("effects", gStrPool.Get(Mix_Volume(0, -1))));
diff --git a/engines/crab/MusicManager.h b/engines/crab/MusicManager.h
index ce8f3cc2110..2d5798e4d22 100644
--- a/engines/crab/MusicManager.h
+++ b/engines/crab/MusicManager.h
@@ -1,63 +1,61 @@
#pragma once
-#include "common_header.h"
#include "GameParam.h"
+#include "common_header.h"
#include "musicparam.h"
-namespace pyrodactyl
-{
- namespace music
- {
- class MusicManager
- {
- //The background music for our current level
- MusicData bg;
-
- //The sound effects in the game
- std::unordered_map<ChunkKey, Mix_Chunk*> effect;
+namespace pyrodactyl {
+namespace music {
+class MusicManager {
+ // The background music for our current level
+ MusicData bg;
- //Data about the audio
- int freq, channels, chunksize;
+ // The sound effects in the game
+ std::unordered_map<ChunkKey, Mix_Chunk *> effect;
- public:
+ // Data about the audio
+ int freq, channels, chunksize;
- //The notification sound
- ChunkKey notify, rep_inc, rep_dec;
+public:
+ // The notification sound
+ ChunkKey notify, rep_inc, rep_dec;
- MusicManager()
- {
- freq = MIX_DEFAULT_FREQUENCY;
- channels = MIX_DEFAULT_CHANNELS;
- chunksize = 1024;
+ MusicManager() {
+ freq = MIX_DEFAULT_FREQUENCY;
+ channels = MIX_DEFAULT_CHANNELS;
+ chunksize = 1024;
- notify = -1;
- rep_inc = -1;
- rep_dec = -1;
- }
- ~MusicManager(){}
-
- bool Load(rapidxml::xml_node<char> *node);
+ notify = -1;
+ rep_inc = -1;
+ rep_dec = -1;
+ }
+ ~MusicManager() {}
- void PlayMusic(const MusicKey &id);
- void PlayEffect(const ChunkKey &id, const int &loops);
+ bool Load(rapidxml::xml_node<char> *node);
- static void Pause(){ Mix_PauseMusic(); }
- static void Resume(){ Mix_ResumeMusic(); }
- static void Stop(){ Mix_HaltMusic(); }
+ void PlayMusic(const MusicKey &id);
+ void PlayEffect(const ChunkKey &id, const int &loops);
- static void VolEffects(const int &volume){ Mix_Volume(-1, volume); }
- static int VolEffects() { return Mix_Volume(0, -1); }
+ static void Pause() { Mix_PauseMusic(); }
+ static void Resume() { Mix_ResumeMusic(); }
+ static void Stop() { Mix_HaltMusic(); }
- static void VolMusic(const int &volume) { Mix_VolumeMusic(volume); }
- static int VolMusic() { return Mix_VolumeMusic(-1); }
+ static void VolEffects(const int &volume) { Mix_Volume(-1, volume); }
+ static int VolEffects() { return Mix_Volume(0, -1); }
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ static void VolMusic(const int &volume) { Mix_VolumeMusic(volume); }
+ static int VolMusic() { return Mix_VolumeMusic(-1); }
- void FreeMusic();
- void FreeChunk();
- void Quit(){ FreeMusic(); FreeChunk(); }
- };
+ void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- extern MusicManager gMusicManager;
+ void FreeMusic();
+ void FreeChunk();
+ void Quit() {
+ FreeMusic();
+ FreeChunk();
}
-}
\ No newline at end of file
+};
+
+extern MusicManager gMusicManager;
+} // End of namespace music
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/OptionMenu.cpp b/engines/crab/OptionMenu.cpp
index a299a708155..41bbdaf55cc 100644
--- a/engines/crab/OptionMenu.cpp
+++ b/engines/crab/OptionMenu.cpp
@@ -1,31 +1,25 @@
-#include "stdafx.h"
#include "OptionMenu.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::music;
-namespace pyrodactyl
-{
- namespace ui
- {
- OptionMenu gOptionMenu;
- }
+namespace pyrodactyl {
+namespace ui {
+OptionMenu gOptionMenu;
}
+} // End of namespace pyrodactyl
-void OptionMenu::Load(const std::string &filename)
-{
+void OptionMenu::Load(const std::string &filename) {
XMLDoc conf(filename);
- if (conf.ready())
- {
+ if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("option");
- if (NodeValid(node))
- {
+ if (NodeValid(node)) {
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("state", node))
- {
+ if (NodeValid("state", node)) {
menu.Load(node->first_node("state"));
if (!menu.element.empty())
@@ -44,8 +38,7 @@ void OptionMenu::Load(const std::string &filename)
if (NodeValid("general", node))
general.Load(node->first_node("general"));
- if (NodeValid("change", node))
- {
+ if (NodeValid("change", node)) {
rapidxml::xml_node<char> *chanode = node->first_node("change");
if (NodeValid("accept", chanode))
@@ -63,8 +56,7 @@ void OptionMenu::Load(const std::string &filename)
if (NodeValid("height", chanode))
prompt_h.Load(chanode->first_node("height"));
- if (NodeValid("countdown", chanode))
- {
+ if (NodeValid("countdown", chanode)) {
rapidxml::xml_node<char> *counode = chanode->first_node("countdown");
countdown.Load(counode);
timer.Load(counode, "time");
@@ -77,8 +69,7 @@ void OptionMenu::Load(const std::string &filename)
}
}
-void OptionMenu::Reset()
-{
+void OptionMenu::Reset() {
keybind.Reset();
state = STATE_GENERAL;
@@ -86,37 +77,45 @@ void OptionMenu::Reset()
menu.element.at(i).State(i == STATE_GENERAL);
}
-void OptionMenu::Draw(Button &back)
-{
- if (state < STATE_ENTER_W)
- {
+void OptionMenu::Draw(Button &back) {
+ if (state < STATE_ENTER_W) {
bg.Draw();
- switch (state)
- {
- case STATE_GENERAL: general.Draw(); break;
- case STATE_GRAPHICS: gfx.Draw(); break;
- case STATE_KEYBOARD: keybind.Draw(); break;
- case STATE_CONTROLLER: conbind.Draw(); break;
- default:break;
+ switch (state) {
+ case STATE_GENERAL:
+ general.Draw();
+ break;
+ case STATE_GRAPHICS:
+ gfx.Draw();
+ break;
+ case STATE_KEYBOARD:
+ keybind.Draw();
+ break;
+ case STATE_CONTROLLER:
+ conbind.Draw();
+ break;
+ default:
+ break;
}
menu.Draw();
back.Draw();
- }
- else
- {
+ } else {
questionbox.Draw();
- switch (state)
- {
- case STATE_ENTER_W: prompt_w.Draw(); break;
- case STATE_ENTER_H: prompt_h.Draw(); break;
+ switch (state) {
+ case STATE_ENTER_W:
+ prompt_w.Draw();
+ break;
+ case STATE_ENTER_H:
+ prompt_h.Draw();
+ break;
case STATE_CONFIRM:
notice_res.Draw();
countdown.Draw(NumberToString(timer.RemainingTicks() / 1000));
break;
- default:break;
+ default:
+ break;
}
accept.Draw();
@@ -124,65 +123,54 @@ void OptionMenu::Draw(Button &back)
}
}
-bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event)
-{
- if (state < STATE_ENTER_W)
- {
+bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
+ if (state < STATE_ENTER_W) {
bg.Draw();
- switch (state)
- {
- case STATE_GENERAL: general.HandleEvents(Event); break;
- case STATE_KEYBOARD: keybind.HandleEvents(Event); break;
- case STATE_GRAPHICS:
- {
+ switch (state) {
+ case STATE_GENERAL:
+ general.HandleEvents(Event);
+ break;
+ case STATE_KEYBOARD:
+ keybind.HandleEvents(Event);
+ break;
+ case STATE_GRAPHICS: {
int result = gfx.HandleEvents(Event);
- if (result == 1)
- {
+ if (result == 1) {
state = STATE_CONFIRM;
timer.Start();
gScreenSettings.SetResolution();
gfx.SetInfo();
- }
- else if (result == 2)
+ } else if (result == 2)
state = STATE_ENTER_W;
- }
+ } break;
+ default:
break;
- default:break;
}
return HandleTabs(back, Event);
- }
- else
- {
+ } else {
questionbox.Draw();
- switch (state)
- {
+ switch (state) {
case STATE_ENTER_W:
- if (prompt_w.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK)
- {
+ if (prompt_w.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
gScreenSettings.cur.w = StringToNumber<int>(prompt_w.text);
state = STATE_ENTER_H;
- }
- else if (cancel.HandleEvents(Event) == BUAC_LCLICK)
- {
+ } else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
gScreenSettings.RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
break;
case STATE_ENTER_H:
- if (prompt_h.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK)
- {
+ if (prompt_h.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
gScreenSettings.cur.h = StringToNumber<int>(prompt_h.text);
state = STATE_CONFIRM;
timer.Start();
gScreenSettings.SetResolution();
gfx.SetInfo();
- }
- else if (cancel.HandleEvents(Event) == BUAC_LCLICK)
- {
+ } else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
gScreenSettings.RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
@@ -190,20 +178,18 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event)
break;
case STATE_CONFIRM:
- if (accept.HandleEvents(Event))
- {
+ if (accept.HandleEvents(Event)) {
state = STATE_GRAPHICS;
timer.Stop();
- }
- else if (cancel.HandleEvents(Event))
- {
+ } else if (cancel.HandleEvents(Event)) {
gScreenSettings.RestoreBackup();
gScreenSettings.SetResolution();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
break;
- default:break;
+ default:
+ break;
}
accept.Draw();
@@ -213,30 +199,34 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event)
return false;
}
-bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event)
-{
- if (back.HandleEvents(Event) == BUAC_LCLICK)
- {
+bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
+ if (back.HandleEvents(Event) == BUAC_LCLICK) {
Reset();
return true;
}
int choice = menu.HandleEvents(Event);
- if (choice >= 0)
- {
+ if (choice >= 0) {
if (choice < 4)
for (unsigned i = 0; i < menu.element.size(); ++i)
menu.element.at(i).State(i == choice);
- switch (choice)
- {
- case 0: state = STATE_GENERAL; break;
- case 1: state = STATE_GRAPHICS; break;
- case 2: state = STATE_KEYBOARD; break;
- case 3: state = STATE_CONTROLLER; break;
+ switch (choice) {
+ case 0:
+ state = STATE_GENERAL;
+ break;
+ case 1:
+ state = STATE_GRAPHICS;
+ break;
+ case 2:
+ state = STATE_KEYBOARD;
+ break;
+ case 3:
+ state = STATE_CONTROLLER;
+ break;
case 4:
- //Save settings to file
+ // Save settings to file
pyrodactyl::input::gInput.Save();
SaveState();
general.CreateBackup();
@@ -244,36 +234,34 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event)
return true;
case 5:
- //Revert all changes made to settings and exit
+ // Revert all changes made to settings and exit
pyrodactyl::input::gInput.RestoreBackup();
keybind.SetCaption();
gScreenSettings.RestoreBackup();
general.RestoreBackup();
SDL_DisplayMode current;
- if (SDL_GetCurrentDisplayMode(0, ¤t) == 0)
- {
+ if (SDL_GetCurrentDisplayMode(0, ¤t) == 0) {
if (gScreenSettings.cur.w != current.w || gScreenSettings.cur.h != current.h)
gfx.SetInfo();
}
gScreenSettings.SetResolution();
return true;
- default: break;
+ default:
+ break;
}
}
return false;
}
-void OptionMenu::InternalEvents()
-{
- //Since these states can be changed at any time, we just update it regularly
+void OptionMenu::InternalEvents() {
+ // Since these states can be changed at any time, we just update it regularly
gfx.InternalEvents();
general.InternalEvents();
- if (state == STATE_CONFIRM && timer.TargetReached())
- {
+ if (state == STATE_CONFIRM && timer.TargetReached()) {
gScreenSettings.RestoreBackup();
gScreenSettings.SetResolution();
gfx.SetInfo();
@@ -281,8 +269,7 @@ void OptionMenu::InternalEvents()
}
}
-void OptionMenu::SaveState()
-{
+void OptionMenu::SaveState() {
rapidxml::xml_document<char> doc;
// xml declaration
@@ -304,8 +291,7 @@ void OptionMenu::SaveState()
settingpath += "settings.xml";
std::ofstream save(settingpath, std::ios::out);
- if (save.is_open())
- {
+ if (save.is_open()) {
save << xml_as_string;
save.close();
}
@@ -313,8 +299,7 @@ void OptionMenu::SaveState()
doc.clear();
}
-void OptionMenu::SetUI()
-{
+void OptionMenu::SetUI() {
bg.SetUI();
menu.SetUI();
diff --git a/engines/crab/OptionMenu.h b/engines/crab/OptionMenu.h
index 9a40774a176..86851b1a487 100644
--- a/engines/crab/OptionMenu.h
+++ b/engines/crab/OptionMenu.h
@@ -1,75 +1,82 @@
#pragma once
-#include "common_header.h"
-#include "slider.h"
+#include "GeneralSettingMenu.h"
+#include "GfxSettingMenu.h"
#include "ImageData.h"
#include "KeyBindMenu.h"
#include "StateButton.h"
#include "ToggleButton.h"
-#include "GfxSettingMenu.h"
-#include "GeneralSettingMenu.h"
+#include "common_header.h"
+#include "slider.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class OptionMenu
- {
- //What overall state the menu is in
- enum { STATE_GENERAL, STATE_GRAPHICS, STATE_KEYBOARD, STATE_CONTROLLER, STATE_ENTER_W, STATE_ENTER_H, STATE_CONFIRM } state;
+namespace pyrodactyl {
+namespace ui {
+class OptionMenu {
+ // What overall state the menu is in
+ enum { STATE_GENERAL,
+ STATE_GRAPHICS,
+ STATE_KEYBOARD,
+ STATE_CONTROLLER,
+ STATE_ENTER_W,
+ STATE_ENTER_H,
+ STATE_CONFIRM } state;
- //The overall menu for switching between states
- //The second last button is save, the last button is cancel
- Menu<StateButton> menu;
+ // The overall menu for switching between states
+ // The second last button is save, the last button is cancel
+ Menu<StateButton> menu;
- //The background image
- ImageData bg;
+ // The background image
+ ImageData bg;
- //The graphical settings menu
- GfxSettingMenu gfx;
+ // The graphical settings menu
+ GfxSettingMenu gfx;
- //The general settings menu
- GeneralSettingMenu general;
+ // The general settings menu
+ GeneralSettingMenu general;
- //Keyboard controls menu
- KeyBindMenu keybind;
+ // Keyboard controls menu
+ KeyBindMenu keybind;
- //The controller controls are just drawn in a single image, no reassign options
- ImageData conbind;
+ // The controller controls are just drawn in a single image, no reassign options
+ ImageData conbind;
- //The UI for accepting/rejecting change in resolution
- HoverInfo notice_res;
- ImageData questionbox;
- Button accept, cancel;
+ // The UI for accepting/rejecting change in resolution
+ HoverInfo notice_res;
+ ImageData questionbox;
+ Button accept, cancel;
- //If the user wants to input a custom resolution, these are used along with the question box
- TextArea prompt_w, prompt_h;
+ // If the user wants to input a custom resolution, these are used along with the question box
+ TextArea prompt_w, prompt_h;
- //The countdown until the timer resets
- TextData countdown;
- Timer timer;
+ // The countdown until the timer resets
+ TextData countdown;
+ Timer timer;
- //Function to draw the main menu (controls, settings, save, cancel)
- bool HandleTabs(Button &back, const SDL_Event &Event);
+ // Function to draw the main menu (controls, settings, save, cancel)
+ bool HandleTabs(Button &back, const SDL_Event &Event);
- public:
- bool loaded;
+public:
+ bool loaded;
- OptionMenu(void){ loaded = false; state = STATE_GENERAL; menu.UseKeyboard(true); }
- ~OptionMenu(void){}
+ OptionMenu(void) {
+ loaded = false;
+ state = STATE_GENERAL;
+ menu.UseKeyboard(true);
+ }
+ ~OptionMenu(void) {}
- void Reset();
- bool DisableHotkeys() { return keybind.DisableHotkeys(); }
+ void Reset();
+ bool DisableHotkeys() { return keybind.DisableHotkeys(); }
- void Load(const std::string &filename);
- void Draw(Button &back);
- bool HandleEvents(Button &back, const SDL_Event &Event);
- void InternalEvents();
+ void Load(const std::string &filename);
+ void Draw(Button &back);
+ bool HandleEvents(Button &back, const SDL_Event &Event);
+ void InternalEvents();
- void SetUI();
- void SaveState();
- };
+ void SetUI();
+ void SaveState();
+};
- extern OptionMenu gOptionMenu;
- }
-}
\ No newline at end of file
+extern OptionMenu gOptionMenu;
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/OptionSelect.cpp b/engines/crab/OptionSelect.cpp
index 220fe09fa9a..343b564a3fa 100644
--- a/engines/crab/OptionSelect.cpp
+++ b/engines/crab/OptionSelect.cpp
@@ -5,18 +5,15 @@
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
-void OptionSelect::Load(rapidxml::xml_node<char> *node)
-{
- if (NodeValid(node))
- {
+void OptionSelect::Load(rapidxml::xml_node<char> *node) {
+ if (NodeValid(node)) {
option.data.Load(node);
prev.Load(node->first_node("prev"));
next.Load(node->first_node("next"));
cur = 0;
option.text.clear();
- for (auto n = node->first_node("option"); n != NULL; n = n->next_sibling("option"))
- {
+ for (auto n = node->first_node("option"); n != NULL; n = n->next_sibling("option")) {
std::string s;
LoadStr(s, "name", n);
option.text.push_back(s);
@@ -26,8 +23,7 @@ void OptionSelect::Load(rapidxml::xml_node<char> *node)
}
}
-void OptionSelect::Draw()
-{
+void OptionSelect::Draw() {
option.Draw(cur);
if (cur > 0)
@@ -37,23 +33,18 @@ void OptionSelect::Draw()
next.Draw();
}
-bool OptionSelect::HandleEvents(const SDL_Event &Event)
-{
+bool OptionSelect::HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
- if (cur > 0)
- {
- if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_LEFT, Event) == SDL_PRESSED))
- {
+ if (cur > 0) {
+ if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_LEFT, Event) == SDL_PRESSED)) {
cur--;
return true;
}
}
- if (cur < option.text.size() - 1)
- {
- if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED))
- {
+ if (cur < option.text.size() - 1) {
+ if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
cur++;
return true;
}
@@ -62,8 +53,7 @@ bool OptionSelect::HandleEvents(const SDL_Event &Event)
return false;
}
-void OptionSelect::SetUI()
-{
+void OptionSelect::SetUI() {
option.data.SetUI();
prev.SetUI();
next.SetUI();
diff --git a/engines/crab/OptionSelect.h b/engines/crab/OptionSelect.h
index 7c7b569effc..f7611f51570 100644
--- a/engines/crab/OptionSelect.h
+++ b/engines/crab/OptionSelect.h
@@ -1,40 +1,39 @@
#pragma once
#include "common_header.h"
-#include "button.h"
#include "TextData.h"
+#include "button.h"
-namespace pyrodactyl
-{
- namespace ui
+namespace pyrodactyl {
+namespace ui {
+class OptionSelect {
+ struct
{
- class OptionSelect
- {
- struct
- {
- std::vector<std::string> text;
- TextData data;
-
- void Draw(const int &index)
- {
- if(index >= 0 && index < text.size())
- data.Draw(text.at(index));
- }
- } option;
-
- Button prev, next;
- bool usekeyboard;
-
- public:
- int cur;
-
- OptionSelect() { cur = 0; usekeyboard = false; }
- void Load(rapidxml::xml_node<char> *node);
-
- void Draw();
- bool HandleEvents(const SDL_Event &Event);
-
- void SetUI();
- };
+ std::vector<std::string> text;
+ TextData data;
+
+ void Draw(const int &index) {
+ if (index >= 0 && index < text.size())
+ data.Draw(text.at(index));
+ }
+ } option;
+
+ Button prev, next;
+ bool usekeyboard;
+
+public:
+ int cur;
+
+ OptionSelect() {
+ cur = 0;
+ usekeyboard = false;
}
-}
\ No newline at end of file
+ void Load(rapidxml::xml_node<char> *node);
+
+ void Draw();
+ bool HandleEvents(const SDL_Event &Event);
+
+ void SetUI();
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/PageMenu.h b/engines/crab/PageMenu.h
index cd70707a775..6501a344402 100644
--- a/engines/crab/PageMenu.h
+++ b/engines/crab/PageMenu.h
@@ -3,216 +3,200 @@
#include "common_header.h"
#include "menu.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- //Sometimes we need multiple pages in a menu, this object does that
- //Used in save, load, mod and quest menu
- template <typename T>
- class PageMenu
- {
- //The buttons for cycling between pages of the menu
- Button prev, next;
-
- //Each page is stored separately in a menu object
- std::vector<Menu<T>> menu;
-
- //Keep track of which page we are at, and how many elements we keep in a page
- unsigned int current_page, elements_per_page, rows, cols;
-
- //The image used for the elements
- Button ref;
-
- //This vector stores the increments in x,y for each new button
- Vector2i inc;
-
- //Display "Page 1 of 3" style information for the menu
- TextData status;
- std::string info;
-
- public:
- PageMenu(){ current_page = 0; elements_per_page = 1; rows = 1; cols = 1; Clear(); }
- ~PageMenu(){}
-
- void Reset()
- {
- for (auto m = menu.begin(); m != menu.end(); ++m)
- m->Reset();
- }
+namespace pyrodactyl {
+namespace ui {
+// Sometimes we need multiple pages in a menu, this object does that
+// Used in save, load, mod and quest menu
+template<typename T>
+class PageMenu {
+ // The buttons for cycling between pages of the menu
+ Button prev, next;
+
+ // Each page is stored separately in a menu object
+ std::vector<Menu<T> > menu;
+
+ // Keep track of which page we are at, and how many elements we keep in a page
+ unsigned int current_page, elements_per_page, rows, cols;
+
+ // The image used for the elements
+ Button ref;
+
+ // This vector stores the increments in x,y for each new button
+ Vector2i inc;
+
+ // Display "Page 1 of 3" style information for the menu
+ TextData status;
+ std::string info;
+
+public:
+ PageMenu() {
+ current_page = 0;
+ elements_per_page = 1;
+ rows = 1;
+ cols = 1;
+ Clear();
+ }
+ ~PageMenu() {}
- void Clear()
- {
- menu.resize(1);
- menu.at(0).Clear();
- menu.at(0).UseKeyboard(true);
- }
+ void Reset() {
+ for (auto m = menu.begin(); m != menu.end(); ++m)
+ m->Reset();
+ }
- //Get the elements per page
- unsigned int ElementsPerPage() { return elements_per_page; }
+ void Clear() {
+ menu.resize(1);
+ menu.at(0).Clear();
+ menu.at(0).UseKeyboard(true);
+ }
- //This is added to the result from HandleEvents to calculate the exact position
- unsigned int Index() { return current_page * elements_per_page; }
+ // Get the elements per page
+ unsigned int ElementsPerPage() { return elements_per_page; }
- //The end position of the elements
- unsigned int IndexPlusOne() { return (current_page + 1) * elements_per_page; }
+ // This is added to the result from HandleEvents to calculate the exact position
+ unsigned int Index() { return current_page * elements_per_page; }
- //Get the current page of the menu
- unsigned int CurrentPage() { return current_page; }
- void CurrentPage(int &val) { current_page = val; }
+ // The end position of the elements
+ unsigned int IndexPlusOne() { return (current_page + 1) * elements_per_page; }
- //Get the index of the hovered element in the menu
- const int HoverIndex()
- {
- if (menu.at(current_page).HoverIndex() >= 0)
- return (current_page * elements_per_page) + menu.at(current_page).HoverIndex();
+ // Get the current page of the menu
+ unsigned int CurrentPage() { return current_page; }
+ void CurrentPage(int &val) { current_page = val; }
- return -1;
- }
+ // Get the index of the hovered element in the menu
+ const int HoverIndex() {
+ if (menu.at(current_page).HoverIndex() >= 0)
+ return (current_page * elements_per_page) + menu.at(current_page).HoverIndex();
- //Get the base position of the elements
- const int BaseX(const int &count) { return ref.x + inc.x * (count % cols); }
- const int BaseY(const int &count) { return ref.y + inc.y * (count / cols); }
+ return -1;
+ }
- //This is used to get the coordinates of a button
- const int& CurX(const int& count) { return menu[current_page].element[count].x; }
- const int& CurY(const int& count) { return menu[current_page].element[count].y; }
+ // Get the base position of the elements
+ const int BaseX(const int &count) { return ref.x + inc.x * (count % cols); }
+ const int BaseY(const int &count) { return ref.y + inc.y * (count / cols); }
- void Image(const int &slot, const int &page, ButtonImage &bi) { menu.at(page).element.at(slot).Img(bi); }
+ // This is used to get the coordinates of a button
+ const int &CurX(const int &count) { return menu[current_page].element[count].x; }
+ const int &CurY(const int &count) { return menu[current_page].element[count].y; }
- void AssignPaths()
- {
- for (auto m = menu.begin(); m != menu.end(); ++m)
- m->AssignPaths();
- }
+ void Image(const int &slot, const int &page, ButtonImage &bi) { menu.at(page).element.at(slot).Img(bi); }
- void UseKeyboard(const bool &val)
- {
- for (auto m = menu.begin(); m != menu.end(); ++m)
- m->UseKeyboard(val);
- }
+ void AssignPaths() {
+ for (auto m = menu.begin(); m != menu.end(); ++m)
+ m->AssignPaths();
+ }
- void SetUI()
- {
- prev.SetUI();
- next.SetUI();
- ref.SetUI();
- status.SetUI();
+ void UseKeyboard(const bool &val) {
+ for (auto m = menu.begin(); m != menu.end(); ++m)
+ m->UseKeyboard(val);
+ }
- for (auto m = menu.begin(); m != menu.end(); ++m)
- m->SetUI();
- }
+ void SetUI() {
+ prev.SetUI();
+ next.SetUI();
+ ref.SetUI();
+ status.SetUI();
- void UpdateInfo() { info = NumberToString(current_page + 1) + " of " + NumberToString(menu.size()); }
-
- void Load(rapidxml::xml_node<char> *node)
- {
- using namespace pyrodactyl::input;
- if (NodeValid(node))
- {
- if (NodeValid("prev", node))
- {
- prev.Load(node->first_node("prev"));
- prev.hotkey.Set(IU_PREV);
- }
-
- if (NodeValid("next", node))
- {
- next.Load(node->first_node("next"));
- next.hotkey.Set(IU_NEXT);
- }
-
- if (NodeValid("reference", node))
- ref.Load(node->first_node("reference"));
-
- if (NodeValid("inc", node))
- inc.Load(node->first_node("inc"));
-
- if (NodeValid("status", node))
- status.Load(node->first_node("status"));
-
- if (NodeValid("dim", node))
- {
- rapidxml::xml_node<char> *dimnode = node->first_node("dim");
- LoadNum(rows, "rows", dimnode);
- LoadNum(cols, "cols", dimnode);
- elements_per_page = rows * cols;
- }
- }
- }
+ for (auto m = menu.begin(); m != menu.end(); ++m)
+ m->SetUI();
+ }
- void Add(unsigned int &slot, unsigned int &page)
- {
- if (slot >= elements_per_page)
- {
- ++page;
- slot = 0;
- menu.resize(page + 1);
- menu.at(page).UseKeyboard(true);
- }
-
- T b;
- b.Init(ref, inc.x*(slot%cols), inc.y*(slot / cols));
- menu[page].element.push_back(b);
- ++slot;
-
- AssignPaths();
- UpdateInfo();
+ void UpdateInfo() { info = NumberToString(current_page + 1) + " of " + NumberToString(menu.size()); }
+
+ void Load(rapidxml::xml_node<char> *node) {
+ using namespace pyrodactyl::input;
+ if (NodeValid(node)) {
+ if (NodeValid("prev", node)) {
+ prev.Load(node->first_node("prev"));
+ prev.hotkey.Set(IU_PREV);
}
- void Add()
- {
- unsigned int page = menu.size() - 1;
- unsigned int slot = menu.at(page).element.size();
- Add(slot, page);
+ if (NodeValid("next", node)) {
+ next.Load(node->first_node("next"));
+ next.hotkey.Set(IU_NEXT);
}
- void Erase()
- {
- unsigned int page = menu.size() - 1;
- menu.at(page).element.pop_back();
- AssignPaths();
- UpdateInfo();
+ if (NodeValid("reference", node))
+ ref.Load(node->first_node("reference"));
+
+ if (NodeValid("inc", node))
+ inc.Load(node->first_node("inc"));
+
+ if (NodeValid("status", node))
+ status.Load(node->first_node("status"));
+
+ if (NodeValid("dim", node)) {
+ rapidxml::xml_node<char> *dimnode = node->first_node("dim");
+ LoadNum(rows, "rows", dimnode);
+ LoadNum(cols, "cols", dimnode);
+ elements_per_page = rows * cols;
}
+ }
+ }
+
+ void Add(unsigned int &slot, unsigned int &page) {
+ if (slot >= elements_per_page) {
+ ++page;
+ slot = 0;
+ menu.resize(page + 1);
+ menu.at(page).UseKeyboard(true);
+ }
+
+ T b;
+ b.Init(ref, inc.x * (slot % cols), inc.y * (slot / cols));
+ menu[page].element.push_back(b);
+ ++slot;
+
+ AssignPaths();
+ UpdateInfo();
+ }
- int HandleEvents(const SDL_Event &Event)
- {
- using namespace pyrodactyl::input;
+ void Add() {
+ unsigned int page = menu.size() - 1;
+ unsigned int slot = menu.at(page).element.size();
+ Add(slot, page);
+ }
- if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK)
- {
- current_page--;
- UpdateInfo();
+ void Erase() {
+ unsigned int page = menu.size() - 1;
+ menu.at(page).element.pop_back();
+ AssignPaths();
+ UpdateInfo();
+ }
- if (current_page < 0)
- current_page = 0;
- }
+ int HandleEvents(const SDL_Event &Event) {
+ using namespace pyrodactyl::input;
- if (current_page < menu.size() - 1 && next.HandleEvents(Event) == BUAC_LCLICK)
- {
- current_page++;
- UpdateInfo();
+ if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
+ current_page--;
+ UpdateInfo();
- if (current_page >= menu.size())
- current_page = menu.size() - 1;
- }
+ if (current_page < 0)
+ current_page = 0;
+ }
- return menu.at(current_page).HandleEvents(Event);
- }
+ if (current_page < menu.size() - 1 && next.HandleEvents(Event) == BUAC_LCLICK) {
+ current_page++;
+ UpdateInfo();
- void Draw()
- {
- status.Draw(info);
- menu.at(current_page).Draw();
+ if (current_page >= menu.size())
+ current_page = menu.size() - 1;
+ }
- if (current_page > 0)
- prev.Draw();
+ return menu.at(current_page).HandleEvents(Event);
+ }
- if (current_page < menu.size() - 1)
- next.Draw();
- }
- };
+ void Draw() {
+ status.Draw(info);
+ menu.at(current_page).Draw();
+
+ if (current_page > 0)
+ prev.Draw();
- typedef PageMenu<Button> PageButtonMenu;
+ if (current_page < menu.size() - 1)
+ next.Draw();
}
-}
\ No newline at end of file
+};
+
+typedef PageMenu<Button> PageButtonMenu;
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/ParagraphData.cpp b/engines/crab/ParagraphData.cpp
index 5dee850d0e9..28d8ff019a8 100644
--- a/engines/crab/ParagraphData.cpp
+++ b/engines/crab/ParagraphData.cpp
@@ -1,17 +1,15 @@
-#include "stdafx.h"
#include "ParagraphData.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
-bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo)
-{
+bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
if (NodeValid("line", node))
line.Load(node->first_node("line"));
return TextData::Load(node, parent, echo);
}
-void ParagraphData::Draw(const std::string &val, const int &XOffset, const int &YOffset)
-{
+void ParagraphData::Draw(const std::string &val, const int &XOffset, const int &YOffset) {
pyrodactyl::text::gTextManager.Draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
}
\ No newline at end of file
diff --git a/engines/crab/ParagraphData.h b/engines/crab/ParagraphData.h
index 0e5812e13df..32c9f18f1e0 100644
--- a/engines/crab/ParagraphData.h
+++ b/engines/crab/ParagraphData.h
@@ -1,23 +1,20 @@
#pragma once
-#include "common_header.h"
#include "TextData.h"
+#include "common_header.h"
-namespace pyrodactyl
-{
- namespace ui
- {
- class ParagraphData : public TextData
- {
- public:
- Vector2i line;
+namespace pyrodactyl {
+namespace ui {
+class ParagraphData : public TextData {
+public:
+ Vector2i line;
- ParagraphData() : line(1, 1){}
- ~ParagraphData(){}
+ ParagraphData() : line(1, 1) {}
+ ~ParagraphData() {}
- bool Load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
+ bool Load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
- void Draw(const std::string &val, const int &XOffset = 0, const int &YOffset = 0);
- };
- }
-}
\ No newline at end of file
+ void Draw(const std::string &val, const int &XOffset = 0, const int &YOffset = 0);
+};
+} // End of namespace ui
+} // End of namespace pyrodactyl
\ No newline at end of file
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 9fb944ba7f1..161e70dd3dc 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -1,8 +1,7 @@
-#include "stdafx.h"
#include "PathfindingAgent.h"
+#include "stdafx.h"
-PathfindingAgent::PathfindingAgent(void) : nodeQueue(compareNodes)
-{
+PathfindingAgent::PathfindingAgent(void) : nodeQueue(compareNodes) {
grid = NULL;
destinationSet = false;
@@ -15,12 +14,10 @@ PathfindingAgent::PathfindingAgent(void) : nodeQueue(compareNodes)
m_pClickedTile = nullptr;
}
-PathfindingAgent::~PathfindingAgent(void)
-{
+PathfindingAgent::~PathfindingAgent(void) {
}
-void PathfindingAgent::initialize(PathfindingGrid* g)
-{
+void PathfindingAgent::initialize(PathfindingGrid *g) {
grid = g;
nodeBufferDistance = grid->GetCellSize().x / 2.0f;
@@ -28,42 +25,38 @@ void PathfindingAgent::initialize(PathfindingGrid* g)
nodeBufferDistance *= nodeBufferDistance;
}
-void PathfindingAgent::SetDestination(Vector2i d, bool r)
-{
+void PathfindingAgent::SetDestination(Vector2i d, bool r) {
Vector2f iVec = Vector2f((float)d.x, (float)d.y);
SetDestination(iVec, r);
}
-void PathfindingAgent::SetDestination(Vector2i d)
-{
+void PathfindingAgent::SetDestination(Vector2i d) {
SetDestination(d, true);
}
-void PathfindingAgent::SetDestination(Vector2f d)
-{
+void PathfindingAgent::SetDestination(Vector2f d) {
SetDestination(d, true);
}
-void PathfindingAgent::SetDestination(Vector2f d, bool r)
-{
+void PathfindingAgent::SetDestination(Vector2f d, bool r) {
if (grid == NULL)
return;
destination = d;
- //TODO: This could be optimized to cache the route somehow... (SZ)
+ // TODO: This could be optimized to cache the route somehow... (SZ)
exit();
m_pStartTile = grid->GetNodeAtPoint(position);
- //m_pGoalTile = grid->GetNodeAtPoint(d);
+ // m_pGoalTile = grid->GetNodeAtPoint(d);
- //I am now tracking the goal node and the clicked tile separately to solve problems
- //with hangups and trying to reach un-reachable destinations.
+ // I am now tracking the goal node and the clicked tile separately to solve problems
+ // with hangups and trying to reach un-reachable destinations.
m_pClickedTile = grid->GetNodeAtPoint(d);
m_pGoalTile = grid->GetNearestOpenNode(d, position);
- PlannerNode* startingNode = new PlannerNode();
+ PlannerNode *startingNode = new PlannerNode();
startingNode->SetLocation(m_pStartTile);
startingNode->SetHCost((position - destination).Magnitude());
startingNode->SetFinalCost((position - destination).Magnitude());
@@ -78,29 +71,23 @@ void PathfindingAgent::SetDestination(Vector2f d, bool r)
destinationReachable = r;
}
-void PathfindingAgent::Update(long timeslice)
-{
+void PathfindingAgent::Update(long timeslice) {
long prevTime = SDL_GetTicks();
long time = timeslice;
double dTempCost;
- if (solutionFound)
- {
- if (m_vSolution.size() > 0)
- {
+ if (solutionFound) {
+ if (m_vSolution.size() > 0) {
float distSqr = (position - m_vSolution.back()->GetPosition()).MagSqr();
- if (distSqr < nodeBufferDistance) //Have to find the right deadzone buffer
+ if (distSqr < nodeBufferDistance) // Have to find the right deadzone buffer
{
m_vSolution.pop_back();
}
}
- if (m_vSolution.size() > 0)
- {
+ if (m_vSolution.size() > 0) {
immediateDest = Vector2i(m_vSolution.back()->GetPosition().x, m_vSolution.back()->GetPosition().y);
- }
- else
- {
+ } else {
if (destinationReachable)
immediateDest = Vector2i((int)destination.x, (int)destination.y);
else
@@ -110,61 +97,53 @@ void PathfindingAgent::Update(long timeslice)
return;
}
- //No nodes, no pathing.
- if (nodeQueue.empty())
- {
+ // No nodes, no pathing.
+ if (nodeQueue.empty()) {
return;
}
- std::map<PathfindingGraphNode*, PlannerNode*>::iterator currentIter;
+ std::map<PathfindingGraphNode *, PlannerNode *>::iterator currentIter;
- do
- {
- PlannerNode* current = nodeQueue.front();
+ do {
+ PlannerNode *current = nodeQueue.front();
nodeQueue.pop();
if (current->GetLocation() == m_pGoalTile)
- //|| //We're done.
+ //|| //We're done.
{
- //m_vSolution = getSolution();
+ // m_vSolution = getSolution();
m_vSolution = getPrunedSolution(NULL);
solutionFound = true;
return;
- }
- else if (current->GetLocation()->GetMovementCost() > 0 && current->GetLocation()->AdjacentToNode(m_pClickedTile) && m_pClickedTile->GetMovementCost() < 0)
- {
+ } else if (current->GetLocation()->GetMovementCost() > 0 && current->GetLocation()->AdjacentToNode(m_pClickedTile) && m_pClickedTile->GetMovementCost() < 0) {
m_vSolution = getPrunedSolution(current->GetLocation());
solutionFound = true;
return;
}
- //PathfindingGraphNode* _checkTile;
+ // PathfindingGraphNode* _checkTile;
- //Find the successors
- //for(int x = -1; x < 2; ++x)
+ // Find the successors
+ // for(int x = -1; x < 2; ++x)
//{
// for(int y = -1; y < 2; ++y)
// {
- std::vector<PathfindingGraphNode*>::iterator i;
+ std::vector<PathfindingGraphNode *>::iterator i;
- for (i = current->location->neighborNodes.begin(); i != current->location->neighborNodes.end(); ++i)
- {
- //Get the new tile to check
+ for (i = current->location->neighborNodes.begin(); i != current->location->neighborNodes.end(); ++i) {
+ // Get the new tile to check
//_checkTile = m_pTileMap->getTile(current->GetLocation()->getRow() + x, current->GetLocation()->getColumn() + y);
- if ((*i)->GetMovementCost() > 0)
- {
- //Compute the temp given cost
+ if ((*i)->GetMovementCost() > 0) {
+ // Compute the temp given cost
dTempCost = current->GetGivenCost() + ((*i)->GetMovementCost() * distExact((*i), current->GetLocation()));
- //If it's a duplicate...
+ // If it's a duplicate...
currentIter = m_mCreatedList.find((*i));
- if (currentIter != m_mCreatedList.end())
- {
- if (dTempCost < currentIter->second->GetGivenCost())
- {
- //If the current planner node has already been added, but the current path is cheaper,
- //replace it.
+ if (currentIter != m_mCreatedList.end()) {
+ if (dTempCost < currentIter->second->GetGivenCost()) {
+ // If the current planner node has already been added, but the current path is cheaper,
+ // replace it.
nodeQueue.remove(currentIter->second);
@@ -179,55 +158,49 @@ void PathfindingAgent::Update(long timeslice)
}
}
- //Otherwise...
- else
- {
- PlannerNode* successor = new PlannerNode();
+ // Otherwise...
+ else {
+ PlannerNode *successor = new PlannerNode();
successor->SetLocation((*i));
- //Set the new heuristic (distance from node to the goal)
+ // Set the new heuristic (distance from node to the goal)
successor->SetHCost(distExact((*i), m_pGoalTile));
successor->SetGivenCost(dTempCost);
- //Final cost is the distance to goal (scaled by 10%) plus the distance of the path.
+ // Final cost is the distance to goal (scaled by 10%) plus the distance of the path.
successor->SetFinalCost(successor->GetHCost() * 1.1 + successor->GetGivenCost());
successor->SetParent(current);
m_mCreatedList[(*i)] = (successor);
- nodeQueue.push(successor); //When the node is pushed onto the PriorityQueue it ends up beings sorted cheapest -> most expensive
+ nodeQueue.push(successor); // When the node is pushed onto the PriorityQueue it ends up beings sorted cheapest -> most expensive
}
}
}
// }
//}
- //Update the time
- if (timeslice != 0)
- {
+ // Update the time
+ if (timeslice != 0) {
time -= (SDL_GetTicks() - prevTime);
prevTime = SDL_GetTicks();
}
} while (!isDone() && (time >= 0 || timeslice == 0));
- noSolution = true; //You can't get there from here (SZ)
+ noSolution = true; // You can't get there from here (SZ)
}
-bool PathfindingAgent::isDone() const
-{
+bool PathfindingAgent::isDone() const {
if (nodeQueue.empty())
return true;
return false;
}
-//Clear everything.
-void PathfindingAgent::exit()
-{
- std::map<PathfindingGraphNode*, PlannerNode*>::iterator iter;
- if (!m_mCreatedList.empty())
- {
- for (iter = m_mCreatedList.begin(); iter != m_mCreatedList.end(); ++iter)
- {
+// Clear everything.
+void PathfindingAgent::exit() {
+ std::map<PathfindingGraphNode *, PlannerNode *>::iterator iter;
+ if (!m_mCreatedList.empty()) {
+ for (iter = m_mCreatedList.begin(); iter != m_mCreatedList.end(); ++iter) {
delete (*iter).second;
}
}
@@ -242,37 +215,31 @@ void PathfindingAgent::exit()
m_pStartTile = NULL;
}
-void PathfindingAgent::shutdown()
-{
+void PathfindingAgent::shutdown() {
exit();
grid = NULL;
}
-std::vector<PathfindingGraphNode const*> const PathfindingAgent::getSolution(PathfindingGraphNode* destNode) const
-{
- std::vector<PathfindingGraphNode const*> temp;
+std::vector<PathfindingGraphNode const *> const PathfindingAgent::getSolution(PathfindingGraphNode *destNode) const {
+ std::vector<PathfindingGraphNode const *> temp;
- PlannerNode* current = NULL;
+ PlannerNode *current = NULL;
- if (m_mCreatedList.find(m_pGoalTile) != m_mCreatedList.end())
- {
+ if (m_mCreatedList.find(m_pGoalTile) != m_mCreatedList.end()) {
current = m_mCreatedList.find(m_pGoalTile)->second;
}
- //If the dest node passed in is not null, that means we did not reach the goal but came close
- //so we should start with that node instead when we are constructing our path
- else if (destNode != NULL)
- {
+ // If the dest node passed in is not null, that means we did not reach the goal but came close
+ // so we should start with that node instead when we are constructing our path
+ else if (destNode != NULL) {
current = m_mCreatedList.find(destNode)->second;
}
- //Iterate through the planner nodes to create a vector to return.
- while (current)
- {
- if (current->GetLocation() != m_pStartTile)
- {
- //You don't have to path to the start
+ // Iterate through the planner nodes to create a vector to return.
+ while (current) {
+ if (current->GetLocation() != m_pStartTile) {
+ // You don't have to path to the start
if (current->GetLocation() != m_pStartTile)
temp.push_back(current->GetLocation());
}
@@ -283,26 +250,21 @@ std::vector<PathfindingGraphNode const*> const PathfindingAgent::getSolution(Pat
return temp;
}
-std::vector<PathfindingGraphNode const*> const PathfindingAgent::getPrunedSolution(PathfindingGraphNode* destNode)
-{
- std::vector<PathfindingGraphNode const*> temp = getSolution(destNode);
+std::vector<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSolution(PathfindingGraphNode *destNode) {
+ std::vector<PathfindingGraphNode const *> temp = getSolution(destNode);
- std::vector<PathfindingGraphNode const*> returnVec = temp;
+ std::vector<PathfindingGraphNode const *> returnVec = temp;
- //Any node that is not adjacent to an obstacle or an obstacle corner can be removed.
- for (int i = 0; i < temp.size(); ++i)
- {
- if (!temp[i]->AdjacentToObstacle())
- {
- if (i > 0 && i < temp.size() - 1)
- {
- //This check to see if the node is a "corner" to an obstacle that should not be pruned
- //to prevent hanging on corners.
- std::vector<PathfindingGraphNode*> corners = grid->CornerCheck(temp[i - 1], temp[i + 1]);
+ // Any node that is not adjacent to an obstacle or an obstacle corner can be removed.
+ for (int i = 0; i < temp.size(); ++i) {
+ if (!temp[i]->AdjacentToObstacle()) {
+ if (i > 0 && i < temp.size() - 1) {
+ // This check to see if the node is a "corner" to an obstacle that should not be pruned
+ // to prevent hanging on corners.
+ std::vector<PathfindingGraphNode *> corners = grid->CornerCheck(temp[i - 1], temp[i + 1]);
- if (corners.size() == 0)
- {
- std::vector<PathfindingGraphNode const*>::iterator theEnd = std::remove(returnVec.begin(), returnVec.end(), temp[i]);
+ if (corners.size() == 0) {
+ std::vector<PathfindingGraphNode const *>::iterator theEnd = std::remove(returnVec.begin(), returnVec.end(), temp[i]);
returnVec.erase(theEnd);
}
}
@@ -312,32 +274,26 @@ std::vector<PathfindingGraphNode const*> const PathfindingAgent::getPrunedSoluti
return returnVec;
}
-double PathfindingAgent::distSquared(PathfindingGraphNode* tileA, PathfindingGraphNode* tileB)
-{
+double PathfindingAgent::distSquared(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB) {
Vector2f vecTo = tileA->GetPosition() - tileB->GetPosition();
return vecTo.MagSqr();
}
-double PathfindingAgent::distExact(PathfindingGraphNode* tileA, PathfindingGraphNode* tileB)
-{
+double PathfindingAgent::distExact(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB) {
Vector2f vecTo = tileA->GetPosition() - tileB->GetPosition();
return vecTo.Magnitude();
}
-//This keeps the PriorityQueue organized based on the cost of the paths.
-bool compareNodes(PlannerNode const* nodeA, PlannerNode const* nodeB)
-{
+// This keeps the PriorityQueue organized based on the cost of the paths.
+bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB) {
return nodeA->GetFinalCost() > nodeB->GetFinalCost();
}
-bool PathfindingAgent::AdjacentToGoal(PathfindingGraphNode* node)
-{
- for (auto iter : node->neighborNodes)
- {
- if (iter == m_pGoalTile)
- {
+bool PathfindingAgent::AdjacentToGoal(PathfindingGraphNode *node) {
+ for (auto iter : node->neighborNodes) {
+ if (iter == m_pGoalTile) {
return true;
}
}
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index cc961b5d9d6..068ff6c2b43 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -4,79 +4,84 @@
#include "PriorityQueue.h"
#include "vectors.h"
-//This class represents the actual pathfinding and following agent that utilizes
-//the pathfinding grid
-class PlannerNode
-{
- PlannerNode* parent;
- PlannerNode* child;
+// This class represents the actual pathfinding and following agent that utilizes
+// the pathfinding grid
+class PlannerNode {
+ PlannerNode *parent;
+ PlannerNode *child;
- double cost; //Heuristic cost equivalent to cost to reach goal from planner node's position.
- double finalCost; //Final cost of route through the planner node. Used to determine optimal path.
- double givenCost; //The current distance of the route.
+ double cost; // Heuristic cost equivalent to cost to reach goal from planner node's position.
+ double finalCost; // Final cost of route through the planner node. Used to determine optimal path.
+ double givenCost; // The current distance of the route.
public:
- PathfindingGraphNode* location;
-
- PlannerNode(){ location = NULL; parent = NULL; child = NULL; cost = 0; finalCost = 0; givenCost = 0; }
- ~PlannerNode(){}
-
- PathfindingGraphNode* GetLocation(void) { return location; }
- PlannerNode* GetParent(void) { return parent; }
- PlannerNode* GetChild(void) { return child; }
- double GetHCost(void) const { return cost; }
- double GetFinalCost(void) const { return finalCost; }
- double GetGivenCost(void) const { return givenCost; }
-
- void SetLocation(PathfindingGraphNode* loc) { location = loc; }
- void SetParent(PlannerNode* p) { parent = p; }
- void SetChild(PlannerNode* c) { child = c; }
- void SetHCost(double c) { cost = c; }
- void SetFinalCost(double cost) { finalCost = cost; }
- void SetGivenCost(double cost) { givenCost = cost; }
+ PathfindingGraphNode *location;
+
+ PlannerNode() {
+ location = NULL;
+ parent = NULL;
+ child = NULL;
+ cost = 0;
+ finalCost = 0;
+ givenCost = 0;
+ }
+ ~PlannerNode() {}
+
+ PathfindingGraphNode *GetLocation(void) { return location; }
+ PlannerNode *GetParent(void) { return parent; }
+ PlannerNode *GetChild(void) { return child; }
+ double GetHCost(void) const { return cost; }
+ double GetFinalCost(void) const { return finalCost; }
+ double GetGivenCost(void) const { return givenCost; }
+
+ void SetLocation(PathfindingGraphNode *loc) { location = loc; }
+ void SetParent(PlannerNode *p) { parent = p; }
+ void SetChild(PlannerNode *c) { child = c; }
+ void SetHCost(double c) { cost = c; }
+ void SetFinalCost(double cost) { finalCost = cost; }
+ void SetGivenCost(double cost) { givenCost = cost; }
};
-class PathfindingAgent
-{
+class PathfindingAgent {
Vector2f position;
- Vector2f prevPosition; //Used to determine that we are making progress toward the goal
- Vector2i immediateDest; //The next stop on the AI's path
+ Vector2f prevPosition; // Used to determine that we are making progress toward the goal
+ Vector2i immediateDest; // The next stop on the AI's path
- bool destinationSet; //Was a destination specified.
- bool destinationReachable; //Can the agent actually get to the destination?
+ bool destinationSet; // Was a destination specified.
+ bool destinationReachable; // Can the agent actually get to the destination?
- float nodeBufferDistance; //How much leeway is there for reaching the destination
+ float nodeBufferDistance; // How much leeway is there for reaching the destination
public:
PathfindingAgent();
~PathfindingAgent();
- PathfindingGrid* grid;
+ PathfindingGrid *grid;
Vector2f destination;
- PathfindingGraphNode* m_pStartTile; //The system originally used tiles, but this one uses discreet points.
- PathfindingGraphNode* m_pGoalTile; //The tile we are trying to reach. May not be the tile that was clicked if the clicked tile is blocked.
- PathfindingGraphNode* m_pClickedTile; //The tile that was clicked. If it is open, it will be the goal node.
+ PathfindingGraphNode *m_pStartTile; // The system originally used tiles, but this one uses discreet points.
+ PathfindingGraphNode *m_pGoalTile; // The tile we are trying to reach. May not be the tile that was clicked if the clicked tile is blocked.
+ PathfindingGraphNode *m_pClickedTile; // The tile that was clicked. If it is open, it will be the goal node.
bool solutionFound;
bool noSolution;
- std::vector<PathfindingGraphNode const*> m_vSolution;
+ std::vector<PathfindingGraphNode const *> m_vSolution;
- void SetNodeBufferDistance(float w){ nodeBufferDistance = w; }
- float GetNodeBufferDistance(){ return nodeBufferDistance; }
+ void SetNodeBufferDistance(float w) { nodeBufferDistance = w; }
+ float GetNodeBufferDistance() { return nodeBufferDistance; }
- //Added for Greedy search
- double distSquared(PathfindingGraphNode* tileA, PathfindingGraphNode* tileB);
- //Added for A* search
- double distExact(PathfindingGraphNode* tileA, PathfindingGraphNode* tileB);
+ // Added for Greedy search
+ double distSquared(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB);
+ // Added for A* search
+ double distExact(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB);
PriorityQueue<PlannerNode> nodeQueue;
- std::map<PathfindingGraphNode*, PlannerNode*> m_mCreatedList;
+ std::map<PathfindingGraphNode *, PlannerNode *> m_mCreatedList;
- //void SetSprite(pyrodactyl::anim::Sprite* s){entitySprite = s;}
+ // void SetSprite(pyrodactyl::anim::Sprite* s){entitySprite = s;}
//! \brief Sets the tile map.
//!
@@ -84,20 +89,20 @@ public:
//!
//! \param _tileMap the data structure that this algorithm will use
//! to access each tile's location and weight data.
- void initialize(PathfindingGrid* g);
+ void initialize(PathfindingGrid *g);
void SetDestination(Vector2f d);
void SetDestination(Vector2f d, bool r);
void SetDestination(Vector2i d);
void SetDestination(Vector2i d, bool r);
- void SetPosition(Vector2f p){ position = p; }
- void SetPrevPosition(Vector2f p){ prevPosition = p; }
- Vector2f GetPosition(){ return position; }
+ void SetPosition(Vector2f p) { position = p; }
+ void SetPrevPosition(Vector2f p) { prevPosition = p; }
+ Vector2f GetPosition() { return position; }
- bool PositionChanged(){ return position != prevPosition; }
+ bool PositionChanged() { return position != prevPosition; }
- Vector2i GetImmediateDest(){ return immediateDest; }
+ Vector2i GetImmediateDest() { return immediateDest; }
//! \brief Performs the main part of the algorithm until the specified time has elapsed or
//! no nodes are left open.
@@ -109,11 +114,11 @@ public:
bool isDone() const;
//! \brief Returns an unmodifiable view of the solution path found by this algorithm.
- std::vector<PathfindingGraphNode const*> const getSolution(PathfindingGraphNode* destNode) const;
+ std::vector<PathfindingGraphNode const *> const getSolution(PathfindingGraphNode *destNode) const;
- //Get the solution removing any nodes that are completely surrounded by open space.
- //This will result in a more linear path to the goal.
- std::vector<PathfindingGraphNode const*> const getPrunedSolution(PathfindingGraphNode* destNode);
+ // Get the solution removing any nodes that are completely surrounded by open space.
+ // This will result in a more linear path to the goal.
+ std::vector<PathfindingGraphNode const *> const getPrunedSolution(PathfindingGraphNode *destNode);
//! \brief Resets the algorithm.
void exit();
@@ -121,8 +126,8 @@ public:
//! \brief Uninitializes the algorithm before the tile map is unloaded.
void shutdown();
- //Returns true if the node connects to the goal node
- bool AdjacentToGoal(PathfindingGraphNode* node);
+ // Returns true if the node connects to the goal node
+ bool AdjacentToGoal(PathfindingGraphNode *node);
};
-bool compareNodes(PlannerNode const* nodeA, PlannerNode const* nodeB);
+bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB);
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 5bcbe1ff124..3222f903f68 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -1,61 +1,49 @@
-#include "stdafx.h"
#include "PathfindingGraphNode.h"
+#include "stdafx.h"
-PathfindingGraphNode::PathfindingGraphNode(void)
-{
+PathfindingGraphNode::PathfindingGraphNode(void) {
id = -1;
movementCost = -1.0f;
}
-PathfindingGraphNode::PathfindingGraphNode(Vector2f pos, int i) : position(pos)
-{
+PathfindingGraphNode::PathfindingGraphNode(Vector2f pos, int i) : position(pos) {
id = i;
movementCost = -1.0f;
}
-PathfindingGraphNode::~PathfindingGraphNode(void)
-{
+PathfindingGraphNode::~PathfindingGraphNode(void) {
}
-void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode* node)
-{
+void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode *node) {
AddNeighbor(node, false);
}
-void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode* node, bool ignoreDistance)
-{
- //You can't be your own neighbor. Sorry.
+void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode *node, bool ignoreDistance) {
+ // You can't be your own neighbor. Sorry.
if (node->id == this->id)
return;
- //Make sure that the node is not already a neighbor (SZ)
- for (int i = 0; i < neighborNodes.size(); ++i)
- {
- if (neighborNodes[i]->id == node->id)
- {
+ // Make sure that the node is not already a neighbor (SZ)
+ for (int i = 0; i < neighborNodes.size(); ++i) {
+ if (neighborNodes[i]->id == node->id) {
return;
}
}
neighborNodes.push_back(node);
- //Determine the cost.
- if (ignoreDistance)
- {
+ // Determine the cost.
+ if (ignoreDistance) {
neighborCosts.push_back(node->movementCost);
- }
- else
- {
+ } else {
Vector2f distVec = node->position - this->position;
neighborCosts.push_back(distVec.Magnitude() * node->movementCost);
}
}
-bool PathfindingGraphNode::AdjacentToObstacle() const
-{
- for (auto iter = neighborNodes.begin(); iter != neighborNodes.end(); ++iter)
- {
+bool PathfindingGraphNode::AdjacentToObstacle() const {
+ for (auto iter = neighborNodes.begin(); iter != neighborNodes.end(); ++iter) {
if ((*iter)->GetMovementCost() < 0)
return true;
}
@@ -63,10 +51,8 @@ bool PathfindingGraphNode::AdjacentToObstacle() const
return false;
}
-bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode* otherNode)
-{
- for (int i = 0; i < neighborNodes.size(); ++i)
- {
+bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode *otherNode) {
+ for (int i = 0; i < neighborNodes.size(); ++i) {
if (neighborNodes[i] == otherNode)
return true;
}
@@ -75,7 +61,7 @@ bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode* otherNode)
}
//
-//const std::vector< PathfindingGraphNode*>& PathfindingGraphNode::GetNeighbors() const
+// const std::vector< PathfindingGraphNode*>& PathfindingGraphNode::GetNeighbors() const
//{
// return neighborNodes;
//}
\ No newline at end of file
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
index d8db10ea089..50f3321af63 100644
--- a/engines/crab/PathfindingGraphNode.h
+++ b/engines/crab/PathfindingGraphNode.h
@@ -1,52 +1,48 @@
#pragma once
-#include "vectors.h"
#include "Rectangle.h"
+#include "vectors.h"
-//This is the basic pathfinding node that will construct the pathfinding graph. (SZ)
-//Although Unrest is using a square grid based pathfinding map, this is made to be a general use pathfinding node.
-class PathfindingGraphNode
-{
+// This is the basic pathfinding node that will construct the pathfinding graph. (SZ)
+// Although Unrest is using a square grid based pathfinding map, this is made to be a general use pathfinding node.
+class PathfindingGraphNode {
friend class PathfindingGrid;
- int id; //Each ID will be assigned when the pathfinding graph is generated and will identify each node.
+ int id; // Each ID will be assigned when the pathfinding graph is generated and will identify each node.
- float movementCost; //1 is open terrain, >1 is impeding terrain, <0 is completely obstructed
+ float movementCost; // 1 is open terrain, >1 is impeding terrain, <0 is completely obstructed
- Vector2f position; //Position of the node
+ Vector2f position; // Position of the node
- Rect collisionRect; //Represents spaced covered by the node.
+ Rect collisionRect; // Represents spaced covered by the node.
public:
-
- std::vector<PathfindingGraphNode*> neighborNodes;
- std::vector<float> neighborCosts; //The movement cost for the neighbor nodes (distance to the node X the nodes movement cost)
- //This is stored to prevent having to recalculate each frame.
+ std::vector<PathfindingGraphNode *> neighborNodes;
+ std::vector<float> neighborCosts; // The movement cost for the neighbor nodes (distance to the node X the nodes movement cost)
+ // This is stored to prevent having to recalculate each frame.
PathfindingGraphNode(void);
PathfindingGraphNode(Vector2f pos, int i);
~PathfindingGraphNode(void);
- float GetMovementCost(){return movementCost;}
- Vector2f GetPosition() const {return position;}
+ float GetMovementCost() { return movementCost; }
+ Vector2f GetPosition() const { return position; }
- //Adds node to neighbor vector and cost to neighbor costs
- void AddNeighbor( PathfindingGraphNode* node);
+ // Adds node to neighbor vector and cost to neighbor costs
+ void AddNeighbor(PathfindingGraphNode *node);
- //Same as above, but does not calculate distance. Used when all nodes
- //are equidistant
- void AddNeighbor( PathfindingGraphNode* node, bool ignoreDistance);
+ // Same as above, but does not calculate distance. Used when all nodes
+ // are equidistant
+ void AddNeighbor(PathfindingGraphNode *node, bool ignoreDistance);
- //const std::vector< PathfindingGraphNode*>& GetNeighbors() const;
+ // const std::vector< PathfindingGraphNode*>& GetNeighbors() const;
- Rect GetRect() const {return collisionRect;}
+ Rect GetRect() const { return collisionRect; }
- //Return true if the node is adjacent to a blocked node
+ // Return true if the node is adjacent to a blocked node
bool AdjacentToObstacle() const;
-
- //Return true if the node is adjacent to the otherNode
- bool AdjacentToNode(PathfindingGraphNode* otherNode);
+ // Return true if the node is adjacent to the otherNode
+ bool AdjacentToNode(PathfindingGraphNode *otherNode);
};
-
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 695bc9a77d5..c0571992bdf 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -1,73 +1,63 @@
-#include "stdafx.h"
#include "PathfindingGrid.h"
#include "TMXMap.h"
+#include "stdafx.h"
using namespace TMX;
-PathfindingGrid::PathfindingGrid(void)
-{
+PathfindingGrid::PathfindingGrid(void) {
blockedCost = BLOCKED;
openCost = OPEN;
stairsCost = STAIRS;
nodes = nullptr;
}
-PathfindingGrid::~PathfindingGrid(void)
-{
- for (int x = 0; x < dimensions.x; ++x)
- {
+PathfindingGrid::~PathfindingGrid(void) {
+ for (int x = 0; x < dimensions.x; ++x) {
delete[] nodes[x];
}
delete nodes;
}
-void PathfindingGrid::SetupNodes(TMXMap map)
-{
- dimensions.x = map.path_rows; //Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
+void PathfindingGrid::SetupNodes(TMXMap map) {
+ dimensions.x = map.path_rows; // Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
dimensions.y = map.path_cols;
cellSize.x = (float)map.path_size.x;
cellSize.y = (float)map.path_size.y;
- //Check to see if the costs have been loaded from the level file.
- //If not, assign to defaults.
- if (map.movementCosts.no_walk != 0)
- {
+ // Check to see if the costs have been loaded from the level file.
+ // If not, assign to defaults.
+ if (map.movementCosts.no_walk != 0) {
blockedCost = map.movementCosts.no_walk;
}
- if (map.movementCosts.open != 0)
- {
+ if (map.movementCosts.open != 0) {
openCost = map.movementCosts.open;
}
- if (map.movementCosts.stairs != 0)
- {
+ if (map.movementCosts.stairs != 0) {
stairsCost = map.movementCosts.stairs;
}
- nodes = new PathfindingGraphNode*[dimensions.x];
+ nodes = new PathfindingGraphNode *[dimensions.x];
- //Allocate some nodes!
- //TODO: probably want to change this to a one chunk allocation...
- for (int i = 0; i < dimensions.x; ++i)
- {
+ // Allocate some nodes!
+ // TODO: probably want to change this to a one chunk allocation...
+ for (int i = 0; i < dimensions.x; ++i) {
nodes[i] = new PathfindingGraphNode[dimensions.y];
}
- //Fill up those nodes!
+ // Fill up those nodes!
int idCounter = 0;
Vector2f pos = Vector2f(0.0f, 0.0f);
Vector2f topLeftPos = pos;
- //Initialize the nodes
- for (int x = 0; x < dimensions.x; ++x)
- {
- for (int y = 0; y < dimensions.y; ++y)
- {
- //PathfindingGraphNode* newNode = new PathfindingGraphNode(pos, idCounter++);
+ // Initialize the nodes
+ for (int x = 0; x < dimensions.x; ++x) {
+ for (int y = 0; y < dimensions.y; ++y) {
+ // PathfindingGraphNode* newNode = new PathfindingGraphNode(pos, idCounter++);
- //nodes[x][y] = *newNode;
+ // nodes[x][y] = *newNode;
nodes[x][y].collisionRect = Rect(pos.x, pos.y, cellSize.x, cellSize.y);
nodes[x][y].position.x = pos.x + cellSize.x / 2.0f;
@@ -75,59 +65,51 @@ void PathfindingGrid::SetupNodes(TMXMap map)
nodes[x][y].id = idCounter++;
nodes[x][y].movementCost = openCost;
- nodes[x][y].neighborCosts.reserve(4); //since its a square based grid, 4 is the greatest number of costs and nodes possible.
+ nodes[x][y].neighborCosts.reserve(4); // since its a square based grid, 4 is the greatest number of costs and nodes possible.
nodes[x][y].neighborNodes.reserve(4);
pos.y += cellSize.y;
std::vector<Shape> noWalk = map.AreaNoWalk();
- //Check if the square should count as blocked
- for (auto i = noWalk.begin(); i != noWalk.end(); ++i)
- {
- if (i->Collide(nodes[x][y].collisionRect).intersect)
- {
+ // Check if the square should count as blocked
+ for (auto i = noWalk.begin(); i != noWalk.end(); ++i) {
+ if (i->Collide(nodes[x][y].collisionRect).intersect) {
nodes[x][y].movementCost = (float)blockedCost;
break;
}
}
- //Check for stairs if the cell isn't blocked
- if (nodes[x][y].movementCost >= 0.0f)
- {
+ // Check for stairs if the cell isn't blocked
+ if (nodes[x][y].movementCost >= 0.0f) {
std::vector<pyrodactyl::level::Stairs> stairs = map.AreaStairs();
- for (auto i = stairs.begin(); i != stairs.end(); ++i)
- {
- if (i->Collide(nodes[x][y].collisionRect).intersect)
- {
+ for (auto i = stairs.begin(); i != stairs.end(); ++i) {
+ if (i->Collide(nodes[x][y].collisionRect).intersect) {
nodes[x][y].movementCost = (float)stairsCost;
break;
}
}
}
- //More collision checks can be added for the node as long as it checks for the high cost objects first
- //since the highest cost collider in any given tile would be used for the path cost. (SZ)
+ // More collision checks can be added for the node as long as it checks for the high cost objects first
+ // since the highest cost collider in any given tile would be used for the path cost. (SZ)
}
pos.x += cellSize.x;
pos.y = topLeftPos.y;
}
- //Connect the nodes
- for (int x = 0; x < dimensions.x; ++x)
- {
- for (int y = 0; y < dimensions.y; ++y)
- {
- //Check horizontal
- if (x < dimensions.x - 1)
- {
+ // Connect the nodes
+ for (int x = 0; x < dimensions.x; ++x) {
+ for (int y = 0; y < dimensions.y; ++y) {
+ // Check horizontal
+ if (x < dimensions.x - 1) {
ConnectNodes(&nodes[x][y], &nodes[x + 1][y]);
- //Check diagonals
- //This causes hangups since the collider has a greater width to take into account when traveling
- //diagonally compared to horizontal or vertical. (SZ)
+ // Check diagonals
+ // This causes hangups since the collider has a greater width to take into account when traveling
+ // diagonally compared to horizontal or vertical. (SZ)
/*if( y < dimensions.y - 2)
{
ConnectNodes(&nodes[x][y], &nodes[x + 1][y + 1]);
@@ -144,9 +126,8 @@ void PathfindingGrid::SetupNodes(TMXMap map)
nodes[x + 1][y - 1].movementCost *= 1.41f;
}*/
}
- //Check vertical
- if (y < dimensions.y - 1)
- {
+ // Check vertical
+ if (y < dimensions.y - 1) {
ConnectNodes(&nodes[x][y], &nodes[x][y + 1]);
}
}
@@ -154,7 +135,7 @@ void PathfindingGrid::SetupNodes(TMXMap map)
////Check for adjacencies
////This could be used if additional weight should be applied to nodes adjacent to blocked nodes.
- //for(int x = 0; x < dimensions.x; ++x)
+ // for(int x = 0; x < dimensions.x; ++x)
//{
// for(int y = 0; y < dimensions.y; ++y)
// {
@@ -167,35 +148,29 @@ void PathfindingGrid::SetupNodes(TMXMap map)
// }
// }
// }
- //}
+ // }
}
-void PathfindingGrid::ConnectNodes(PathfindingGraphNode* node1, PathfindingGraphNode* node2)
-{
+void PathfindingGrid::ConnectNodes(PathfindingGraphNode *node1, PathfindingGraphNode *node2) {
node1->AddNeighbor(node2, true);
node2->AddNeighbor(node1, true);
}
-PathfindingGraphNode* PathfindingGrid::GetNodeAtPoint(Vector2f point)
-{
+PathfindingGraphNode *PathfindingGrid::GetNodeAtPoint(Vector2f point) {
int x = (int)floor(point.x / cellSize.x);
int y = (int)floor(point.y / cellSize.y);
return &nodes[x][y];
}
-std::vector<PathfindingGraphNode*> PathfindingGrid::CornerCheck(const PathfindingGraphNode* node1, const PathfindingGraphNode* node2)
-{
- std::vector<PathfindingGraphNode*> returnNodes;
-
- //Iterat through both nodes neighbors. If a blocked neighbor is found that is shared between the two,
- //It is a corner to them.
- for (auto iter : node1->neighborNodes)
- {
- for (auto iter2 : node2->neighborNodes)
- {
- if (iter == iter2 && iter->movementCost < 0)
- {
+std::vector<PathfindingGraphNode *> PathfindingGrid::CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2) {
+ std::vector<PathfindingGraphNode *> returnNodes;
+
+ // Iterat through both nodes neighbors. If a blocked neighbor is found that is shared between the two,
+ // It is a corner to them.
+ for (auto iter : node1->neighborNodes) {
+ for (auto iter2 : node2->neighborNodes) {
+ if (iter == iter2 && iter->movementCost < 0) {
if (returnNodes.size() == 0 || (*(std::find(returnNodes.begin(), returnNodes.end(), iter))) == NULL)
returnNodes.push_back(iter);
}
@@ -205,51 +180,44 @@ std::vector<PathfindingGraphNode*> PathfindingGrid::CornerCheck(const Pathfindin
return returnNodes;
}
-PathfindingGraphNode* PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vector2f comparePos)
-{
- PathfindingGraphNode* startNode = GetNodeAtPoint(nodePos);
+PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vector2f comparePos) {
+ PathfindingGraphNode *startNode = GetNodeAtPoint(nodePos);
- if (startNode->GetMovementCost() > 0) //If the clicked node is open, we're done!
+ if (startNode->GetMovementCost() > 0) // If the clicked node is open, we're done!
return startNode;
- PathfindingGraphNode* returnNode = NULL;
+ PathfindingGraphNode *returnNode = NULL;
float shortestDistance = 0.0f;
- std::list<PathfindingGraphNode*> checkNodes;
+ std::list<PathfindingGraphNode *> checkNodes;
checkNodes.push_back(startNode);
- std::vector<PathfindingGraphNode*> allUsedNodes;
+ std::vector<PathfindingGraphNode *> allUsedNodes;
allUsedNodes.push_back(startNode);
- //Iterate through the nodes, check if they are open then check their distance from the compare point.
- while (!checkNodes.empty())
- {
- if (checkNodes.front()->GetMovementCost() > 0)
- {
+ // Iterate through the nodes, check if they are open then check their distance from the compare point.
+ while (!checkNodes.empty()) {
+ if (checkNodes.front()->GetMovementCost() > 0) {
float distance = (comparePos - checkNodes.front()->GetPosition()).MagSqr();
- if (shortestDistance == 0.0f || distance) //If this is the new shortest distance, this becomes the new return.
+ if (shortestDistance == 0.0f || distance) // If this is the new shortest distance, this becomes the new return.
{
shortestDistance = distance;
returnNode = checkNodes.front();
}
- }
- else
- {
- for (int i = 0; i < checkNodes.front()->neighborNodes.size(); ++i)
- {
- //If the neighbor hasn't been checked yet, add it to the list to check.
- if (std::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->neighborNodes[i]) == allUsedNodes.end())
- {
+ } else {
+ for (int i = 0; i < checkNodes.front()->neighborNodes.size(); ++i) {
+ // If the neighbor hasn't been checked yet, add it to the list to check.
+ if (std::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->neighborNodes[i]) == allUsedNodes.end()) {
allUsedNodes.push_back(checkNodes.front()->neighborNodes[i]);
checkNodes.push_back(checkNodes.front()->neighborNodes[i]);
}
}
}
- if (returnNode != NULL) //If a node has been found, we are done. We don't want to continue iterating through neighbors since it would take us further from the clicked node.
+ if (returnNode != NULL) // If a node has been found, we are done. We don't want to continue iterating through neighbors since it would take us further from the clicked node.
return returnNode;
checkNodes.pop_front();
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 6ed49b0036f..381137d4d06 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -1,36 +1,33 @@
#pragma once
-#include "common_header.h"
#include "PathfindingGraphNode.h"
+#include "common_header.h"
#include <math.h>
-namespace TMX
-{
- class TMXMap;
+namespace TMX {
+class TMXMap;
}
-//This is the grid of pathfinding nodes that is formed for the level (SZ)
-class PathfindingGrid
-{
+// This is the grid of pathfinding nodes that is formed for the level (SZ)
+class PathfindingGrid {
friend class PathfindingGraphNode;
- PathfindingGraphNode** nodes; //2D array of nodes (size is [dimensions.x][dimensions.y]
+ PathfindingGraphNode **nodes; // 2D array of nodes (size is [dimensions.x][dimensions.y]
- Vector2i dimensions; //rows and columns of nodes.
- Vector2f cellSize; //size of a cell in width and height
+ Vector2i dimensions; // rows and columns of nodes.
+ Vector2f cellSize; // size of a cell in width and height
- //Neighbor node1 to node2.
- void ConnectNodes(PathfindingGraphNode* node1, PathfindingGraphNode* node2);
+ // Neighbor node1 to node2.
+ void ConnectNodes(PathfindingGraphNode *node1, PathfindingGraphNode *node2);
public:
-
- //these are the default graph node costs.
- //they can be overwritten by values stored in the level's file.(SZ)
+ // these are the default graph node costs.
+ // they can be overwritten by values stored in the level's file.(SZ)
static const int BLOCKED = -1;
- static const int OPEN = 1;
- static const int STAIRS = 5;
+ static const int OPEN = 1;
+ static const int STAIRS = 5;
- //These are the actual data members used to assign costs. (SZ)
+ // These are the actual data members used to assign costs. (SZ)
int blockedCost;
int openCost;
int stairsCost;
@@ -40,20 +37,20 @@ public:
void SetupNodes(TMX::TMXMap map);
- //Return the node at the given point (SZ)
- PathfindingGraphNode* GetNodeAtPoint(Vector2f point);
- //Return the node at the given coordinates (SZ)
- PathfindingGraphNode* GetNodeAtCoords(int x, int y){ return &nodes[x][y]; }
+ // Return the node at the given point (SZ)
+ PathfindingGraphNode *GetNodeAtPoint(Vector2f point);
+ // Return the node at the given coordinates (SZ)
+ PathfindingGraphNode *GetNodeAtCoords(int x, int y) { return &nodes[x][y]; }
- Vector2i GetDimensions(){ return dimensions; }
+ Vector2i GetDimensions() { return dimensions; }
- Vector2f GetCellSize(){ return cellSize; }
+ Vector2f GetCellSize() { return cellSize; }
- //Returns the nearest open node to the compare spot, starting with the given nodePos
- //and iterating through its neighbors. (SZ)
- PathfindingGraphNode* GetNearestOpenNode(Vector2f nodePos, Vector2f comparePos);
+ // Returns the nearest open node to the compare spot, starting with the given nodePos
+ // and iterating through its neighbors. (SZ)
+ PathfindingGraphNode *GetNearestOpenNode(Vector2f nodePos, Vector2f comparePos);
- //Return true if two nodes share and adjacency to the same blocked node.
- //Can be used to find corners that shouldn't be cut.
- std::vector<PathfindingGraphNode*> CornerCheck(const PathfindingGraphNode* node1, const PathfindingGraphNode* node2);
+ // Return true if two nodes share and adjacency to the same blocked node.
+ // Can be used to find corners that shouldn't be cut.
+ std::vector<PathfindingGraphNode *> CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2);
};
\ No newline at end of file
diff --git a/engines/crab/PauseMenu.cpp b/engines/crab/PauseMenu.cpp
index 1c263c89db7..f794fe7879a 100644
--- a/engines/crab/PauseMenu.cpp
+++ b/engines/crab/PauseMenu.cpp
@@ -1,11 +1,10 @@
-#include "stdafx.h"
#include "PauseMenu.h"
+#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void PauseMenu::Load(rapidxml::xml_node<char> *node)
-{
+void PauseMenu::Load(rapidxml::xml_node<char> *node) {
menu.Load(node->first_node("menu"));
save.Load(node->first_node("save"));
@@ -13,10 +12,8 @@ void PauseMenu::Load(rapidxml::xml_node<char> *node)
bg.Load(node->first_node("bg"));
}
-bool PauseMenu::Draw(Button &back)
-{
- switch (state)
- {
+bool PauseMenu::Draw(Button &back) {
+ switch (state) {
case STATE_NORMAL:
bg.Draw();
menu.Draw();
@@ -32,50 +29,56 @@ bool PauseMenu::Draw(Button &back)
case STATE_OPTION:
gOptionMenu.Draw(back);
return true;
- default:break;
+ default:
+ break;
}
return false;
}
-PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back)
-{
- switch (state)
- {
+PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
+ switch (state) {
case STATE_NORMAL:
choice = menu.HandleEvents(Event);
- if (choice == -1)
- {
+ if (choice == -1) {
if (back.hotkey.HandleEvents(Event))
return PS_RESUME;
- }
- else
- {
- switch (choice)
- {
- case 0: state = STATE_NORMAL; return PS_RESUME;
- case 1: state = STATE_SAVE; save.ScanDir(); break;
- case 2: state = STATE_LOAD; gLoadMenu.ScanDir(); break;
- case 3: state = STATE_OPTION; break;
- case 4: return PS_HELP;
- case 5: return PS_QUIT_MENU;
- case 6: return PS_QUIT_GAME;
- default: break;
+ } else {
+ switch (choice) {
+ case 0:
Commit: 44722beab927f2e5ee4b160b8f2afa1acd83c13d
https://github.com/scummvm/scummvm/commit/44722beab927f2e5ee4b160b8f2afa1acd83c13d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Include copyright headers and fix newlines
Changed paths:
engines/crab/AlphaImage.cpp
engines/crab/AlphaImage.h
engines/crab/AnimationEffect.h
engines/crab/AnimationFrame.cpp
engines/crab/AnimationFrame.h
engines/crab/Caption.cpp
engines/crab/Caption.h
engines/crab/ChapterIntro.cpp
engines/crab/ChapterIntro.h
engines/crab/ClipButton.cpp
engines/crab/ClipButton.h
engines/crab/CreditScreen.cpp
engines/crab/CreditScreen.h
engines/crab/DevConsole.cpp
engines/crab/DevConsole.h
engines/crab/EventSeqGroup.cpp
engines/crab/EventSeqGroup.h
engines/crab/EventSequence.cpp
engines/crab/EventSequence.h
engines/crab/FileData.cpp
engines/crab/FileData.h
engines/crab/FileMenu.cpp
engines/crab/FileMenu.h
engines/crab/GameClock.h
engines/crab/GameEventInfo.cpp
engines/crab/GameEventInfo.h
engines/crab/GameOverMenu.cpp
engines/crab/GameOverMenu.h
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/GeneralSettingMenu.cpp
engines/crab/GeneralSettingMenu.h
engines/crab/GfxSettingMenu.cpp
engines/crab/GfxSettingMenu.h
engines/crab/HealthIndicator.cpp
engines/crab/HealthIndicator.h
engines/crab/HoverInfo.cpp
engines/crab/HoverInfo.h
engines/crab/Image.cpp
engines/crab/Image.h
engines/crab/ImageData.cpp
engines/crab/ImageData.h
engines/crab/ImageManager.cpp
engines/crab/ImageManager.h
engines/crab/Inventory.cpp
engines/crab/Inventory.h
engines/crab/Item.cpp
engines/crab/Item.h
engines/crab/ItemCollection.cpp
engines/crab/ItemCollection.h
engines/crab/ItemDesc.h
engines/crab/ItemMenu.cpp
engines/crab/ItemMenu.h
engines/crab/ItemSlot.cpp
engines/crab/ItemSlot.h
engines/crab/KeyBindMenu.cpp
engines/crab/KeyBindMenu.h
engines/crab/LevelExit.cpp
engines/crab/LevelExit.h
engines/crab/LevelResult.h
engines/crab/Line.cpp
engines/crab/Line.h
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/MapData.cpp
engines/crab/MapData.h
engines/crab/MapMarkerMenu.cpp
engines/crab/MapMarkerMenu.h
engines/crab/ModMenu.cpp
engines/crab/ModMenu.h
engines/crab/MusicArea.cpp
engines/crab/MusicArea.h
engines/crab/MusicManager.cpp
engines/crab/MusicManager.h
engines/crab/OptionMenu.cpp
engines/crab/OptionMenu.h
engines/crab/OptionSelect.cpp
engines/crab/OptionSelect.h
engines/crab/PageMenu.h
engines/crab/ParagraphData.cpp
engines/crab/ParagraphData.h
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGraphNode.h
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/PauseMenu.cpp
engines/crab/PauseMenu.h
engines/crab/PersonHandler.cpp
engines/crab/PersonHandler.h
engines/crab/PersonScreen.cpp
engines/crab/PersonScreen.h
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/PopUp.cpp
engines/crab/PopUp.h
engines/crab/PriorityQueue.h
engines/crab/ProgressBar.cpp
engines/crab/ProgressBar.h
engines/crab/QuestText.cpp
engines/crab/QuestText.h
engines/crab/RadioButton.h
engines/crab/RadioButtonMenu.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/ReplyButton.cpp
engines/crab/ReplyButton.h
engines/crab/ReplyMenu.cpp
engines/crab/ReplyMenu.h
engines/crab/ResolutionMenu.cpp
engines/crab/ResolutionMenu.h
engines/crab/SaveGameMenu.cpp
engines/crab/SaveGameMenu.h
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/SectionHeader.cpp
engines/crab/SectionHeader.h
engines/crab/Shape.cpp
engines/crab/Shape.h
engines/crab/SlideShow.cpp
engines/crab/SlideShow.h
engines/crab/SpriteConstant.cpp
engines/crab/SpriteConstant.h
engines/crab/Stairs.cpp
engines/crab/Stairs.h
engines/crab/Stat.cpp
engines/crab/Stat.h
engines/crab/StatDrawHelper.cpp
engines/crab/StatDrawHelper.h
engines/crab/StatPreview.cpp
engines/crab/StatPreview.h
engines/crab/StatTemplate.cpp
engines/crab/StatTemplate.h
engines/crab/StateButton.cpp
engines/crab/StateButton.h
engines/crab/TMXLayer.cpp
engines/crab/TMXLayer.h
engines/crab/TMXMap.cpp
engines/crab/TMXMap.h
engines/crab/TMXTileSet.cpp
engines/crab/TMXTileSet.h
engines/crab/TextData.h
engines/crab/TextManager.cpp
engines/crab/TextManager.h
engines/crab/TileInfo.h
engines/crab/ToggleButton.cpp
engines/crab/ToggleButton.h
engines/crab/TraitButton.cpp
engines/crab/TraitButton.h
engines/crab/TraitMenu.cpp
engines/crab/TraitMenu.h
engines/crab/XMLDoc.cpp
engines/crab/XMLDoc.h
engines/crab/animation.cpp
engines/crab/animation.h
engines/crab/animframe.cpp
engines/crab/animframe.h
engines/crab/animset.cpp
engines/crab/animset.h
engines/crab/app.cpp
engines/crab/app.h
engines/crab/bonus.h
engines/crab/button.cpp
engines/crab/button.h
engines/crab/changeval.h
engines/crab/collision.cpp
engines/crab/collision.h
engines/crab/color.cpp
engines/crab/color.h
engines/crab/common_header.h
engines/crab/console.cpp
engines/crab/console.h
engines/crab/conversationdata.cpp
engines/crab/conversationdata.h
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/cursor.cpp
engines/crab/cursor.h
engines/crab/detection.cpp
engines/crab/detection.h
engines/crab/detection_tables.h
engines/crab/dialogbox.cpp
engines/crab/dialogbox.h
engines/crab/effect.cpp
engines/crab/effect.h
engines/crab/element.cpp
engines/crab/element.h
engines/crab/emotion.cpp
engines/crab/emotion.h
engines/crab/eventstore.cpp
engines/crab/eventstore.h
engines/crab/fightanim.cpp
engines/crab/fightanim.h
engines/crab/fightinput.cpp
engines/crab/fightinput.h
engines/crab/fightmove.cpp
engines/crab/fightmove.h
engines/crab/fightmoves.cpp
engines/crab/fightmoves.h
engines/crab/filesystem.cpp
engines/crab/filesystem.h
engines/crab/fm_ai_data.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gameevent.cpp
engines/crab/gameevent.h
engines/crab/gameeventmanager.cpp
engines/crab/gameeventmanager.h
engines/crab/gamestate_container.h
engines/crab/gamestates.h
engines/crab/gametype.h
engines/crab/hotkey.cpp
engines/crab/hotkey.h
engines/crab/hud.cpp
engines/crab/hud.h
engines/crab/imageeffect.cpp
engines/crab/imageeffect.h
engines/crab/input.cpp
engines/crab/input.h
engines/crab/inputval.cpp
engines/crab/inputval.h
engines/crab/journal.cpp
engines/crab/journal.h
engines/crab/level.cpp
engines/crab/level.h
engines/crab/level_ai.cpp
engines/crab/level_collide.cpp
engines/crab/level_draw.cpp
engines/crab/level_load.cpp
engines/crab/level_objects.cpp
engines/crab/level_objects.h
engines/crab/levelpaths.h
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/main.cpp
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/map.cpp
engines/crab/map.h
engines/crab/mapbutton.h
engines/crab/menu.h
engines/crab/metaengine.cpp
engines/crab/metaengine.h
engines/crab/moveeffect.cpp
engines/crab/moveeffect.h
engines/crab/movement.cpp
engines/crab/movement.h
engines/crab/musicparam.h
engines/crab/numstr.h
engines/crab/opinion.cpp
engines/crab/opinion.h
engines/crab/person.cpp
engines/crab/person.h
engines/crab/personbase.cpp
engines/crab/personbase.h
engines/crab/quest.cpp
engines/crab/quest.h
engines/crab/questmenu.cpp
engines/crab/questmenu.h
engines/crab/range.h
engines/crab/resource.h
engines/crab/shadow.h
engines/crab/slider.cpp
engines/crab/slider.h
engines/crab/splash.cpp
engines/crab/splash.h
engines/crab/sprite.cpp
engines/crab/sprite.h
engines/crab/spriteai.cpp
engines/crab/spriteai.h
engines/crab/stdafx.cpp
engines/crab/stdafx.h
engines/crab/talknotify.cpp
engines/crab/talknotify.h
engines/crab/textarea.cpp
engines/crab/textarea.h
engines/crab/textdata.cpp
engines/crab/timer.cpp
engines/crab/timer.h
engines/crab/trait.cpp
engines/crab/trait.h
engines/crab/trigger.cpp
engines/crab/trigger.h
engines/crab/triggerset.cpp
engines/crab/triggerset.h
engines/crab/url.cpp
engines/crab/url.h
engines/crab/vectors.h
engines/crab/walkframes.cpp
engines/crab/walkframes.h
diff --git a/engines/crab/AlphaImage.cpp b/engines/crab/AlphaImage.cpp
index ee39ff7b6e1..0404ba57244 100644
--- a/engines/crab/AlphaImage.cpp
+++ b/engines/crab/AlphaImage.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "AlphaImage.h"
#include "TextManager.h"
#include "stdafx.h"
@@ -38,4 +68,4 @@ void AlphaImage::InternalEvents() {
void AlphaImage::Draw(const int &XOffset, const int &YOffset) {
if (gImageManager.ValidTexture(img))
gImageManager.GetTexture(img).Draw(pos.x + XOffset, pos.y + YOffset);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/AlphaImage.h b/engines/crab/AlphaImage.h
index a4b4726043e..903672fb693 100644
--- a/engines/crab/AlphaImage.h
+++ b/engines/crab/AlphaImage.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -49,4 +79,4 @@ public:
void SetUI() { pos.SetUI(); }
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/AnimationEffect.h b/engines/crab/AnimationEffect.h
index ac88419cbc0..76034f7517c 100644
--- a/engines/crab/AnimationEffect.h
+++ b/engines/crab/AnimationEffect.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -59,4 +89,4 @@ struct AnimationEffect {
}
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/AnimationFrame.cpp b/engines/crab/AnimationFrame.cpp
index 8639069a3d7..84de9da43d7 100644
--- a/engines/crab/AnimationFrame.cpp
+++ b/engines/crab/AnimationFrame.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "AnimationFrame.h"
#include "stdafx.h"
@@ -63,4 +93,4 @@ DrawType AnimationFrame::InternalEvents(const Uint32 ×tamp) {
}
return DRAW_SAME;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/AnimationFrame.h b/engines/crab/AnimationFrame.h
index a4044ffcd7b..68b50dd5a1c 100644
--- a/engines/crab/AnimationFrame.h
+++ b/engines/crab/AnimationFrame.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "AnimationEffect.h"
@@ -40,4 +70,4 @@ struct AnimationFrame : public Vector2i {
DrawType InternalEvents(const Uint32 ×tamp);
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Caption.cpp b/engines/crab/Caption.cpp
index 02146c89213..872cd8557b9 100644
--- a/engines/crab/Caption.cpp
+++ b/engines/crab/Caption.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "Caption.h"
@@ -26,4 +56,4 @@ void Caption::Draw(bool selected, const int &XOffset, const int &YOffset) {
else
TextData::Draw(text, XOffset, YOffset);
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Caption.h b/engines/crab/Caption.h
index edb7b78885c..4966da2b093 100644
--- a/engines/crab/Caption.h
+++ b/engines/crab/Caption.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -25,4 +55,4 @@ public:
void Draw(bool selected, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ChapterIntro.cpp b/engines/crab/ChapterIntro.cpp
index e18a471b209..6bcd30e5efe 100644
--- a/engines/crab/ChapterIntro.cpp
+++ b/engines/crab/ChapterIntro.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ChapterIntro.h"
#include "stdafx.h"
@@ -33,4 +63,4 @@ void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
Rect clip = cur_sp->DialogClip(state);
gImageManager.Draw(pos.x, pos.y, cur_sp->Img(), &clip);
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ChapterIntro.h b/engines/crab/ChapterIntro.h
index 43f29c036f8..fb447baef48 100644
--- a/engines/crab/ChapterIntro.h
+++ b/engines/crab/ChapterIntro.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
diff --git a/engines/crab/ClipButton.cpp b/engines/crab/ClipButton.cpp
index b8a215669de..0557ffc4199 100644
--- a/engines/crab/ClipButton.cpp
+++ b/engines/crab/ClipButton.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "ClipButton.h"
@@ -20,4 +50,4 @@ void ClipButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
void ClipButton::Draw(const int &XOffset, const int &YOffset) {
Button::Draw(XOffset, YOffset, &clip);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ClipButton.h b/engines/crab/ClipButton.h
index 50792e8ce03..04f05dbdd8c 100644
--- a/engines/crab/ClipButton.h
+++ b/engines/crab/ClipButton.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "button.h"
#include "common_header.h"
diff --git a/engines/crab/CreditScreen.cpp b/engines/crab/CreditScreen.cpp
index e76ec290eeb..8322054ec3c 100644
--- a/engines/crab/CreditScreen.cpp
+++ b/engines/crab/CreditScreen.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "CreditScreen.h"
#include "stdafx.h"
#include "url.h"
@@ -143,4 +173,4 @@ void CreditScreen::SetUI() {
logo.SetUI();
twitter.SetUI();
website.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/CreditScreen.h b/engines/crab/CreditScreen.h
index d00304559e8..7cb1e24ac2d 100644
--- a/engines/crab/CreditScreen.h
+++ b/engines/crab/CreditScreen.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageData.h"
@@ -87,4 +117,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/DevConsole.cpp b/engines/crab/DevConsole.cpp
index 256b823c577..33f693dd960 100644
--- a/engines/crab/DevConsole.cpp
+++ b/engines/crab/DevConsole.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "DevConsole.h"
#include "stdafx.h"
@@ -90,4 +120,4 @@ void DebugConsole::HandleEvents(const SDL_Event &Event) {
}
void DebugConsole::InternalEvents() {
-}
\ No newline at end of file
+}
diff --git a/engines/crab/DevConsole.h b/engines/crab/DevConsole.h
index bb81f48c3ab..5dd7e56d0a5 100644
--- a/engines/crab/DevConsole.h
+++ b/engines/crab/DevConsole.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
@@ -37,4 +67,4 @@ public:
void InternalEvents();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/EventSeqGroup.cpp b/engines/crab/EventSeqGroup.cpp
index 375cbbe3013..f0f1abf7dfe 100644
--- a/engines/crab/EventSeqGroup.cpp
+++ b/engines/crab/EventSeqGroup.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "EventSeqGroup.h"
@@ -63,4 +93,4 @@ void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node) {
if (seq.count(id) > 0)
seq[id].LoadState(n);
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/EventSeqGroup.h b/engines/crab/EventSeqGroup.h
index c04436cc0b2..1d1b7ad2715 100644
--- a/engines/crab/EventSeqGroup.h
+++ b/engines/crab/EventSeqGroup.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -33,4 +63,4 @@ public:
void LoadState(rapidxml::xml_node<char> *node);
};
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/EventSequence.cpp b/engines/crab/EventSequence.cpp
index aa445695149..1e7cc73cc95 100644
--- a/engines/crab/EventSequence.cpp
+++ b/engines/crab/EventSequence.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "EventSequence.h"
@@ -111,4 +141,4 @@ void EventSequence::LoadState(rapidxml::xml_node<char> *node) {
if (next.empty())
next.push_back(0);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/EventSequence.h b/engines/crab/EventSequence.h
index 96bc26c26c5..de38f4bca9d 100644
--- a/engines/crab/EventSequence.h
+++ b/engines/crab/EventSequence.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -46,4 +76,4 @@ public:
void LoadState(rapidxml::xml_node<char> *node);
};
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/FileData.cpp b/engines/crab/FileData.cpp
index 81fbab32680..3fee022ed31 100644
--- a/engines/crab/FileData.cpp
+++ b/engines/crab/FileData.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "FileData.h"
#include "stdafx.h"
#include <iomanip>
@@ -56,4 +86,4 @@ ModFileData::ModFileData(boost::filesystem::path filepath) : FileData(filepath)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/FileData.h b/engines/crab/FileData.h
index 1d7c5cc9d74..1fbc1d5014b 100644
--- a/engines/crab/FileData.h
+++ b/engines/crab/FileData.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "XMLDoc.h"
@@ -45,4 +75,4 @@ enum { DATA_AUTHOR,
DATA_WEBSITE };
const int DATA_HOVER_TOTAL = 4;
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/FileMenu.cpp b/engines/crab/FileMenu.cpp
index 7ba1862a800..80500dd9d32 100644
--- a/engines/crab/FileMenu.cpp
+++ b/engines/crab/FileMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "FileMenu.h"
#include "stdafx.h"
@@ -5,4 +35,4 @@ namespace pyrodactyl {
namespace ui {
FileMenu<SaveFileData> gLoadMenu;
}
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/FileMenu.h b/engines/crab/FileMenu.h
index 77536076ede..eac11a593a9 100644
--- a/engines/crab/FileMenu.h
+++ b/engines/crab/FileMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "FileData.h"
@@ -221,4 +251,4 @@ public:
extern FileMenu<SaveFileData> gLoadMenu;
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 89672e1665a..775999808f2 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -50,4 +80,4 @@ public:
return NumberToString(hours) + seperator + NumberToString(minutes) + seperator + NumberToString(seconds);
}
-};
\ No newline at end of file
+};
diff --git a/engines/crab/GameEventInfo.cpp b/engines/crab/GameEventInfo.cpp
index 95e96a8b2e4..ce528d3e2e3 100644
--- a/engines/crab/GameEventInfo.cpp
+++ b/engines/crab/GameEventInfo.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "GameEventInfo.h"
#include "eventstore.h"
#include "stdafx.h"
@@ -363,4 +393,4 @@ void Info::LoadState(rapidxml::xml_node<char> *node) {
void Info::SetUI() {
journal.SetUI();
inv.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/GameEventInfo.h b/engines/crab/GameEventInfo.h
index c6d49c23983..cdaaff4a6f8 100644
--- a/engines/crab/GameEventInfo.h
+++ b/engines/crab/GameEventInfo.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Inventory.h"
@@ -172,4 +202,4 @@ public:
void SetUI();
};
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/GameOverMenu.cpp b/engines/crab/GameOverMenu.cpp
index 5fe2d957fbf..3e175bbbaab 100644
--- a/engines/crab/GameOverMenu.cpp
+++ b/engines/crab/GameOverMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "GameOverMenu.h"
@@ -41,4 +71,4 @@ void GameOverMenu::SetUI() {
bg.SetUI();
title.SetUI();
menu.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/GameOverMenu.h b/engines/crab/GameOverMenu.h
index 1abb27407d1..a0aba35d7d6 100644
--- a/engines/crab/GameOverMenu.h
+++ b/engines/crab/GameOverMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageData.h"
@@ -36,4 +66,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index a43712bd7f5..36f98aba383 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "GameParam.h"
#include "stdafx.h"
@@ -127,4 +157,4 @@ void FilePaths::Load(const std::string &filename) {
loaded = true;
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index a60ffd97f12..1614bc29a2d 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "XMLDoc.h"
@@ -153,4 +183,4 @@ extern FilePaths gFilePath;
extern StringPool gStrPool;
// Generate random numbers using this
-extern RandomNumberGen gRandom;
\ No newline at end of file
+extern RandomNumberGen gRandom;
diff --git a/engines/crab/GeneralSettingMenu.cpp b/engines/crab/GeneralSettingMenu.cpp
index 58c968dad86..68a63016578 100644
--- a/engines/crab/GeneralSettingMenu.cpp
+++ b/engines/crab/GeneralSettingMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "GeneralSettingMenu.h"
#include "stdafx.h"
@@ -106,4 +136,4 @@ void GeneralSettingMenu::SetUI() {
vol_effects.SetUI();
text_speed.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/GeneralSettingMenu.h b/engines/crab/GeneralSettingMenu.h
index e2260cb410a..6165e72afa7 100644
--- a/engines/crab/GeneralSettingMenu.h
+++ b/engines/crab/GeneralSettingMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "RadioButtonMenu.h"
diff --git a/engines/crab/GfxSettingMenu.cpp b/engines/crab/GfxSettingMenu.cpp
index 3ec8dd991a4..b69e38ea4a7 100644
--- a/engines/crab/GfxSettingMenu.cpp
+++ b/engines/crab/GfxSettingMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "GfxSettingMenu.h"
#include "stdafx.h"
@@ -114,4 +144,4 @@ void GfxSettingMenu::SetUI() {
notice_quality.SetUI();
brightness.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/GfxSettingMenu.h b/engines/crab/GfxSettingMenu.h
index 9dbd3371a17..e5dc050f537 100644
--- a/engines/crab/GfxSettingMenu.h
+++ b/engines/crab/GfxSettingMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageData.h"
@@ -36,4 +66,4 @@ public:
void SetInfo() { resolution.SetInfo(); }
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/HealthIndicator.cpp b/engines/crab/HealthIndicator.cpp
index 6623af8286f..3d306350ed6 100644
--- a/engines/crab/HealthIndicator.cpp
+++ b/engines/crab/HealthIndicator.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "HealthIndicator.h"
@@ -39,4 +69,4 @@ void HealthIndicator::Draw(int num) {
break;
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/HealthIndicator.h b/engines/crab/HealthIndicator.h
index 88893e347f8..1128f6a864a 100644
--- a/engines/crab/HealthIndicator.h
+++ b/engines/crab/HealthIndicator.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -31,4 +61,4 @@ public:
void Draw(int num);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/HoverInfo.cpp b/engines/crab/HoverInfo.cpp
index 0c75561e247..904f8b64a51 100644
--- a/engines/crab/HoverInfo.cpp
+++ b/engines/crab/HoverInfo.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "HoverInfo.h"
@@ -21,4 +51,4 @@ void HoverInfo::Load(rapidxml::xml_node<char> *node, Rect *parent) {
void HoverInfo::Draw(const int &XOffset, const int &YOffset) {
if (enabled)
TextData::Draw(text, XOffset, YOffset);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/HoverInfo.h b/engines/crab/HoverInfo.h
index d76d83ea79b..5d8464e09a3 100644
--- a/engines/crab/HoverInfo.h
+++ b/engines/crab/HoverInfo.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -20,4 +50,4 @@ public:
void Draw(const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Image.cpp b/engines/crab/Image.cpp
index b7fd31f9fc8..9f327a46c22 100644
--- a/engines/crab/Image.cpp
+++ b/engines/crab/Image.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "Image.h"
#include "stdafx.h"
@@ -121,4 +151,4 @@ void Image::Delete() {
w = 0;
h = 0;
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Image.h b/engines/crab/Image.h
index 3afe02c7621..57099e087ad 100644
--- a/engines/crab/Image.h
+++ b/engines/crab/Image.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ScreenSettings.h"
@@ -49,4 +79,4 @@ public:
const bool Valid() { return texture != nullptr; }
};
} // End of namespace image
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ImageData.cpp b/engines/crab/ImageData.cpp
index 81e8b4caeaf..ec260e38521 100644
--- a/engines/crab/ImageData.cpp
+++ b/engines/crab/ImageData.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ImageData.h"
#include "stdafx.h"
@@ -19,4 +49,4 @@ void ImageData::Draw(const int &XOffset, const int &YOffset) {
gImageManager.Draw(x + XOffset, y + YOffset, key, &clip);
else
gImageManager.Draw(x + XOffset, y + YOffset, key);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ImageData.h b/engines/crab/ImageData.h
index 2366165abd4..1e2d7e2dfeb 100644
--- a/engines/crab/ImageData.h
+++ b/engines/crab/ImageData.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -27,4 +57,4 @@ public:
void Draw(const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ImageManager.cpp b/engines/crab/ImageManager.cpp
index 1f50518fda1..4562bee33f5 100644
--- a/engines/crab/ImageManager.cpp
+++ b/engines/crab/ImageManager.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: Contains the image manager class - used to manage in-game images
@@ -145,4 +175,4 @@ void ImageManager::Quit() {
}
invalid_img.Delete();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ImageManager.h b/engines/crab/ImageManager.h
index 0b7a95be7ed..49499de6e1a 100644
--- a/engines/crab/ImageManager.h
+++ b/engines/crab/ImageManager.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: Contains the image manager class - used to manage in-game assets
@@ -77,4 +107,4 @@ public:
extern ImageManager gImageManager;
} // End of namespace image
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Inventory.cpp b/engines/crab/Inventory.cpp
index c9c72034d1b..39ff8530020 100644
--- a/engines/crab/Inventory.cpp
+++ b/engines/crab/Inventory.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "Inventory.h"
#include "stdafx.h"
@@ -97,4 +127,4 @@ void Inventory::SetUI() {
bg.SetUI();
collection.SetUI();
money.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Inventory.h b/engines/crab/Inventory.h
index d5ab455fab4..a80f9ca12b2 100644
--- a/engines/crab/Inventory.h
+++ b/engines/crab/Inventory.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageData.h"
@@ -48,4 +78,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Item.cpp b/engines/crab/Item.cpp
index a677e9a0714..813b0944c09 100644
--- a/engines/crab/Item.cpp
+++ b/engines/crab/Item.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "Item.h"
#include "stdafx.h"
@@ -85,4 +115,4 @@ void Item::StatChange(Person &obj, bool increase) {
void Item::Draw(const int &x, const int &y) {
gImageManager.Draw(x, y, img);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Item.h b/engines/crab/Item.h
index 493a2baf251..7363ba4b33c 100644
--- a/engines/crab/Item.h
+++ b/engines/crab/Item.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -35,4 +65,4 @@ struct Item {
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
} // End of namespace item
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ItemCollection.cpp b/engines/crab/ItemCollection.cpp
index ecfbf67ef12..8fd6cdd85bb 100644
--- a/engines/crab/ItemCollection.cpp
+++ b/engines/crab/ItemCollection.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ItemCollection.h"
#include "stdafx.h"
@@ -110,4 +140,4 @@ void ItemCollection::SetUI() {
for (auto i = item.begin(); i != item.end(); ++i)
i->second.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ItemCollection.h b/engines/crab/ItemCollection.h
index d40d4581ac4..24cbd63d4e3 100644
--- a/engines/crab/ItemCollection.h
+++ b/engines/crab/ItemCollection.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ItemMenu.h"
@@ -57,4 +87,4 @@ public:
void SetUI();
};
} // End of namespace item
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ItemDesc.h b/engines/crab/ItemDesc.h
index de9f5f4b8a1..c97ac08f50a 100644
--- a/engines/crab/ItemDesc.h
+++ b/engines/crab/ItemDesc.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Item.h"
diff --git a/engines/crab/ItemMenu.cpp b/engines/crab/ItemMenu.cpp
index 4614e5036f1..d4f7155e319 100644
--- a/engines/crab/ItemMenu.cpp
+++ b/engines/crab/ItemMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ItemMenu.h"
#include "stdafx.h"
@@ -133,4 +163,4 @@ bool ItemMenu::Swap(ItemMenu &target, int index) {
}
return false;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ItemMenu.h b/engines/crab/ItemMenu.h
index 5ac124acfe7..57b9d8efc4a 100644
--- a/engines/crab/ItemMenu.h
+++ b/engines/crab/ItemMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ItemDesc.h"
@@ -52,4 +82,4 @@ public:
void LoadState(rapidxml::xml_node<char> *node);
};
} // End of namespace item
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ItemSlot.cpp b/engines/crab/ItemSlot.cpp
index e424a32544e..e2e0263e661 100644
--- a/engines/crab/ItemSlot.cpp
+++ b/engines/crab/ItemSlot.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ItemSlot.h"
#include "stdafx.h"
@@ -132,4 +162,4 @@ bool ItemSlot::Equip(Item &i) {
void ItemSlot::StatChange(Person &obj, bool increase) {
if (enabled)
item.StatChange(obj, increase);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ItemSlot.h b/engines/crab/ItemSlot.h
index 669801654c5..b6b488b414e 100644
--- a/engines/crab/ItemSlot.h
+++ b/engines/crab/ItemSlot.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -58,4 +88,4 @@ public:
void LoadState(rapidxml::xml_node<char> *node);
};
} // End of namespace item
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/KeyBindMenu.cpp b/engines/crab/KeyBindMenu.cpp
index 0d3c35d1601..5ca1dd16a3d 100644
--- a/engines/crab/KeyBindMenu.cpp
+++ b/engines/crab/KeyBindMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "KeyBindMenu.h"
#include "stdafx.h"
@@ -164,4 +194,4 @@ void KeyBindMenu::SetUI() {
desc.SetUI();
sel_controls.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/KeyBindMenu.h b/engines/crab/KeyBindMenu.h
index 75c06033e52..ade7d14b4ba 100644
--- a/engines/crab/KeyBindMenu.h
+++ b/engines/crab/KeyBindMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageData.h"
@@ -86,4 +116,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/LevelExit.cpp b/engines/crab/LevelExit.cpp
index 8603367a8db..3dc7b7d46a2 100644
--- a/engines/crab/LevelExit.cpp
+++ b/engines/crab/LevelExit.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "LevelExit.h"
#include "stdafx.h"
@@ -21,4 +51,4 @@ void Exit::Load(rapidxml::xml_node<char> *node) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/LevelExit.h b/engines/crab/LevelExit.h
index a0ee40eaa8d..570aa5d13ff 100644
--- a/engines/crab/LevelExit.h
+++ b/engines/crab/LevelExit.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
@@ -18,4 +48,4 @@ struct Exit {
void Load(rapidxml::xml_node<char> *node);
};
} // End of namespace level
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index e54b84b4a5f..13c917a1818 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -17,4 +47,4 @@ struct LevelResult {
x = -1;
y = -1;
}
-};
\ No newline at end of file
+};
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index 6759e20f16e..dbefc46ff2e 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "Line.h"
#include "stdafx.h"
@@ -8,4 +38,4 @@ void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a) {
SDL_SetRenderDrawColor(gRenderer, r, g, b, a);
SDL_RenderDrawLine(gRenderer, x1, y1, x2, y2);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index e83b9e5d696..1e33d926b38 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ScreenSettings.h"
@@ -38,4 +68,4 @@ bool CollideLine(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y,
// Draw a line OpenGL style
void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
- const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a);
\ No newline at end of file
+ const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a);
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index dc835a3bd8b..8356cff04c7 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "LoadingScreen.h"
#include "XMLDoc.h"
#include "stdafx.h"
@@ -53,4 +83,4 @@ void LoadingScreen::Quit() {
i->Delete();
}
-LoadingScreen gLoadScreen;
\ No newline at end of file
+LoadingScreen gLoadScreen;
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 58fd91db5a9..068f05228c8 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Image.h"
@@ -36,4 +66,4 @@ public:
void Quit();
};
-extern LoadingScreen gLoadScreen;
\ No newline at end of file
+extern LoadingScreen gLoadScreen;
diff --git a/engines/crab/MapData.cpp b/engines/crab/MapData.cpp
index 1aa2766c97c..ecc7f7699fd 100644
--- a/engines/crab/MapData.cpp
+++ b/engines/crab/MapData.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "MapData.h"
#include "stdafx.h"
@@ -54,4 +84,4 @@ void MapData::LoadState(rapidxml::xml_node<char> *node) {
dest.push_back(md);
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/MapData.h b/engines/crab/MapData.h
index 267503f1239..6ae99e78e96 100644
--- a/engines/crab/MapData.h
+++ b/engines/crab/MapData.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Rectangle.h"
@@ -34,4 +64,4 @@ struct MapData {
void LoadState(rapidxml::xml_node<char> *node);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/MapMarkerMenu.cpp b/engines/crab/MapMarkerMenu.cpp
index 92ace3e49e9..5b8d11287b0 100644
--- a/engines/crab/MapMarkerMenu.cpp
+++ b/engines/crab/MapMarkerMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "MapMarkerMenu.h"
#include "stdafx.h"
@@ -100,4 +130,4 @@ void MapMarkerMenu::InternalEvents(const Element &pos, const Vector2i &player_po
void MapMarkerMenu::SetUI() {
player.SetUI();
menu.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/MapMarkerMenu.h b/engines/crab/MapMarkerMenu.h
index d6101a13d6c..b471cdd64c0 100644
--- a/engines/crab/MapMarkerMenu.h
+++ b/engines/crab/MapMarkerMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "StateButton.h"
@@ -59,4 +89,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ModMenu.cpp b/engines/crab/ModMenu.cpp
index f237552ceb5..13fe78b69e8 100644
--- a/engines/crab/ModMenu.cpp
+++ b/engines/crab/ModMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ModMenu.h"
#include "stdafx.h"
@@ -87,4 +117,4 @@ void ModMenu::Draw() {
hov[num].Draw();
} else if (hover)
Reset();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ModMenu.h b/engines/crab/ModMenu.h
index 8fd82ae6267..edc9dd4f03d 100644
--- a/engines/crab/ModMenu.h
+++ b/engines/crab/ModMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "FileMenu.h"
@@ -15,4 +45,4 @@ public:
void Draw();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/MusicArea.cpp b/engines/crab/MusicArea.cpp
index 4987be2654c..596d9bd4f44 100644
--- a/engines/crab/MusicArea.cpp
+++ b/engines/crab/MusicArea.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "MusicArea.h"
#include "stdafx.h"
@@ -20,4 +50,4 @@ void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/MusicArea.h b/engines/crab/MusicArea.h
index 373a79d1281..c81bd44c8bc 100644
--- a/engines/crab/MusicArea.h
+++ b/engines/crab/MusicArea.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Shape.h"
@@ -32,4 +62,4 @@ public:
void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
};
} // End of namespace level
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/MusicManager.cpp b/engines/crab/MusicManager.cpp
index b181be6d43e..7e7efa8d0eb 100644
--- a/engines/crab/MusicManager.cpp
+++ b/engines/crab/MusicManager.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "MusicManager.h"
@@ -114,4 +144,4 @@ void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<c
child->append_attribute(doc.allocate_attribute("channels", gStrPool.Get(channels)));
child->append_attribute(doc.allocate_attribute("chunk_size", gStrPool.Get(chunksize)));
root->append_node(child);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/MusicManager.h b/engines/crab/MusicManager.h
index 2d5798e4d22..fd03dba69c2 100644
--- a/engines/crab/MusicManager.h
+++ b/engines/crab/MusicManager.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameParam.h"
@@ -58,4 +88,4 @@ public:
extern MusicManager gMusicManager;
} // End of namespace music
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/OptionMenu.cpp b/engines/crab/OptionMenu.cpp
index 41bbdaf55cc..591bb80b789 100644
--- a/engines/crab/OptionMenu.cpp
+++ b/engines/crab/OptionMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "OptionMenu.h"
#include "stdafx.h"
@@ -319,4 +349,4 @@ void OptionMenu::SetUI() {
accept.SetUI();
cancel.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/OptionMenu.h b/engines/crab/OptionMenu.h
index 86851b1a487..9f9d19e42d4 100644
--- a/engines/crab/OptionMenu.h
+++ b/engines/crab/OptionMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GeneralSettingMenu.h"
@@ -79,4 +109,4 @@ public:
extern OptionMenu gOptionMenu;
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/OptionSelect.cpp b/engines/crab/OptionSelect.cpp
index 343b564a3fa..40b051fbbe6 100644
--- a/engines/crab/OptionSelect.cpp
+++ b/engines/crab/OptionSelect.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "OptionSelect.h"
@@ -57,4 +87,4 @@ void OptionSelect::SetUI() {
option.data.SetUI();
prev.SetUI();
next.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/OptionSelect.h b/engines/crab/OptionSelect.h
index f7611f51570..a048a442bfc 100644
--- a/engines/crab/OptionSelect.h
+++ b/engines/crab/OptionSelect.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -36,4 +66,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/PageMenu.h b/engines/crab/PageMenu.h
index 6501a344402..9e58c89d6cc 100644
--- a/engines/crab/PageMenu.h
+++ b/engines/crab/PageMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -199,4 +229,4 @@ public:
typedef PageMenu<Button> PageButtonMenu;
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ParagraphData.cpp b/engines/crab/ParagraphData.cpp
index 28d8ff019a8..62e1b7f59d0 100644
--- a/engines/crab/ParagraphData.cpp
+++ b/engines/crab/ParagraphData.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ParagraphData.h"
#include "stdafx.h"
@@ -12,4 +42,4 @@ bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const boo
void ParagraphData::Draw(const std::string &val, const int &XOffset, const int &YOffset) {
pyrodactyl::text::gTextManager.Draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ParagraphData.h b/engines/crab/ParagraphData.h
index 32c9f18f1e0..7bcd987f04c 100644
--- a/engines/crab/ParagraphData.h
+++ b/engines/crab/ParagraphData.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "TextData.h"
@@ -17,4 +47,4 @@ public:
void Draw(const std::string &val, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 161e70dd3dc..724a284c39d 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "PathfindingAgent.h"
#include "stdafx.h"
@@ -299,4 +329,4 @@ bool PathfindingAgent::AdjacentToGoal(PathfindingGraphNode *node) {
}
return false;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 068ff6c2b43..ee5fe162b8b 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "PathfindingGrid.h"
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 3222f903f68..94f7585c967 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "PathfindingGraphNode.h"
#include "stdafx.h"
@@ -64,4 +94,4 @@ bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode *otherNode) {
// const std::vector< PathfindingGraphNode*>& PathfindingGraphNode::GetNeighbors() const
//{
// return neighborNodes;
-//}
\ No newline at end of file
+//}
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
index 50f3321af63..4cef8b6c425 100644
--- a/engines/crab/PathfindingGraphNode.h
+++ b/engines/crab/PathfindingGraphNode.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Rectangle.h"
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index c0571992bdf..5427b756919 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "PathfindingGrid.h"
#include "TMXMap.h"
#include "stdafx.h"
@@ -224,4 +254,4 @@ PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vect
}
return NULL;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 381137d4d06..da24f587d47 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "PathfindingGraphNode.h"
@@ -53,4 +83,4 @@ public:
// Return true if two nodes share and adjacency to the same blocked node.
// Can be used to find corners that shouldn't be cut.
std::vector<PathfindingGraphNode *> CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2);
-};
\ No newline at end of file
+};
diff --git a/engines/crab/PauseMenu.cpp b/engines/crab/PauseMenu.cpp
index f794fe7879a..457a066dc39 100644
--- a/engines/crab/PauseMenu.cpp
+++ b/engines/crab/PauseMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "PauseMenu.h"
#include "stdafx.h"
@@ -104,4 +134,4 @@ void PauseMenu::SetUI() {
bg.SetUI();
menu.SetUI();
save.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/PauseMenu.h b/engines/crab/PauseMenu.h
index 2d206c2fbe6..646d5f72a8a 100644
--- a/engines/crab/PauseMenu.h
+++ b/engines/crab/PauseMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "FileMenu.h"
@@ -68,4 +98,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/PersonHandler.cpp b/engines/crab/PersonHandler.cpp
index 870eb1a9ddf..613069aa419 100644
--- a/engines/crab/PersonHandler.cpp
+++ b/engines/crab/PersonHandler.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "PersonHandler.h"
#include "stdafx.h"
@@ -137,4 +167,4 @@ void PersonHandler::SetUI() {
for (auto i = 0; i < pyrodactyl::people::OPI_TOTAL; ++i)
opinion[i].SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/PersonHandler.h b/engines/crab/PersonHandler.h
index 9b5025d68b4..1409ad66620 100644
--- a/engines/crab/PersonHandler.h
+++ b/engines/crab/PersonHandler.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
@@ -73,4 +103,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/PersonScreen.cpp b/engines/crab/PersonScreen.cpp
index c2e5aee655d..e86c3be286f 100644
--- a/engines/crab/PersonScreen.cpp
+++ b/engines/crab/PersonScreen.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "PersonScreen.h"
#include "stdafx.h"
@@ -67,4 +97,4 @@ void PersonScreen::SetUI() {
name.SetUI();
img.SetUI();
menu.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/PersonScreen.h b/engines/crab/PersonScreen.h
index ebfac764f2c..a0e5f252ed8 100644
--- a/engines/crab/PersonScreen.h
+++ b/engines/crab/PersonScreen.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
@@ -41,4 +71,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 89789788fa9..c84ffb44359 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "Polygon.h"
#include "stdafx.h"
@@ -237,4 +267,4 @@ void Polygon2D::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, con
DrawLine(p1.x + XOffset, p1.y + YOffset, p2.x + XOffset, p2.y + YOffset, r, g, b, a);
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index 61e0aaada78..d29eba2549b 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Rectangle.h"
diff --git a/engines/crab/PopUp.cpp b/engines/crab/PopUp.cpp
index ad9bc83cad6..56dd60e28e0 100644
--- a/engines/crab/PopUp.cpp
+++ b/engines/crab/PopUp.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "PopUp.h"
#include "stdafx.h"
@@ -96,4 +126,4 @@ void PopUp::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop,
void PopUpCollection::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
if (cur >= 0 && cur < element.size())
element.at(cur).Draw(x, y, pop, camera);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/PopUp.h b/engines/crab/PopUp.h
index 296972020bf..9c7036da940 100644
--- a/engines/crab/PopUp.h
+++ b/engines/crab/PopUp.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index 1cfee393aaf..447d65c9567 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include <algorithm>
diff --git a/engines/crab/ProgressBar.cpp b/engines/crab/ProgressBar.cpp
index 0c1c9d4cb4c..33e65922feb 100644
--- a/engines/crab/ProgressBar.cpp
+++ b/engines/crab/ProgressBar.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ProgressBar.h"
#include "stdafx.h"
@@ -82,4 +112,4 @@ void ProgressBar::Effect(const int &value, const int &prev) {
changed = false;
type = NONE;
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ProgressBar.h b/engines/crab/ProgressBar.h
index 35f5b380332..943e71e5a5c 100644
--- a/engines/crab/ProgressBar.h
+++ b/engines/crab/ProgressBar.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ClipButton.h"
diff --git a/engines/crab/QuestText.cpp b/engines/crab/QuestText.cpp
index 031ce84f067..1fe2c5a4dff 100644
--- a/engines/crab/QuestText.cpp
+++ b/engines/crab/QuestText.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "QuestText.h"
#include "stdafx.h"
@@ -126,4 +156,4 @@ void QuestText::SetUI() {
prev.SetUI();
next.SetUI();
status.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/QuestText.h b/engines/crab/QuestText.h
index 442708eb2a9..f20b0930147 100644
--- a/engines/crab/QuestText.h
+++ b/engines/crab/QuestText.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageData.h"
@@ -55,4 +85,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/RadioButton.h b/engines/crab/RadioButton.h
index 9531703ac2b..26b72719bc8 100644
--- a/engines/crab/RadioButton.h
+++ b/engines/crab/RadioButton.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ToggleButton.h"
@@ -18,4 +48,4 @@ public:
}
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/RadioButtonMenu.h b/engines/crab/RadioButtonMenu.h
index 0ef7e89b8c4..cb77eb1f15e 100644
--- a/engines/crab/RadioButtonMenu.h
+++ b/engines/crab/RadioButtonMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "RadioButton.h"
@@ -48,4 +78,4 @@ public:
}
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index e77d29e9be7..3ae9790789c 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "Rectangle.h"
#include "stdafx.h"
@@ -70,4 +100,4 @@ void Rect::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
child->append_attribute(doc.allocate_attribute("w", gStrPool.Get(w)));
child->append_attribute(doc.allocate_attribute("h", gStrPool.Get(h)));
root->append_node(child);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index ee20a6d2e8c..50dd54138a1 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Line.h"
diff --git a/engines/crab/ReplyButton.cpp b/engines/crab/ReplyButton.cpp
index ddac39e7fc2..da36ad3d4fc 100644
--- a/engines/crab/ReplyButton.cpp
+++ b/engines/crab/ReplyButton.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ReplyButton.h"
#include "stdafx.h"
@@ -52,4 +82,4 @@ void ReplyButton::Cache(const std::string &val, const int &spacing, const int &b
if (orig.y < bottom_edge)
y = bottom_edge + spacing;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ReplyButton.h b/engines/crab/ReplyButton.h
index 86a179044e7..053c9e49939 100644
--- a/engines/crab/ReplyButton.h
+++ b/engines/crab/ReplyButton.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "button.h"
diff --git a/engines/crab/ReplyMenu.cpp b/engines/crab/ReplyMenu.cpp
index fa33955c07b..a4633b81a8f 100644
--- a/engines/crab/ReplyMenu.cpp
+++ b/engines/crab/ReplyMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ReplyMenu.h"
#include "stdafx.h"
@@ -110,4 +140,4 @@ void ReplyMenu::SetUI() {
Menu<ReplyButton>::SetUI();
bg.SetUI();
tone.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ReplyMenu.h b/engines/crab/ReplyMenu.h
index a05566f6ba7..dbf002f5b70 100644
--- a/engines/crab/ReplyMenu.h
+++ b/engines/crab/ReplyMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
@@ -36,4 +66,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ResolutionMenu.cpp b/engines/crab/ResolutionMenu.cpp
index 719fd8538f3..53733610eb1 100644
--- a/engines/crab/ResolutionMenu.cpp
+++ b/engines/crab/ResolutionMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "ResolutionMenu.h"
@@ -100,4 +130,4 @@ void ResolutionMenu::SetUI() {
info.SetUI();
ref.SetUI();
ButtonMenu::SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ResolutionMenu.h b/engines/crab/ResolutionMenu.h
index 1f9718743a8..396bd51468c 100644
--- a/engines/crab/ResolutionMenu.h
+++ b/engines/crab/ResolutionMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -45,4 +75,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/SaveGameMenu.cpp b/engines/crab/SaveGameMenu.cpp
index 5fdf257a8b5..eda25ecf6ff 100644
--- a/engines/crab/SaveGameMenu.cpp
+++ b/engines/crab/SaveGameMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "SaveGameMenu.h"
#include "stdafx.h"
@@ -108,4 +138,4 @@ void GameSaveMenu::Draw() {
void GameSaveMenu::SetUI() {
FileMenu<SaveFileData>::SetUI();
ta_name.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/SaveGameMenu.h b/engines/crab/SaveGameMenu.h
index 4da153b2d6a..b96c422b45a 100644
--- a/engines/crab/SaveGameMenu.h
+++ b/engines/crab/SaveGameMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "FileMenu.h"
@@ -37,4 +67,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index 567ce4e0a6c..dd2398b09f2 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ScreenSettings.h"
#include "stdafx.h"
@@ -122,4 +152,4 @@ void ScreenSettings::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node
root->append_node(child);
CreateBackup();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index a0dfb11bd75..61c84ea2e0b 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameParam.h"
@@ -115,4 +145,4 @@ public:
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
-extern ScreenSettings gScreenSettings;
\ No newline at end of file
+extern ScreenSettings gScreenSettings;
diff --git a/engines/crab/SectionHeader.cpp b/engines/crab/SectionHeader.cpp
index ecfa9727aed..f35ef3302e0 100644
--- a/engines/crab/SectionHeader.cpp
+++ b/engines/crab/SectionHeader.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "SectionHeader.h"
#include "stdafx.h"
@@ -54,4 +84,4 @@ void SectionHeader::Draw(const std::string &str, const int &XOffset, const int &
gImageManager.Draw(right.x + XOffset, right.y + YOffset, img, NULL, FLIP_X);
TextData::Draw(str, XOffset, YOffset);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/SectionHeader.h b/engines/crab/SectionHeader.h
index ecaa0db09ab..9d8cfab8141 100644
--- a/engines/crab/SectionHeader.h
+++ b/engines/crab/SectionHeader.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -34,4 +64,4 @@ public:
void Draw(const std::string &str, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index 748c71beb41..67222e8db77 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "Shape.h"
#include "stdafx.h"
@@ -49,4 +79,4 @@ void Shape::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, const U
poly.Draw(XOffset, YOffset, r, g, b, a);
else
rect.Draw(XOffset, YOffset, r, g, b, a);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index f1483489dad..63bd487a2b2 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Polygon.h"
diff --git a/engines/crab/SlideShow.cpp b/engines/crab/SlideShow.cpp
index 13d94fb88c6..8b73594c7b5 100644
--- a/engines/crab/SlideShow.cpp
+++ b/engines/crab/SlideShow.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "SlideShow.h"
#include "stdafx.h"
@@ -81,4 +111,4 @@ void SlideShow::SetUI() {
bg.SetUI();
prev.SetUI();
next.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/SlideShow.h b/engines/crab/SlideShow.h
index 103a2d945dd..ec8371dda7a 100644
--- a/engines/crab/SlideShow.h
+++ b/engines/crab/SlideShow.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Image.h"
@@ -45,4 +75,4 @@ public:
extern SlideShow gHelpScreen;
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/SpriteConstant.cpp b/engines/crab/SpriteConstant.cpp
index b51576ee17f..ee52a88e8cc 100644
--- a/engines/crab/SpriteConstant.cpp
+++ b/engines/crab/SpriteConstant.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "SpriteConstant.h"
#include "stdafx.h"
@@ -36,4 +66,4 @@ void SpriteConstant::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("fly", node))
fly.Load(node->first_node("fly"));
-}
\ No newline at end of file
+}
diff --git a/engines/crab/SpriteConstant.h b/engines/crab/SpriteConstant.h
index c99b58937a1..8938c0f9f1d 100644
--- a/engines/crab/SpriteConstant.h
+++ b/engines/crab/SpriteConstant.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -40,4 +70,4 @@ struct SpriteConstant {
void Load(rapidxml::xml_node<char> *node);
};
} // End of namespace ai
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Stairs.cpp b/engines/crab/Stairs.cpp
index fac0653a0c6..5ac90e4267a 100644
--- a/engines/crab/Stairs.cpp
+++ b/engines/crab/Stairs.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "Stairs.h"
#include "stdafx.h"
@@ -18,4 +48,4 @@ void Stairs::Load(rapidxml::xml_node<char> *node, const bool &echo) {
}
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Stairs.h b/engines/crab/Stairs.h
index 4d0573a8c75..3738bc2f0c5 100644
--- a/engines/crab/Stairs.h
+++ b/engines/crab/Stairs.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Shape.h"
@@ -16,4 +46,4 @@ public:
void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
};
} // End of namespace level
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/Stat.cpp b/engines/crab/Stat.cpp
index ed3e7c032de..1b801655afe 100644
--- a/engines/crab/Stat.cpp
+++ b/engines/crab/Stat.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "Stat.h"
@@ -78,4 +108,4 @@ void Stat::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
child->append_attribute(doc.allocate_attribute("min", gStrPool.Get(min)));
child->append_attribute(doc.allocate_attribute("max", gStrPool.Get(max)));
root->append_node(child);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/Stat.h b/engines/crab/Stat.h
index 72207121444..6e7b5e09a3b 100644
--- a/engines/crab/Stat.h
+++ b/engines/crab/Stat.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -40,4 +70,4 @@ struct StatGroup {
StatType StringToStatType(const std::string &val);
const char *StatTypeToString(const StatType &val);
} // End of namespace stat
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/StatDrawHelper.cpp b/engines/crab/StatDrawHelper.cpp
index 6d1001ae09d..19e915731b6 100644
--- a/engines/crab/StatDrawHelper.cpp
+++ b/engines/crab/StatDrawHelper.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "StatDrawHelper.h"
@@ -48,4 +78,4 @@ void StatDrawHelper::Load(rapidxml::xml_node<char> *node) {
void StatDrawHelper::DrawInfo(const Person &obj) {
for (int i = 0; i < STAT_TOTAL; i++)
info[i].Draw(obj.stat.val[i].cur, obj.stat.val[i].max);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/StatDrawHelper.h b/engines/crab/StatDrawHelper.h
index 40c2407580b..24a96f81724 100644
--- a/engines/crab/StatDrawHelper.h
+++ b/engines/crab/StatDrawHelper.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -38,4 +68,4 @@ public:
const std::string &Name(const StatType &type) { return info[type].text; }
};
} // End of namespace stat
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/StatPreview.cpp b/engines/crab/StatPreview.cpp
index 4ca748e0539..e7fdabab63a 100644
--- a/engines/crab/StatPreview.cpp
+++ b/engines/crab/StatPreview.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "StatPreview.h"
@@ -30,4 +60,4 @@ void StatPreview::Draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
unit.Draw(gStrPool.Get(i->val), inc_u.x * count, inc_u.y * count);
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/StatPreview.h b/engines/crab/StatPreview.h
index 50ad235d425..5e0b56a37ce 100644
--- a/engines/crab/StatPreview.h
+++ b/engines/crab/StatPreview.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -21,4 +51,4 @@ struct StatPreview {
void Draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper);
};
} // End of namespace item
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/StatTemplate.cpp b/engines/crab/StatTemplate.cpp
index d773f0a9a75..319e8815afd 100644
--- a/engines/crab/StatTemplate.cpp
+++ b/engines/crab/StatTemplate.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "StatTemplate.h"
@@ -12,4 +42,4 @@ void StatTemplates::Load(const std::string &filename) {
for (auto n = node->first_node("stats"); n != NULL; n = n->next_sibling("stats"))
collection.push_back(n);
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/StatTemplate.h b/engines/crab/StatTemplate.h
index a538b9b6273..7b00e68509c 100644
--- a/engines/crab/StatTemplate.h
+++ b/engines/crab/StatTemplate.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -15,4 +45,4 @@ public:
void Load(const std::string &filename);
};
} // End of namespace stat
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/StateButton.cpp b/engines/crab/StateButton.cpp
index 8f7599aad33..8968993babb 100644
--- a/engines/crab/StateButton.cpp
+++ b/engines/crab/StateButton.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "StateButton.h"
#include "stdafx.h"
@@ -55,4 +85,4 @@ void StateButton::Img(const StateButtonImage &sbi) {
img = sbi.select;
img_set = sbi;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/StateButton.h b/engines/crab/StateButton.h
index 73198fc3b74..95732b56a5e 100644
--- a/engines/crab/StateButton.h
+++ b/engines/crab/StateButton.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "button.h"
@@ -53,4 +83,4 @@ public:
void Img(const StateButtonImage &sbi);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/TMXLayer.cpp b/engines/crab/TMXLayer.cpp
index 9da8b2a47be..8f0072dc8c4 100644
--- a/engines/crab/TMXLayer.cpp
+++ b/engines/crab/TMXLayer.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "TMXLayer.h"
@@ -72,4 +102,4 @@ bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
}
return false;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/TMXLayer.h b/engines/crab/TMXLayer.h
index f235bebce45..450352fbfd0 100644
--- a/engines/crab/TMXLayer.h
+++ b/engines/crab/TMXLayer.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Image.h"
@@ -72,4 +102,4 @@ public:
}
bool Load(const std::string &path, rapidxml::xml_node<char> *node);
};
-} // End of namespace TMX
\ No newline at end of file
+} // End of namespace TMX
diff --git a/engines/crab/TMXMap.cpp b/engines/crab/TMXMap.cpp
index c94b0ee2280..a143579c491 100644
--- a/engines/crab/TMXMap.cpp
+++ b/engines/crab/TMXMap.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "TMXMap.h"
#include "TextManager.h"
#include "collision.h"
@@ -373,4 +403,4 @@ bool TMXMap::CollideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &mus
//------------------------------------------------------------------------
// Purpose: Path finding functions
-//------------------------------------------------------------------------
\ No newline at end of file
+//------------------------------------------------------------------------
diff --git a/engines/crab/TMXMap.h b/engines/crab/TMXMap.h
index ead6394d0b8..0571135358c 100644
--- a/engines/crab/TMXMap.h
+++ b/engines/crab/TMXMap.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -96,4 +126,4 @@ public:
std::vector<Shape> AreaNoWalk() { return area_nowalk; }
std::vector<pyrodactyl::level::Stairs> AreaStairs() { return area_stairs; }
};
-} // End of namespace TMX
\ No newline at end of file
+} // End of namespace TMX
diff --git a/engines/crab/TMXTileSet.cpp b/engines/crab/TMXTileSet.cpp
index 1f78d167042..64f2b10987d 100644
--- a/engines/crab/TMXTileSet.cpp
+++ b/engines/crab/TMXTileSet.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "TMXTileSet.h"
#include "stdafx.h"
// #include "TextManager.h"
@@ -132,4 +162,4 @@ void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &til
v.y += tile_size.y;
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/TMXTileSet.h b/engines/crab/TMXTileSet.h
index 5807d490079..a8c0e6ce520 100644
--- a/engines/crab/TMXTileSet.h
+++ b/engines/crab/TMXTileSet.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Image.h"
@@ -64,4 +94,4 @@ public:
void Load(const std::string &path, rapidxml::xml_node<char> *node);
void Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
};
-}; // End of namespace TMX
\ No newline at end of file
+}; // End of namespace TMX
diff --git a/engines/crab/TextData.h b/engines/crab/TextData.h
index bd04af68740..7b5eb100a95 100644
--- a/engines/crab/TextData.h
+++ b/engines/crab/TextData.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "TextManager.h"
@@ -30,4 +60,4 @@ public:
void DrawColor(const std::string &val, const int &color, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/TextManager.cpp b/engines/crab/TextManager.cpp
index 1f2449f655c..ba580fb5580 100644
--- a/engines/crab/TextManager.cpp
+++ b/engines/crab/TextManager.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "TextManager.h"
#include "XMLDoc.h"
#include "stdafx.h"
@@ -192,4 +222,4 @@ void TextManager::Quit() {
i->empty = true;
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/TextManager.h b/engines/crab/TextManager.h
index 79c97a1cce3..c0e40783cdc 100644
--- a/engines/crab/TextManager.h
+++ b/engines/crab/TextManager.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameParam.h"
@@ -81,4 +111,4 @@ public:
extern TextManager gTextManager;
} // End of namespace text
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/TileInfo.h b/engines/crab/TileInfo.h
index 49b9d7141f0..f2c24f1844c 100644
--- a/engines/crab/TileInfo.h
+++ b/engines/crab/TileInfo.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -56,4 +86,4 @@ struct TileInfo {
gid &= ~(FlippedHorizontallyFlag | FlippedVerticallyFlag | FlippedAntiDiagonallyFlag);
}
};
-} // End of namespace TMX
\ No newline at end of file
+} // End of namespace TMX
diff --git a/engines/crab/ToggleButton.cpp b/engines/crab/ToggleButton.cpp
index 4674143cf8d..2d15bd0b26e 100644
--- a/engines/crab/ToggleButton.cpp
+++ b/engines/crab/ToggleButton.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "ToggleButton.h"
#include "stdafx.h"
@@ -29,4 +59,4 @@ ButtonAction ToggleButton::HandleEvents(const SDL_Event &Event, const int &XOffs
state = !state;
return action;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/ToggleButton.h b/engines/crab/ToggleButton.h
index b917c52f2b7..207c2696b81 100644
--- a/engines/crab/ToggleButton.h
+++ b/engines/crab/ToggleButton.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "button.h"
@@ -30,4 +60,4 @@ public:
ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/TraitButton.cpp b/engines/crab/TraitButton.cpp
index 1c7ff93d4fd..011b1e9bcdd 100644
--- a/engines/crab/TraitButton.cpp
+++ b/engines/crab/TraitButton.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "TraitButton.h"
#include "stdafx.h"
@@ -32,4 +62,4 @@ void TraitButton::Cache(const pyrodactyl::people::Trait &trait) {
void TraitButton::Empty() {
trait_img = 0;
caption.text = "";
-}
\ No newline at end of file
+}
diff --git a/engines/crab/TraitButton.h b/engines/crab/TraitButton.h
index 759c27f8037..ce02e1ef882 100644
--- a/engines/crab/TraitButton.h
+++ b/engines/crab/TraitButton.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "StateButton.h"
diff --git a/engines/crab/TraitMenu.cpp b/engines/crab/TraitMenu.cpp
index 82d56d9ebc3..7347b77e58c 100644
--- a/engines/crab/TraitMenu.cpp
+++ b/engines/crab/TraitMenu.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "TraitMenu.h"
#include "stdafx.h"
@@ -87,4 +117,4 @@ void TraitMenu::SetUI() {
ref.SetUI();
desc.SetUI();
menu.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/TraitMenu.h b/engines/crab/TraitMenu.h
index 1e5b3d461dd..1fe760136dd 100644
--- a/engines/crab/TraitMenu.h
+++ b/engines/crab/TraitMenu.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ParagraphData.h"
@@ -47,4 +77,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index 3ebc760c4ef..94b313d32b9 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "engines/crab/XMLDoc.h"
#include "engines/crab/common_header.h"
diff --git a/engines/crab/XMLDoc.h b/engines/crab/XMLDoc.h
index 110a453b630..d3d8198902a 100644
--- a/engines/crab/XMLDoc.h
+++ b/engines/crab/XMLDoc.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "engines/crab/common_header.h"
diff --git a/engines/crab/animation.cpp b/engines/crab/animation.cpp
index e6d1d8baa57..08963afd05f 100644
--- a/engines/crab/animation.cpp
+++ b/engines/crab/animation.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "animation.h"
#include "stdafx.h"
@@ -30,4 +60,4 @@ bool Animation::InternalEvents(DrawType &game_draw) {
void Animation::Reset() {
for (auto i = frame.begin(); i != frame.end(); ++i)
i->Reset();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/animation.h b/engines/crab/animation.h
index 3f218c5d7d5..8b6f7f2c398 100644
--- a/engines/crab/animation.h
+++ b/engines/crab/animation.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "AnimationEffect.h"
diff --git a/engines/crab/animframe.cpp b/engines/crab/animframe.cpp
index 4de304e9a97..ad1ffee2eaa 100644
--- a/engines/crab/animframe.cpp
+++ b/engines/crab/animframe.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "animframe.h"
#include "stdafx.h"
@@ -73,4 +103,4 @@ bool AnimationFrames::UpdateClip() {
const AnimFrame &AnimationFrames::CurrentFrame() {
return frame.at(current_clip);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/animframe.h b/engines/crab/animframe.h
index bac2953f14e..97d65e30878 100644
--- a/engines/crab/animframe.h
+++ b/engines/crab/animframe.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Rectangle.h"
@@ -70,4 +100,4 @@ public:
const AnimFrame &CurrentFrame();
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/animset.cpp b/engines/crab/animset.cpp
index c79de3e43e0..94ee16710c4 100644
--- a/engines/crab/animset.cpp
+++ b/engines/crab/animset.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "animset.h"
#include "stdafx.h"
@@ -52,4 +82,4 @@ const int AnimSet::AnchorY(const Direction &dir) {
return faf.anchor.y;
return walk.AnchorY(dir);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/animset.h b/engines/crab/animset.h
index 2512a98ca17..ff31b48c74d 100644
--- a/engines/crab/animset.h
+++ b/engines/crab/animset.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -35,4 +65,4 @@ struct AnimSet {
const int AnchorY(const Direction &dir);
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 906450e3c02..b2f1d008f99 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "app.h"
#include "stdafx.h"
@@ -257,4 +287,4 @@ App::~App() {
// Quit SDL
SDL_Quit();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/app.h b/engines/crab/app.h
index d0c5db552fb..fcc9e692a34 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -25,4 +55,4 @@ public:
bool Init();
void Run();
-};
\ No newline at end of file
+};
diff --git a/engines/crab/bonus.h b/engines/crab/bonus.h
index 1bba51d505a..153482deeb9 100644
--- a/engines/crab/bonus.h
+++ b/engines/crab/bonus.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -16,4 +46,4 @@ struct Bonus {
}
};
} // End of namespace stat
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/button.cpp b/engines/crab/button.cpp
index de2efc4cdd8..d1a58ef2a06 100644
--- a/engines/crab/button.cpp
+++ b/engines/crab/button.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: Contains the button functions
@@ -165,4 +195,4 @@ void Button::SetUI(Rect *parent) {
tooltip.SetUI(this);
caption.SetUI(this);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/button.h b/engines/crab/button.h
index 5c49d4b76e5..56b0c7e7ecd 100644
--- a/engines/crab/button.h
+++ b/engines/crab/button.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: Button class
@@ -91,4 +121,4 @@ public:
void HoverInfoOnlyDraw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/changeval.h b/engines/crab/changeval.h
index 03cab6d2b70..034bd9ab373 100644
--- a/engines/crab/changeval.h
+++ b/engines/crab/changeval.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -30,4 +60,4 @@ struct ChangeVal {
}
};
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/collision.cpp b/engines/crab/collision.cpp
index 48a54fced56..b2163bdc38e 100644
--- a/engines/crab/collision.cpp
+++ b/engines/crab/collision.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "collision.h"
#include "stdafx.h"
@@ -187,4 +217,4 @@ bool LineOfSight(const Rect &a, const Rect &b, const Rect &obstacle) {
// }
//
// return result;
-// }
\ No newline at end of file
+// }
diff --git a/engines/crab/collision.h b/engines/crab/collision.h
index 37fb5d95d94..78c3243bcc7 100644
--- a/engines/crab/collision.h
+++ b/engines/crab/collision.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "Polygon.h"
@@ -14,4 +44,4 @@ bool LineOfSight(const Rect &a, const Rect &b, const Rect &obstacle);
template<typename T>
double Distance2D(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y) {
return sqrt((p0_x - p1_x) * (p0_x - p1_x) + (p0_y - p1_y) * (p0_y - p1_y));
-}
\ No newline at end of file
+}
diff --git a/engines/crab/color.cpp b/engines/crab/color.cpp
index b88bbe7c668..c5eaab4da19 100644
--- a/engines/crab/color.cpp
+++ b/engines/crab/color.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "color.h"
#include "stdafx.h"
@@ -21,4 +51,4 @@ SDL_Color &ColorPool::Get(const int &num) {
return invalid;
return pool.at(num);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/color.h b/engines/crab/color.h
index b225ba228a5..96bb7e44052 100644
--- a/engines/crab/color.h
+++ b/engines/crab/color.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "XMLDoc.h"
@@ -25,4 +55,4 @@ public:
void Load(const std::string &filename);
};
} // End of namespace text
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index f5e95fbc459..d00f99dc478 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#if 0
diff --git a/engines/crab/console.cpp b/engines/crab/console.cpp
index 1f6f9175ad0..a1faf3da982 100644
--- a/engines/crab/console.cpp
+++ b/engines/crab/console.cpp
@@ -19,6 +19,36 @@
*
*/
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
#include "crab/console.h"
namespace Crab {
diff --git a/engines/crab/console.h b/engines/crab/console.h
index a2769b0b221..1371bdff91e 100644
--- a/engines/crab/console.h
+++ b/engines/crab/console.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
/* ScummVM - Graphic Adventure Engine
*
diff --git a/engines/crab/conversationdata.cpp b/engines/crab/conversationdata.cpp
index 2b178d58401..13e41d97b0e 100644
--- a/engines/crab/conversationdata.cpp
+++ b/engines/crab/conversationdata.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "conversationdata.h"
#include "stdafx.h"
@@ -19,4 +49,4 @@ void ReplyChoice::Load(rapidxml::xml_node<char> *node) {
void ConversationData::Load(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("reply"); n != NULL; n = n->next_sibling("reply"))
reply.push_back(n);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/conversationdata.h b/engines/crab/conversationdata.h
index a817e12cd6b..66cbec76c8c 100644
--- a/engines/crab/conversationdata.h
+++ b/engines/crab/conversationdata.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "changeval.h"
@@ -41,4 +71,4 @@ struct ConversationData {
void Load(rapidxml::xml_node<char> *node);
};
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index e9e69103e41..0d60e89106a 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -19,6 +19,36 @@
*
*/
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
#include "crab/crab.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index d7eeae09266..5ca8032f68d 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -19,6 +19,36 @@
*
*/
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
#ifndef CRAB_H
#define CRAB_H
diff --git a/engines/crab/cursor.cpp b/engines/crab/cursor.cpp
index ff227ad8936..f5b03c69fa4 100644
--- a/engines/crab/cursor.cpp
+++ b/engines/crab/cursor.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: Cursor class
@@ -84,4 +114,4 @@ void Cursor::Draw() {
else
img.Draw(motion.x, motion.y);
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/cursor.h b/engines/crab/cursor.h
index dfb65115148..0127aff2166 100644
--- a/engines/crab/cursor.h
+++ b/engines/crab/cursor.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: Cursor object
@@ -53,4 +83,4 @@ public:
extern Cursor gMouse;
} // End of namespace input
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
index 53ed7feaaed..a71eeb4bbc7 100644
--- a/engines/crab/detection.cpp
+++ b/engines/crab/detection.cpp
@@ -19,6 +19,36 @@
*
*/
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
#include "base/plugins.h"
#include "engines/advancedDetector.h"
diff --git a/engines/crab/detection.h b/engines/crab/detection.h
index ebaa6c9f17f..ec1894f1968 100644
--- a/engines/crab/detection.h
+++ b/engines/crab/detection.h
@@ -19,6 +19,36 @@
*
*/
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
#ifndef CRAB_DETECTION_H
#define CRAB_DETECTION_H
diff --git a/engines/crab/detection_tables.h b/engines/crab/detection_tables.h
index 27ff95ac140..7d33bbb7205 100644
--- a/engines/crab/detection_tables.h
+++ b/engines/crab/detection_tables.h
@@ -19,6 +19,36 @@
*
*/
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
namespace Crab {
const PlainGameDescriptor crabGames[] = {
diff --git a/engines/crab/dialogbox.cpp b/engines/crab/dialogbox.cpp
index 45feab4e739..177edd167a3 100644
--- a/engines/crab/dialogbox.cpp
+++ b/engines/crab/dialogbox.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: Dialog box!
@@ -57,4 +87,4 @@ void GameDialogBox::SetUI() {
pos.SetUI();
text.SetUI(&pos);
button.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/dialogbox.h b/engines/crab/dialogbox.h
index 18bf904f6f6..f7060238336 100644
--- a/engines/crab/dialogbox.h
+++ b/engines/crab/dialogbox.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: Dialog box!
@@ -44,4 +74,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/effect.cpp b/engines/crab/effect.cpp
index 7440edaad39..46547c6a0b0 100644
--- a/engines/crab/effect.cpp
+++ b/engines/crab/effect.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "effect.h"
#include "MusicManager.h"
#include "stdafx.h"
@@ -254,4 +284,4 @@ bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id
}
return false;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/effect.h b/engines/crab/effect.h
index 4ea7bc4a3b7..78aa308e2b0 100644
--- a/engines/crab/effect.h
+++ b/engines/crab/effect.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
@@ -80,4 +110,4 @@ struct Effect {
void ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType type);
};
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/element.cpp b/engines/crab/element.cpp
index d1402e45e45..0e1f56194c4 100644
--- a/engines/crab/element.cpp
+++ b/engines/crab/element.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "element.h"
#include "stdafx.h"
@@ -100,4 +130,4 @@ void Element::SetUI(Rect *parent) {
break;
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/element.h b/engines/crab/element.h
index 311879bd552..a89aca04b82 100644
--- a/engines/crab/element.h
+++ b/engines/crab/element.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
diff --git a/engines/crab/emotion.cpp b/engines/crab/emotion.cpp
index 91570c94d6e..32848b6d130 100644
--- a/engines/crab/emotion.cpp
+++ b/engines/crab/emotion.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "emotion.h"
#include "stdafx.h"
@@ -18,4 +48,4 @@ void EmotionIndicator::Draw(const int &select) {
void EmotionIndicator::SetUI() {
text.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/emotion.h b/engines/crab/emotion.h
index a2a8e09470d..1c335eb0ef9 100644
--- a/engines/crab/emotion.h
+++ b/engines/crab/emotion.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -21,4 +51,4 @@ struct EmotionIndicator {
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/eventstore.cpp b/engines/crab/eventstore.cpp
index 28c6f30ce25..ca3e61bce38 100644
--- a/engines/crab/eventstore.cpp
+++ b/engines/crab/eventstore.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "eventstore.h"
#include "stdafx.h"
@@ -70,4 +100,4 @@ void GameEventStore::SetAchievement(const int &id) {
m_pSteamUserStats->StoreStats();
}
*/
-}
\ No newline at end of file
+}
diff --git a/engines/crab/eventstore.h b/engines/crab/eventstore.h
index a4b36920c97..59f7f19aa5f 100644
--- a/engines/crab/eventstore.h
+++ b/engines/crab/eventstore.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "StateButton.h"
@@ -52,4 +82,4 @@ struct GameEventStore {
extern GameEventStore gEventStore;
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/fightanim.cpp b/engines/crab/fightanim.cpp
index b7e611da293..15900df6ab3 100644
--- a/engines/crab/fightanim.cpp
+++ b/engines/crab/fightanim.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "fightanim.h"
#include "stdafx.h"
@@ -50,4 +80,4 @@ void FightAnimFrames::Load(rapidxml::xml_node<char> *node) {
frame.push_back(faf);
}
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/fightanim.h b/engines/crab/fightanim.h
index ae1ee4d1b55..e465c3af887 100644
--- a/engines/crab/fightanim.h
+++ b/engines/crab/fightanim.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "MusicManager.h"
@@ -71,4 +101,4 @@ public:
void Load(rapidxml::xml_node<char> *node);
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/fightinput.cpp b/engines/crab/fightinput.cpp
index 5ac9da438ae..ce6120086ab 100644
--- a/engines/crab/fightinput.cpp
+++ b/engines/crab/fightinput.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "fightinput.h"
#include "stdafx.h"
@@ -15,4 +45,4 @@ FightAnimationType FightInput::HandleEvents(const SDL_Event &Event) {
return FA_BLOCK;
return FA_IDLE;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/fightinput.h b/engines/crab/fightinput.h
index 440707f7c24..f8bb3624952 100644
--- a/engines/crab/fightinput.h
+++ b/engines/crab/fightinput.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -44,4 +74,4 @@ struct FightInput {
FightAnimationType HandleEvents(const SDL_Event &Event);
};
} // End of namespace input
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/fightmove.cpp b/engines/crab/fightmove.cpp
index 60cdce1040d..a7fdb7a05b3 100644
--- a/engines/crab/fightmove.cpp
+++ b/engines/crab/fightmove.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "fightmove.h"
#include "stdafx.h"
@@ -20,4 +50,4 @@ void FightMove::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("ai", node, false))
ai.Load(node->first_node("ai"));
-}
\ No newline at end of file
+}
diff --git a/engines/crab/fightmove.h b/engines/crab/fightmove.h
index 6bd7f192fc4..82f123347e4 100644
--- a/engines/crab/fightmove.h
+++ b/engines/crab/fightmove.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -28,4 +58,4 @@ struct FightMove {
void Load(rapidxml::xml_node<char> *node);
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/fightmoves.cpp b/engines/crab/fightmoves.cpp
index 727e8a94c60..259f1ef3350 100644
--- a/engines/crab/fightmoves.cpp
+++ b/engines/crab/fightmoves.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "fightmoves.h"
#include "stdafx.h"
@@ -165,4 +195,4 @@ bool FightMoves::Flip(TextureFlipType &flip, Direction d) {
}
return false;
-}
\ No newline at end of file
+}
diff --git a/engines/crab/fightmoves.h b/engines/crab/fightmoves.h
index e85095257c1..da19f104fbb 100644
--- a/engines/crab/fightmoves.h
+++ b/engines/crab/fightmoves.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "MusicManager.h"
@@ -68,4 +98,4 @@ public:
void Evaluate(pyrodactyl::event::Info &info);
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index 4043d12ef8c..cb754a16a74 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "engines/crab/filesystem.h"
#include "common/file.h"
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index 2bc66ac7c96..fbb9dfd4aaa 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
diff --git a/engines/crab/fm_ai_data.h b/engines/crab/fm_ai_data.h
index ed3838e0296..304469e1849 100644
--- a/engines/crab/fm_ai_data.h
+++ b/engines/crab/fm_ai_data.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -43,4 +73,4 @@ struct FightMoveAIData {
}
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index d5617d58f4a..3303d606623 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "game.h"
#include "stdafx.h"
@@ -675,4 +705,4 @@ void Game::SetUI() {
gem.SetUI();
info.SetUI();
level.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 43a537ff534..fa64a13610a 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "DevConsole.h"
@@ -105,4 +135,4 @@ public:
void AutoSave() { CreateSaveGame(SAVEGAME_EXIT); }
void SetUI();
-};
\ No newline at end of file
+};
diff --git a/engines/crab/gameevent.cpp b/engines/crab/gameevent.cpp
index 691d3b1817e..85d06a7b2a5 100644
--- a/engines/crab/gameevent.cpp
+++ b/engines/crab/gameevent.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "gameevent.h"
#include "stdafx.h"
@@ -55,4 +85,4 @@ void GameEvent::Load(rapidxml::xml_node<char> *node) {
e.Load(it);
effect.push_back(e);
}
-}
\ No newline at end of file
+}
diff --git a/engines/crab/gameevent.h b/engines/crab/gameevent.h
index ef488518cb2..fdb03650cc2 100644
--- a/engines/crab/gameevent.h
+++ b/engines/crab/gameevent.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageManager.h"
@@ -58,4 +88,4 @@ struct GameEvent {
void Load(rapidxml::xml_node<char> *node);
};
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/gameeventmanager.cpp b/engines/crab/gameeventmanager.cpp
index 2257d95fac1..58537ca5187 100644
--- a/engines/crab/gameeventmanager.cpp
+++ b/engines/crab/gameeventmanager.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "gameeventmanager.h"
#include "stdafx.h"
@@ -319,4 +349,4 @@ void Manager::SetUI() {
reply.SetUI();
textin.SetUI();
per.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/gameeventmanager.h b/engines/crab/gameeventmanager.h
index 8c429bf9b6a..16c1b2fc624 100644
--- a/engines/crab/gameeventmanager.h
+++ b/engines/crab/gameeventmanager.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ChapterIntro.h"
@@ -76,4 +106,4 @@ public:
void SetUI();
};
} // End of namespace event
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index 315a984360b..a568531a960 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: The game state virtual class
@@ -18,4 +48,4 @@ public:
virtual void SetUI() = 0;
virtual void AutoSave() = 0;
virtual ~GameState(){};
-};
\ No newline at end of file
+};
diff --git a/engines/crab/gamestates.h b/engines/crab/gamestates.h
index c5a6d424cb7..037c3f68923 100644
--- a/engines/crab/gamestates.h
+++ b/engines/crab/gamestates.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -12,4 +42,4 @@ enum GameStateID {
GAMESTATE_NEW_GAME,
GAMESTATE_LOAD_GAME,
TOTAL_GAMESTATES // ALWAYS THE LAST VALUE
-};
\ No newline at end of file
+};
diff --git a/engines/crab/gametype.h b/engines/crab/gametype.h
index c1bbcb71348..8ba2842b2dc 100644
--- a/engines/crab/gametype.h
+++ b/engines/crab/gametype.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
namespace Crab {
diff --git a/engines/crab/hotkey.cpp b/engines/crab/hotkey.cpp
index 3cd7a9a0e66..47c1e96ce4a 100644
--- a/engines/crab/hotkey.cpp
+++ b/engines/crab/hotkey.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "hotkey.h"
#include "stdafx.h"
@@ -27,4 +57,4 @@ const char *HotKey::Name() {
return SDL_GetScancodeName(gInput.iv[input].key);
return "";
-}
\ No newline at end of file
+}
diff --git a/engines/crab/hotkey.h b/engines/crab/hotkey.h
index 2737c0e0cbc..2d795a5300b 100644
--- a/engines/crab/hotkey.h
+++ b/engines/crab/hotkey.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -26,4 +56,4 @@ public:
bool HandleEvents(const SDL_Event &Event);
};
} // End of namespace input
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/hud.cpp b/engines/crab/hud.cpp
index f2bd88908d5..110b76c3a1c 100644
--- a/engines/crab/hud.cpp
+++ b/engines/crab/hud.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: The tray where you have inventory, map and GameObjectives icons
@@ -127,4 +157,4 @@ void HUD::SetUI() {
gom.SetUI();
pause.SetUI();
back.SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/hud.h b/engines/crab/hud.h
index 95d6250a953..59078b1d998 100644
--- a/engines/crab/hud.h
+++ b/engines/crab/hud.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
//=============================================================================
// Author: Arvind
// Purpose: The tray where you have inventory, map and journal icons
@@ -77,4 +107,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/imageeffect.cpp b/engines/crab/imageeffect.cpp
index 61cc7b9d558..40e54d48884 100644
--- a/engines/crab/imageeffect.cpp
+++ b/engines/crab/imageeffect.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "stdafx.h"
#include "imageeffect.h"
@@ -14,4 +44,4 @@ void ImageEffect::Load(rapidxml::xml_node<char> *node) {
void ImageEffect::Draw(const int &XOffset, const int &YOffset) {
if (visible)
pyrodactyl::image::gImageManager.Draw(x + XOffset, y + YOffset, img);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/imageeffect.h b/engines/crab/imageeffect.h
index 6a1a691ebda..a0d67b81ea6 100644
--- a/engines/crab/imageeffect.h
+++ b/engines/crab/imageeffect.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -18,4 +48,4 @@ struct ImageEffect : public Vector2i {
void Draw(const int &XOffset, const int &YOffset);
};
} // End of namespace anim
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/input.cpp b/engines/crab/input.cpp
index bcfb3a9de18..845b0d60709 100644
--- a/engines/crab/input.cpp
+++ b/engines/crab/input.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "input.h"
#include "stdafx.h"
@@ -179,4 +209,4 @@ void InputManager::Save() {
doc.clear();
CreateBackup();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/input.h b/engines/crab/input.h
index 626b13ed974..537f635e9cd 100644
--- a/engines/crab/input.h
+++ b/engines/crab/input.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "common_header.h"
@@ -106,4 +136,4 @@ public:
// The saved key values
extern InputManager gInput;
} // End of namespace input
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/inputval.cpp b/engines/crab/inputval.cpp
index 4802e8c17f2..30537789d1f 100644
--- a/engines/crab/inputval.cpp
+++ b/engines/crab/inputval.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "inputval.h"
#include "stdafx.h"
@@ -70,4 +100,4 @@ const bool InputVal::Equals(const SDL_ControllerButtonEvent &Event) {
//------------------------------------------------------------------------
const bool InputVal::Equals(const SDL_KeyboardEvent &Event) {
return (key == Event.keysym.scancode || alt == Event.keysym.scancode);
-}
\ No newline at end of file
+}
diff --git a/engines/crab/inputval.h b/engines/crab/inputval.h
index d5fbd234d25..e0e33bb7a1c 100644
--- a/engines/crab/inputval.h
+++ b/engines/crab/inputval.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameParam.h"
@@ -70,4 +100,4 @@ public:
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title);
};
} // End of namespace input
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/journal.cpp b/engines/crab/journal.cpp
index 6f6ba57aee4..a5a82c7cede 100644
--- a/engines/crab/journal.cpp
+++ b/engines/crab/journal.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "journal.h"
#include "stdafx.h"
@@ -251,4 +281,4 @@ void Journal::SetUI() {
for (auto &m : journal)
for (auto i = 0; i < JE_TOTAL; ++i)
m.menu[i].SetUI();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/journal.h b/engines/crab/journal.h
index 0bdc0935239..818e9db0307 100644
--- a/engines/crab/journal.h
+++ b/engines/crab/journal.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "ImageData.h"
@@ -83,4 +113,4 @@ public:
void SetUI();
};
} // End of namespace ui
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/level.cpp b/engines/crab/level.cpp
index e89b7d75977..009e3aac280 100644
--- a/engines/crab/level.cpp
+++ b/engines/crab/level.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#include "level.h"
#include "stdafx.h"
@@ -108,4 +138,4 @@ void Level::SetUI() {
camera.w = gScreenSettings.cur.w;
camera.h = gScreenSettings.cur.h;
SetCamera();
-}
\ No newline at end of file
+}
diff --git a/engines/crab/level.h b/engines/crab/level.h
index cea06fd46f8..363cd802e66 100644
--- a/engines/crab/level.h
+++ b/engines/crab/level.h
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+/*
+ * This code is based on the CRAB engine
+ *
+ * Copyright (c) Arvind Raja Yadav
+ *
+ * Licensed under MIT
+ *
+ */
+
#pragma once
#include "GameEventInfo.h"
@@ -162,4 +192,4 @@ public:
void SetUI();
};
} // End of namespace level
-} // End of namespace pyrodactyl
\ No newline at end of file
+} // End of namespace pyrodactyl
diff --git a/engines/crab/level_ai.cpp b/engines/crab/level_ai.cpp
index 462cf1b4674..85ab9861467 100644
--- a/engines/crab/level_ai.cpp
+++ b/engines/crab/level_ai.cpp
@@ -1,3 +1,33 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
Commit: a73534cc3b7d5ce88d6344f51d5336ffe8b460c0
https://github.com/scummvm/scummvm/commit/a73534cc3b7d5ce88d6344f51d5336ffe8b460c0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace #pragma once with include guards
Changed paths:
engines/crab/AlphaImage.h
engines/crab/AnimationEffect.h
engines/crab/AnimationFrame.h
engines/crab/Caption.h
engines/crab/ChapterIntro.h
engines/crab/ClipButton.h
engines/crab/CreditScreen.h
engines/crab/DevConsole.h
engines/crab/EventSeqGroup.h
engines/crab/EventSequence.h
engines/crab/FileData.h
engines/crab/FileMenu.h
engines/crab/GameClock.h
engines/crab/GameEventInfo.h
engines/crab/GameOverMenu.h
engines/crab/GameParam.h
engines/crab/GeneralSettingMenu.h
engines/crab/GfxSettingMenu.h
engines/crab/HealthIndicator.h
engines/crab/HoverInfo.h
engines/crab/Image.h
engines/crab/ImageData.h
engines/crab/ImageManager.h
engines/crab/Inventory.h
engines/crab/Item.h
engines/crab/ItemCollection.h
engines/crab/ItemDesc.h
engines/crab/ItemMenu.h
engines/crab/ItemSlot.h
engines/crab/KeyBindMenu.h
engines/crab/LevelExit.h
engines/crab/LevelResult.h
engines/crab/Line.h
engines/crab/LoadingScreen.h
engines/crab/MapData.h
engines/crab/MapMarkerMenu.h
engines/crab/ModMenu.h
engines/crab/MusicArea.h
engines/crab/MusicManager.h
engines/crab/OptionMenu.h
engines/crab/OptionSelect.h
engines/crab/PageMenu.h
engines/crab/ParagraphData.h
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGraphNode.h
engines/crab/PathfindingGrid.h
engines/crab/PauseMenu.h
engines/crab/PersonHandler.h
engines/crab/PersonScreen.h
engines/crab/Polygon.h
engines/crab/PopUp.h
engines/crab/PriorityQueue.h
engines/crab/ProgressBar.h
engines/crab/QuestText.h
engines/crab/RadioButton.h
engines/crab/RadioButtonMenu.h
engines/crab/Rectangle.h
engines/crab/ReplyButton.h
engines/crab/ReplyMenu.h
engines/crab/ResolutionMenu.h
engines/crab/SaveGameMenu.h
engines/crab/ScreenSettings.h
engines/crab/SectionHeader.h
engines/crab/Shape.h
engines/crab/SlideShow.h
engines/crab/SpriteConstant.h
engines/crab/Stairs.h
engines/crab/Stat.h
engines/crab/StatDrawHelper.h
engines/crab/StatPreview.h
engines/crab/StatTemplate.h
engines/crab/StateButton.h
engines/crab/TMXLayer.h
engines/crab/TMXMap.h
engines/crab/TMXTileSet.h
engines/crab/TextData.h
engines/crab/TextManager.h
engines/crab/TileInfo.h
engines/crab/ToggleButton.h
engines/crab/TraitButton.h
engines/crab/TraitMenu.h
engines/crab/XMLDoc.h
engines/crab/animation.h
engines/crab/animframe.h
engines/crab/animset.h
engines/crab/app.h
engines/crab/bonus.h
engines/crab/button.h
engines/crab/changeval.h
engines/crab/collision.h
engines/crab/color.h
engines/crab/common_header.h
engines/crab/conversationdata.h
engines/crab/cursor.h
engines/crab/dialogbox.h
engines/crab/effect.h
engines/crab/element.h
engines/crab/emotion.h
engines/crab/eventstore.h
engines/crab/fightanim.h
engines/crab/fightinput.h
engines/crab/fightmove.h
engines/crab/fightmoves.h
engines/crab/filesystem.h
engines/crab/fm_ai_data.h
engines/crab/game.h
engines/crab/gameevent.h
engines/crab/gameeventmanager.h
engines/crab/gamestate_container.h
engines/crab/gamestates.h
engines/crab/gametype.h
engines/crab/hotkey.h
engines/crab/hud.h
engines/crab/imageeffect.h
engines/crab/input.h
engines/crab/inputval.h
engines/crab/journal.h
engines/crab/level.h
engines/crab/level_objects.h
engines/crab/loaders.h
engines/crab/mainmenu.h
engines/crab/map.h
engines/crab/mapbutton.h
engines/crab/menu.h
engines/crab/moveeffect.h
engines/crab/movement.h
engines/crab/musicparam.h
engines/crab/numstr.h
engines/crab/opinion.h
engines/crab/person.h
engines/crab/personbase.h
engines/crab/quest.h
engines/crab/questmenu.h
engines/crab/range.h
engines/crab/shadow.h
engines/crab/slider.h
engines/crab/splash.h
engines/crab/sprite.h
engines/crab/spriteai.h
engines/crab/stdafx.h
engines/crab/talknotify.h
engines/crab/textarea.h
engines/crab/timer.h
engines/crab/trait.h
engines/crab/trigger.h
engines/crab/triggerset.h
engines/crab/url.h
engines/crab/vectors.h
engines/crab/walkframes.h
diff --git a/engines/crab/AlphaImage.h b/engines/crab/AlphaImage.h
index 903672fb693..e5ae1a4ebf6 100644
--- a/engines/crab/AlphaImage.h
+++ b/engines/crab/AlphaImage.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ALPHAIMAGE_H
+#define CRAB_ALPHAIMAGE_H
#include "ImageManager.h"
#include "common_header.h"
@@ -80,3 +81,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_ALPHAIMAGE_H
diff --git a/engines/crab/AnimationEffect.h b/engines/crab/AnimationEffect.h
index 76034f7517c..a78105ffb5f 100644
--- a/engines/crab/AnimationEffect.h
+++ b/engines/crab/AnimationEffect.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ANIMATIONEFFECT_H
+#define CRAB_ANIMATIONEFFECT_H
#include "common_header.h"
#include "loaders.h"
@@ -90,3 +91,5 @@ struct AnimationEffect {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_ANIMATIONEFFECT_H
diff --git a/engines/crab/AnimationFrame.h b/engines/crab/AnimationFrame.h
index 68b50dd5a1c..ceb7b8708bc 100644
--- a/engines/crab/AnimationFrame.h
+++ b/engines/crab/AnimationFrame.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ANIMATIONFRAME_H
+#define CRAB_ANIMATIONFRAME_H
#include "AnimationEffect.h"
#include "HoverInfo.h"
@@ -71,3 +72,5 @@ struct AnimationFrame : public Vector2i {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_ANIMATIONFRAME_H
diff --git a/engines/crab/Caption.h b/engines/crab/Caption.h
index 4966da2b093..617452070a4 100644
--- a/engines/crab/Caption.h
+++ b/engines/crab/Caption.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_CAPTION_H
+#define CRAB_CAPTION_H
#include "common_header.h"
#include "TextData.h"
@@ -56,3 +57,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_CAPTION_H
diff --git a/engines/crab/ChapterIntro.h b/engines/crab/ChapterIntro.h
index fb447baef48..52879d274be 100644
--- a/engines/crab/ChapterIntro.h
+++ b/engines/crab/ChapterIntro.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_CHAPTERINTRO_H
+#define CRAB_CHAPTERINTRO_H
#include "GameEventInfo.h"
#include "button.h"
@@ -60,3 +61,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_CHAPTERINTRO_H
diff --git a/engines/crab/ClipButton.h b/engines/crab/ClipButton.h
index 04f05dbdd8c..0933ea3cc09 100644
--- a/engines/crab/ClipButton.h
+++ b/engines/crab/ClipButton.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_CLIPBUTTON_H
+#define CRAB_CLIPBUTTON_H
#include "button.h"
#include "common_header.h"
@@ -48,3 +49,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_CLIPBUTTON_H
diff --git a/engines/crab/CreditScreen.h b/engines/crab/CreditScreen.h
index 7cb1e24ac2d..25729717c5e 100644
--- a/engines/crab/CreditScreen.h
+++ b/engines/crab/CreditScreen.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_CREDITSCREEN_H
+#define CRAB_CREDITSCREEN_H
#include "ImageData.h"
#include "TextData.h"
@@ -118,3 +119,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_CREDITSCREEN_H
diff --git a/engines/crab/DevConsole.h b/engines/crab/DevConsole.h
index 5dd7e56d0a5..e2635dde6e6 100644
--- a/engines/crab/DevConsole.h
+++ b/engines/crab/DevConsole.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_DEVCONSOLE_H
+#define CRAB_DEVCONSOLE_H
#include "GameEventInfo.h"
#include "common_header.h"
@@ -68,3 +69,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_DEVCONSOLE_H
diff --git a/engines/crab/EventSeqGroup.h b/engines/crab/EventSeqGroup.h
index 1d1b7ad2715..0d4d4fc4420 100644
--- a/engines/crab/EventSeqGroup.h
+++ b/engines/crab/EventSeqGroup.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_EVENTSEQGROUP_H
+#define CRAB_EVENTSEQGROUP_H
#include "common_header.h"
#include "EventSequence.h"
@@ -64,3 +65,5 @@ public:
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_EVENTSEQGROUP_H
diff --git a/engines/crab/EventSequence.h b/engines/crab/EventSequence.h
index de38f4bca9d..4542bd3a1c3 100644
--- a/engines/crab/EventSequence.h
+++ b/engines/crab/EventSequence.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_EVENTSEQUENCE_H
+#define CRAB_EVENTSEQUENCE_H
#include "common_header.h"
#include "GameEventInfo.h"
@@ -77,3 +78,5 @@ public:
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_EVENTSEQUENCE_H
diff --git a/engines/crab/FileData.h b/engines/crab/FileData.h
index 1fbc1d5014b..d0c01932b68 100644
--- a/engines/crab/FileData.h
+++ b/engines/crab/FileData.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_FILEDATA_H
+#define CRAB_FILEDATA_H
#include "XMLDoc.h"
#include "common_header.h"
@@ -76,3 +77,5 @@ enum { DATA_AUTHOR,
const int DATA_HOVER_TOTAL = 4;
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_FILEDATA_H
diff --git a/engines/crab/FileMenu.h b/engines/crab/FileMenu.h
index eac11a593a9..ac283f6b303 100644
--- a/engines/crab/FileMenu.h
+++ b/engines/crab/FileMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_FILEMENU_H
+#define CRAB_FILEMENU_H
#include "FileData.h"
#include "ImageData.h"
@@ -252,3 +253,5 @@ public:
extern FileMenu<SaveFileData> gLoadMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_FILEMENU_H
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 775999808f2..77fc9e68d47 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAMECLOCK_H
+#define CRAB_GAMECLOCK_H
#include "common_header.h"
#include "timer.h"
@@ -81,3 +82,5 @@ public:
return NumberToString(hours) + seperator + NumberToString(minutes) + seperator + NumberToString(seconds);
}
};
+
+#endif // CRAB_GAMECLOCK_H
diff --git a/engines/crab/GameEventInfo.h b/engines/crab/GameEventInfo.h
index cdaaff4a6f8..fbac425f8ba 100644
--- a/engines/crab/GameEventInfo.h
+++ b/engines/crab/GameEventInfo.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAMEEVENTINFO_H
+#define CRAB_GAMEEVENTINFO_H
#include "Inventory.h"
#include "StatTemplate.h"
@@ -203,3 +204,5 @@ public:
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_GAMEEVENTINFO_H
diff --git a/engines/crab/GameOverMenu.h b/engines/crab/GameOverMenu.h
index a0aba35d7d6..b9c4c4950ca 100644
--- a/engines/crab/GameOverMenu.h
+++ b/engines/crab/GameOverMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAMEOVERMENU_H
+#define CRAB_GAMEOVERMENU_H
#include "ImageData.h"
#include "TextData.h"
@@ -67,3 +68,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_GAMEOVERMENU_H
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 1614bc29a2d..abecf18aa75 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAMEPARAM_H
+#define CRAB_GAMEPARAM_H
#include "XMLDoc.h"
#include "common_header.h"
@@ -184,3 +185,5 @@ extern StringPool gStrPool;
// Generate random numbers using this
extern RandomNumberGen gRandom;
+
+#endif // CRAB_GAMEPARAM_H
diff --git a/engines/crab/GeneralSettingMenu.h b/engines/crab/GeneralSettingMenu.h
index 6165e72afa7..7e4ae1c29df 100644
--- a/engines/crab/GeneralSettingMenu.h
+++ b/engines/crab/GeneralSettingMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GENERALSETTINGMENU_H
+#define CRAB_GENERALSETTINGMENU_H
#include "RadioButtonMenu.h"
#include "ToggleButton.h"
@@ -68,3 +69,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_GENERALSETTINGMENU_H
diff --git a/engines/crab/GfxSettingMenu.h b/engines/crab/GfxSettingMenu.h
index e5dc050f537..79a4eb5b48f 100644
--- a/engines/crab/GfxSettingMenu.h
+++ b/engines/crab/GfxSettingMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GFXSETTINGMENU_H
+#define CRAB_GFXSETTINGMENU_H
#include "ImageData.h"
#include "ResolutionMenu.h"
@@ -67,3 +68,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_GFXSETTINGMENU_H
diff --git a/engines/crab/HealthIndicator.h b/engines/crab/HealthIndicator.h
index 1128f6a864a..a13fe12a71f 100644
--- a/engines/crab/HealthIndicator.h
+++ b/engines/crab/HealthIndicator.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_HEALTHINDICATOR_H
+#define CRAB_HEALTHINDICATOR_H
#include "common_header.h"
#include "ImageManager.h"
@@ -62,3 +63,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_HEALTHINDICATOR_H
diff --git a/engines/crab/HoverInfo.h b/engines/crab/HoverInfo.h
index 5d8464e09a3..538d7deccbd 100644
--- a/engines/crab/HoverInfo.h
+++ b/engines/crab/HoverInfo.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_HOVERINFO_H
+#define CRAB_HOVERINFO_H
#include "common_header.h"
#include "TextData.h"
@@ -51,3 +52,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_HOVERINFO_H
diff --git a/engines/crab/Image.h b/engines/crab/Image.h
index 57099e087ad..e1387b89ee3 100644
--- a/engines/crab/Image.h
+++ b/engines/crab/Image.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_IMAGE_H
+#define CRAB_IMAGE_H
#include "ScreenSettings.h"
#include "common_header.h"
@@ -80,3 +81,5 @@ public:
};
} // End of namespace image
} // End of namespace pyrodactyl
+
+#endif // CRAB_IMAGE_H
diff --git a/engines/crab/ImageData.h b/engines/crab/ImageData.h
index 1e2d7e2dfeb..ff6911f06b3 100644
--- a/engines/crab/ImageData.h
+++ b/engines/crab/ImageData.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_IMAGEDATA_H
+#define CRAB_IMAGEDATA_H
#include "ImageManager.h"
#include "common_header.h"
@@ -58,3 +59,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_IMAGEDATA_H
diff --git a/engines/crab/ImageManager.h b/engines/crab/ImageManager.h
index 49499de6e1a..c8433404890 100644
--- a/engines/crab/ImageManager.h
+++ b/engines/crab/ImageManager.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: Contains the image manager class - used to manage in-game assets
//=============================================================================
-#pragma once
+#ifndef CRAB_IMAGEMANAGER_H
+#define CRAB_IMAGEMANAGER_H
#include "GameParam.h"
#include "Image.h"
@@ -108,3 +109,5 @@ public:
extern ImageManager gImageManager;
} // End of namespace image
} // End of namespace pyrodactyl
+
+#endif // CRAB_IMAGEMANAGER_H
diff --git a/engines/crab/Inventory.h b/engines/crab/Inventory.h
index a80f9ca12b2..c5320e46be4 100644
--- a/engines/crab/Inventory.h
+++ b/engines/crab/Inventory.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_INVENTORY_H
+#define CRAB_INVENTORY_H
#include "ImageData.h"
#include "ItemCollection.h"
@@ -79,3 +80,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_INVENTORY_H
diff --git a/engines/crab/Item.h b/engines/crab/Item.h
index 7363ba4b33c..abcfdaed1b5 100644
--- a/engines/crab/Item.h
+++ b/engines/crab/Item.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ITEM_H
+#define CRAB_ITEM_H
#include "ImageManager.h"
#include "bonus.h"
@@ -66,3 +67,5 @@ struct Item {
};
} // End of namespace item
} // End of namespace pyrodactyl
+
+#endif // CRAB_ITEM_H
diff --git a/engines/crab/ItemCollection.h b/engines/crab/ItemCollection.h
index 24cbd63d4e3..da90241a63c 100644
--- a/engines/crab/ItemCollection.h
+++ b/engines/crab/ItemCollection.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ITEMCOLLECTION_H
+#define CRAB_ITEMCOLLECTION_H
#include "ItemMenu.h"
#include "StatDrawHelper.h"
@@ -88,3 +89,5 @@ public:
};
} // End of namespace item
} // End of namespace pyrodactyl
+
+#endif // CRAB_ITEMCOLLECTION_H
diff --git a/engines/crab/ItemDesc.h b/engines/crab/ItemDesc.h
index c97ac08f50a..4fe9dc8d3bb 100644
--- a/engines/crab/ItemDesc.h
+++ b/engines/crab/ItemDesc.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ITEMDESC_H
+#define CRAB_ITEMDESC_H
#include "Item.h"
#include "ParagraphData.h"
@@ -67,3 +68,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_ITEMDESC_H
diff --git a/engines/crab/ItemMenu.h b/engines/crab/ItemMenu.h
index 57b9d8efc4a..13a50a6fd26 100644
--- a/engines/crab/ItemMenu.h
+++ b/engines/crab/ItemMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ITEMMENU_H
+#define CRAB_ITEMMENU_H
#include "ItemDesc.h"
#include "ItemSlot.h"
@@ -83,3 +84,5 @@ public:
};
} // End of namespace item
} // End of namespace pyrodactyl
+
+#endif // CRAB_ITEMMENU_H
diff --git a/engines/crab/ItemSlot.h b/engines/crab/ItemSlot.h
index b6b488b414e..8f42ab95aea 100644
--- a/engines/crab/ItemSlot.h
+++ b/engines/crab/ItemSlot.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ITEMSLOT_H
+#define CRAB_ITEMSLOT_H
#include "ImageManager.h"
#include "Item.h"
@@ -89,3 +90,5 @@ public:
};
} // End of namespace item
} // End of namespace pyrodactyl
+
+#endif // CRAB_ITEMSLOT_H
diff --git a/engines/crab/KeyBindMenu.h b/engines/crab/KeyBindMenu.h
index ade7d14b4ba..279b0b16ded 100644
--- a/engines/crab/KeyBindMenu.h
+++ b/engines/crab/KeyBindMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_KEYBINDMENU_H
+#define CRAB_KEYBINDMENU_H
#include "ImageData.h"
#include "OptionSelect.h"
@@ -117,3 +118,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_KEYBINDMENU_H
diff --git a/engines/crab/LevelExit.h b/engines/crab/LevelExit.h
index 570aa5d13ff..cf38b95bccb 100644
--- a/engines/crab/LevelExit.h
+++ b/engines/crab/LevelExit.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_LEVELEXIT_H
+#define CRAB_LEVELEXIT_H
#include "GameEventInfo.h"
#include "ImageManager.h"
@@ -49,3 +50,5 @@ struct Exit {
};
} // End of namespace level
} // End of namespace pyrodactyl
+
+#endif // CRAB_LEVELEXIT_H
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index 13c917a1818..f3bd8fd3bac 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_LEVELRESULT_H
+#define CRAB_LEVELRESULT_H
#include "common_header.h"
#include "ImageManager.h"
@@ -48,3 +49,5 @@ struct LevelResult {
y = -1;
}
};
+
+#endif // CRAB_LEVELRESULT_H
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index 1e33d926b38..59c6b89ab60 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_LINE_H
+#define CRAB_LINE_H
#include "ScreenSettings.h"
#include "common_header.h"
@@ -69,3 +70,5 @@ bool CollideLine(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y,
// Draw a line OpenGL style
void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a);
+
+#endif // CRAB_LINE_H
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 068f05228c8..a6a6a43f685 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_LOADINGSCREEN_H
+#define CRAB_LOADINGSCREEN_H
#include "Image.h"
#include "common_header.h"
@@ -67,3 +68,5 @@ public:
};
extern LoadingScreen gLoadScreen;
+
+#endif // CRAB_LOADINGSCREEN_H
diff --git a/engines/crab/MapData.h b/engines/crab/MapData.h
index 6ae99e78e96..4c421e12d1f 100644
--- a/engines/crab/MapData.h
+++ b/engines/crab/MapData.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MAPDATA_H
+#define CRAB_MAPDATA_H
#include "Rectangle.h"
#include "common_header.h"
@@ -65,3 +66,5 @@ struct MapData {
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_MAPDATA_H
diff --git a/engines/crab/MapMarkerMenu.h b/engines/crab/MapMarkerMenu.h
index b471cdd64c0..372446a1e99 100644
--- a/engines/crab/MapMarkerMenu.h
+++ b/engines/crab/MapMarkerMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MAPMARKERMENU_H
+#define CRAB_MAPMARKERMENU_H
#include "StateButton.h"
#include "common_header.h"
@@ -90,3 +91,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_MAPMARKERMENU_H
diff --git a/engines/crab/ModMenu.h b/engines/crab/ModMenu.h
index edc9dd4f03d..8d20e0c478b 100644
--- a/engines/crab/ModMenu.h
+++ b/engines/crab/ModMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MODMENU_H
+#define CRAB_MODMENU_H
#include "FileMenu.h"
#include "common_header.h"
@@ -46,3 +47,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_MODMENU_H
diff --git a/engines/crab/MusicArea.h b/engines/crab/MusicArea.h
index c81bd44c8bc..546f2bdd07e 100644
--- a/engines/crab/MusicArea.h
+++ b/engines/crab/MusicArea.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MUSICAREA_H
+#define CRAB_MUSICAREA_H
#include "Shape.h"
#include "common_header.h"
@@ -63,3 +64,5 @@ public:
};
} // End of namespace level
} // End of namespace pyrodactyl
+
+#endif // CRAB_MUSICAREA_H
diff --git a/engines/crab/MusicManager.h b/engines/crab/MusicManager.h
index fd03dba69c2..3248a389f1d 100644
--- a/engines/crab/MusicManager.h
+++ b/engines/crab/MusicManager.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MUSICMANAGER_H
+#define CRAB_MUSICMANAGER_H
#include "GameParam.h"
#include "common_header.h"
@@ -89,3 +90,5 @@ public:
extern MusicManager gMusicManager;
} // End of namespace music
} // End of namespace pyrodactyl
+
+#endif // CRAB_MUSICMANAGER_H
diff --git a/engines/crab/OptionMenu.h b/engines/crab/OptionMenu.h
index 9f9d19e42d4..981ce920709 100644
--- a/engines/crab/OptionMenu.h
+++ b/engines/crab/OptionMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_OPTIONMENU_H
+#define CRAB_OPTIONMENU_H
#include "GeneralSettingMenu.h"
#include "GfxSettingMenu.h"
@@ -110,3 +111,5 @@ public:
extern OptionMenu gOptionMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_OPTIONMENU_H
diff --git a/engines/crab/OptionSelect.h b/engines/crab/OptionSelect.h
index a048a442bfc..cd9a0abff53 100644
--- a/engines/crab/OptionSelect.h
+++ b/engines/crab/OptionSelect.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_OPTIONSELECT_H
+#define CRAB_OPTIONSELECT_H
#include "common_header.h"
#include "TextData.h"
@@ -67,3 +68,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_OPTIONSELECT_H
diff --git a/engines/crab/PageMenu.h b/engines/crab/PageMenu.h
index 9e58c89d6cc..98ae1cc9254 100644
--- a/engines/crab/PageMenu.h
+++ b/engines/crab/PageMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PAGEMENU_H
+#define CRAB_PAGEMENU_H
#include "common_header.h"
#include "menu.h"
@@ -230,3 +231,5 @@ public:
typedef PageMenu<Button> PageButtonMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_PAGEMENU_H
diff --git a/engines/crab/ParagraphData.h b/engines/crab/ParagraphData.h
index 7bcd987f04c..491865b8af0 100644
--- a/engines/crab/ParagraphData.h
+++ b/engines/crab/ParagraphData.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PARAGRAPHDATA_H
+#define CRAB_PARAGRAPHDATA_H
#include "TextData.h"
#include "common_header.h"
@@ -48,3 +49,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_PARAGRAPHDATA_H
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index ee5fe162b8b..e7889da68b4 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PATHFINDINGAGENT_H
+#define CRAB_PATHFINDINGAGENT_H
#include "PathfindingGrid.h"
#include "PriorityQueue.h"
@@ -161,3 +162,5 @@ public:
};
bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB);
+
+#endif // CRAB_PATHFINDINGAGENT_H
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
index 4cef8b6c425..f96219d2786 100644
--- a/engines/crab/PathfindingGraphNode.h
+++ b/engines/crab/PathfindingGraphNode.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PATHFINDINGGRAPHNODE_H
+#define CRAB_PATHFINDINGGRAPHNODE_H
#include "Rectangle.h"
#include "vectors.h"
@@ -76,3 +77,5 @@ public:
// Return true if the node is adjacent to the otherNode
bool AdjacentToNode(PathfindingGraphNode *otherNode);
};
+
+#endif // CRAB_PATHFINDINGGRAPHNODE_H
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index da24f587d47..04ffcaaaedd 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PATHFINDINGGRID_H
+#define CRAB_PATHFINDINGGRID_H
#include "PathfindingGraphNode.h"
#include "common_header.h"
@@ -84,3 +85,5 @@ public:
// Can be used to find corners that shouldn't be cut.
std::vector<PathfindingGraphNode *> CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2);
};
+
+#endif // CRAB_PATHFINDINGGRID_H
diff --git a/engines/crab/PauseMenu.h b/engines/crab/PauseMenu.h
index 646d5f72a8a..47926e950bf 100644
--- a/engines/crab/PauseMenu.h
+++ b/engines/crab/PauseMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PAUSEMENU_H
+#define CRAB_PAUSEMENU_H
#include "FileMenu.h"
#include "GameEventInfo.h"
@@ -99,3 +100,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_PAUSEMENU_H
diff --git a/engines/crab/PersonHandler.h b/engines/crab/PersonHandler.h
index 1409ad66620..41c0f2200ac 100644
--- a/engines/crab/PersonHandler.h
+++ b/engines/crab/PersonHandler.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PERSONHANDLER_H
+#define CRAB_PERSONHANDLER_H
#include "GameEventInfo.h"
#include "ProgressBar.h"
@@ -104,3 +105,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_PERSONHANDLER_H
diff --git a/engines/crab/PersonScreen.h b/engines/crab/PersonScreen.h
index a0e5f252ed8..2e21c76147d 100644
--- a/engines/crab/PersonScreen.h
+++ b/engines/crab/PersonScreen.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PERSONSCREEN_H
+#define CRAB_PERSONSCREEN_H
#include "GameEventInfo.h"
#include "ImageData.h"
@@ -72,3 +73,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_PERSONSCREEN_H
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index d29eba2549b..44f6fbb1a19 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_POLYGON_H
+#define CRAB_POLYGON_H
#include "Rectangle.h"
#include "common_header.h"
@@ -89,3 +90,5 @@ public:
void Draw(const int &XOffset = 0, const int &YOffset = 0,
const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0.0f, const Uint8 &a = 255);
};
+
+#endif // CRAB_POLYGON_H
diff --git a/engines/crab/PopUp.h b/engines/crab/PopUp.h
index 9c7036da940..b2328338eea 100644
--- a/engines/crab/PopUp.h
+++ b/engines/crab/PopUp.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_POPUP_H
+#define CRAB_POPUP_H
#include "GameEventInfo.h"
#include "ParagraphData.h"
@@ -118,3 +119,5 @@ struct PopUpCollection {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_POPUP_H
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index 447d65c9567..d4c7f9f0b7f 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PRIORITYQUEUE_H
+#define CRAB_PRIORITYQUEUE_H
#include <algorithm>
#include <deque>
@@ -141,3 +142,5 @@ void PriorityQueue<Node>::enumerate(std::vector<Node const *> &sorted) const {
sorted.resize(open.size());
std::copy(open.begin(), open.end(), sorted.begin());
}
+
+#endif // CRAB_PRIORITYQUEUE_H
diff --git a/engines/crab/ProgressBar.h b/engines/crab/ProgressBar.h
index 943e71e5a5c..4a6a6dbe154 100644
--- a/engines/crab/ProgressBar.h
+++ b/engines/crab/ProgressBar.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PROGRESSBAR_H
+#define CRAB_PROGRESSBAR_H
#include "ClipButton.h"
#include "common_header.h"
@@ -107,3 +108,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_PROGRESSBAR_H
diff --git a/engines/crab/QuestText.h b/engines/crab/QuestText.h
index f20b0930147..94e0b6556e2 100644
--- a/engines/crab/QuestText.h
+++ b/engines/crab/QuestText.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_QUESTTEXT_H
+#define CRAB_QUESTTEXT_H
#include "ImageData.h"
#include "ParagraphData.h"
@@ -86,3 +87,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_QUESTTEXT_H
diff --git a/engines/crab/RadioButton.h b/engines/crab/RadioButton.h
index 26b72719bc8..cbff468ced5 100644
--- a/engines/crab/RadioButton.h
+++ b/engines/crab/RadioButton.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_RADIOBUTTON_H
+#define CRAB_RADIOBUTTON_H
#include "ToggleButton.h"
@@ -49,3 +50,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_RADIOBUTTON_H
diff --git a/engines/crab/RadioButtonMenu.h b/engines/crab/RadioButtonMenu.h
index cb77eb1f15e..37b85fdc91b 100644
--- a/engines/crab/RadioButtonMenu.h
+++ b/engines/crab/RadioButtonMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_RADIOBUTTONMENU_H
+#define CRAB_RADIOBUTTONMENU_H
#include "RadioButton.h"
#include "menu.h"
@@ -79,3 +80,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_RADIOBUTTONMENU_H
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index 50dd54138a1..b1a79f8a35e 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_RECTANGLE_H
+#define CRAB_RECTANGLE_H
#include "Line.h"
#include "common_header.h"
@@ -80,3 +81,5 @@ public:
// Save to file
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name);
};
+
+#endif // CRAB_RECTANGLE_H
diff --git a/engines/crab/ReplyButton.h b/engines/crab/ReplyButton.h
index 053c9e49939..7601651df1a 100644
--- a/engines/crab/ReplyButton.h
+++ b/engines/crab/ReplyButton.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_REPLYBUTTON_H
+#define CRAB_REPLYBUTTON_H
#include "button.h"
#include "common_header.h"
@@ -73,3 +74,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_REPLYBUTTON_H
diff --git a/engines/crab/ReplyMenu.h b/engines/crab/ReplyMenu.h
index dbf002f5b70..b19512469e7 100644
--- a/engines/crab/ReplyMenu.h
+++ b/engines/crab/ReplyMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_REPLYMENU_H
+#define CRAB_REPLYMENU_H
#include "GameEventInfo.h"
#include "ImageData.h"
@@ -67,3 +68,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_REPLYMENU_H
diff --git a/engines/crab/ResolutionMenu.h b/engines/crab/ResolutionMenu.h
index 396bd51468c..4b1b18b3fdb 100644
--- a/engines/crab/ResolutionMenu.h
+++ b/engines/crab/ResolutionMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_RESOLUTIONMENU_H
+#define CRAB_RESOLUTIONMENU_H
#include "common_header.h"
#include "menu.h"
@@ -76,3 +77,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_RESOLUTIONMENU_H
diff --git a/engines/crab/SaveGameMenu.h b/engines/crab/SaveGameMenu.h
index b96c422b45a..13ad3d9fc24 100644
--- a/engines/crab/SaveGameMenu.h
+++ b/engines/crab/SaveGameMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SAVEGAMEMENU_H
+#define CRAB_SAVEGAMEMENU_H
#include "FileMenu.h"
#include "common_header.h"
@@ -68,3 +69,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_SAVEGAMEMENU_H
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index 61c84ea2e0b..4b6621443c1 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SCREENSETTINGS_H
+#define CRAB_SCREENSETTINGS_H
#include "GameParam.h"
#include "common_header.h"
@@ -146,3 +147,5 @@ public:
};
extern ScreenSettings gScreenSettings;
+
+#endif // CRAB_SCREENSETTINGS_H
diff --git a/engines/crab/SectionHeader.h b/engines/crab/SectionHeader.h
index 9d8cfab8141..f2e61c7a1c2 100644
--- a/engines/crab/SectionHeader.h
+++ b/engines/crab/SectionHeader.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SECTIONHEADER_H
+#define CRAB_SECTIONHEADER_H
#include "ImageManager.h"
#include "TextData.h"
@@ -65,3 +66,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_SECTIONHEADER_H
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index 63bd487a2b2..a25ebe7e595 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SHAPE_H
+#define CRAB_SHAPE_H
#include "Polygon.h"
#include "vectors.h"
@@ -77,3 +78,5 @@ public:
void Draw(const int &XOffset = 0, const int &YOffset = 0,
const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0.0f, const Uint8 &a = 255);
};
+
+#endif // CRAB_SHAPE_H
diff --git a/engines/crab/SlideShow.h b/engines/crab/SlideShow.h
index ec8371dda7a..a61c208499e 100644
--- a/engines/crab/SlideShow.h
+++ b/engines/crab/SlideShow.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SLIDESHOW_H
+#define CRAB_SLIDESHOW_H
#include "Image.h"
#include "ImageData.h"
@@ -76,3 +77,5 @@ public:
extern SlideShow gHelpScreen;
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_SLIDESHOW_H
diff --git a/engines/crab/SpriteConstant.h b/engines/crab/SpriteConstant.h
index 8938c0f9f1d..7a66873fe8a 100644
--- a/engines/crab/SpriteConstant.h
+++ b/engines/crab/SpriteConstant.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SPRITECONSTANT_H
+#define CRAB_SPRITECONSTANT_H
#include "common_header.h"
#include "vectors.h"
@@ -71,3 +72,5 @@ struct SpriteConstant {
};
} // End of namespace ai
} // End of namespace pyrodactyl
+
+#endif // CRAB_SPRITECONSTANT_H
diff --git a/engines/crab/Stairs.h b/engines/crab/Stairs.h
index 3738bc2f0c5..b02c0563a34 100644
--- a/engines/crab/Stairs.h
+++ b/engines/crab/Stairs.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_STAIRS_H
+#define CRAB_STAIRS_H
#include "Shape.h"
#include "common_header.h"
@@ -47,3 +48,5 @@ public:
};
} // End of namespace level
} // End of namespace pyrodactyl
+
+#endif // CRAB_STAIRS_H
diff --git a/engines/crab/Stat.h b/engines/crab/Stat.h
index 6e7b5e09a3b..6b6ca86d0d0 100644
--- a/engines/crab/Stat.h
+++ b/engines/crab/Stat.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_STAT_H
+#define CRAB_STAT_H
#include "common_header.h"
#include "ImageManager.h"
@@ -71,3 +72,5 @@ StatType StringToStatType(const std::string &val);
const char *StatTypeToString(const StatType &val);
} // End of namespace stat
} // End of namespace pyrodactyl
+
+#endif // CRAB_STAT_H
diff --git a/engines/crab/StatDrawHelper.h b/engines/crab/StatDrawHelper.h
index 24a96f81724..c018607dea3 100644
--- a/engines/crab/StatDrawHelper.h
+++ b/engines/crab/StatDrawHelper.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_STATDRAWHELPER_H
+#define CRAB_STATDRAWHELPER_H
#include "common_header.h"
#include "TextData.h"
@@ -69,3 +70,5 @@ public:
};
} // End of namespace stat
} // End of namespace pyrodactyl
+
+#endif // CRAB_STATDRAWHELPER_H
diff --git a/engines/crab/StatPreview.h b/engines/crab/StatPreview.h
index 5e0b56a37ce..54bd9d709d4 100644
--- a/engines/crab/StatPreview.h
+++ b/engines/crab/StatPreview.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_STATPREVIEW_H
+#define CRAB_STATPREVIEW_H
#include "common_header.h"
#include "Item.h"
@@ -52,3 +53,5 @@ struct StatPreview {
};
} // End of namespace item
} // End of namespace pyrodactyl
+
+#endif // CRAB_STATPREVIEW_H
diff --git a/engines/crab/StatTemplate.h b/engines/crab/StatTemplate.h
index 7b00e68509c..389abf3af27 100644
--- a/engines/crab/StatTemplate.h
+++ b/engines/crab/StatTemplate.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_STATTEMPLATE_H
+#define CRAB_STATTEMPLATE_H
#include "common_header.h"
#include "Stat.h"
@@ -46,3 +47,5 @@ public:
};
} // End of namespace stat
} // End of namespace pyrodactyl
+
+#endif // CRAB_STATTEMPLATE_H
diff --git a/engines/crab/StateButton.h b/engines/crab/StateButton.h
index 95732b56a5e..ed79b1737f8 100644
--- a/engines/crab/StateButton.h
+++ b/engines/crab/StateButton.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_STATEBUTTON_H
+#define CRAB_STATEBUTTON_H
#include "button.h"
#include "common_header.h"
@@ -84,3 +85,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_STATEBUTTON_H
diff --git a/engines/crab/TMXLayer.h b/engines/crab/TMXLayer.h
index 450352fbfd0..022eef99de5 100644
--- a/engines/crab/TMXLayer.h
+++ b/engines/crab/TMXLayer.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TMXLAYER_H
+#define CRAB_TMXLAYER_H
#include "Image.h"
#include "Rectangle.h"
@@ -103,3 +104,5 @@ public:
bool Load(const std::string &path, rapidxml::xml_node<char> *node);
};
} // End of namespace TMX
+
+#endif // CRAB_TMXLAYER_H
diff --git a/engines/crab/TMXMap.h b/engines/crab/TMXMap.h
index 0571135358c..bbf080293c2 100644
--- a/engines/crab/TMXMap.h
+++ b/engines/crab/TMXMap.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TMXMAP_H
+#define CRAB_TMXMAP_H
#include "ImageManager.h"
#include "LevelExit.h"
@@ -127,3 +128,5 @@ public:
std::vector<pyrodactyl::level::Stairs> AreaStairs() { return area_stairs; }
};
} // End of namespace TMX
+
+#endif // CRAB_TMXMAP_H
diff --git a/engines/crab/TMXTileSet.h b/engines/crab/TMXTileSet.h
index a8c0e6ce520..1a1ea24bef7 100644
--- a/engines/crab/TMXTileSet.h
+++ b/engines/crab/TMXTileSet.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TMXTILESET_H
+#define CRAB_TMXTILESET_H
#include "Image.h"
#include "TMXLayer.h"
@@ -95,3 +96,5 @@ public:
void Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
};
}; // End of namespace TMX
+
+#endif // CRAB_TMXTILESET_H
diff --git a/engines/crab/TextData.h b/engines/crab/TextData.h
index 7b5eb100a95..3c98832dc85 100644
--- a/engines/crab/TextData.h
+++ b/engines/crab/TextData.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TEXTDATA_H
+#define CRAB_TEXTDATA_H
#include "TextManager.h"
#include "common_header.h"
@@ -61,3 +62,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_TEXTDATA_H
diff --git a/engines/crab/TextManager.h b/engines/crab/TextManager.h
index c0e40783cdc..f16d3a747c0 100644
--- a/engines/crab/TextManager.h
+++ b/engines/crab/TextManager.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TEXTMANAGER_H
+#define CRAB_TEXTMANAGER_H
#include "GameParam.h"
#include "Image.h"
@@ -112,3 +113,5 @@ public:
extern TextManager gTextManager;
} // End of namespace text
} // End of namespace pyrodactyl
+
+#endif // CRAB_TEXTMANAGER_H
diff --git a/engines/crab/TileInfo.h b/engines/crab/TileInfo.h
index f2c24f1844c..1234668c29b 100644
--- a/engines/crab/TileInfo.h
+++ b/engines/crab/TileInfo.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TILEINFO_H
+#define CRAB_TILEINFO_H
#include "common_header.h"
#include "loaders.h"
@@ -87,3 +88,5 @@ struct TileInfo {
}
};
} // End of namespace TMX
+
+#endif // CRAB_TILEINFO_H
diff --git a/engines/crab/ToggleButton.h b/engines/crab/ToggleButton.h
index 207c2696b81..7bc8520b819 100644
--- a/engines/crab/ToggleButton.h
+++ b/engines/crab/ToggleButton.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TOGGLEBUTTON_H
+#define CRAB_TOGGLEBUTTON_H
#include "button.h"
#include "common_header.h"
@@ -61,3 +62,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_TOGGLEBUTTON_H
diff --git a/engines/crab/TraitButton.h b/engines/crab/TraitButton.h
index ce02e1ef882..973a856cdbc 100644
--- a/engines/crab/TraitButton.h
+++ b/engines/crab/TraitButton.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TRAITBUTTON_H
+#define CRAB_TRAITBUTTON_H
#include "StateButton.h"
#include "common_header.h"
@@ -57,3 +58,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_TRAITBUTTON_H
diff --git a/engines/crab/TraitMenu.h b/engines/crab/TraitMenu.h
index 1fe760136dd..250653fdcb9 100644
--- a/engines/crab/TraitMenu.h
+++ b/engines/crab/TraitMenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TRAITMENU_H
+#define CRAB_TRAITMENU_H
#include "ParagraphData.h"
#include "TraitButton.h"
@@ -78,3 +79,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_TRAITMENU_H
diff --git a/engines/crab/XMLDoc.h b/engines/crab/XMLDoc.h
index d3d8198902a..445bb349588 100644
--- a/engines/crab/XMLDoc.h
+++ b/engines/crab/XMLDoc.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_XMLDOC_H
+#define CRAB_XMLDOC_H
#include "engines/crab/common_header.h"
#include "engines/crab/filesystem.h"
@@ -59,3 +60,5 @@ public:
};
} // End of namespace Crab
+
+#endif // CRAB_XMLDOC_H
diff --git a/engines/crab/animation.h b/engines/crab/animation.h
index 8b6f7f2c398..c86195e21d5 100644
--- a/engines/crab/animation.h
+++ b/engines/crab/animation.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB__ANIMATION_H
+#define CRAB__ANIMATION_H
#include "AnimationEffect.h"
#include "AnimationFrame.h"
@@ -62,3 +63,5 @@ public:
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB__ANIMATION_H
diff --git a/engines/crab/animframe.h b/engines/crab/animframe.h
index 97d65e30878..ec46aafba4c 100644
--- a/engines/crab/animframe.h
+++ b/engines/crab/animframe.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ANIMFRAME_H
+#define CRAB_ANIMFRAME_H
#include "Rectangle.h"
#include "common_header.h"
@@ -101,3 +102,5 @@ public:
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_ANIMFRAME_H
diff --git a/engines/crab/animset.h b/engines/crab/animset.h
index ff31b48c74d..84b7e5e5f31 100644
--- a/engines/crab/animset.h
+++ b/engines/crab/animset.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ANIMSET_H
+#define CRAB_ANIMSET_H
#include "common_header.h"
#include "fightmoves.h"
@@ -66,3 +67,5 @@ struct AnimSet {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_ANIMSET_H
diff --git a/engines/crab/app.h b/engines/crab/app.h
index fcc9e692a34..41a513b03a5 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_APP_H
+#define CRAB_APP_H
#include "ImageManager.h"
#include "MusicManager.h"
@@ -56,3 +57,5 @@ public:
bool Init();
void Run();
};
+
+#endif // CRAB_APP_H
diff --git a/engines/crab/bonus.h b/engines/crab/bonus.h
index 153482deeb9..f9a26a3956f 100644
--- a/engines/crab/bonus.h
+++ b/engines/crab/bonus.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_BONUS_H
+#define CRAB_BONUS_H
#include "common_header.h"
#include "loaders.h"
@@ -47,3 +48,5 @@ struct Bonus {
};
} // End of namespace stat
} // End of namespace pyrodactyl
+
+#endif // CRAB_BONUS_H
diff --git a/engines/crab/button.h b/engines/crab/button.h
index 56b0c7e7ecd..7667f67ebc6 100644
--- a/engines/crab/button.h
+++ b/engines/crab/button.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: Button class
//=============================================================================
-#pragma once
+#ifndef CRAB_BUTTON_H
+#define CRAB_BUTTON_H
#include "Caption.h"
#include "HoverInfo.h"
@@ -122,3 +123,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_BUTTON_H
diff --git a/engines/crab/changeval.h b/engines/crab/changeval.h
index 034bd9ab373..d3af6953a9a 100644
--- a/engines/crab/changeval.h
+++ b/engines/crab/changeval.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_CHANGEVAL_H
+#define CRAB_CHANGEVAL_H
#include "common_header.h"
#include "opinion.h"
@@ -61,3 +62,5 @@ struct ChangeVal {
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_CHANGEVAL_H
diff --git a/engines/crab/collision.h b/engines/crab/collision.h
index 78c3243bcc7..0014f4bb2c8 100644
--- a/engines/crab/collision.h
+++ b/engines/crab/collision.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_COLLISION_H
+#define CRAB_COLLISION_H
#include "Polygon.h"
#include "Rectangle.h"
@@ -45,3 +46,5 @@ template<typename T>
double Distance2D(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y) {
return sqrt((p0_x - p1_x) * (p0_x - p1_x) + (p0_y - p1_y) * (p0_y - p1_y));
}
+
+#endif // CRAB_COLLISION_H
diff --git a/engines/crab/color.h b/engines/crab/color.h
index 96bb7e44052..1373614bb05 100644
--- a/engines/crab/color.h
+++ b/engines/crab/color.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_COLOR_H
+#define CRAB_COLOR_H
#include "XMLDoc.h"
#include "common_header.h"
@@ -56,3 +57,5 @@ public:
};
} // End of namespace text
} // End of namespace pyrodactyl
+
+#endif // CRAB_COLOR_H
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index d00f99dc478..9215cdc127e 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_COMMON_HEADER_H
+#define CRAB_COMMON_HEADER_H
#if 0
#include <algorithm>
@@ -55,3 +56,5 @@
#define RAPIDXML_NO_EXCEPTIONS
#include "rapidxml/rapidxml.hpp"
+
+#endif // CRAB_COMMON_HEADER_H
diff --git a/engines/crab/conversationdata.h b/engines/crab/conversationdata.h
index 66cbec76c8c..d0f15da2a57 100644
--- a/engines/crab/conversationdata.h
+++ b/engines/crab/conversationdata.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_CONVERSATIONDATA_H
+#define CRAB_CONVERSATIONDATA_H
#include "changeval.h"
#include "common_header.h"
@@ -72,3 +73,5 @@ struct ConversationData {
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_CONVERSATIONDATA_H
diff --git a/engines/crab/cursor.h b/engines/crab/cursor.h
index 0127aff2166..64fef75708a 100644
--- a/engines/crab/cursor.h
+++ b/engines/crab/cursor.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: Cursor object
//=============================================================================
-#pragma once
+#ifndef CRAB_CURSOR_H
+#define CRAB_CURSOR_H
#include "Image.h"
#include "common_header.h"
@@ -84,3 +85,5 @@ public:
extern Cursor gMouse;
} // End of namespace input
} // End of namespace pyrodactyl
+
+#endif // CRAB_CURSOR_H
diff --git a/engines/crab/dialogbox.h b/engines/crab/dialogbox.h
index f7060238336..e9c7c450933 100644
--- a/engines/crab/dialogbox.h
+++ b/engines/crab/dialogbox.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: Dialog box!
//=============================================================================
-#pragma once
+#ifndef CRAB_DIALOGBOX_H
+#define CRAB_DIALOGBOX_H
#include "GameEventInfo.h"
#include "ParagraphData.h"
@@ -75,3 +76,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_DIALOGBOX_H
diff --git a/engines/crab/effect.h b/engines/crab/effect.h
index 78aa308e2b0..49b917b12b2 100644
--- a/engines/crab/effect.h
+++ b/engines/crab/effect.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_EFFECT_H
+#define CRAB_EFFECT_H
#include "GameEventInfo.h"
#include "XMLDoc.h"
@@ -111,3 +112,5 @@ struct Effect {
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_EFFECT_H
diff --git a/engines/crab/element.h b/engines/crab/element.h
index a89aca04b82..b3144996366 100644
--- a/engines/crab/element.h
+++ b/engines/crab/element.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_ELEMENT_H
+#define CRAB_ELEMENT_H
#include "ImageManager.h"
#include "ScreenSettings.h"
@@ -76,3 +77,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_ELEMENT_H
diff --git a/engines/crab/emotion.h b/engines/crab/emotion.h
index 1c335eb0ef9..0f36a621218 100644
--- a/engines/crab/emotion.h
+++ b/engines/crab/emotion.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_EMOTION_H
+#define CRAB_EMOTION_H
#include "ImageManager.h"
#include "common_header.h"
@@ -52,3 +53,5 @@ struct EmotionIndicator {
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_EMOTION_H
diff --git a/engines/crab/eventstore.h b/engines/crab/eventstore.h
index 59f7f19aa5f..49c1a5bc8e2 100644
--- a/engines/crab/eventstore.h
+++ b/engines/crab/eventstore.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_EVENTSTORE_H
+#define CRAB_EVENTSTORE_H
#include "StateButton.h"
#include "animation.h"
@@ -83,3 +84,5 @@ struct GameEventStore {
extern GameEventStore gEventStore;
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_EVENTSTORE_H
diff --git a/engines/crab/fightanim.h b/engines/crab/fightanim.h
index e465c3af887..0a8bd5408d0 100644
--- a/engines/crab/fightanim.h
+++ b/engines/crab/fightanim.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_FIGHTANIM_H
+#define CRAB_FIGHTANIM_H
#include "MusicManager.h"
#include "common_header.h"
@@ -102,3 +103,5 @@ public:
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_FIGHTANIM_H
diff --git a/engines/crab/fightinput.h b/engines/crab/fightinput.h
index f8bb3624952..8bec03cd8a0 100644
--- a/engines/crab/fightinput.h
+++ b/engines/crab/fightinput.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_FIGHTINPUT_H
+#define CRAB_FIGHTINPUT_H
#include "common_header.h"
#include "input.h"
@@ -75,3 +76,5 @@ struct FightInput {
};
} // End of namespace input
} // End of namespace pyrodactyl
+
+#endif // CRAB_FIGHTINPUT_H
diff --git a/engines/crab/fightmove.h b/engines/crab/fightmove.h
index 82f123347e4..606c5473f4f 100644
--- a/engines/crab/fightmove.h
+++ b/engines/crab/fightmove.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_FIGHTMOVE_H
+#define CRAB_FIGHTMOVE_H
#include "common_header.h"
#include "fightanim.h"
@@ -59,3 +60,5 @@ struct FightMove {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_FIGHTMOVE_H
diff --git a/engines/crab/fightmoves.h b/engines/crab/fightmoves.h
index da19f104fbb..575952e3cdd 100644
--- a/engines/crab/fightmoves.h
+++ b/engines/crab/fightmoves.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_FIGHTMOVES_H
+#define CRAB_FIGHTMOVES_H
#include "MusicManager.h"
#include "common_header.h"
@@ -99,3 +100,5 @@ public:
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_FIGHTMOVES_H
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index fbb9dfd4aaa..4507a1b63de 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_FILESYSTEM_H
+#define CRAB_FILESYSTEM_H
#include "common_header.h"
namespace Crab {
@@ -37,3 +38,5 @@ bool FileOpen(const Common::Path &path, char *&data);
bool PathCompare(const boost::filesystem::path &p1, const boost::filesystem::path &p2);
#endif
} // End of namespace Crab
+
+#endif // CRAB_FILESYSTEM_H
diff --git a/engines/crab/fm_ai_data.h b/engines/crab/fm_ai_data.h
index 304469e1849..162627074b3 100644
--- a/engines/crab/fm_ai_data.h
+++ b/engines/crab/fm_ai_data.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_FM_AI_DATA_H
+#define CRAB_FM_AI_DATA_H
#include "common_header.h"
#include "range.h"
@@ -74,3 +75,5 @@ struct FightMoveAIData {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_FM_AI_DATA_H
diff --git a/engines/crab/game.h b/engines/crab/game.h
index fa64a13610a..d3be0442b97 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAME_H
+#define CRAB_GAME_H
#include "DevConsole.h"
#include "GameClock.h"
@@ -136,3 +137,5 @@ public:
void SetUI();
};
+
+#endif // CRAB_GAME_H
diff --git a/engines/crab/gameevent.h b/engines/crab/gameevent.h
index fdb03650cc2..1933bf617c1 100644
--- a/engines/crab/gameevent.h
+++ b/engines/crab/gameevent.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAMEEVENT_H
+#define CRAB_GAMEEVENT_H
#include "ImageManager.h"
#include "common_header.h"
@@ -89,3 +90,5 @@ struct GameEvent {
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_GAMEEVENT_H
diff --git a/engines/crab/gameeventmanager.h b/engines/crab/gameeventmanager.h
index 16c1b2fc624..c9d6a384829 100644
--- a/engines/crab/gameeventmanager.h
+++ b/engines/crab/gameeventmanager.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAMEEVENTMANAGER_H
+#define CRAB_GAMEEVENTMANAGER_H
#include "ChapterIntro.h"
#include "EventSeqGroup.h"
@@ -107,3 +108,5 @@ public:
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_GAMEEVENTMANAGER_H
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index a568531a960..1b9c1f8efd9 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: The game state virtual class
//=============================================================================
-#pragma once
+#ifndef CRAB_GAMESTATE_CONTAINER_H
+#define CRAB_GAMESTATE_CONTAINER_H
#include "common_header.h"
#include "gamestates.h"
@@ -49,3 +50,5 @@ public:
virtual void AutoSave() = 0;
virtual ~GameState(){};
};
+
+#endif // CRAB_GAMESTATE_CONTAINER_H
diff --git a/engines/crab/gamestates.h b/engines/crab/gamestates.h
index 037c3f68923..ce76c54ab6a 100644
--- a/engines/crab/gamestates.h
+++ b/engines/crab/gamestates.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAMESTATES_H
+#define CRAB_GAMESTATES_H
#include "common_header.h"
//------------------------------------------------------------------------
@@ -43,3 +44,5 @@ enum GameStateID {
GAMESTATE_LOAD_GAME,
TOTAL_GAMESTATES // ALWAYS THE LAST VALUE
};
+
+#endif // CRAB_GAMESTATES_H
diff --git a/engines/crab/gametype.h b/engines/crab/gametype.h
index 8ba2842b2dc..d9a5c97b42f 100644
--- a/engines/crab/gametype.h
+++ b/engines/crab/gametype.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_GAMETYPE_H
+#define CRAB_GAMETYPE_H
namespace Crab {
@@ -108,3 +109,5 @@ enum TextureFlipType {
};
} // End of namespace Crab
+
+#endif // CRAB_GAMETYPE_H
diff --git a/engines/crab/hotkey.h b/engines/crab/hotkey.h
index 2d795a5300b..640b9b9b198 100644
--- a/engines/crab/hotkey.h
+++ b/engines/crab/hotkey.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_HOTKEY_H
+#define CRAB_HOTKEY_H
#include "common_header.h"
#include "input.h"
@@ -57,3 +58,5 @@ public:
};
} // End of namespace input
} // End of namespace pyrodactyl
+
+#endif // CRAB_HOTKEY_H
diff --git a/engines/crab/hud.h b/engines/crab/hud.h
index 59078b1d998..1b1f2eaf2a1 100644
--- a/engines/crab/hud.h
+++ b/engines/crab/hud.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: The tray where you have inventory, map and journal icons
//=============================================================================
-#pragma once
+#ifndef CRAB_HUD_H
+#define CRAB_HUD_H
#include "FileMenu.h"
#include "GameEventInfo.h"
@@ -108,3 +109,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_HUD_H
diff --git a/engines/crab/imageeffect.h b/engines/crab/imageeffect.h
index a0d67b81ea6..e9329867146 100644
--- a/engines/crab/imageeffect.h
+++ b/engines/crab/imageeffect.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_IMAGEEFFECT_H
+#define CRAB_IMAGEEFFECT_H
#include "common_header.h"
#include "ImageManager.h"
@@ -49,3 +50,5 @@ struct ImageEffect : public Vector2i {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_IMAGEEFFECT_H
diff --git a/engines/crab/input.h b/engines/crab/input.h
index 537f635e9cd..bce8877bf2f 100644
--- a/engines/crab/input.h
+++ b/engines/crab/input.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_INPUT_H
+#define CRAB_INPUT_H
#include "common_header.h"
#include "inputval.h"
@@ -137,3 +138,5 @@ public:
extern InputManager gInput;
} // End of namespace input
} // End of namespace pyrodactyl
+
+#endif // CRAB_INPUT_H
diff --git a/engines/crab/inputval.h b/engines/crab/inputval.h
index e0e33bb7a1c..080f8e86008 100644
--- a/engines/crab/inputval.h
+++ b/engines/crab/inputval.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_INPUTVAL_H
+#define CRAB_INPUTVAL_H
#include "GameParam.h"
#include "XMLDoc.h"
@@ -101,3 +102,5 @@ public:
};
} // End of namespace input
} // End of namespace pyrodactyl
+
+#endif // CRAB_INPUTVAL_H
diff --git a/engines/crab/journal.h b/engines/crab/journal.h
index 818e9db0307..c9ba3e61a73 100644
--- a/engines/crab/journal.h
+++ b/engines/crab/journal.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_JOURNAL_H
+#define CRAB_JOURNAL_H
#include "ImageData.h"
#include "ImageManager.h"
@@ -114,3 +115,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_JOURNAL_H
diff --git a/engines/crab/level.h b/engines/crab/level.h
index 363cd802e66..31a2ac3e444 100644
--- a/engines/crab/level.h
+++ b/engines/crab/level.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_LEVEL_H
+#define CRAB_LEVEL_H
#include "GameEventInfo.h"
#include "ImageManager.h"
@@ -193,3 +194,5 @@ public:
};
} // End of namespace level
} // End of namespace pyrodactyl
+
+#endif // CRAB_LEVEL_H
diff --git a/engines/crab/level_objects.h b/engines/crab/level_objects.h
index f5a84cb6583..a4f9c530612 100644
--- a/engines/crab/level_objects.h
+++ b/engines/crab/level_objects.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_LEVEL_OBJECTS_H
+#define CRAB_LEVEL_OBJECTS_H
#include "ImageManager.h"
#include "common_header.h"
@@ -58,3 +59,5 @@ struct PlayerDestMarker {
};
} // End of namespace level
} // End of namespace pyrodactyl
+
+#endif // CRAB_LEVEL_OBJECTS_H
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 414374ff746..1f38d71e9a2 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_LOADERS_H
+#define CRAB_LOADERS_H
#include "engines/crab/XMLDoc.h"
#include "engines/crab/common_header.h"
@@ -132,3 +133,5 @@ bool LoadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node,
unsigned int Version(const Common::String &filename);
} // End of namespace Crab
+
+#endif // CRAB_LOADERS_H
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 3fcb6e895ba..619d8a3100b 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MAINMENU_H
+#define CRAB_MAINMENU_H
#include "AlphaImage.h"
#include "CreditScreen.h"
@@ -131,3 +132,5 @@ public:
// We don't need to save game state here
void AutoSave() {}
};
+
+#endif // CRAB_MAINMENU_H
diff --git a/engines/crab/map.h b/engines/crab/map.h
index c36162f38b5..9967d229f20 100644
--- a/engines/crab/map.h
+++ b/engines/crab/map.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MAP_H
+#define CRAB_MAP_H
#include "GameEventInfo.h"
#include "ImageData.h"
@@ -137,3 +138,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_MAP_H
diff --git a/engines/crab/mapbutton.h b/engines/crab/mapbutton.h
index a180d212723..94c3b0ae95a 100644
--- a/engines/crab/mapbutton.h
+++ b/engines/crab/mapbutton.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MAPBUTTON_H
+#define CRAB_MAPBUTTON_H
#include "common_header.h"
#include "menu.h"
@@ -59,3 +60,5 @@ public:
typedef Menu<MapButton> MapButtonMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_MAPBUTTON_H
diff --git a/engines/crab/menu.h b/engines/crab/menu.h
index ee4a0511dc6..46fdc399871 100644
--- a/engines/crab/menu.h
+++ b/engines/crab/menu.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: Menu class
//=============================================================================
-#pragma once
+#ifndef CRAB_MENU_H
+#define CRAB_MENU_H
#include "ImageManager.h"
#include "button.h"
@@ -311,3 +312,5 @@ public:
typedef Menu<Button> ButtonMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_MENU_H
diff --git a/engines/crab/moveeffect.h b/engines/crab/moveeffect.h
index 64d2e8ae3c0..5abc358c495 100644
--- a/engines/crab/moveeffect.h
+++ b/engines/crab/moveeffect.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MOVEEFFECT_H
+#define CRAB_MOVEEFFECT_H
#include "common_header.h"
#include "imageeffect.h"
@@ -64,3 +65,5 @@ struct FightMoveEffect {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_MOVEEFFECT_H
diff --git a/engines/crab/movement.h b/engines/crab/movement.h
index b77118c0132..fa04e97ec72 100644
--- a/engines/crab/movement.h
+++ b/engines/crab/movement.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MOVEMENT_H
+#define CRAB_MOVEMENT_H
#include "Rectangle.h"
#include "common_header.h"
@@ -83,3 +84,5 @@ struct MovementSet {
};
} // End of namespace ai
} // End of namespace pyrodactyl
+
+#endif // CRAB_MOVEMENT_H
diff --git a/engines/crab/musicparam.h b/engines/crab/musicparam.h
index 1dab573a276..069d07ff6d9 100644
--- a/engines/crab/musicparam.h
+++ b/engines/crab/musicparam.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_MUSICPARAM_H
+#define CRAB_MUSICPARAM_H
#include "common_header.h"
#include "loaders.h"
@@ -71,3 +72,5 @@ struct MusicData {
};
} // End of namespace music
} // End of namespace pyrodactyl
+
+#endif // CRAB_MUSICPARAM_H
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 88be7aa5125..9faf008a394 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_NUMSTR_H
+#define CRAB_NUMSTR_H
#include "common_header.h"
namespace Crab {
@@ -90,3 +91,5 @@ void GetPoint(T &v, Common::String &coords) {
}
} // End of namespace Crab
+
+#endif // CRAB_NUMSTR_H
diff --git a/engines/crab/opinion.h b/engines/crab/opinion.h
index 9f365b1654e..c1f21b29f56 100644
--- a/engines/crab/opinion.h
+++ b/engines/crab/opinion.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_OPINION_H
+#define CRAB_OPINION_H
#include "common_header.h"
#include "GameParam.h"
@@ -64,3 +65,5 @@ struct Opinion {
};
} // End of namespace people
} // End of namespace pyrodactyl
+
+#endif // CRAB_OPINION_H
diff --git a/engines/crab/person.h b/engines/crab/person.h
index 83884a9df2c..b2a9e56eca5 100644
--- a/engines/crab/person.h
+++ b/engines/crab/person.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PERSON_H
+#define CRAB_PERSON_H
#include "ImageManager.h"
#include "Stat.h"
@@ -87,3 +88,5 @@ struct Person {
typedef std::unordered_map<std::string, Person> PersonMap;
} // End of namespace people
} // End of namespace pyrodactyl
+
+#endif // CRAB_PERSON_H
diff --git a/engines/crab/personbase.h b/engines/crab/personbase.h
index ce198b80428..cae51aeea59 100644
--- a/engines/crab/personbase.h
+++ b/engines/crab/personbase.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_PERSONBASE_H
+#define CRAB_PERSONBASE_H
#include "Stat.h"
#include "common_header.h"
@@ -61,3 +62,5 @@ PersonType StringToPersonType(const std::string &val);
PersonState StringToPersonState(const std::string &val);
} // End of namespace people
} // End of namespace pyrodactyl
+
+#endif // CRAB_PERSONBASE_H
diff --git a/engines/crab/quest.h b/engines/crab/quest.h
index aa519e2df7b..58412154d70 100644
--- a/engines/crab/quest.h
+++ b/engines/crab/quest.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_QUEST_H
+#define CRAB_QUEST_H
#include "common_header.h"
#include "loaders.h"
@@ -59,3 +60,5 @@ struct Quest {
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_QUEST_H
diff --git a/engines/crab/questmenu.h b/engines/crab/questmenu.h
index d29a8de984c..18122a787f7 100644
--- a/engines/crab/questmenu.h
+++ b/engines/crab/questmenu.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_QUESTMENU_H
+#define CRAB_QUESTMENU_H
#include "PageMenu.h"
#include "QuestText.h"
@@ -93,3 +94,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_QUESTMENU_H
diff --git a/engines/crab/range.h b/engines/crab/range.h
index 82b703b12e7..ea62436babb 100644
--- a/engines/crab/range.h
+++ b/engines/crab/range.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_RANGE_H
+#define CRAB_RANGE_H
#include "animframe.h"
#include "common_header.h"
@@ -55,3 +56,5 @@ struct Range {
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_RANGE_H
diff --git a/engines/crab/shadow.h b/engines/crab/shadow.h
index 9cd956b17ac..70bfa821eab 100644
--- a/engines/crab/shadow.h
+++ b/engines/crab/shadow.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SHADOW_H
+#define CRAB_SHADOW_H
#include "ImageManager.h"
#include "common_header.h"
@@ -70,3 +71,5 @@ public:
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_SHADOW_H
diff --git a/engines/crab/slider.h b/engines/crab/slider.h
index 171745f2ca7..31eb7a0f03a 100644
--- a/engines/crab/slider.h
+++ b/engines/crab/slider.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SLIDER_H
+#define CRAB_SLIDER_H
#include "Caption.h"
#include "ImageData.h"
@@ -79,3 +80,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_SLIDER_H
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 9270731324e..1f4f8a53b61 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: A basic screen that flashes an image for a time interval
//=============================================================================
-#pragma once
+#ifndef CRAB_SPLASH_H
+#define CRAB_SPLASH_H
#include "ImageManager.h"
#include "LoadingScreen.h"
@@ -64,3 +65,5 @@ public:
// We don't need to save game state here
void AutoSave() {}
};
+
+#endif // CRAB_SPLASH_H
diff --git a/engines/crab/sprite.h b/engines/crab/sprite.h
index bc2f0295be6..a31b2b767be 100644
--- a/engines/crab/sprite.h
+++ b/engines/crab/sprite.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SPRITE_H
+#define CRAB_SPRITE_H
#include "ImageManager.h"
#include "LevelExit.h"
@@ -236,3 +237,5 @@ public:
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_SPRITE_H
diff --git a/engines/crab/spriteai.h b/engines/crab/spriteai.h
index e60eb8b6997..a66861493bf 100644
--- a/engines/crab/spriteai.h
+++ b/engines/crab/spriteai.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_SPRITEAI_H
+#define CRAB_SPRITEAI_H
#include "common_header.h"
#include "movement.h"
@@ -96,3 +97,5 @@ struct SpriteAIData {
};
} // End of namespace ai
} // End of namespace pyrodactyl
+
+#endif // CRAB_SPRITEAI_H
diff --git a/engines/crab/stdafx.h b/engines/crab/stdafx.h
index b787b719b5f..421ade1d99f 100644
--- a/engines/crab/stdafx.h
+++ b/engines/crab/stdafx.h
@@ -28,5 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_STDAFX_H
+#define CRAB_STDAFX_H
#include "common_header.h"
+
+#endif // CRAB_STDAFX_H
diff --git a/engines/crab/talknotify.h b/engines/crab/talknotify.h
index 441a5cc503e..88691137bfc 100644
--- a/engines/crab/talknotify.h
+++ b/engines/crab/talknotify.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TALKNOTIFY_H
+#define CRAB_TALKNOTIFY_H
#include "GameEventInfo.h"
#include "ImageManager.h"
@@ -56,3 +57,5 @@ public:
};
} // End of namespace level
} // End of namespace pyrodactyl
+
+#endif // CRAB_TALKNOTIFY_H
diff --git a/engines/crab/textarea.h b/engines/crab/textarea.h
index 4d508f33df8..0ec18f086e1 100644
--- a/engines/crab/textarea.h
+++ b/engines/crab/textarea.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: A box for entering text
//=============================================================================
-#pragma once
+#ifndef CRAB_TEXTAREA_H
+#define CRAB_TEXTAREA_H
#include "HoverInfo.h"
#include "MusicManager.h"
@@ -74,3 +75,5 @@ public:
};
} // End of namespace ui
} // End of namespace pyrodactyl
+
+#endif // CRAB_TEXTAREA_H
diff --git a/engines/crab/timer.h b/engines/crab/timer.h
index 3dd163919e2..b66ee6132fc 100644
--- a/engines/crab/timer.h
+++ b/engines/crab/timer.h
@@ -32,7 +32,8 @@
// Author: Arvind
// Purpose: Timer class
//=============================================================================
-#pragma once
+#ifndef CRAB_TIMER_H
+#define CRAB_TIMER_H
#include "common_header.h"
#include "loaders.h"
@@ -85,3 +86,5 @@ public:
const bool Paused() { return paused; }
const bool TargetValid() { return target_valid; }
};
+
+#endif // CRAB_TIMER_H
diff --git a/engines/crab/trait.h b/engines/crab/trait.h
index dbcdea1f439..b4754bd1403 100644
--- a/engines/crab/trait.h
+++ b/engines/crab/trait.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TRAIT_H
+#define CRAB_TRAIT_H
#include "ImageManager.h"
#include "common_header.h"
@@ -68,3 +69,5 @@ struct Trait {
};
} // End of namespace people
} // End of namespace pyrodactyl
+
+#endif // CRAB_TRAIT_H
diff --git a/engines/crab/trigger.h b/engines/crab/trigger.h
index 9b6d00bc38d..4e57fd89bcd 100644
--- a/engines/crab/trigger.h
+++ b/engines/crab/trigger.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TRIGGER_H
+#define CRAB_TRIGGER_H
#include "GameEventInfo.h"
#include "common_header.h"
@@ -73,3 +74,5 @@ struct Trigger {
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_TRIGGER_H
diff --git a/engines/crab/triggerset.h b/engines/crab/triggerset.h
index 2755822b161..24461cda85e 100644
--- a/engines/crab/triggerset.h
+++ b/engines/crab/triggerset.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_TRIGGERSET_H
+#define CRAB_TRIGGERSET_H
#include "common_header.h"
#include "trigger.h"
@@ -61,3 +62,5 @@ public:
};
} // End of namespace event
} // End of namespace pyrodactyl
+
+#endif // CRAB_TRIGGERSET_H
diff --git a/engines/crab/url.h b/engines/crab/url.h
index f1b786fa4db..e60fd32c7a5 100644
--- a/engines/crab/url.h
+++ b/engines/crab/url.h
@@ -28,8 +28,11 @@
*
*/
-#pragma once
+#ifndef CRAB_URL_H
+#define CRAB_URL_H
#include <string>
void OpenURL(const std::string &url_str);
+
+#endif // CRAB_URL_H
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index 95eeca7975d..bd203ba123e 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_VECTORS_H
+#define CRAB_VECTORS_H
#include "common_header.h"
#include "GameParam.h"
@@ -122,3 +123,5 @@ public:
typedef Vector3D<int> Vector3i;
typedef Vector3D<float> Vector3f;
+
+#endif // CRAB_VECTORS_H
diff --git a/engines/crab/walkframes.h b/engines/crab/walkframes.h
index 8c30bae283e..0c6353b4343 100644
--- a/engines/crab/walkframes.h
+++ b/engines/crab/walkframes.h
@@ -28,7 +28,8 @@
*
*/
-#pragma once
+#ifndef CRAB_WALKFRAMES_H
+#define CRAB_WALKFRAMES_H
#include "animframe.h"
#include "common_header.h"
@@ -99,3 +100,5 @@ public:
};
} // End of namespace anim
} // End of namespace pyrodactyl
+
+#endif // CRAB_WALKFRAMES_H
Commit: 81cedd071a4767d6df227542563f2e39dcf8edaa
https://github.com/scummvm/scummvm/commit/81cedd071a4767d6df227542563f2e39dcf8edaa
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove extra files(stdafx[.cpp/.h])
Changed paths:
R engines/crab/stdafx.cpp
R engines/crab/stdafx.h
engines/crab/AlphaImage.cpp
engines/crab/AnimationFrame.cpp
engines/crab/Caption.cpp
engines/crab/ChapterIntro.cpp
engines/crab/ClipButton.cpp
engines/crab/CreditScreen.cpp
engines/crab/DevConsole.cpp
engines/crab/EventSeqGroup.cpp
engines/crab/EventSequence.cpp
engines/crab/FileData.cpp
engines/crab/FileMenu.cpp
engines/crab/GameEventInfo.cpp
engines/crab/GameOverMenu.cpp
engines/crab/GameParam.cpp
engines/crab/GeneralSettingMenu.cpp
engines/crab/GfxSettingMenu.cpp
engines/crab/HealthIndicator.cpp
engines/crab/HoverInfo.cpp
engines/crab/Image.cpp
engines/crab/ImageData.cpp
engines/crab/ImageManager.cpp
engines/crab/Inventory.cpp
engines/crab/Item.cpp
engines/crab/ItemCollection.cpp
engines/crab/ItemMenu.cpp
engines/crab/ItemSlot.cpp
engines/crab/KeyBindMenu.cpp
engines/crab/LevelExit.cpp
engines/crab/Line.cpp
engines/crab/LoadingScreen.cpp
engines/crab/MapData.cpp
engines/crab/MapMarkerMenu.cpp
engines/crab/ModMenu.cpp
engines/crab/MusicArea.cpp
engines/crab/MusicManager.cpp
engines/crab/OptionMenu.cpp
engines/crab/OptionSelect.cpp
engines/crab/ParagraphData.cpp
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGrid.cpp
engines/crab/PauseMenu.cpp
engines/crab/PersonHandler.cpp
engines/crab/PersonScreen.cpp
engines/crab/Polygon.cpp
engines/crab/PopUp.cpp
engines/crab/ProgressBar.cpp
engines/crab/QuestText.cpp
engines/crab/Rectangle.cpp
engines/crab/ReplyButton.cpp
engines/crab/ReplyMenu.cpp
engines/crab/ResolutionMenu.cpp
engines/crab/SaveGameMenu.cpp
engines/crab/ScreenSettings.cpp
engines/crab/SectionHeader.cpp
engines/crab/Shape.cpp
engines/crab/SlideShow.cpp
engines/crab/SpriteConstant.cpp
engines/crab/Stairs.cpp
engines/crab/Stat.cpp
engines/crab/StatDrawHelper.cpp
engines/crab/StatPreview.cpp
engines/crab/StatTemplate.cpp
engines/crab/StateButton.cpp
engines/crab/TMXLayer.cpp
engines/crab/TMXMap.cpp
engines/crab/TMXTileSet.cpp
engines/crab/TextManager.cpp
engines/crab/ToggleButton.cpp
engines/crab/TraitButton.cpp
engines/crab/TraitMenu.cpp
engines/crab/animation.cpp
engines/crab/animframe.cpp
engines/crab/animset.cpp
engines/crab/app.cpp
engines/crab/button.cpp
engines/crab/collision.cpp
engines/crab/color.cpp
engines/crab/conversationdata.cpp
engines/crab/cursor.cpp
engines/crab/dialogbox.cpp
engines/crab/effect.cpp
engines/crab/element.cpp
engines/crab/emotion.cpp
engines/crab/eventstore.cpp
engines/crab/fightanim.cpp
engines/crab/fightinput.cpp
engines/crab/fightmove.cpp
engines/crab/fightmoves.cpp
engines/crab/game.cpp
engines/crab/gameevent.cpp
engines/crab/gameeventmanager.cpp
engines/crab/hotkey.cpp
engines/crab/hud.cpp
engines/crab/imageeffect.cpp
engines/crab/input.cpp
engines/crab/inputval.cpp
engines/crab/journal.cpp
engines/crab/level.cpp
engines/crab/level_ai.cpp
engines/crab/level_collide.cpp
engines/crab/level_draw.cpp
engines/crab/level_load.cpp
engines/crab/level_objects.cpp
engines/crab/main.cpp
engines/crab/mainmenu.cpp
engines/crab/map.cpp
engines/crab/moveeffect.cpp
engines/crab/movement.cpp
engines/crab/opinion.cpp
engines/crab/person.cpp
engines/crab/personbase.cpp
engines/crab/quest.cpp
engines/crab/questmenu.cpp
engines/crab/slider.cpp
engines/crab/splash.cpp
engines/crab/sprite.cpp
engines/crab/spriteai.cpp
engines/crab/talknotify.cpp
engines/crab/textarea.cpp
engines/crab/textdata.cpp
engines/crab/timer.cpp
engines/crab/trait.cpp
engines/crab/trigger.cpp
engines/crab/triggerset.cpp
engines/crab/url.cpp
engines/crab/walkframes.cpp
diff --git a/engines/crab/AlphaImage.cpp b/engines/crab/AlphaImage.cpp
index 0404ba57244..3bbcde4501a 100644
--- a/engines/crab/AlphaImage.cpp
+++ b/engines/crab/AlphaImage.cpp
@@ -30,7 +30,6 @@
#include "AlphaImage.h"
#include "TextManager.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/AnimationFrame.cpp b/engines/crab/AnimationFrame.cpp
index 84de9da43d7..e462633fe1d 100644
--- a/engines/crab/AnimationFrame.cpp
+++ b/engines/crab/AnimationFrame.cpp
@@ -29,7 +29,6 @@
*/
#include "AnimationFrame.h"
-#include "stdafx.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
diff --git a/engines/crab/Caption.cpp b/engines/crab/Caption.cpp
index 872cd8557b9..7c1314a8516 100644
--- a/engines/crab/Caption.cpp
+++ b/engines/crab/Caption.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "Caption.h"
diff --git a/engines/crab/ChapterIntro.cpp b/engines/crab/ChapterIntro.cpp
index 6bcd30e5efe..a0f1ed4e4d9 100644
--- a/engines/crab/ChapterIntro.cpp
+++ b/engines/crab/ChapterIntro.cpp
@@ -29,7 +29,6 @@
*/
#include "ChapterIntro.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/ClipButton.cpp b/engines/crab/ClipButton.cpp
index 0557ffc4199..c747760e1c8 100644
--- a/engines/crab/ClipButton.cpp
+++ b/engines/crab/ClipButton.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "ClipButton.h"
diff --git a/engines/crab/CreditScreen.cpp b/engines/crab/CreditScreen.cpp
index 8322054ec3c..20a7bf8ad8a 100644
--- a/engines/crab/CreditScreen.cpp
+++ b/engines/crab/CreditScreen.cpp
@@ -29,7 +29,6 @@
*/
#include "CreditScreen.h"
-#include "stdafx.h"
#include "url.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/DevConsole.cpp b/engines/crab/DevConsole.cpp
index 33f693dd960..6bf333e6fa5 100644
--- a/engines/crab/DevConsole.cpp
+++ b/engines/crab/DevConsole.cpp
@@ -29,7 +29,6 @@
*/
#include "DevConsole.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/EventSeqGroup.cpp b/engines/crab/EventSeqGroup.cpp
index f0f1abf7dfe..722261396ec 100644
--- a/engines/crab/EventSeqGroup.cpp
+++ b/engines/crab/EventSeqGroup.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "EventSeqGroup.h"
diff --git a/engines/crab/EventSequence.cpp b/engines/crab/EventSequence.cpp
index 1e7cc73cc95..879a9178cef 100644
--- a/engines/crab/EventSequence.cpp
+++ b/engines/crab/EventSequence.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "EventSequence.h"
diff --git a/engines/crab/FileData.cpp b/engines/crab/FileData.cpp
index 3fee022ed31..02f2706ffe2 100644
--- a/engines/crab/FileData.cpp
+++ b/engines/crab/FileData.cpp
@@ -29,7 +29,6 @@
*/
#include "FileData.h"
-#include "stdafx.h"
#include <iomanip>
using namespace pyrodactyl::ui;
diff --git a/engines/crab/FileMenu.cpp b/engines/crab/FileMenu.cpp
index 80500dd9d32..177081efb31 100644
--- a/engines/crab/FileMenu.cpp
+++ b/engines/crab/FileMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "FileMenu.h"
-#include "stdafx.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/GameEventInfo.cpp b/engines/crab/GameEventInfo.cpp
index ce528d3e2e3..7ec62b5d790 100644
--- a/engines/crab/GameEventInfo.cpp
+++ b/engines/crab/GameEventInfo.cpp
@@ -30,7 +30,6 @@
#include "GameEventInfo.h"
#include "eventstore.h"
-#include "stdafx.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/GameOverMenu.cpp b/engines/crab/GameOverMenu.cpp
index 3e175bbbaab..bac911bd498 100644
--- a/engines/crab/GameOverMenu.cpp
+++ b/engines/crab/GameOverMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "GameOverMenu.h"
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index 36f98aba383..1400ad8795e 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -29,7 +29,6 @@
*/
#include "GameParam.h"
-#include "stdafx.h"
// Temporary values go here
TempValue gTemp;
diff --git a/engines/crab/GeneralSettingMenu.cpp b/engines/crab/GeneralSettingMenu.cpp
index 68a63016578..234899a278e 100644
--- a/engines/crab/GeneralSettingMenu.cpp
+++ b/engines/crab/GeneralSettingMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "GeneralSettingMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::music;
diff --git a/engines/crab/GfxSettingMenu.cpp b/engines/crab/GfxSettingMenu.cpp
index b69e38ea4a7..3a2d95f16ca 100644
--- a/engines/crab/GfxSettingMenu.cpp
+++ b/engines/crab/GfxSettingMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "GfxSettingMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/HealthIndicator.cpp b/engines/crab/HealthIndicator.cpp
index 3d306350ed6..1910c3720e3 100644
--- a/engines/crab/HealthIndicator.cpp
+++ b/engines/crab/HealthIndicator.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "HealthIndicator.h"
diff --git a/engines/crab/HoverInfo.cpp b/engines/crab/HoverInfo.cpp
index 904f8b64a51..87f540f89ac 100644
--- a/engines/crab/HoverInfo.cpp
+++ b/engines/crab/HoverInfo.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "HoverInfo.h"
diff --git a/engines/crab/Image.cpp b/engines/crab/Image.cpp
index 9f327a46c22..dab8b57257d 100644
--- a/engines/crab/Image.cpp
+++ b/engines/crab/Image.cpp
@@ -29,7 +29,6 @@
*/
#include "Image.h"
-#include "stdafx.h"
using namespace pyrodactyl::image;
diff --git a/engines/crab/ImageData.cpp b/engines/crab/ImageData.cpp
index ec260e38521..968dda5820b 100644
--- a/engines/crab/ImageData.cpp
+++ b/engines/crab/ImageData.cpp
@@ -29,7 +29,6 @@
*/
#include "ImageData.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/ImageManager.cpp b/engines/crab/ImageManager.cpp
index 4562bee33f5..7c44fffccd3 100644
--- a/engines/crab/ImageManager.cpp
+++ b/engines/crab/ImageManager.cpp
@@ -34,7 +34,6 @@
//=============================================================================
#include "ImageManager.h"
#include "XMLDoc.h"
-#include "stdafx.h"
using namespace pyrodactyl::image;
diff --git a/engines/crab/Inventory.cpp b/engines/crab/Inventory.cpp
index 39ff8530020..ad8626b0f68 100644
--- a/engines/crab/Inventory.cpp
+++ b/engines/crab/Inventory.cpp
@@ -29,7 +29,6 @@
*/
#include "Inventory.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/Item.cpp b/engines/crab/Item.cpp
index 813b0944c09..972a26b5170 100644
--- a/engines/crab/Item.cpp
+++ b/engines/crab/Item.cpp
@@ -29,7 +29,6 @@
*/
#include "Item.h"
-#include "stdafx.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::item;
diff --git a/engines/crab/ItemCollection.cpp b/engines/crab/ItemCollection.cpp
index 8fd6cdd85bb..0158fd8d772 100644
--- a/engines/crab/ItemCollection.cpp
+++ b/engines/crab/ItemCollection.cpp
@@ -29,7 +29,6 @@
*/
#include "ItemCollection.h"
-#include "stdafx.h"
using namespace pyrodactyl::people;
using namespace pyrodactyl::item;
diff --git a/engines/crab/ItemMenu.cpp b/engines/crab/ItemMenu.cpp
index d4f7155e319..375e4b715ee 100644
--- a/engines/crab/ItemMenu.cpp
+++ b/engines/crab/ItemMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "ItemMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::item;
diff --git a/engines/crab/ItemSlot.cpp b/engines/crab/ItemSlot.cpp
index e2e0263e661..7075536da9a 100644
--- a/engines/crab/ItemSlot.cpp
+++ b/engines/crab/ItemSlot.cpp
@@ -29,7 +29,6 @@
*/
#include "ItemSlot.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::item;
diff --git a/engines/crab/KeyBindMenu.cpp b/engines/crab/KeyBindMenu.cpp
index 5ca1dd16a3d..e31e56cebb4 100644
--- a/engines/crab/KeyBindMenu.cpp
+++ b/engines/crab/KeyBindMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "KeyBindMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/LevelExit.cpp b/engines/crab/LevelExit.cpp
index 3dc7b7d46a2..1403d04ab0b 100644
--- a/engines/crab/LevelExit.cpp
+++ b/engines/crab/LevelExit.cpp
@@ -29,7 +29,6 @@
*/
#include "LevelExit.h"
-#include "stdafx.h"
using namespace pyrodactyl::level;
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index dbefc46ff2e..6952ee84ff6 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -29,7 +29,6 @@
*/
#include "Line.h"
-#include "stdafx.h"
//------------------------------------------------------------------------
// Purpose: Draw a line from start to end
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 8356cff04c7..a911f4451f5 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -30,7 +30,6 @@
#include "LoadingScreen.h"
#include "XMLDoc.h"
-#include "stdafx.h"
void LoadingScreen::Load() {
const std::string &filename = "res/layout/loading.xml";
diff --git a/engines/crab/MapData.cpp b/engines/crab/MapData.cpp
index ecc7f7699fd..01b0b4b8d56 100644
--- a/engines/crab/MapData.cpp
+++ b/engines/crab/MapData.cpp
@@ -29,7 +29,6 @@
*/
#include "MapData.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/MapMarkerMenu.cpp b/engines/crab/MapMarkerMenu.cpp
index 5b8d11287b0..5f3279d0892 100644
--- a/engines/crab/MapMarkerMenu.cpp
+++ b/engines/crab/MapMarkerMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "MapMarkerMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/ModMenu.cpp b/engines/crab/ModMenu.cpp
index 13fe78b69e8..185f9a44fd7 100644
--- a/engines/crab/ModMenu.cpp
+++ b/engines/crab/ModMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "ModMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/MusicArea.cpp b/engines/crab/MusicArea.cpp
index 596d9bd4f44..27d2551f0cd 100644
--- a/engines/crab/MusicArea.cpp
+++ b/engines/crab/MusicArea.cpp
@@ -29,7 +29,6 @@
*/
#include "MusicArea.h"
-#include "stdafx.h"
using namespace pyrodactyl::level;
diff --git a/engines/crab/MusicManager.cpp b/engines/crab/MusicManager.cpp
index 7e7efa8d0eb..0587023133c 100644
--- a/engines/crab/MusicManager.cpp
+++ b/engines/crab/MusicManager.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "MusicManager.h"
#include "ScreenSettings.h"
diff --git a/engines/crab/OptionMenu.cpp b/engines/crab/OptionMenu.cpp
index 591bb80b789..cb08af71076 100644
--- a/engines/crab/OptionMenu.cpp
+++ b/engines/crab/OptionMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "OptionMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/OptionSelect.cpp b/engines/crab/OptionSelect.cpp
index 40b051fbbe6..9ae70c8394b 100644
--- a/engines/crab/OptionSelect.cpp
+++ b/engines/crab/OptionSelect.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "OptionSelect.h"
diff --git a/engines/crab/ParagraphData.cpp b/engines/crab/ParagraphData.cpp
index 62e1b7f59d0..fc053b57d0b 100644
--- a/engines/crab/ParagraphData.cpp
+++ b/engines/crab/ParagraphData.cpp
@@ -29,7 +29,6 @@
*/
#include "ParagraphData.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 724a284c39d..132fc417928 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -29,7 +29,6 @@
*/
#include "PathfindingAgent.h"
-#include "stdafx.h"
PathfindingAgent::PathfindingAgent(void) : nodeQueue(compareNodes) {
grid = NULL;
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 94f7585c967..09ea474025f 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -29,7 +29,6 @@
*/
#include "PathfindingGraphNode.h"
-#include "stdafx.h"
PathfindingGraphNode::PathfindingGraphNode(void) {
id = -1;
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 5427b756919..aae80d577be 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -30,7 +30,6 @@
#include "PathfindingGrid.h"
#include "TMXMap.h"
-#include "stdafx.h"
using namespace TMX;
diff --git a/engines/crab/PauseMenu.cpp b/engines/crab/PauseMenu.cpp
index 457a066dc39..d5732c99e3b 100644
--- a/engines/crab/PauseMenu.cpp
+++ b/engines/crab/PauseMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "PauseMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/PersonHandler.cpp b/engines/crab/PersonHandler.cpp
index 613069aa419..b411a219e3b 100644
--- a/engines/crab/PersonHandler.cpp
+++ b/engines/crab/PersonHandler.cpp
@@ -29,7 +29,6 @@
*/
#include "PersonHandler.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/PersonScreen.cpp b/engines/crab/PersonScreen.cpp
index e86c3be286f..a278a4d7e59 100644
--- a/engines/crab/PersonScreen.cpp
+++ b/engines/crab/PersonScreen.cpp
@@ -29,7 +29,6 @@
*/
#include "PersonScreen.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index c84ffb44359..39007f5f563 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -29,7 +29,6 @@
*/
#include "Polygon.h"
-#include "stdafx.h"
// Calculate the distance between [minA, maxA] and [minB, maxB]
// The distance will be negative if the intervals overlap
diff --git a/engines/crab/PopUp.cpp b/engines/crab/PopUp.cpp
index 56dd60e28e0..0a9e1c89906 100644
--- a/engines/crab/PopUp.cpp
+++ b/engines/crab/PopUp.cpp
@@ -29,7 +29,6 @@
*/
#include "PopUp.h"
-#include "stdafx.h"
using namespace pyrodactyl::anim;
using namespace pyrodactyl::event;
diff --git a/engines/crab/ProgressBar.cpp b/engines/crab/ProgressBar.cpp
index 33e65922feb..1ea25b8c76a 100644
--- a/engines/crab/ProgressBar.cpp
+++ b/engines/crab/ProgressBar.cpp
@@ -29,7 +29,6 @@
*/
#include "ProgressBar.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/QuestText.cpp b/engines/crab/QuestText.cpp
index 1fe2c5a4dff..b65718dbbf0 100644
--- a/engines/crab/QuestText.cpp
+++ b/engines/crab/QuestText.cpp
@@ -29,7 +29,6 @@
*/
#include "QuestText.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 3ae9790789c..03b93157aa5 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -29,7 +29,6 @@
*/
#include "Rectangle.h"
-#include "stdafx.h"
bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const std::string &x_name, const std::string &y_name,
const std::string &w_name, const std::string &h_name) {
diff --git a/engines/crab/ReplyButton.cpp b/engines/crab/ReplyButton.cpp
index da36ad3d4fc..575a403fb00 100644
--- a/engines/crab/ReplyButton.cpp
+++ b/engines/crab/ReplyButton.cpp
@@ -29,7 +29,6 @@
*/
#include "ReplyButton.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/ReplyMenu.cpp b/engines/crab/ReplyMenu.cpp
index a4633b81a8f..8dc94834ea6 100644
--- a/engines/crab/ReplyMenu.cpp
+++ b/engines/crab/ReplyMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "ReplyMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/ResolutionMenu.cpp b/engines/crab/ResolutionMenu.cpp
index 53733610eb1..47e7adadddc 100644
--- a/engines/crab/ResolutionMenu.cpp
+++ b/engines/crab/ResolutionMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "ResolutionMenu.h"
diff --git a/engines/crab/SaveGameMenu.cpp b/engines/crab/SaveGameMenu.cpp
index eda25ecf6ff..629ec12be6c 100644
--- a/engines/crab/SaveGameMenu.cpp
+++ b/engines/crab/SaveGameMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "SaveGameMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::input;
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index dd2398b09f2..ba30e5d7d41 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -29,7 +29,6 @@
*/
#include "ScreenSettings.h"
-#include "stdafx.h"
// Our screen settings object
ScreenSettings gScreenSettings;
diff --git a/engines/crab/SectionHeader.cpp b/engines/crab/SectionHeader.cpp
index f35ef3302e0..3a4567ce1fa 100644
--- a/engines/crab/SectionHeader.cpp
+++ b/engines/crab/SectionHeader.cpp
@@ -29,7 +29,6 @@
*/
#include "SectionHeader.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index 67222e8db77..73b4f16cdbc 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -29,7 +29,6 @@
*/
#include "Shape.h"
-#include "stdafx.h"
void Shape::Load(rapidxml::xml_node<char> *node, const bool &echo) {
if (NodeValid("polygon", node, echo)) {
diff --git a/engines/crab/SlideShow.cpp b/engines/crab/SlideShow.cpp
index 8b73594c7b5..0c322185538 100644
--- a/engines/crab/SlideShow.cpp
+++ b/engines/crab/SlideShow.cpp
@@ -29,7 +29,6 @@
*/
#include "SlideShow.h"
-#include "stdafx.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/SpriteConstant.cpp b/engines/crab/SpriteConstant.cpp
index ee52a88e8cc..3a1ac25c36f 100644
--- a/engines/crab/SpriteConstant.cpp
+++ b/engines/crab/SpriteConstant.cpp
@@ -29,7 +29,6 @@
*/
#include "SpriteConstant.h"
-#include "stdafx.h"
using namespace pyrodactyl::ai;
diff --git a/engines/crab/Stairs.cpp b/engines/crab/Stairs.cpp
index 5ac90e4267a..cbe51f3c884 100644
--- a/engines/crab/Stairs.cpp
+++ b/engines/crab/Stairs.cpp
@@ -29,7 +29,6 @@
*/
#include "Stairs.h"
-#include "stdafx.h"
using namespace pyrodactyl::level;
diff --git a/engines/crab/Stat.cpp b/engines/crab/Stat.cpp
index 1b801655afe..672094fb501 100644
--- a/engines/crab/Stat.cpp
+++ b/engines/crab/Stat.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "Stat.h"
diff --git a/engines/crab/StatDrawHelper.cpp b/engines/crab/StatDrawHelper.cpp
index 19e915731b6..aa0d274a438 100644
--- a/engines/crab/StatDrawHelper.cpp
+++ b/engines/crab/StatDrawHelper.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "StatDrawHelper.h"
diff --git a/engines/crab/StatPreview.cpp b/engines/crab/StatPreview.cpp
index e7fdabab63a..f8ce0218106 100644
--- a/engines/crab/StatPreview.cpp
+++ b/engines/crab/StatPreview.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "StatPreview.h"
diff --git a/engines/crab/StatTemplate.cpp b/engines/crab/StatTemplate.cpp
index 319e8815afd..ae2abbac6c4 100644
--- a/engines/crab/StatTemplate.cpp
+++ b/engines/crab/StatTemplate.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "StatTemplate.h"
#include "XMLDoc.h"
diff --git a/engines/crab/StateButton.cpp b/engines/crab/StateButton.cpp
index 8968993babb..8a212db803e 100644
--- a/engines/crab/StateButton.cpp
+++ b/engines/crab/StateButton.cpp
@@ -29,7 +29,6 @@
*/
#include "StateButton.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/TMXLayer.cpp b/engines/crab/TMXLayer.cpp
index 8f0072dc8c4..958e73efbf4 100644
--- a/engines/crab/TMXLayer.cpp
+++ b/engines/crab/TMXLayer.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "TMXLayer.h"
diff --git a/engines/crab/TMXMap.cpp b/engines/crab/TMXMap.cpp
index a143579c491..a01a3239e24 100644
--- a/engines/crab/TMXMap.cpp
+++ b/engines/crab/TMXMap.cpp
@@ -31,7 +31,6 @@
#include "TMXMap.h"
#include "TextManager.h"
#include "collision.h"
-#include "stdafx.h"
using namespace TMX;
using namespace pyrodactyl::image;
diff --git a/engines/crab/TMXTileSet.cpp b/engines/crab/TMXTileSet.cpp
index 64f2b10987d..6d6379b1121 100644
--- a/engines/crab/TMXTileSet.cpp
+++ b/engines/crab/TMXTileSet.cpp
@@ -29,7 +29,6 @@
*/
#include "TMXTileSet.h"
-#include "stdafx.h"
// #include "TextManager.h"
using namespace TMX;
diff --git a/engines/crab/TextManager.cpp b/engines/crab/TextManager.cpp
index ba580fb5580..1bd69d9ca70 100644
--- a/engines/crab/TextManager.cpp
+++ b/engines/crab/TextManager.cpp
@@ -30,7 +30,6 @@
#include "TextManager.h"
#include "XMLDoc.h"
-#include "stdafx.h"
using namespace pyrodactyl::text;
diff --git a/engines/crab/ToggleButton.cpp b/engines/crab/ToggleButton.cpp
index 2d15bd0b26e..c969bdee2d7 100644
--- a/engines/crab/ToggleButton.cpp
+++ b/engines/crab/ToggleButton.cpp
@@ -29,7 +29,6 @@
*/
#include "ToggleButton.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/TraitButton.cpp b/engines/crab/TraitButton.cpp
index 011b1e9bcdd..bd4a3ba0f1b 100644
--- a/engines/crab/TraitButton.cpp
+++ b/engines/crab/TraitButton.cpp
@@ -29,7 +29,6 @@
*/
#include "TraitButton.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/TraitMenu.cpp b/engines/crab/TraitMenu.cpp
index 7347b77e58c..63a163564de 100644
--- a/engines/crab/TraitMenu.cpp
+++ b/engines/crab/TraitMenu.cpp
@@ -29,7 +29,6 @@
*/
#include "TraitMenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/animation.cpp b/engines/crab/animation.cpp
index 08963afd05f..c16807f0778 100644
--- a/engines/crab/animation.cpp
+++ b/engines/crab/animation.cpp
@@ -29,7 +29,6 @@
*/
#include "animation.h"
-#include "stdafx.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
diff --git a/engines/crab/animframe.cpp b/engines/crab/animframe.cpp
index ad1ffee2eaa..61ceedb6dbb 100644
--- a/engines/crab/animframe.cpp
+++ b/engines/crab/animframe.cpp
@@ -29,7 +29,6 @@
*/
#include "animframe.h"
-#include "stdafx.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/animset.cpp b/engines/crab/animset.cpp
index 94ee16710c4..69917ab52b2 100644
--- a/engines/crab/animset.cpp
+++ b/engines/crab/animset.cpp
@@ -29,7 +29,6 @@
*/
#include "animset.h"
-#include "stdafx.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index b2f1d008f99..3327ba45f6e 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -29,7 +29,6 @@
*/
#include "app.h"
-#include "stdafx.h"
bool App::Init() {
// Load all SDL subsystems and the TrueType font subsystem
diff --git a/engines/crab/button.cpp b/engines/crab/button.cpp
index d1a58ef2a06..bcdbeb13482 100644
--- a/engines/crab/button.cpp
+++ b/engines/crab/button.cpp
@@ -33,7 +33,6 @@
// Purpose: Contains the button functions
//=============================================================================
#include "button.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/collision.cpp b/engines/crab/collision.cpp
index b2163bdc38e..a6a7017fd14 100644
--- a/engines/crab/collision.cpp
+++ b/engines/crab/collision.cpp
@@ -29,7 +29,6 @@
*/
#include "collision.h"
-#include "stdafx.h"
// Find if a line and a rectangle intersect
bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect) {
diff --git a/engines/crab/color.cpp b/engines/crab/color.cpp
index c5eaab4da19..26ed6e1ad26 100644
--- a/engines/crab/color.cpp
+++ b/engines/crab/color.cpp
@@ -29,7 +29,6 @@
*/
#include "color.h"
-#include "stdafx.h"
using namespace pyrodactyl::text;
diff --git a/engines/crab/conversationdata.cpp b/engines/crab/conversationdata.cpp
index 13e41d97b0e..0519460f612 100644
--- a/engines/crab/conversationdata.cpp
+++ b/engines/crab/conversationdata.cpp
@@ -29,7 +29,6 @@
*/
#include "conversationdata.h"
-#include "stdafx.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/cursor.cpp b/engines/crab/cursor.cpp
index f5b03c69fa4..33a896f9f8a 100644
--- a/engines/crab/cursor.cpp
+++ b/engines/crab/cursor.cpp
@@ -33,7 +33,6 @@
// Purpose: Cursor class
//=============================================================================
#include "cursor.h"
-#include "stdafx.h"
namespace pyrodactyl {
namespace input {
diff --git a/engines/crab/dialogbox.cpp b/engines/crab/dialogbox.cpp
index 177edd167a3..834638a2ab9 100644
--- a/engines/crab/dialogbox.cpp
+++ b/engines/crab/dialogbox.cpp
@@ -33,7 +33,6 @@
// Purpose: Dialog box!
//=============================================================================
#include "dialogbox.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/effect.cpp b/engines/crab/effect.cpp
index 46547c6a0b0..38986d57248 100644
--- a/engines/crab/effect.cpp
+++ b/engines/crab/effect.cpp
@@ -30,7 +30,6 @@
#include "effect.h"
#include "MusicManager.h"
-#include "stdafx.h"
using namespace pyrodactyl::event;
using namespace pyrodactyl::music;
diff --git a/engines/crab/element.cpp b/engines/crab/element.cpp
index 0e1f56194c4..452bea9b1ea 100644
--- a/engines/crab/element.cpp
+++ b/engines/crab/element.cpp
@@ -29,7 +29,6 @@
*/
#include "element.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/emotion.cpp b/engines/crab/emotion.cpp
index 32848b6d130..9723f7ae51b 100644
--- a/engines/crab/emotion.cpp
+++ b/engines/crab/emotion.cpp
@@ -29,7 +29,6 @@
*/
#include "emotion.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
diff --git a/engines/crab/eventstore.cpp b/engines/crab/eventstore.cpp
index ca3e61bce38..47ea732a08e 100644
--- a/engines/crab/eventstore.cpp
+++ b/engines/crab/eventstore.cpp
@@ -29,7 +29,6 @@
*/
#include "eventstore.h"
-#include "stdafx.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/fightanim.cpp b/engines/crab/fightanim.cpp
index 15900df6ab3..80b2c3d6ea9 100644
--- a/engines/crab/fightanim.cpp
+++ b/engines/crab/fightanim.cpp
@@ -29,7 +29,6 @@
*/
#include "fightanim.h"
-#include "stdafx.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/fightinput.cpp b/engines/crab/fightinput.cpp
index ce6120086ab..ec4a67d7e08 100644
--- a/engines/crab/fightinput.cpp
+++ b/engines/crab/fightinput.cpp
@@ -29,7 +29,6 @@
*/
#include "fightinput.h"
-#include "stdafx.h"
using namespace pyrodactyl::input;
diff --git a/engines/crab/fightmove.cpp b/engines/crab/fightmove.cpp
index a7fdb7a05b3..2c8d0ca1454 100644
--- a/engines/crab/fightmove.cpp
+++ b/engines/crab/fightmove.cpp
@@ -29,7 +29,6 @@
*/
#include "fightmove.h"
-#include "stdafx.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/fightmoves.cpp b/engines/crab/fightmoves.cpp
index 259f1ef3350..5042fe9da55 100644
--- a/engines/crab/fightmoves.cpp
+++ b/engines/crab/fightmoves.cpp
@@ -29,7 +29,6 @@
*/
#include "fightmoves.h"
-#include "stdafx.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 3303d606623..0712fde336f 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -29,7 +29,6 @@
*/
#include "game.h"
-#include "stdafx.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::ui;
diff --git a/engines/crab/gameevent.cpp b/engines/crab/gameevent.cpp
index 85d06a7b2a5..9324da74de5 100644
--- a/engines/crab/gameevent.cpp
+++ b/engines/crab/gameevent.cpp
@@ -29,7 +29,6 @@
*/
#include "gameevent.h"
-#include "stdafx.h"
using namespace pyrodactyl::event;
using namespace pyrodactyl::people;
diff --git a/engines/crab/gameeventmanager.cpp b/engines/crab/gameeventmanager.cpp
index 58537ca5187..580491cddfc 100644
--- a/engines/crab/gameeventmanager.cpp
+++ b/engines/crab/gameeventmanager.cpp
@@ -29,7 +29,6 @@
*/
#include "gameeventmanager.h"
-#include "stdafx.h"
using namespace pyrodactyl::people;
using namespace pyrodactyl::event;
diff --git a/engines/crab/hotkey.cpp b/engines/crab/hotkey.cpp
index 47c1e96ce4a..15ee554f440 100644
--- a/engines/crab/hotkey.cpp
+++ b/engines/crab/hotkey.cpp
@@ -29,7 +29,6 @@
*/
#include "hotkey.h"
-#include "stdafx.h"
using namespace pyrodactyl::input;
diff --git a/engines/crab/hud.cpp b/engines/crab/hud.cpp
index 110b76c3a1c..d01f94fc7d8 100644
--- a/engines/crab/hud.cpp
+++ b/engines/crab/hud.cpp
@@ -33,7 +33,6 @@
// Purpose: The tray where you have inventory, map and GameObjectives icons
//=============================================================================
#include "hud.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/imageeffect.cpp b/engines/crab/imageeffect.cpp
index 40e54d48884..fe7caa045fd 100644
--- a/engines/crab/imageeffect.cpp
+++ b/engines/crab/imageeffect.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "imageeffect.h"
diff --git a/engines/crab/input.cpp b/engines/crab/input.cpp
index 845b0d60709..4f54d290e9d 100644
--- a/engines/crab/input.cpp
+++ b/engines/crab/input.cpp
@@ -29,7 +29,6 @@
*/
#include "input.h"
-#include "stdafx.h"
namespace pyrodactyl {
namespace input {
diff --git a/engines/crab/inputval.cpp b/engines/crab/inputval.cpp
index 30537789d1f..7858fe737c5 100644
--- a/engines/crab/inputval.cpp
+++ b/engines/crab/inputval.cpp
@@ -29,7 +29,6 @@
*/
#include "inputval.h"
-#include "stdafx.h"
using namespace pyrodactyl::input;
diff --git a/engines/crab/journal.cpp b/engines/crab/journal.cpp
index a5a82c7cede..22299cdf98e 100644
--- a/engines/crab/journal.cpp
+++ b/engines/crab/journal.cpp
@@ -29,7 +29,6 @@
*/
#include "journal.h"
-#include "stdafx.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::ui;
diff --git a/engines/crab/level.cpp b/engines/crab/level.cpp
index 009e3aac280..5b1659e90f0 100644
--- a/engines/crab/level.cpp
+++ b/engines/crab/level.cpp
@@ -29,7 +29,6 @@
*/
#include "level.h"
-#include "stdafx.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_ai.cpp b/engines/crab/level_ai.cpp
index 85ab9861467..643c21950ec 100644
--- a/engines/crab/level_ai.cpp
+++ b/engines/crab/level_ai.cpp
@@ -29,7 +29,6 @@
*/
#include "level.h"
-#include "stdafx.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_collide.cpp b/engines/crab/level_collide.cpp
index e6f7e67845f..f11d31402a0 100644
--- a/engines/crab/level_collide.cpp
+++ b/engines/crab/level_collide.cpp
@@ -29,7 +29,6 @@
*/
#include "level.h"
-#include "stdafx.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_draw.cpp b/engines/crab/level_draw.cpp
index 5791d464dbb..8e65e7305a8 100644
--- a/engines/crab/level_draw.cpp
+++ b/engines/crab/level_draw.cpp
@@ -29,7 +29,6 @@
*/
#include "level.h"
-#include "stdafx.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_load.cpp b/engines/crab/level_load.cpp
index 13d5751d5d2..ca2654fb953 100644
--- a/engines/crab/level_load.cpp
+++ b/engines/crab/level_load.cpp
@@ -29,7 +29,6 @@
*/
#include "level.h"
-#include "stdafx.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_objects.cpp b/engines/crab/level_objects.cpp
index 2eb04307c5e..183399e92fb 100644
--- a/engines/crab/level_objects.cpp
+++ b/engines/crab/level_objects.cpp
@@ -29,7 +29,6 @@
*/
#include "level_objects.h"
-#include "stdafx.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::level;
diff --git a/engines/crab/main.cpp b/engines/crab/main.cpp
index e249f5412d0..14af0cdecac 100644
--- a/engines/crab/main.cpp
+++ b/engines/crab/main.cpp
@@ -29,7 +29,6 @@
*/
#include "app.h"
-#include "stdafx.h"
int WinMain(int argc, char *args[]) {
App app;
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index fdf95e8675c..9990248b714 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -29,7 +29,6 @@
*/
#include "mainmenu.h"
-#include "stdafx.h"
#include "url.h"
using namespace pyrodactyl::music;
diff --git a/engines/crab/map.cpp b/engines/crab/map.cpp
index 5b5859d483c..969aa962cd4 100644
--- a/engines/crab/map.cpp
+++ b/engines/crab/map.cpp
@@ -29,7 +29,6 @@
*/
#include "map.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/moveeffect.cpp b/engines/crab/moveeffect.cpp
index e69a9e943f7..fb1f368b576 100644
--- a/engines/crab/moveeffect.cpp
+++ b/engines/crab/moveeffect.cpp
@@ -29,7 +29,6 @@
*/
#include "moveeffect.h"
-#include "stdafx.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/movement.cpp b/engines/crab/movement.cpp
index 1357741b298..04dd0f1dd77 100644
--- a/engines/crab/movement.cpp
+++ b/engines/crab/movement.cpp
@@ -29,7 +29,6 @@
*/
#include "movement.h"
-#include "stdafx.h"
using namespace pyrodactyl::ai;
diff --git a/engines/crab/opinion.cpp b/engines/crab/opinion.cpp
index 8b0f790ebac..502a378fe20 100644
--- a/engines/crab/opinion.cpp
+++ b/engines/crab/opinion.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "opinion.h"
diff --git a/engines/crab/person.cpp b/engines/crab/person.cpp
index a6bd9fe5f1f..ba3a545ef16 100644
--- a/engines/crab/person.cpp
+++ b/engines/crab/person.cpp
@@ -29,7 +29,6 @@
*/
#include "person.h"
-#include "stdafx.h"
using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
diff --git a/engines/crab/personbase.cpp b/engines/crab/personbase.cpp
index 631cad57159..18cfafb3383 100644
--- a/engines/crab/personbase.cpp
+++ b/engines/crab/personbase.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "personbase.h"
diff --git a/engines/crab/quest.cpp b/engines/crab/quest.cpp
index 4a71079d54d..94179e18739 100644
--- a/engines/crab/quest.cpp
+++ b/engines/crab/quest.cpp
@@ -29,7 +29,6 @@
*/
#include "quest.h"
-#include "stdafx.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/questmenu.cpp b/engines/crab/questmenu.cpp
index a6cbc6e1a31..c9ada6be319 100644
--- a/engines/crab/questmenu.cpp
+++ b/engines/crab/questmenu.cpp
@@ -29,7 +29,6 @@
*/
#include "questmenu.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
diff --git a/engines/crab/slider.cpp b/engines/crab/slider.cpp
index a6f5323a36c..72f71491b6f 100644
--- a/engines/crab/slider.cpp
+++ b/engines/crab/slider.cpp
@@ -29,7 +29,6 @@
*/
#include "slider.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 05a6995f946..ae44a989a85 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
//=============================================================================
// Author: Arvind
diff --git a/engines/crab/sprite.cpp b/engines/crab/sprite.cpp
index 3f859f67ad1..3653de168f6 100644
--- a/engines/crab/sprite.cpp
+++ b/engines/crab/sprite.cpp
@@ -29,7 +29,6 @@
*/
#include "sprite.h"
-#include "stdafx.h"
using namespace pyrodactyl::ai;
using namespace pyrodactyl::anim;
diff --git a/engines/crab/spriteai.cpp b/engines/crab/spriteai.cpp
index 68989fdda72..f0965729e68 100644
--- a/engines/crab/spriteai.cpp
+++ b/engines/crab/spriteai.cpp
@@ -29,7 +29,6 @@
*/
#include "sprite.h"
-#include "stdafx.h"
using namespace pyrodactyl::anim;
using namespace pyrodactyl::ai;
diff --git a/engines/crab/stdafx.cpp b/engines/crab/stdafx.cpp
deleted file mode 100644
index 22ccd88e7df..00000000000
--- a/engines/crab/stdafx.cpp
+++ /dev/null
@@ -1,31 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#include "stdafx.h"
diff --git a/engines/crab/stdafx.h b/engines/crab/stdafx.h
deleted file mode 100644
index 421ade1d99f..00000000000
--- a/engines/crab/stdafx.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#ifndef CRAB_STDAFX_H
-#define CRAB_STDAFX_H
-#include "common_header.h"
-
-#endif // CRAB_STDAFX_H
diff --git a/engines/crab/talknotify.cpp b/engines/crab/talknotify.cpp
index 189405e63ec..bc330212720 100644
--- a/engines/crab/talknotify.cpp
+++ b/engines/crab/talknotify.cpp
@@ -29,7 +29,6 @@
*/
#include "talknotify.h"
-#include "stdafx.h"
using namespace pyrodactyl::text;
using namespace pyrodactyl::level;
diff --git a/engines/crab/textarea.cpp b/engines/crab/textarea.cpp
index 80930308c5e..2ad5d9be4fb 100644
--- a/engines/crab/textarea.cpp
+++ b/engines/crab/textarea.cpp
@@ -33,7 +33,6 @@
// Purpose: TextArea functions
//=============================================================================
#include "textarea.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/textdata.cpp b/engines/crab/textdata.cpp
index 0d358119bae..24a84bfea2f 100644
--- a/engines/crab/textdata.cpp
+++ b/engines/crab/textdata.cpp
@@ -29,7 +29,6 @@
*/
#include "TextData.h"
-#include "stdafx.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index 07f57a60d85..0d4131eca6d 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
//=============================================================================
// Author: Arvind
diff --git a/engines/crab/trait.cpp b/engines/crab/trait.cpp
index 4ea608d092e..a9a975e13d1 100644
--- a/engines/crab/trait.cpp
+++ b/engines/crab/trait.cpp
@@ -29,7 +29,6 @@
*/
#include "trait.h"
-#include "stdafx.h"
using namespace pyrodactyl::people;
diff --git a/engines/crab/trigger.cpp b/engines/crab/trigger.cpp
index 7e7879ea1cc..8af68550727 100644
--- a/engines/crab/trigger.cpp
+++ b/engines/crab/trigger.cpp
@@ -29,7 +29,6 @@
*/
#include "trigger.h"
-#include "stdafx.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/triggerset.cpp b/engines/crab/triggerset.cpp
index a53d7f85672..9bac2bb8cb8 100644
--- a/engines/crab/triggerset.cpp
+++ b/engines/crab/triggerset.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "triggerset.h"
diff --git a/engines/crab/url.cpp b/engines/crab/url.cpp
index 3b3f4cc1c46..3241e83c6f2 100644
--- a/engines/crab/url.cpp
+++ b/engines/crab/url.cpp
@@ -29,7 +29,6 @@
*/
#include "url.h"
-#include "stdafx.h"
#ifdef __WIN32__
#include <ShellAPI.h>
diff --git a/engines/crab/walkframes.cpp b/engines/crab/walkframes.cpp
index 30dfe0f5804..25445d0de40 100644
--- a/engines/crab/walkframes.cpp
+++ b/engines/crab/walkframes.cpp
@@ -28,7 +28,6 @@
*
*/
-#include "stdafx.h"
#include "walkframes.h"
Commit: 92f7422a600e54df4e3e27030f249419ee8a6aa6
https://github.com/scummvm/scummvm/commit/92f7422a600e54df4e3e27030f249419ee8a6aa6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: fix includes to have engine path
Changed paths:
engines/crab/AlphaImage.cpp
engines/crab/AlphaImage.h
engines/crab/AnimationEffect.h
engines/crab/AnimationFrame.cpp
engines/crab/AnimationFrame.h
engines/crab/Caption.cpp
engines/crab/Caption.h
engines/crab/ChapterIntro.cpp
engines/crab/ChapterIntro.h
engines/crab/ClipButton.cpp
engines/crab/ClipButton.h
engines/crab/CreditScreen.cpp
engines/crab/CreditScreen.h
engines/crab/DevConsole.cpp
engines/crab/DevConsole.h
engines/crab/EventSeqGroup.cpp
engines/crab/EventSeqGroup.h
engines/crab/EventSequence.cpp
engines/crab/EventSequence.h
engines/crab/FileData.cpp
engines/crab/FileData.h
engines/crab/FileMenu.cpp
engines/crab/FileMenu.h
engines/crab/GameClock.h
engines/crab/GameEventInfo.cpp
engines/crab/GameEventInfo.h
engines/crab/GameOverMenu.cpp
engines/crab/GameOverMenu.h
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/GeneralSettingMenu.cpp
engines/crab/GeneralSettingMenu.h
engines/crab/GfxSettingMenu.cpp
engines/crab/GfxSettingMenu.h
engines/crab/HealthIndicator.cpp
engines/crab/HealthIndicator.h
engines/crab/HoverInfo.cpp
engines/crab/HoverInfo.h
engines/crab/Image.cpp
engines/crab/Image.h
engines/crab/ImageData.cpp
engines/crab/ImageData.h
engines/crab/ImageManager.cpp
engines/crab/ImageManager.h
engines/crab/Inventory.cpp
engines/crab/Inventory.h
engines/crab/Item.cpp
engines/crab/Item.h
engines/crab/ItemCollection.cpp
engines/crab/ItemCollection.h
engines/crab/ItemDesc.h
engines/crab/ItemMenu.cpp
engines/crab/ItemMenu.h
engines/crab/ItemSlot.cpp
engines/crab/ItemSlot.h
engines/crab/KeyBindMenu.cpp
engines/crab/KeyBindMenu.h
engines/crab/LevelExit.cpp
engines/crab/LevelExit.h
engines/crab/LevelResult.h
engines/crab/Line.cpp
engines/crab/Line.h
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/MapData.cpp
engines/crab/MapData.h
engines/crab/MapMarkerMenu.cpp
engines/crab/MapMarkerMenu.h
engines/crab/ModMenu.cpp
engines/crab/ModMenu.h
engines/crab/MusicArea.cpp
engines/crab/MusicArea.h
engines/crab/MusicManager.cpp
engines/crab/MusicManager.h
engines/crab/OptionMenu.cpp
engines/crab/OptionMenu.h
engines/crab/OptionSelect.cpp
engines/crab/OptionSelect.h
engines/crab/PageMenu.h
engines/crab/ParagraphData.cpp
engines/crab/ParagraphData.h
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGraphNode.h
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/PauseMenu.cpp
engines/crab/PauseMenu.h
engines/crab/PersonHandler.cpp
engines/crab/PersonHandler.h
engines/crab/PersonScreen.cpp
engines/crab/PersonScreen.h
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/PopUp.cpp
engines/crab/PopUp.h
engines/crab/ProgressBar.cpp
engines/crab/ProgressBar.h
engines/crab/QuestText.cpp
engines/crab/QuestText.h
engines/crab/RadioButton.h
engines/crab/RadioButtonMenu.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/ReplyButton.cpp
engines/crab/ReplyButton.h
engines/crab/ReplyMenu.cpp
engines/crab/ReplyMenu.h
engines/crab/ResolutionMenu.cpp
engines/crab/ResolutionMenu.h
engines/crab/SaveGameMenu.cpp
engines/crab/SaveGameMenu.h
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/SectionHeader.cpp
engines/crab/SectionHeader.h
engines/crab/Shape.cpp
engines/crab/Shape.h
engines/crab/SlideShow.cpp
engines/crab/SlideShow.h
engines/crab/SpriteConstant.cpp
engines/crab/SpriteConstant.h
engines/crab/Stairs.cpp
engines/crab/Stairs.h
engines/crab/Stat.cpp
engines/crab/Stat.h
engines/crab/StatDrawHelper.cpp
engines/crab/StatDrawHelper.h
engines/crab/StatPreview.cpp
engines/crab/StatPreview.h
engines/crab/StatTemplate.cpp
engines/crab/StatTemplate.h
engines/crab/StateButton.cpp
engines/crab/StateButton.h
engines/crab/TMXLayer.cpp
engines/crab/TMXLayer.h
engines/crab/TMXMap.cpp
engines/crab/TMXMap.h
engines/crab/TMXTileSet.cpp
engines/crab/TMXTileSet.h
engines/crab/TextData.h
engines/crab/TextManager.cpp
engines/crab/TextManager.h
engines/crab/TileInfo.h
engines/crab/ToggleButton.cpp
engines/crab/ToggleButton.h
engines/crab/TraitButton.cpp
engines/crab/TraitButton.h
engines/crab/TraitMenu.cpp
engines/crab/TraitMenu.h
engines/crab/XMLDoc.cpp
engines/crab/XMLDoc.h
engines/crab/animation.cpp
engines/crab/animframe.cpp
engines/crab/animframe.h
engines/crab/animset.cpp
engines/crab/animset.h
engines/crab/app.cpp
engines/crab/app.h
engines/crab/bonus.h
engines/crab/button.cpp
engines/crab/button.h
engines/crab/changeval.h
engines/crab/collision.cpp
engines/crab/collision.h
engines/crab/color.cpp
engines/crab/color.h
engines/crab/common_header.h
engines/crab/conversationdata.cpp
engines/crab/conversationdata.h
engines/crab/crab.cpp
engines/crab/cursor.cpp
engines/crab/cursor.h
engines/crab/dialogbox.cpp
engines/crab/dialogbox.h
engines/crab/effect.cpp
engines/crab/effect.h
engines/crab/element.cpp
engines/crab/element.h
engines/crab/emotion.cpp
engines/crab/emotion.h
engines/crab/eventstore.cpp
engines/crab/eventstore.h
engines/crab/fightanim.cpp
engines/crab/fightanim.h
engines/crab/fightinput.cpp
engines/crab/fightinput.h
engines/crab/fightmove.cpp
engines/crab/fightmove.h
engines/crab/fightmoves.cpp
engines/crab/fightmoves.h
engines/crab/filesystem.cpp
engines/crab/filesystem.h
engines/crab/fm_ai_data.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gameevent.cpp
engines/crab/gameevent.h
engines/crab/gameeventmanager.cpp
engines/crab/gameeventmanager.h
engines/crab/gamestate_container.h
engines/crab/gamestates.h
engines/crab/hotkey.cpp
engines/crab/hotkey.h
engines/crab/hud.cpp
engines/crab/hud.h
engines/crab/imageeffect.cpp
engines/crab/imageeffect.h
engines/crab/input.cpp
engines/crab/input.h
engines/crab/inputval.cpp
engines/crab/inputval.h
engines/crab/journal.cpp
engines/crab/journal.h
engines/crab/level.cpp
engines/crab/level.h
engines/crab/level_ai.cpp
engines/crab/level_collide.cpp
engines/crab/level_draw.cpp
engines/crab/level_load.cpp
engines/crab/level_objects.cpp
engines/crab/level_objects.h
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/main.cpp
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/map.cpp
engines/crab/map.h
engines/crab/mapbutton.h
engines/crab/menu.h
engines/crab/moveeffect.cpp
engines/crab/moveeffect.h
engines/crab/movement.cpp
engines/crab/movement.h
engines/crab/musicparam.h
engines/crab/numstr.h
engines/crab/opinion.cpp
engines/crab/opinion.h
engines/crab/person.cpp
engines/crab/person.h
engines/crab/personbase.h
engines/crab/quest.cpp
engines/crab/quest.h
engines/crab/questmenu.cpp
engines/crab/questmenu.h
engines/crab/range.h
engines/crab/shadow.h
engines/crab/slider.cpp
engines/crab/slider.h
engines/crab/splash.cpp
engines/crab/splash.h
engines/crab/sprite.cpp
engines/crab/sprite.h
engines/crab/spriteai.cpp
engines/crab/spriteai.h
engines/crab/talknotify.cpp
engines/crab/talknotify.h
engines/crab/textarea.cpp
engines/crab/textarea.h
engines/crab/textdata.cpp
engines/crab/timer.cpp
engines/crab/timer.h
engines/crab/trait.cpp
engines/crab/trait.h
engines/crab/trigger.cpp
engines/crab/trigger.h
engines/crab/triggerset.cpp
engines/crab/triggerset.h
engines/crab/url.cpp
engines/crab/vectors.h
engines/crab/walkframes.cpp
engines/crab/walkframes.h
diff --git a/engines/crab/AlphaImage.cpp b/engines/crab/AlphaImage.cpp
index 3bbcde4501a..e08f89b6db8 100644
--- a/engines/crab/AlphaImage.cpp
+++ b/engines/crab/AlphaImage.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "AlphaImage.h"
-#include "TextManager.h"
+#include "crab/AlphaImage.h"
+#include "crab/TextManager.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/AlphaImage.h b/engines/crab/AlphaImage.h
index e5ae1a4ebf6..5a84913ea95 100644
--- a/engines/crab/AlphaImage.h
+++ b/engines/crab/AlphaImage.h
@@ -31,9 +31,9 @@
#ifndef CRAB_ALPHAIMAGE_H
#define CRAB_ALPHAIMAGE_H
-#include "ImageManager.h"
-#include "common_header.h"
-#include "element.h"
+#include "crab/ImageManager.h"
+#include "crab/common_header.h"
+#include "crab/element.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/AnimationEffect.h b/engines/crab/AnimationEffect.h
index a78105ffb5f..c294463032f 100644
--- a/engines/crab/AnimationEffect.h
+++ b/engines/crab/AnimationEffect.h
@@ -31,8 +31,8 @@
#ifndef CRAB_ANIMATIONEFFECT_H
#define CRAB_ANIMATIONEFFECT_H
-#include "common_header.h"
-#include "loaders.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/AnimationFrame.cpp b/engines/crab/AnimationFrame.cpp
index e462633fe1d..b09ddc172ec 100644
--- a/engines/crab/AnimationFrame.cpp
+++ b/engines/crab/AnimationFrame.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "AnimationFrame.h"
+#include "crab/AnimationFrame.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
diff --git a/engines/crab/AnimationFrame.h b/engines/crab/AnimationFrame.h
index ceb7b8708bc..a8ee74bc469 100644
--- a/engines/crab/AnimationFrame.h
+++ b/engines/crab/AnimationFrame.h
@@ -31,11 +31,11 @@
#ifndef CRAB_ANIMATIONFRAME_H
#define CRAB_ANIMATIONFRAME_H
-#include "AnimationEffect.h"
-#include "HoverInfo.h"
-#include "ImageManager.h"
-#include "TextManager.h"
-#include "common_header.h"
+#include "crab/AnimationEffect.h"
+#include "crab/HoverInfo.h"
+#include "crab/ImageManager.h"
+#include "crab/TextManager.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/Caption.cpp b/engines/crab/Caption.cpp
index 7c1314a8516..c83ed82331e 100644
--- a/engines/crab/Caption.cpp
+++ b/engines/crab/Caption.cpp
@@ -29,7 +29,7 @@
*/
-#include "Caption.h"
+#include "crab/Caption.h"
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
diff --git a/engines/crab/Caption.h b/engines/crab/Caption.h
index 617452070a4..faef16da380 100644
--- a/engines/crab/Caption.h
+++ b/engines/crab/Caption.h
@@ -30,9 +30,9 @@
#ifndef CRAB_CAPTION_H
#define CRAB_CAPTION_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "TextData.h"
+#include "crab/TextData.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ChapterIntro.cpp b/engines/crab/ChapterIntro.cpp
index a0f1ed4e4d9..3152f2cc3b1 100644
--- a/engines/crab/ChapterIntro.cpp
+++ b/engines/crab/ChapterIntro.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ChapterIntro.h"
+#include "crab/ChapterIntro.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/ChapterIntro.h b/engines/crab/ChapterIntro.h
index 52879d274be..38238fa7060 100644
--- a/engines/crab/ChapterIntro.h
+++ b/engines/crab/ChapterIntro.h
@@ -31,10 +31,10 @@
#ifndef CRAB_CHAPTERINTRO_H
#define CRAB_CHAPTERINTRO_H
-#include "GameEventInfo.h"
-#include "button.h"
-#include "dialogbox.h"
-#include "sprite.h"
+#include "crab/GameEventInfo.h"
+#include "crab/button.h"
+#include "crab/dialogbox.h"
+#include "crab/sprite.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ClipButton.cpp b/engines/crab/ClipButton.cpp
index c747760e1c8..53775d70d52 100644
--- a/engines/crab/ClipButton.cpp
+++ b/engines/crab/ClipButton.cpp
@@ -29,7 +29,7 @@
*/
-#include "ClipButton.h"
+#include "crab/ClipButton.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/ClipButton.h b/engines/crab/ClipButton.h
index 0933ea3cc09..addc773e076 100644
--- a/engines/crab/ClipButton.h
+++ b/engines/crab/ClipButton.h
@@ -30,8 +30,8 @@
#ifndef CRAB_CLIPBUTTON_H
#define CRAB_CLIPBUTTON_H
-#include "button.h"
-#include "common_header.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/CreditScreen.cpp b/engines/crab/CreditScreen.cpp
index 20a7bf8ad8a..45804947ddf 100644
--- a/engines/crab/CreditScreen.cpp
+++ b/engines/crab/CreditScreen.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "CreditScreen.h"
-#include "url.h"
+#include "crab/CreditScreen.h"
+#include "crab/url.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/CreditScreen.h b/engines/crab/CreditScreen.h
index 25729717c5e..74063dcb51c 100644
--- a/engines/crab/CreditScreen.h
+++ b/engines/crab/CreditScreen.h
@@ -31,12 +31,12 @@
#ifndef CRAB_CREDITSCREEN_H
#define CRAB_CREDITSCREEN_H
-#include "ImageData.h"
-#include "TextData.h"
-#include "TextManager.h"
-#include "button.h"
-#include "common_header.h"
-#include "timer.h"
+#include "crab/ImageData.h"
+#include "crab/TextData.h"
+#include "crab/TextManager.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
+#include "crab/timer.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/DevConsole.cpp b/engines/crab/DevConsole.cpp
index 6bf333e6fa5..361c5d44660 100644
--- a/engines/crab/DevConsole.cpp
+++ b/engines/crab/DevConsole.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "DevConsole.h"
+#include "crab/DevConsole.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/DevConsole.h b/engines/crab/DevConsole.h
index e2635dde6e6..aefd86ec2ce 100644
--- a/engines/crab/DevConsole.h
+++ b/engines/crab/DevConsole.h
@@ -31,9 +31,9 @@
#ifndef CRAB_DEVCONSOLE_H
#define CRAB_DEVCONSOLE_H
-#include "GameEventInfo.h"
-#include "common_header.h"
-#include "textarea.h"
+#include "crab/GameEventInfo.h"
+#include "crab/common_header.h"
+#include "crab/textarea.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/EventSeqGroup.cpp b/engines/crab/EventSeqGroup.cpp
index 722261396ec..43e6b5d6820 100644
--- a/engines/crab/EventSeqGroup.cpp
+++ b/engines/crab/EventSeqGroup.cpp
@@ -29,7 +29,7 @@
*/
-#include "EventSeqGroup.h"
+#include "crab/EventSeqGroup.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/EventSeqGroup.h b/engines/crab/EventSeqGroup.h
index 0d4d4fc4420..06d15971e09 100644
--- a/engines/crab/EventSeqGroup.h
+++ b/engines/crab/EventSeqGroup.h
@@ -30,9 +30,9 @@
#ifndef CRAB_EVENTSEQGROUP_H
#define CRAB_EVENTSEQGROUP_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "EventSequence.h"
+#include "crab/EventSequence.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/EventSequence.cpp b/engines/crab/EventSequence.cpp
index 879a9178cef..37ae336b15e 100644
--- a/engines/crab/EventSequence.cpp
+++ b/engines/crab/EventSequence.cpp
@@ -29,7 +29,7 @@
*/
-#include "EventSequence.h"
+#include "crab/EventSequence.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/EventSequence.h b/engines/crab/EventSequence.h
index 4542bd3a1c3..8db93e24943 100644
--- a/engines/crab/EventSequence.h
+++ b/engines/crab/EventSequence.h
@@ -30,13 +30,13 @@
#ifndef CRAB_EVENTSEQUENCE_H
#define CRAB_EVENTSEQUENCE_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "GameEventInfo.h"
-#include "ImageManager.h"
-#include "Inventory.h"
-#include "gameevent.h"
-#include "journal.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ImageManager.h"
+#include "crab/Inventory.h"
+#include "crab/gameevent.h"
+#include "crab/journal.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/FileData.cpp b/engines/crab/FileData.cpp
index 02f2706ffe2..8fd1b8a3491 100644
--- a/engines/crab/FileData.cpp
+++ b/engines/crab/FileData.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "FileData.h"
+#include "crab/FileData.h"
#include <iomanip>
using namespace pyrodactyl::ui;
diff --git a/engines/crab/FileData.h b/engines/crab/FileData.h
index d0c01932b68..2d31152bf9d 100644
--- a/engines/crab/FileData.h
+++ b/engines/crab/FileData.h
@@ -31,9 +31,9 @@
#ifndef CRAB_FILEDATA_H
#define CRAB_FILEDATA_H
-#include "XMLDoc.h"
-#include "common_header.h"
-#include "loaders.h"
+#include "crab/XMLDoc.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/FileMenu.cpp b/engines/crab/FileMenu.cpp
index 177081efb31..b1cd6800b0d 100644
--- a/engines/crab/FileMenu.cpp
+++ b/engines/crab/FileMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "FileMenu.h"
+#include "crab/FileMenu.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/FileMenu.h b/engines/crab/FileMenu.h
index ac283f6b303..e8742035faf 100644
--- a/engines/crab/FileMenu.h
+++ b/engines/crab/FileMenu.h
@@ -31,11 +31,11 @@
#ifndef CRAB_FILEMENU_H
#define CRAB_FILEMENU_H
-#include "FileData.h"
-#include "ImageData.h"
-#include "PageMenu.h"
-#include "TextData.h"
-#include "common_header.h"
+#include "crab/FileData.h"
+#include "crab/ImageData.h"
+#include "crab/PageMenu.h"
+#include "crab/TextData.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 77fc9e68d47..a9e6b20ecfd 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -31,8 +31,8 @@
#ifndef CRAB_GAMECLOCK_H
#define CRAB_GAMECLOCK_H
-#include "common_header.h"
-#include "timer.h"
+#include "crab/common_header.h"
+#include "crab/timer.h"
class GameClock {
Timer timer;
diff --git a/engines/crab/GameEventInfo.cpp b/engines/crab/GameEventInfo.cpp
index 7ec62b5d790..60422a3f7a2 100644
--- a/engines/crab/GameEventInfo.cpp
+++ b/engines/crab/GameEventInfo.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "GameEventInfo.h"
-#include "eventstore.h"
+#include "crab/GameEventInfo.h"
+#include "crab/eventstore.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/GameEventInfo.h b/engines/crab/GameEventInfo.h
index fbac425f8ba..d747f82d839 100644
--- a/engines/crab/GameEventInfo.h
+++ b/engines/crab/GameEventInfo.h
@@ -31,11 +31,11 @@
#ifndef CRAB_GAMEEVENTINFO_H
#define CRAB_GAMEEVENTINFO_H
-#include "Inventory.h"
-#include "StatTemplate.h"
-#include "common_header.h"
-#include "journal.h"
-#include "person.h"
+#include "crab/Inventory.h"
+#include "crab/StatTemplate.h"
+#include "crab/common_header.h"
+#include "crab/journal.h"
+#include "crab/person.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/GameOverMenu.cpp b/engines/crab/GameOverMenu.cpp
index bac911bd498..51b1d2e43e0 100644
--- a/engines/crab/GameOverMenu.cpp
+++ b/engines/crab/GameOverMenu.cpp
@@ -29,7 +29,7 @@
*/
-#include "GameOverMenu.h"
+#include "crab/GameOverMenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/GameOverMenu.h b/engines/crab/GameOverMenu.h
index b9c4c4950ca..a1de1f8ff1d 100644
--- a/engines/crab/GameOverMenu.h
+++ b/engines/crab/GameOverMenu.h
@@ -31,10 +31,10 @@
#ifndef CRAB_GAMEOVERMENU_H
#define CRAB_GAMEOVERMENU_H
-#include "ImageData.h"
-#include "TextData.h"
-#include "common_header.h"
-#include "menu.h"
+#include "crab/ImageData.h"
+#include "crab/TextData.h"
+#include "crab/common_header.h"
+#include "crab/menu.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index 1400ad8795e..3a968c8c83e 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "GameParam.h"
+#include "crab/GameParam.h"
// Temporary values go here
TempValue gTemp;
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index abecf18aa75..a341c7c0bdf 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -31,9 +31,9 @@
#ifndef CRAB_GAMEPARAM_H
#define CRAB_GAMEPARAM_H
-#include "XMLDoc.h"
-#include "common_header.h"
-#include "loaders.h"
+#include "crab/XMLDoc.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
// The index for all levels in the game
struct LevelPath {
diff --git a/engines/crab/GeneralSettingMenu.cpp b/engines/crab/GeneralSettingMenu.cpp
index 234899a278e..aaa1db9d4a5 100644
--- a/engines/crab/GeneralSettingMenu.cpp
+++ b/engines/crab/GeneralSettingMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "GeneralSettingMenu.h"
+#include "crab/GeneralSettingMenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::music;
diff --git a/engines/crab/GeneralSettingMenu.h b/engines/crab/GeneralSettingMenu.h
index 7e4ae1c29df..55545a99f6d 100644
--- a/engines/crab/GeneralSettingMenu.h
+++ b/engines/crab/GeneralSettingMenu.h
@@ -31,10 +31,10 @@
#ifndef CRAB_GENERALSETTINGMENU_H
#define CRAB_GENERALSETTINGMENU_H
-#include "RadioButtonMenu.h"
-#include "ToggleButton.h"
-#include "common_header.h"
-#include "slider.h"
+#include "crab/RadioButtonMenu.h"
+#include "crab/ToggleButton.h"
+#include "crab/common_header.h"
+#include "crab/slider.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/GfxSettingMenu.cpp b/engines/crab/GfxSettingMenu.cpp
index 3a2d95f16ca..ee396ccb340 100644
--- a/engines/crab/GfxSettingMenu.cpp
+++ b/engines/crab/GfxSettingMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "GfxSettingMenu.h"
+#include "crab/GfxSettingMenu.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/GfxSettingMenu.h b/engines/crab/GfxSettingMenu.h
index 79a4eb5b48f..891a7f202e8 100644
--- a/engines/crab/GfxSettingMenu.h
+++ b/engines/crab/GfxSettingMenu.h
@@ -31,12 +31,12 @@
#ifndef CRAB_GFXSETTINGMENU_H
#define CRAB_GFXSETTINGMENU_H
-#include "ImageData.h"
-#include "ResolutionMenu.h"
-#include "StateButton.h"
-#include "ToggleButton.h"
-#include "common_header.h"
-#include "slider.h"
+#include "crab/ImageData.h"
+#include "crab/ResolutionMenu.h"
+#include "crab/StateButton.h"
+#include "crab/ToggleButton.h"
+#include "crab/common_header.h"
+#include "crab/slider.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/HealthIndicator.cpp b/engines/crab/HealthIndicator.cpp
index 1910c3720e3..22cd679bd1c 100644
--- a/engines/crab/HealthIndicator.cpp
+++ b/engines/crab/HealthIndicator.cpp
@@ -29,7 +29,7 @@
*/
-#include "HealthIndicator.h"
+#include "crab/HealthIndicator.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/HealthIndicator.h b/engines/crab/HealthIndicator.h
index a13fe12a71f..b217a3044bd 100644
--- a/engines/crab/HealthIndicator.h
+++ b/engines/crab/HealthIndicator.h
@@ -30,9 +30,9 @@
#ifndef CRAB_HEALTHINDICATOR_H
#define CRAB_HEALTHINDICATOR_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "ImageManager.h"
+#include "crab/ImageManager.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/HoverInfo.cpp b/engines/crab/HoverInfo.cpp
index 87f540f89ac..9244c42e92f 100644
--- a/engines/crab/HoverInfo.cpp
+++ b/engines/crab/HoverInfo.cpp
@@ -29,7 +29,7 @@
*/
-#include "HoverInfo.h"
+#include "crab/HoverInfo.h"
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
diff --git a/engines/crab/HoverInfo.h b/engines/crab/HoverInfo.h
index 538d7deccbd..8d914f6c20a 100644
--- a/engines/crab/HoverInfo.h
+++ b/engines/crab/HoverInfo.h
@@ -30,9 +30,9 @@
#ifndef CRAB_HOVERINFO_H
#define CRAB_HOVERINFO_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "TextData.h"
+#include "crab/TextData.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/Image.cpp b/engines/crab/Image.cpp
index dab8b57257d..9cd3f3584ca 100644
--- a/engines/crab/Image.cpp
+++ b/engines/crab/Image.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "Image.h"
+#include "crab/Image.h"
using namespace pyrodactyl::image;
diff --git a/engines/crab/Image.h b/engines/crab/Image.h
index e1387b89ee3..995311b7b87 100644
--- a/engines/crab/Image.h
+++ b/engines/crab/Image.h
@@ -31,8 +31,8 @@
#ifndef CRAB_IMAGE_H
#define CRAB_IMAGE_H
-#include "ScreenSettings.h"
-#include "common_header.h"
+#include "crab/ScreenSettings.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace image {
diff --git a/engines/crab/ImageData.cpp b/engines/crab/ImageData.cpp
index 968dda5820b..78ed2a94ce8 100644
--- a/engines/crab/ImageData.cpp
+++ b/engines/crab/ImageData.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ImageData.h"
+#include "crab/ImageData.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/ImageData.h b/engines/crab/ImageData.h
index ff6911f06b3..00e4a53ef04 100644
--- a/engines/crab/ImageData.h
+++ b/engines/crab/ImageData.h
@@ -31,9 +31,9 @@
#ifndef CRAB_IMAGEDATA_H
#define CRAB_IMAGEDATA_H
-#include "ImageManager.h"
-#include "common_header.h"
-#include "element.h"
+#include "crab/ImageManager.h"
+#include "crab/common_header.h"
+#include "crab/element.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ImageManager.cpp b/engines/crab/ImageManager.cpp
index 7c44fffccd3..06195616723 100644
--- a/engines/crab/ImageManager.cpp
+++ b/engines/crab/ImageManager.cpp
@@ -32,8 +32,8 @@
// Author: Arvind
// Purpose: Contains the image manager class - used to manage in-game images
//=============================================================================
-#include "ImageManager.h"
-#include "XMLDoc.h"
+#include "crab/ImageManager.h"
+#include "crab/XMLDoc.h"
using namespace pyrodactyl::image;
diff --git a/engines/crab/ImageManager.h b/engines/crab/ImageManager.h
index c8433404890..80b5a5b25c4 100644
--- a/engines/crab/ImageManager.h
+++ b/engines/crab/ImageManager.h
@@ -35,13 +35,13 @@
#ifndef CRAB_IMAGEMANAGER_H
#define CRAB_IMAGEMANAGER_H
-#include "GameParam.h"
-#include "Image.h"
-#include "LoadingScreen.h"
-#include "TMXTileSet.h"
-#include "common_header.h"
-#include "cursor.h"
-#include "loaders.h"
+#include "crab/GameParam.h"
+#include "crab/Image.h"
+#include "crab/LoadingScreen.h"
+#include "crab/TMXTileSet.h"
+#include "crab/common_header.h"
+#include "crab/cursor.h"
+#include "crab/loaders.h"
// We use this object as the key for all image assets
typedef unsigned int ImageKey;
diff --git a/engines/crab/Inventory.cpp b/engines/crab/Inventory.cpp
index ad8626b0f68..e821adbaed0 100644
--- a/engines/crab/Inventory.cpp
+++ b/engines/crab/Inventory.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "Inventory.h"
+#include "crab/Inventory.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/Inventory.h b/engines/crab/Inventory.h
index c5320e46be4..a85bea4e1f7 100644
--- a/engines/crab/Inventory.h
+++ b/engines/crab/Inventory.h
@@ -31,12 +31,12 @@
#ifndef CRAB_INVENTORY_H
#define CRAB_INVENTORY_H
-#include "ImageData.h"
-#include "ItemCollection.h"
-#include "ItemSlot.h"
-#include "Stat.h"
-#include "button.h"
-#include "common_header.h"
+#include "crab/ImageData.h"
+#include "crab/ItemCollection.h"
+#include "crab/ItemSlot.h"
+#include "crab/Stat.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/Item.cpp b/engines/crab/Item.cpp
index 972a26b5170..1d8a24c48d7 100644
--- a/engines/crab/Item.cpp
+++ b/engines/crab/Item.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "Item.h"
+#include "crab/Item.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::item;
diff --git a/engines/crab/Item.h b/engines/crab/Item.h
index abcfdaed1b5..0d61c3b2d93 100644
--- a/engines/crab/Item.h
+++ b/engines/crab/Item.h
@@ -31,10 +31,10 @@
#ifndef CRAB_ITEM_H
#define CRAB_ITEM_H
-#include "ImageManager.h"
-#include "bonus.h"
-#include "common_header.h"
-#include "person.h"
+#include "crab/ImageManager.h"
+#include "crab/bonus.h"
+#include "crab/common_header.h"
+#include "crab/person.h"
namespace pyrodactyl {
namespace item {
diff --git a/engines/crab/ItemCollection.cpp b/engines/crab/ItemCollection.cpp
index 0158fd8d772..3e496bb4c18 100644
--- a/engines/crab/ItemCollection.cpp
+++ b/engines/crab/ItemCollection.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ItemCollection.h"
+#include "crab/ItemCollection.h"
using namespace pyrodactyl::people;
using namespace pyrodactyl::item;
diff --git a/engines/crab/ItemCollection.h b/engines/crab/ItemCollection.h
index da90241a63c..a7236865f38 100644
--- a/engines/crab/ItemCollection.h
+++ b/engines/crab/ItemCollection.h
@@ -31,9 +31,9 @@
#ifndef CRAB_ITEMCOLLECTION_H
#define CRAB_ITEMCOLLECTION_H
-#include "ItemMenu.h"
-#include "StatDrawHelper.h"
-#include "common_header.h"
+#include "crab/ItemMenu.h"
+#include "crab/StatDrawHelper.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace item {
diff --git a/engines/crab/ItemDesc.h b/engines/crab/ItemDesc.h
index 4fe9dc8d3bb..57121a60b67 100644
--- a/engines/crab/ItemDesc.h
+++ b/engines/crab/ItemDesc.h
@@ -31,9 +31,9 @@
#ifndef CRAB_ITEMDESC_H
#define CRAB_ITEMDESC_H
-#include "Item.h"
-#include "ParagraphData.h"
-#include "SectionHeader.h"
+#include "crab/Item.h"
+#include "crab/ParagraphData.h"
+#include "crab/SectionHeader.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ItemMenu.cpp b/engines/crab/ItemMenu.cpp
index 375e4b715ee..b67c76e06bd 100644
--- a/engines/crab/ItemMenu.cpp
+++ b/engines/crab/ItemMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ItemMenu.h"
+#include "crab/ItemMenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::item;
diff --git a/engines/crab/ItemMenu.h b/engines/crab/ItemMenu.h
index 13a50a6fd26..b5fcf65939f 100644
--- a/engines/crab/ItemMenu.h
+++ b/engines/crab/ItemMenu.h
@@ -31,13 +31,13 @@
#ifndef CRAB_ITEMMENU_H
#define CRAB_ITEMMENU_H
-#include "ItemDesc.h"
-#include "ItemSlot.h"
-#include "StatDrawHelper.h"
-#include "StatPreview.h"
-#include "common_header.h"
-#include "menu.h"
-#include "person.h"
+#include "crab/ItemDesc.h"
+#include "crab/ItemSlot.h"
+#include "crab/StatDrawHelper.h"
+#include "crab/StatPreview.h"
+#include "crab/common_header.h"
+#include "crab/menu.h"
+#include "crab/person.h"
namespace pyrodactyl {
namespace item {
diff --git a/engines/crab/ItemSlot.cpp b/engines/crab/ItemSlot.cpp
index 7075536da9a..ab5a4e0881e 100644
--- a/engines/crab/ItemSlot.cpp
+++ b/engines/crab/ItemSlot.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ItemSlot.h"
+#include "crab/ItemSlot.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::item;
diff --git a/engines/crab/ItemSlot.h b/engines/crab/ItemSlot.h
index 8f42ab95aea..e11bce1c0dd 100644
--- a/engines/crab/ItemSlot.h
+++ b/engines/crab/ItemSlot.h
@@ -31,10 +31,10 @@
#ifndef CRAB_ITEMSLOT_H
#define CRAB_ITEMSLOT_H
-#include "ImageManager.h"
-#include "Item.h"
-#include "StateButton.h"
-#include "common_header.h"
+#include "crab/ImageManager.h"
+#include "crab/Item.h"
+#include "crab/StateButton.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace item {
diff --git a/engines/crab/KeyBindMenu.cpp b/engines/crab/KeyBindMenu.cpp
index e31e56cebb4..ea9f57b5989 100644
--- a/engines/crab/KeyBindMenu.cpp
+++ b/engines/crab/KeyBindMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "KeyBindMenu.h"
+#include "crab/KeyBindMenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/KeyBindMenu.h b/engines/crab/KeyBindMenu.h
index 279b0b16ded..1ebad3d8f92 100644
--- a/engines/crab/KeyBindMenu.h
+++ b/engines/crab/KeyBindMenu.h
@@ -31,10 +31,10 @@
#ifndef CRAB_KEYBINDMENU_H
#define CRAB_KEYBINDMENU_H
-#include "ImageData.h"
-#include "OptionSelect.h"
-#include "common_header.h"
-#include "menu.h"
+#include "crab/ImageData.h"
+#include "crab/OptionSelect.h"
+#include "crab/common_header.h"
+#include "crab/menu.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/LevelExit.cpp b/engines/crab/LevelExit.cpp
index 1403d04ab0b..58814c03262 100644
--- a/engines/crab/LevelExit.cpp
+++ b/engines/crab/LevelExit.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "LevelExit.h"
+#include "crab/LevelExit.h"
using namespace pyrodactyl::level;
diff --git a/engines/crab/LevelExit.h b/engines/crab/LevelExit.h
index cf38b95bccb..1a66231f3f5 100644
--- a/engines/crab/LevelExit.h
+++ b/engines/crab/LevelExit.h
@@ -31,10 +31,10 @@
#ifndef CRAB_LEVELEXIT_H
#define CRAB_LEVELEXIT_H
-#include "GameEventInfo.h"
-#include "ImageManager.h"
-#include "Shape.h"
-#include "common_header.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ImageManager.h"
+#include "crab/Shape.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace level {
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index f3bd8fd3bac..f10d6d05e57 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -30,9 +30,9 @@
#ifndef CRAB_LEVELRESULT_H
#define CRAB_LEVELRESULT_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "ImageManager.h"
+#include "crab/ImageManager.h"
enum LevelResultType { LR_NONE,
LR_LEVEL,
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index 6952ee84ff6..47be27ea81a 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "Line.h"
+#include "crab/Line.h"
//------------------------------------------------------------------------
// Purpose: Draw a line from start to end
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index 59c6b89ab60..35f1fc4f4e6 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -31,9 +31,9 @@
#ifndef CRAB_LINE_H
#define CRAB_LINE_H
-#include "ScreenSettings.h"
-#include "common_header.h"
-#include "vectors.h"
+#include "crab/ScreenSettings.h"
+#include "crab/common_header.h"
+#include "crab/vectors.h"
// Find if 2 lines intersect and store the point of intersection
template<typename T>
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index a911f4451f5..d7d8acf0178 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "LoadingScreen.h"
-#include "XMLDoc.h"
+#include "crab/LoadingScreen.h"
+#include "crab/XMLDoc.h"
void LoadingScreen::Load() {
const std::string &filename = "res/layout/loading.xml";
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index a6a6a43f685..52c9d01f441 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -31,10 +31,10 @@
#ifndef CRAB_LOADINGSCREEN_H
#define CRAB_LOADINGSCREEN_H
-#include "Image.h"
-#include "common_header.h"
-#include "timer.h"
-#include "vectors.h"
+#include "crab/Image.h"
+#include "crab/common_header.h"
+#include "crab/timer.h"
+#include "crab/vectors.h"
class LoadingScreen {
struct Screen {
diff --git a/engines/crab/MapData.cpp b/engines/crab/MapData.cpp
index 01b0b4b8d56..b057516578a 100644
--- a/engines/crab/MapData.cpp
+++ b/engines/crab/MapData.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "MapData.h"
+#include "crab/MapData.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/MapData.h b/engines/crab/MapData.h
index 4c421e12d1f..c4428bbe067 100644
--- a/engines/crab/MapData.h
+++ b/engines/crab/MapData.h
@@ -31,8 +31,8 @@
#ifndef CRAB_MAPDATA_H
#define CRAB_MAPDATA_H
-#include "Rectangle.h"
-#include "common_header.h"
+#include "crab/Rectangle.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/MapMarkerMenu.cpp b/engines/crab/MapMarkerMenu.cpp
index 5f3279d0892..2ae55cfd892 100644
--- a/engines/crab/MapMarkerMenu.cpp
+++ b/engines/crab/MapMarkerMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "MapMarkerMenu.h"
+#include "crab/MapMarkerMenu.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/MapMarkerMenu.h b/engines/crab/MapMarkerMenu.h
index 372446a1e99..8d2ff36feef 100644
--- a/engines/crab/MapMarkerMenu.h
+++ b/engines/crab/MapMarkerMenu.h
@@ -31,9 +31,9 @@
#ifndef CRAB_MAPMARKERMENU_H
#define CRAB_MAPMARKERMENU_H
-#include "StateButton.h"
-#include "common_header.h"
-#include "menu.h"
+#include "crab/StateButton.h"
+#include "crab/common_header.h"
+#include "crab/menu.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ModMenu.cpp b/engines/crab/ModMenu.cpp
index 185f9a44fd7..53ba5447cfa 100644
--- a/engines/crab/ModMenu.cpp
+++ b/engines/crab/ModMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ModMenu.h"
+#include "crab/ModMenu.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/ModMenu.h b/engines/crab/ModMenu.h
index 8d20e0c478b..c7b4a7f1f50 100644
--- a/engines/crab/ModMenu.h
+++ b/engines/crab/ModMenu.h
@@ -31,8 +31,8 @@
#ifndef CRAB_MODMENU_H
#define CRAB_MODMENU_H
-#include "FileMenu.h"
-#include "common_header.h"
+#include "crab/FileMenu.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/MusicArea.cpp b/engines/crab/MusicArea.cpp
index 27d2551f0cd..f8145ab0d2f 100644
--- a/engines/crab/MusicArea.cpp
+++ b/engines/crab/MusicArea.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "MusicArea.h"
+#include "crab/MusicArea.h"
using namespace pyrodactyl::level;
diff --git a/engines/crab/MusicArea.h b/engines/crab/MusicArea.h
index 546f2bdd07e..7ba0652a5c2 100644
--- a/engines/crab/MusicArea.h
+++ b/engines/crab/MusicArea.h
@@ -31,9 +31,9 @@
#ifndef CRAB_MUSICAREA_H
#define CRAB_MUSICAREA_H
-#include "Shape.h"
-#include "common_header.h"
-#include "musicparam.h"
+#include "crab/Shape.h"
+#include "crab/common_header.h"
+#include "crab/musicparam.h"
namespace pyrodactyl {
namespace level {
diff --git a/engines/crab/MusicManager.cpp b/engines/crab/MusicManager.cpp
index 0587023133c..53544f49ac4 100644
--- a/engines/crab/MusicManager.cpp
+++ b/engines/crab/MusicManager.cpp
@@ -29,9 +29,9 @@
*/
-#include "MusicManager.h"
-#include "ScreenSettings.h"
-#include "XMLDoc.h"
+#include "crab/MusicManager.h"
+#include "crab/ScreenSettings.h"
+#include "crab/XMLDoc.h"
using namespace pyrodactyl::music;
diff --git a/engines/crab/MusicManager.h b/engines/crab/MusicManager.h
index 3248a389f1d..4fed66dd274 100644
--- a/engines/crab/MusicManager.h
+++ b/engines/crab/MusicManager.h
@@ -31,9 +31,9 @@
#ifndef CRAB_MUSICMANAGER_H
#define CRAB_MUSICMANAGER_H
-#include "GameParam.h"
-#include "common_header.h"
-#include "musicparam.h"
+#include "crab/GameParam.h"
+#include "crab/common_header.h"
+#include "crab/musicparam.h"
namespace pyrodactyl {
namespace music {
diff --git a/engines/crab/OptionMenu.cpp b/engines/crab/OptionMenu.cpp
index cb08af71076..b542f47db3e 100644
--- a/engines/crab/OptionMenu.cpp
+++ b/engines/crab/OptionMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "OptionMenu.h"
+#include "crab/OptionMenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/OptionMenu.h b/engines/crab/OptionMenu.h
index 981ce920709..112e772c7b3 100644
--- a/engines/crab/OptionMenu.h
+++ b/engines/crab/OptionMenu.h
@@ -31,14 +31,14 @@
#ifndef CRAB_OPTIONMENU_H
#define CRAB_OPTIONMENU_H
-#include "GeneralSettingMenu.h"
-#include "GfxSettingMenu.h"
-#include "ImageData.h"
-#include "KeyBindMenu.h"
-#include "StateButton.h"
-#include "ToggleButton.h"
-#include "common_header.h"
-#include "slider.h"
+#include "crab/GeneralSettingMenu.h"
+#include "crab/GfxSettingMenu.h"
+#include "crab/ImageData.h"
+#include "crab/KeyBindMenu.h"
+#include "crab/StateButton.h"
+#include "crab/ToggleButton.h"
+#include "crab/common_header.h"
+#include "crab/slider.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/OptionSelect.cpp b/engines/crab/OptionSelect.cpp
index 9ae70c8394b..089a321cce0 100644
--- a/engines/crab/OptionSelect.cpp
+++ b/engines/crab/OptionSelect.cpp
@@ -29,7 +29,7 @@
*/
-#include "OptionSelect.h"
+#include "crab/OptionSelect.h"
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
diff --git a/engines/crab/OptionSelect.h b/engines/crab/OptionSelect.h
index cd9a0abff53..c331f8a6002 100644
--- a/engines/crab/OptionSelect.h
+++ b/engines/crab/OptionSelect.h
@@ -30,10 +30,10 @@
#ifndef CRAB_OPTIONSELECT_H
#define CRAB_OPTIONSELECT_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "TextData.h"
-#include "button.h"
+#include "crab/TextData.h"
+#include "crab/button.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/PageMenu.h b/engines/crab/PageMenu.h
index 98ae1cc9254..a7fbdd93ef9 100644
--- a/engines/crab/PageMenu.h
+++ b/engines/crab/PageMenu.h
@@ -31,8 +31,8 @@
#ifndef CRAB_PAGEMENU_H
#define CRAB_PAGEMENU_H
-#include "common_header.h"
-#include "menu.h"
+#include "crab/common_header.h"
+#include "crab/menu.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ParagraphData.cpp b/engines/crab/ParagraphData.cpp
index fc053b57d0b..8ae0e88ef45 100644
--- a/engines/crab/ParagraphData.cpp
+++ b/engines/crab/ParagraphData.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ParagraphData.h"
+#include "crab/ParagraphData.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/ParagraphData.h b/engines/crab/ParagraphData.h
index 491865b8af0..a2b84dc46bf 100644
--- a/engines/crab/ParagraphData.h
+++ b/engines/crab/ParagraphData.h
@@ -31,8 +31,8 @@
#ifndef CRAB_PARAGRAPHDATA_H
#define CRAB_PARAGRAPHDATA_H
-#include "TextData.h"
-#include "common_header.h"
+#include "crab/TextData.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 132fc417928..0245910f17c 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "PathfindingAgent.h"
+#include "crab/PathfindingAgent.h"
PathfindingAgent::PathfindingAgent(void) : nodeQueue(compareNodes) {
grid = NULL;
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index e7889da68b4..0efbfa09524 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -31,9 +31,9 @@
#ifndef CRAB_PATHFINDINGAGENT_H
#define CRAB_PATHFINDINGAGENT_H
-#include "PathfindingGrid.h"
-#include "PriorityQueue.h"
-#include "vectors.h"
+#include "crab/PathfindingGrid.h"
+#include "crab/PriorityQueue.h"
+#include "crab/vectors.h"
// This class represents the actual pathfinding and following agent that utilizes
// the pathfinding grid
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 09ea474025f..eae9ff23ade 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "PathfindingGraphNode.h"
+#include "crab/PathfindingGraphNode.h"
PathfindingGraphNode::PathfindingGraphNode(void) {
id = -1;
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
index f96219d2786..69f0dd99a61 100644
--- a/engines/crab/PathfindingGraphNode.h
+++ b/engines/crab/PathfindingGraphNode.h
@@ -31,8 +31,8 @@
#ifndef CRAB_PATHFINDINGGRAPHNODE_H
#define CRAB_PATHFINDINGGRAPHNODE_H
-#include "Rectangle.h"
-#include "vectors.h"
+#include "crab/Rectangle.h"
+#include "crab/vectors.h"
// This is the basic pathfinding node that will construct the pathfinding graph. (SZ)
// Although Unrest is using a square grid based pathfinding map, this is made to be a general use pathfinding node.
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index aae80d577be..2ea285f914b 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "PathfindingGrid.h"
-#include "TMXMap.h"
+#include "crab/PathfindingGrid.h"
+#include "crab/TMXMap.h"
using namespace TMX;
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 04ffcaaaedd..ad014b417d3 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -31,8 +31,8 @@
#ifndef CRAB_PATHFINDINGGRID_H
#define CRAB_PATHFINDINGGRID_H
-#include "PathfindingGraphNode.h"
-#include "common_header.h"
+#include "crab/PathfindingGraphNode.h"
+#include "crab/common_header.h"
#include <math.h>
namespace TMX {
diff --git a/engines/crab/PauseMenu.cpp b/engines/crab/PauseMenu.cpp
index d5732c99e3b..8560f176c7c 100644
--- a/engines/crab/PauseMenu.cpp
+++ b/engines/crab/PauseMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "PauseMenu.h"
+#include "crab/PauseMenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/PauseMenu.h b/engines/crab/PauseMenu.h
index 47926e950bf..271b516e924 100644
--- a/engines/crab/PauseMenu.h
+++ b/engines/crab/PauseMenu.h
@@ -31,15 +31,15 @@
#ifndef CRAB_PAUSEMENU_H
#define CRAB_PAUSEMENU_H
-#include "FileMenu.h"
-#include "GameEventInfo.h"
-#include "OptionMenu.h"
-#include "SaveGameMenu.h"
-#include "SlideShow.h"
-#include "common_header.h"
-#include "menu.h"
-#include "slider.h"
-#include "textarea.h"
+#include "crab/FileMenu.h"
+#include "crab/GameEventInfo.h"
+#include "crab/OptionMenu.h"
+#include "crab/SaveGameMenu.h"
+#include "crab/SlideShow.h"
+#include "crab/common_header.h"
+#include "crab/menu.h"
+#include "crab/slider.h"
+#include "crab/textarea.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/PersonHandler.cpp b/engines/crab/PersonHandler.cpp
index b411a219e3b..648d5bf6082 100644
--- a/engines/crab/PersonHandler.cpp
+++ b/engines/crab/PersonHandler.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "PersonHandler.h"
+#include "crab/PersonHandler.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/PersonHandler.h b/engines/crab/PersonHandler.h
index 41c0f2200ac..ddb36660f24 100644
--- a/engines/crab/PersonHandler.h
+++ b/engines/crab/PersonHandler.h
@@ -31,13 +31,13 @@
#ifndef CRAB_PERSONHANDLER_H
#define CRAB_PERSONHANDLER_H
-#include "GameEventInfo.h"
-#include "ProgressBar.h"
-#include "common_header.h"
-#include "dialogbox.h"
-#include "gameevent.h"
-#include "person.h"
-#include "sprite.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ProgressBar.h"
+#include "crab/common_header.h"
+#include "crab/dialogbox.h"
+#include "crab/gameevent.h"
+#include "crab/person.h"
+#include "crab/sprite.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/PersonScreen.cpp b/engines/crab/PersonScreen.cpp
index a278a4d7e59..dc3f5b8a180 100644
--- a/engines/crab/PersonScreen.cpp
+++ b/engines/crab/PersonScreen.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "PersonScreen.h"
+#include "crab/PersonScreen.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
diff --git a/engines/crab/PersonScreen.h b/engines/crab/PersonScreen.h
index 2e21c76147d..279aad5ec56 100644
--- a/engines/crab/PersonScreen.h
+++ b/engines/crab/PersonScreen.h
@@ -31,14 +31,14 @@
#ifndef CRAB_PERSONSCREEN_H
#define CRAB_PERSONSCREEN_H
-#include "GameEventInfo.h"
-#include "ImageData.h"
-#include "TraitMenu.h"
-#include "gameevent.h"
-#include "level.h"
-#include "menu.h"
-#include "person.h"
-#include "sprite.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ImageData.h"
+#include "crab/TraitMenu.h"
+#include "crab/gameevent.h"
+#include "crab/level.h"
+#include "crab/menu.h"
+#include "crab/person.h"
+#include "crab/sprite.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 39007f5f563..453854acd94 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "Polygon.h"
+#include "crab/Polygon.h"
// Calculate the distance between [minA, maxA] and [minB, maxB]
// The distance will be negative if the intervals overlap
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index 44f6fbb1a19..8a32dca7432 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -31,9 +31,9 @@
#ifndef CRAB_POLYGON_H
#define CRAB_POLYGON_H
-#include "Rectangle.h"
-#include "common_header.h"
-#include "vectors.h"
+#include "crab/Rectangle.h"
+#include "crab/common_header.h"
+#include "crab/vectors.h"
//------------------------------------------------------------------------
// Purpose: The result of a collision
diff --git a/engines/crab/PopUp.cpp b/engines/crab/PopUp.cpp
index 0a9e1c89906..e5f0702acee 100644
--- a/engines/crab/PopUp.cpp
+++ b/engines/crab/PopUp.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "PopUp.h"
+#include "crab/PopUp.h"
using namespace pyrodactyl::anim;
using namespace pyrodactyl::event;
diff --git a/engines/crab/PopUp.h b/engines/crab/PopUp.h
index b2328338eea..efc95003269 100644
--- a/engines/crab/PopUp.h
+++ b/engines/crab/PopUp.h
@@ -31,12 +31,12 @@
#ifndef CRAB_POPUP_H
#define CRAB_POPUP_H
-#include "GameEventInfo.h"
-#include "ParagraphData.h"
-#include "TextManager.h"
-#include "common_header.h"
-#include "effect.h"
-#include "triggerset.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ParagraphData.h"
+#include "crab/TextManager.h"
+#include "crab/common_header.h"
+#include "crab/effect.h"
+#include "crab/triggerset.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/ProgressBar.cpp b/engines/crab/ProgressBar.cpp
index 1ea25b8c76a..c86e1a2f495 100644
--- a/engines/crab/ProgressBar.cpp
+++ b/engines/crab/ProgressBar.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ProgressBar.h"
+#include "crab/ProgressBar.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/ProgressBar.h b/engines/crab/ProgressBar.h
index 4a6a6dbe154..e3bd9c314ff 100644
--- a/engines/crab/ProgressBar.h
+++ b/engines/crab/ProgressBar.h
@@ -31,9 +31,9 @@
#ifndef CRAB_PROGRESSBAR_H
#define CRAB_PROGRESSBAR_H
-#include "ClipButton.h"
-#include "common_header.h"
-#include "timer.h"
+#include "crab/ClipButton.h"
+#include "crab/common_header.h"
+#include "crab/timer.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/QuestText.cpp b/engines/crab/QuestText.cpp
index b65718dbbf0..899c4b076e3 100644
--- a/engines/crab/QuestText.cpp
+++ b/engines/crab/QuestText.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "QuestText.h"
+#include "crab/QuestText.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/QuestText.h b/engines/crab/QuestText.h
index 94e0b6556e2..cc7b547e5e9 100644
--- a/engines/crab/QuestText.h
+++ b/engines/crab/QuestText.h
@@ -31,11 +31,11 @@
#ifndef CRAB_QUESTTEXT_H
#define CRAB_QUESTTEXT_H
-#include "ImageData.h"
-#include "ParagraphData.h"
-#include "button.h"
-#include "common_header.h"
-#include "quest.h"
+#include "crab/ImageData.h"
+#include "crab/ParagraphData.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
+#include "crab/quest.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/RadioButton.h b/engines/crab/RadioButton.h
index cbff468ced5..5fbfc800737 100644
--- a/engines/crab/RadioButton.h
+++ b/engines/crab/RadioButton.h
@@ -31,7 +31,7 @@
#ifndef CRAB_RADIOBUTTON_H
#define CRAB_RADIOBUTTON_H
-#include "ToggleButton.h"
+#include "crab/ToggleButton.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/RadioButtonMenu.h b/engines/crab/RadioButtonMenu.h
index 37b85fdc91b..e1a00f383cf 100644
--- a/engines/crab/RadioButtonMenu.h
+++ b/engines/crab/RadioButtonMenu.h
@@ -31,8 +31,8 @@
#ifndef CRAB_RADIOBUTTONMENU_H
#define CRAB_RADIOBUTTONMENU_H
-#include "RadioButton.h"
-#include "menu.h"
+#include "crab/RadioButton.h"
+#include "crab/menu.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 03b93157aa5..7605daca833 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "Rectangle.h"
+#include "crab/Rectangle.h"
bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const std::string &x_name, const std::string &y_name,
const std::string &w_name, const std::string &h_name) {
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index b1a79f8a35e..a91ad896765 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -31,9 +31,9 @@
#ifndef CRAB_RECTANGLE_H
#define CRAB_RECTANGLE_H
-#include "Line.h"
-#include "common_header.h"
-#include "vectors.h"
+#include "crab/Line.h"
+#include "crab/common_header.h"
+#include "crab/vectors.h"
//------------------------------------------------------------------------
// Purpose: A simple rectangle class
diff --git a/engines/crab/ReplyButton.cpp b/engines/crab/ReplyButton.cpp
index 575a403fb00..47b63c9e19f 100644
--- a/engines/crab/ReplyButton.cpp
+++ b/engines/crab/ReplyButton.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ReplyButton.h"
+#include "crab/ReplyButton.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/ReplyButton.h b/engines/crab/ReplyButton.h
index 7601651df1a..0f120f8dd44 100644
--- a/engines/crab/ReplyButton.h
+++ b/engines/crab/ReplyButton.h
@@ -31,8 +31,8 @@
#ifndef CRAB_REPLYBUTTON_H
#define CRAB_REPLYBUTTON_H
-#include "button.h"
-#include "common_header.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ReplyMenu.cpp b/engines/crab/ReplyMenu.cpp
index 8dc94834ea6..f601e61ae09 100644
--- a/engines/crab/ReplyMenu.cpp
+++ b/engines/crab/ReplyMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ReplyMenu.h"
+#include "crab/ReplyMenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/ReplyMenu.h b/engines/crab/ReplyMenu.h
index b19512469e7..3c6c85eba88 100644
--- a/engines/crab/ReplyMenu.h
+++ b/engines/crab/ReplyMenu.h
@@ -31,15 +31,15 @@
#ifndef CRAB_REPLYMENU_H
#define CRAB_REPLYMENU_H
-#include "GameEventInfo.h"
-#include "ImageData.h"
-#include "PersonHandler.h"
-#include "ReplyButton.h"
-#include "common_header.h"
-#include "conversationdata.h"
-#include "emotion.h"
-#include "eventstore.h"
-#include "menu.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ImageData.h"
+#include "crab/PersonHandler.h"
+#include "crab/ReplyButton.h"
+#include "crab/common_header.h"
+#include "crab/conversationdata.h"
+#include "crab/emotion.h"
+#include "crab/eventstore.h"
+#include "crab/menu.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ResolutionMenu.cpp b/engines/crab/ResolutionMenu.cpp
index 47e7adadddc..69402c709f5 100644
--- a/engines/crab/ResolutionMenu.cpp
+++ b/engines/crab/ResolutionMenu.cpp
@@ -29,7 +29,7 @@
*/
-#include "ResolutionMenu.h"
+#include "crab/ResolutionMenu.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
diff --git a/engines/crab/ResolutionMenu.h b/engines/crab/ResolutionMenu.h
index 4b1b18b3fdb..90b7da89e96 100644
--- a/engines/crab/ResolutionMenu.h
+++ b/engines/crab/ResolutionMenu.h
@@ -30,10 +30,10 @@
#ifndef CRAB_RESOLUTIONMENU_H
#define CRAB_RESOLUTIONMENU_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "menu.h"
-#include "textarea.h"
+#include "crab/menu.h"
+#include "crab/textarea.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/SaveGameMenu.cpp b/engines/crab/SaveGameMenu.cpp
index 629ec12be6c..4e0ee6b7725 100644
--- a/engines/crab/SaveGameMenu.cpp
+++ b/engines/crab/SaveGameMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "SaveGameMenu.h"
+#include "crab/SaveGameMenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::input;
diff --git a/engines/crab/SaveGameMenu.h b/engines/crab/SaveGameMenu.h
index 13ad3d9fc24..84ac7530c4d 100644
--- a/engines/crab/SaveGameMenu.h
+++ b/engines/crab/SaveGameMenu.h
@@ -31,9 +31,9 @@
#ifndef CRAB_SAVEGAMEMENU_H
#define CRAB_SAVEGAMEMENU_H
-#include "FileMenu.h"
-#include "common_header.h"
-#include "textarea.h"
+#include "crab/FileMenu.h"
+#include "crab/common_header.h"
+#include "crab/textarea.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index ba30e5d7d41..b51b03ee8e1 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ScreenSettings.h"
+#include "crab/ScreenSettings.h"
// Our screen settings object
ScreenSettings gScreenSettings;
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index 4b6621443c1..2ff2e8507be 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -31,9 +31,9 @@
#ifndef CRAB_SCREENSETTINGS_H
#define CRAB_SCREENSETTINGS_H
-#include "GameParam.h"
-#include "common_header.h"
-#include "loaders.h"
+#include "crab/GameParam.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
// Our rendering context
extern SDL_Renderer *gRenderer;
diff --git a/engines/crab/SectionHeader.cpp b/engines/crab/SectionHeader.cpp
index 3a4567ce1fa..584d736d08e 100644
--- a/engines/crab/SectionHeader.cpp
+++ b/engines/crab/SectionHeader.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "SectionHeader.h"
+#include "crab/SectionHeader.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/SectionHeader.h b/engines/crab/SectionHeader.h
index f2e61c7a1c2..102001c29b5 100644
--- a/engines/crab/SectionHeader.h
+++ b/engines/crab/SectionHeader.h
@@ -31,10 +31,10 @@
#ifndef CRAB_SECTIONHEADER_H
#define CRAB_SECTIONHEADER_H
-#include "ImageManager.h"
-#include "TextData.h"
-#include "TextManager.h"
-#include "common_header.h"
+#include "crab/ImageManager.h"
+#include "crab/TextData.h"
+#include "crab/TextManager.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index 73b4f16cdbc..6b90af2ee1a 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "Shape.h"
+#include "crab/Shape.h"
void Shape::Load(rapidxml::xml_node<char> *node, const bool &echo) {
if (NodeValid("polygon", node, echo)) {
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index a25ebe7e595..18248d793ca 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -31,8 +31,8 @@
#ifndef CRAB_SHAPE_H
#define CRAB_SHAPE_H
-#include "Polygon.h"
-#include "vectors.h"
+#include "crab/Polygon.h"
+#include "crab/vectors.h"
// The kind of shape
enum ShapeType { SHAPE_RECT,
diff --git a/engines/crab/SlideShow.cpp b/engines/crab/SlideShow.cpp
index 0c322185538..5e885301a31 100644
--- a/engines/crab/SlideShow.cpp
+++ b/engines/crab/SlideShow.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "SlideShow.h"
+#include "crab/SlideShow.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/SlideShow.h b/engines/crab/SlideShow.h
index a61c208499e..55e81fad7e8 100644
--- a/engines/crab/SlideShow.h
+++ b/engines/crab/SlideShow.h
@@ -31,10 +31,10 @@
#ifndef CRAB_SLIDESHOW_H
#define CRAB_SLIDESHOW_H
-#include "Image.h"
-#include "ImageData.h"
-#include "button.h"
-#include "common_header.h"
+#include "crab/Image.h"
+#include "crab/ImageData.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/SpriteConstant.cpp b/engines/crab/SpriteConstant.cpp
index 3a1ac25c36f..928fdd3743a 100644
--- a/engines/crab/SpriteConstant.cpp
+++ b/engines/crab/SpriteConstant.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "SpriteConstant.h"
+#include "crab/SpriteConstant.h"
using namespace pyrodactyl::ai;
diff --git a/engines/crab/SpriteConstant.h b/engines/crab/SpriteConstant.h
index 7a66873fe8a..ff29ab8f161 100644
--- a/engines/crab/SpriteConstant.h
+++ b/engines/crab/SpriteConstant.h
@@ -31,8 +31,8 @@
#ifndef CRAB_SPRITECONSTANT_H
#define CRAB_SPRITECONSTANT_H
-#include "common_header.h"
-#include "vectors.h"
+#include "crab/common_header.h"
+#include "crab/vectors.h"
namespace pyrodactyl {
namespace ai {
diff --git a/engines/crab/Stairs.cpp b/engines/crab/Stairs.cpp
index cbe51f3c884..0ed3d836130 100644
--- a/engines/crab/Stairs.cpp
+++ b/engines/crab/Stairs.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "Stairs.h"
+#include "crab/Stairs.h"
using namespace pyrodactyl::level;
diff --git a/engines/crab/Stairs.h b/engines/crab/Stairs.h
index b02c0563a34..9c202a2cf11 100644
--- a/engines/crab/Stairs.h
+++ b/engines/crab/Stairs.h
@@ -31,8 +31,8 @@
#ifndef CRAB_STAIRS_H
#define CRAB_STAIRS_H
-#include "Shape.h"
-#include "common_header.h"
+#include "crab/Shape.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace level {
diff --git a/engines/crab/Stat.cpp b/engines/crab/Stat.cpp
index 672094fb501..926331e7760 100644
--- a/engines/crab/Stat.cpp
+++ b/engines/crab/Stat.cpp
@@ -29,7 +29,7 @@
*/
-#include "Stat.h"
+#include "crab/Stat.h"
namespace pyrodactyl {
namespace stat {
diff --git a/engines/crab/Stat.h b/engines/crab/Stat.h
index 6b6ca86d0d0..2bc03672be0 100644
--- a/engines/crab/Stat.h
+++ b/engines/crab/Stat.h
@@ -30,10 +30,10 @@
#ifndef CRAB_STAT_H
#define CRAB_STAT_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "ImageManager.h"
-#include "TextManager.h"
+#include "crab/ImageManager.h"
+#include "crab/TextManager.h"
namespace pyrodactyl {
namespace stat {
diff --git a/engines/crab/StatDrawHelper.cpp b/engines/crab/StatDrawHelper.cpp
index aa0d274a438..90dc5ae677d 100644
--- a/engines/crab/StatDrawHelper.cpp
+++ b/engines/crab/StatDrawHelper.cpp
@@ -29,7 +29,7 @@
*/
-#include "StatDrawHelper.h"
+#include "crab/StatDrawHelper.h"
using namespace pyrodactyl::text;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/StatDrawHelper.h b/engines/crab/StatDrawHelper.h
index c018607dea3..1d58a289eb3 100644
--- a/engines/crab/StatDrawHelper.h
+++ b/engines/crab/StatDrawHelper.h
@@ -30,10 +30,10 @@
#ifndef CRAB_STATDRAWHELPER_H
#define CRAB_STATDRAWHELPER_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "TextData.h"
-#include "person.h"
+#include "crab/TextData.h"
+#include "crab/person.h"
namespace pyrodactyl {
namespace stat {
diff --git a/engines/crab/StatPreview.cpp b/engines/crab/StatPreview.cpp
index f8ce0218106..1564ae9e420 100644
--- a/engines/crab/StatPreview.cpp
+++ b/engines/crab/StatPreview.cpp
@@ -29,7 +29,7 @@
*/
-#include "StatPreview.h"
+#include "crab/StatPreview.h"
using namespace pyrodactyl::item;
diff --git a/engines/crab/StatPreview.h b/engines/crab/StatPreview.h
index 54bd9d709d4..327d02ffcd2 100644
--- a/engines/crab/StatPreview.h
+++ b/engines/crab/StatPreview.h
@@ -30,11 +30,11 @@
#ifndef CRAB_STATPREVIEW_H
#define CRAB_STATPREVIEW_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "Item.h"
-#include "SectionHeader.h"
-#include "StatDrawHelper.h"
+#include "crab/Item.h"
+#include "crab/SectionHeader.h"
+#include "crab/StatDrawHelper.h"
namespace pyrodactyl {
namespace item {
diff --git a/engines/crab/StatTemplate.cpp b/engines/crab/StatTemplate.cpp
index ae2abbac6c4..25f7ce771d2 100644
--- a/engines/crab/StatTemplate.cpp
+++ b/engines/crab/StatTemplate.cpp
@@ -29,8 +29,8 @@
*/
-#include "StatTemplate.h"
-#include "XMLDoc.h"
+#include "crab/StatTemplate.h"
+#include "crab/XMLDoc.h"
using namespace pyrodactyl::stat;
diff --git a/engines/crab/StatTemplate.h b/engines/crab/StatTemplate.h
index 389abf3af27..87c5d919c0b 100644
--- a/engines/crab/StatTemplate.h
+++ b/engines/crab/StatTemplate.h
@@ -30,9 +30,9 @@
#ifndef CRAB_STATTEMPLATE_H
#define CRAB_STATTEMPLATE_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "Stat.h"
+#include "crab/Stat.h"
namespace pyrodactyl {
namespace stat {
diff --git a/engines/crab/StateButton.cpp b/engines/crab/StateButton.cpp
index 8a212db803e..cc020b557ae 100644
--- a/engines/crab/StateButton.cpp
+++ b/engines/crab/StateButton.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "StateButton.h"
+#include "crab/StateButton.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/StateButton.h b/engines/crab/StateButton.h
index ed79b1737f8..0f71101f09c 100644
--- a/engines/crab/StateButton.h
+++ b/engines/crab/StateButton.h
@@ -31,8 +31,8 @@
#ifndef CRAB_STATEBUTTON_H
#define CRAB_STATEBUTTON_H
-#include "button.h"
-#include "common_header.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/TMXLayer.cpp b/engines/crab/TMXLayer.cpp
index 958e73efbf4..ab651be149c 100644
--- a/engines/crab/TMXLayer.cpp
+++ b/engines/crab/TMXLayer.cpp
@@ -29,7 +29,7 @@
*/
-#include "TMXLayer.h"
+#include "crab/TMXLayer.h"
using namespace TMX;
diff --git a/engines/crab/TMXLayer.h b/engines/crab/TMXLayer.h
index 022eef99de5..0bcb40d272a 100644
--- a/engines/crab/TMXLayer.h
+++ b/engines/crab/TMXLayer.h
@@ -31,10 +31,10 @@
#ifndef CRAB_TMXLAYER_H
#define CRAB_TMXLAYER_H
-#include "Image.h"
-#include "Rectangle.h"
-#include "TileInfo.h"
-#include "common_header.h"
+#include "crab/Image.h"
+#include "crab/Rectangle.h"
+#include "crab/TileInfo.h"
+#include "crab/common_header.h"
namespace TMX {
enum LayerType {
diff --git a/engines/crab/TMXMap.cpp b/engines/crab/TMXMap.cpp
index a01a3239e24..665fc905f75 100644
--- a/engines/crab/TMXMap.cpp
+++ b/engines/crab/TMXMap.cpp
@@ -28,9 +28,9 @@
*
*/
-#include "TMXMap.h"
-#include "TextManager.h"
-#include "collision.h"
+#include "crab/TMXMap.h"
+#include "crab/TextManager.h"
+#include "crab/collision.h"
using namespace TMX;
using namespace pyrodactyl::image;
diff --git a/engines/crab/TMXMap.h b/engines/crab/TMXMap.h
index bbf080293c2..6e855490e42 100644
--- a/engines/crab/TMXMap.h
+++ b/engines/crab/TMXMap.h
@@ -31,16 +31,16 @@
#ifndef CRAB_TMXMAP_H
#define CRAB_TMXMAP_H
-#include "ImageManager.h"
-#include "LevelExit.h"
-#include "LevelResult.h"
-#include "MusicArea.h"
-#include "PathfindingGrid.h"
-#include "Shape.h"
-#include "Stairs.h"
-#include "TMXTileSet.h"
-#include "common_header.h"
-#include "spriteai.h"
+#include "crab/ImageManager.h"
+#include "crab/LevelExit.h"
+#include "crab/LevelResult.h"
+#include "crab/MusicArea.h"
+#include "crab/PathfindingGrid.h"
+#include "crab/Shape.h"
+#include "crab/Stairs.h"
+#include "crab/TMXTileSet.h"
+#include "crab/common_header.h"
+#include "crab/spriteai.h"
namespace TMX {
// For TMX version 1.0, orthogonal maps only
diff --git a/engines/crab/TMXTileSet.cpp b/engines/crab/TMXTileSet.cpp
index 6d6379b1121..7e8a0424466 100644
--- a/engines/crab/TMXTileSet.cpp
+++ b/engines/crab/TMXTileSet.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "TMXTileSet.h"
-// #include "TextManager.h"
+#include "crab/TMXTileSet.h"
+#include "crab/TextManager.h"
using namespace TMX;
diff --git a/engines/crab/TMXTileSet.h b/engines/crab/TMXTileSet.h
index 1a1ea24bef7..51e4d6058cb 100644
--- a/engines/crab/TMXTileSet.h
+++ b/engines/crab/TMXTileSet.h
@@ -31,9 +31,9 @@
#ifndef CRAB_TMXTILESET_H
#define CRAB_TMXTILESET_H
-#include "Image.h"
-#include "TMXLayer.h"
-#include "common_header.h"
+#include "crab/Image.h"
+#include "crab/TMXLayer.h"
+#include "crab/common_header.h"
namespace TMX {
struct TileSet {
diff --git a/engines/crab/TextData.h b/engines/crab/TextData.h
index 3c98832dc85..97eb31cdcad 100644
--- a/engines/crab/TextData.h
+++ b/engines/crab/TextData.h
@@ -31,9 +31,9 @@
#ifndef CRAB_TEXTDATA_H
#define CRAB_TEXTDATA_H
-#include "TextManager.h"
-#include "common_header.h"
-#include "element.h"
+#include "crab/TextManager.h"
+#include "crab/common_header.h"
+#include "crab/element.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/TextManager.cpp b/engines/crab/TextManager.cpp
index 1bd69d9ca70..41e1fe18c8f 100644
--- a/engines/crab/TextManager.cpp
+++ b/engines/crab/TextManager.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "TextManager.h"
-#include "XMLDoc.h"
+#include "crab/TextManager.h"
+#include "crab/XMLDoc.h"
using namespace pyrodactyl::text;
diff --git a/engines/crab/TextManager.h b/engines/crab/TextManager.h
index f16d3a747c0..0b8ef725783 100644
--- a/engines/crab/TextManager.h
+++ b/engines/crab/TextManager.h
@@ -31,11 +31,11 @@
#ifndef CRAB_TEXTMANAGER_H
#define CRAB_TEXTMANAGER_H
-#include "GameParam.h"
-#include "Image.h"
-#include "color.h"
-#include "common_header.h"
-#include "vectors.h"
+#include "crab/GameParam.h"
+#include "crab/Image.h"
+#include "crab/color.h"
+#include "crab/common_header.h"
+#include "crab/vectors.h"
// We use this object as the key for all fonts
typedef unsigned int FontKey;
diff --git a/engines/crab/TileInfo.h b/engines/crab/TileInfo.h
index 1234668c29b..63e9634ff12 100644
--- a/engines/crab/TileInfo.h
+++ b/engines/crab/TileInfo.h
@@ -30,9 +30,9 @@
#ifndef CRAB_TILEINFO_H
#define CRAB_TILEINFO_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "loaders.h"
+#include "crab/loaders.h"
namespace TMX {
typedef unsigned int GidFormat;
diff --git a/engines/crab/ToggleButton.cpp b/engines/crab/ToggleButton.cpp
index c969bdee2d7..474c15153e8 100644
--- a/engines/crab/ToggleButton.cpp
+++ b/engines/crab/ToggleButton.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "ToggleButton.h"
+#include "crab/ToggleButton.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/ToggleButton.h b/engines/crab/ToggleButton.h
index 7bc8520b819..e40da60cb73 100644
--- a/engines/crab/ToggleButton.h
+++ b/engines/crab/ToggleButton.h
@@ -31,8 +31,8 @@
#ifndef CRAB_TOGGLEBUTTON_H
#define CRAB_TOGGLEBUTTON_H
-#include "button.h"
-#include "common_header.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/TraitButton.cpp b/engines/crab/TraitButton.cpp
index bd4a3ba0f1b..3809e1a864c 100644
--- a/engines/crab/TraitButton.cpp
+++ b/engines/crab/TraitButton.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "TraitButton.h"
+#include "crab/TraitButton.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/TraitButton.h b/engines/crab/TraitButton.h
index 973a856cdbc..a7f885477ec 100644
--- a/engines/crab/TraitButton.h
+++ b/engines/crab/TraitButton.h
@@ -31,9 +31,9 @@
#ifndef CRAB_TRAITBUTTON_H
#define CRAB_TRAITBUTTON_H
-#include "StateButton.h"
-#include "common_header.h"
-#include "trait.h"
+#include "crab/StateButton.h"
+#include "crab/common_header.h"
+#include "crab/trait.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/TraitMenu.cpp b/engines/crab/TraitMenu.cpp
index 63a163564de..f2c300fb32d 100644
--- a/engines/crab/TraitMenu.cpp
+++ b/engines/crab/TraitMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "TraitMenu.h"
+#include "crab/TraitMenu.h"
using namespace pyrodactyl::ui;
diff --git a/engines/crab/TraitMenu.h b/engines/crab/TraitMenu.h
index 250653fdcb9..d8b1d7d146a 100644
--- a/engines/crab/TraitMenu.h
+++ b/engines/crab/TraitMenu.h
@@ -31,11 +31,11 @@
#ifndef CRAB_TRAITMENU_H
#define CRAB_TRAITMENU_H
-#include "ParagraphData.h"
-#include "TraitButton.h"
-#include "common_header.h"
-#include "menu.h"
-#include "person.h"
+#include "crab/ParagraphData.h"
+#include "crab/TraitButton.h"
+#include "crab/common_header.h"
+#include "crab/menu.h"
+#include "crab/person.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index 94b313d32b9..92314c446dc 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "engines/crab/XMLDoc.h"
-#include "engines/crab/common_header.h"
+#include "crab/XMLDoc.h"
+#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/XMLDoc.h b/engines/crab/XMLDoc.h
index 445bb349588..7deb64b998b 100644
--- a/engines/crab/XMLDoc.h
+++ b/engines/crab/XMLDoc.h
@@ -31,8 +31,8 @@
#ifndef CRAB_XMLDOC_H
#define CRAB_XMLDOC_H
-#include "engines/crab/common_header.h"
-#include "engines/crab/filesystem.h"
+#include "crab/common_header.h"
+#include "crab/filesystem.h"
namespace Crab {
diff --git a/engines/crab/animation.cpp b/engines/crab/animation.cpp
index c16807f0778..abb28514f6d 100644
--- a/engines/crab/animation.cpp
+++ b/engines/crab/animation.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "animation.h"
+#include "crab/animation.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
diff --git a/engines/crab/animframe.cpp b/engines/crab/animframe.cpp
index 61ceedb6dbb..38db4a3ce79 100644
--- a/engines/crab/animframe.cpp
+++ b/engines/crab/animframe.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "animframe.h"
+#include "crab/animframe.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/animframe.h b/engines/crab/animframe.h
index ec46aafba4c..108f8d10969 100644
--- a/engines/crab/animframe.h
+++ b/engines/crab/animframe.h
@@ -31,10 +31,10 @@
#ifndef CRAB_ANIMFRAME_H
#define CRAB_ANIMFRAME_H
-#include "Rectangle.h"
-#include "common_header.h"
-#include "shadow.h"
-#include "vectors.h"
+#include "crab/Rectangle.h"
+#include "crab/common_header.h"
+#include "crab/shadow.h"
+#include "crab/vectors.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/animset.cpp b/engines/crab/animset.cpp
index 69917ab52b2..8240dea6502 100644
--- a/engines/crab/animset.cpp
+++ b/engines/crab/animset.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "animset.h"
+#include "crab/animset.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/animset.h b/engines/crab/animset.h
index 84b7e5e5f31..42bab18bad8 100644
--- a/engines/crab/animset.h
+++ b/engines/crab/animset.h
@@ -31,10 +31,10 @@
#ifndef CRAB_ANIMSET_H
#define CRAB_ANIMSET_H
-#include "common_header.h"
-#include "fightmoves.h"
-#include "shadow.h"
-#include "walkframes.h"
+#include "crab/common_header.h"
+#include "crab/fightmoves.h"
+#include "crab/shadow.h"
+#include "crab/walkframes.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 3327ba45f6e..dd6b6070d77 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "app.h"
+#include "crab/app.h"
bool App::Init() {
// Load all SDL subsystems and the TrueType font subsystem
diff --git a/engines/crab/app.h b/engines/crab/app.h
index 41a513b03a5..dda5562dec0 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -31,14 +31,14 @@
#ifndef CRAB_APP_H
#define CRAB_APP_H
-#include "ImageManager.h"
-#include "MusicManager.h"
-#include "common_header.h"
-#include "game.h"
-#include "gamestates.h"
-#include "mainmenu.h"
-#include "splash.h"
-#include "timer.h"
+#include "crab/ImageManager.h"
+#include "crab/MusicManager.h"
+#include "crab/common_header.h"
+#include "crab/game.h"
+#include "crab/gamestates.h"
+#include "crab/mainmenu.h"
+#include "crab/splash.h"
+#include "crab/timer.h"
class App {
void LoadSettings(const std::string &filename);
diff --git a/engines/crab/bonus.h b/engines/crab/bonus.h
index f9a26a3956f..5bc90967c66 100644
--- a/engines/crab/bonus.h
+++ b/engines/crab/bonus.h
@@ -31,8 +31,8 @@
#ifndef CRAB_BONUS_H
#define CRAB_BONUS_H
-#include "common_header.h"
-#include "loaders.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
namespace pyrodactyl {
namespace stat {
diff --git a/engines/crab/button.cpp b/engines/crab/button.cpp
index bcdbeb13482..d28ba61e3c1 100644
--- a/engines/crab/button.cpp
+++ b/engines/crab/button.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: Contains the button functions
//=============================================================================
-#include "button.h"
+#include "crab/button.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/button.h b/engines/crab/button.h
index 7667f67ebc6..d1d1f757da4 100644
--- a/engines/crab/button.h
+++ b/engines/crab/button.h
@@ -35,14 +35,14 @@
#ifndef CRAB_BUTTON_H
#define CRAB_BUTTON_H
-#include "Caption.h"
-#include "HoverInfo.h"
-#include "ImageManager.h"
-#include "MusicManager.h"
-#include "TextManager.h"
-#include "common_header.h"
-#include "element.h"
-#include "hotkey.h"
+#include "crab/Caption.h"
+#include "crab/HoverInfo.h"
+#include "crab/ImageManager.h"
+#include "crab/MusicManager.h"
+#include "crab/TextManager.h"
+#include "crab/common_header.h"
+#include "crab/element.h"
+#include "crab/hotkey.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/changeval.h b/engines/crab/changeval.h
index d3af6953a9a..61714626208 100644
--- a/engines/crab/changeval.h
+++ b/engines/crab/changeval.h
@@ -31,8 +31,8 @@
#ifndef CRAB_CHANGEVAL_H
#define CRAB_CHANGEVAL_H
-#include "common_header.h"
-#include "opinion.h"
+#include "crab/common_header.h"
+#include "crab/opinion.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/collision.cpp b/engines/crab/collision.cpp
index a6a7017fd14..bdadad73eed 100644
--- a/engines/crab/collision.cpp
+++ b/engines/crab/collision.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "collision.h"
+#include "crab/collision.h"
// Find if a line and a rectangle intersect
bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect) {
diff --git a/engines/crab/collision.h b/engines/crab/collision.h
index 0014f4bb2c8..9f4de4fdcfb 100644
--- a/engines/crab/collision.h
+++ b/engines/crab/collision.h
@@ -31,9 +31,9 @@
#ifndef CRAB_COLLISION_H
#define CRAB_COLLISION_H
-#include "Polygon.h"
-#include "Rectangle.h"
-#include "common_header.h"
+#include "crab/Polygon.h"
+#include "crab/Rectangle.h"
+#include "crab/common_header.h"
// Find if a line and a rectangle intersect
bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect);
diff --git a/engines/crab/color.cpp b/engines/crab/color.cpp
index 26ed6e1ad26..540f13ed766 100644
--- a/engines/crab/color.cpp
+++ b/engines/crab/color.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "color.h"
+#include "crab/color.h"
using namespace pyrodactyl::text;
diff --git a/engines/crab/color.h b/engines/crab/color.h
index 1373614bb05..834d69916a2 100644
--- a/engines/crab/color.h
+++ b/engines/crab/color.h
@@ -31,9 +31,9 @@
#ifndef CRAB_COLOR_H
#define CRAB_COLOR_H
-#include "XMLDoc.h"
-#include "common_header.h"
-#include "loaders.h"
+#include "crab/XMLDoc.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
namespace pyrodactyl {
namespace text {
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 9215cdc127e..12482cf7625 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -55,6 +55,6 @@
#include "common/str.h"
#define RAPIDXML_NO_EXCEPTIONS
-#include "rapidxml/rapidxml.hpp"
+#include "crab/rapidxml/rapidxml.hpp"
#endif // CRAB_COMMON_HEADER_H
diff --git a/engines/crab/conversationdata.cpp b/engines/crab/conversationdata.cpp
index 0519460f612..f1e1d52e00c 100644
--- a/engines/crab/conversationdata.cpp
+++ b/engines/crab/conversationdata.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "conversationdata.h"
+#include "crab/conversationdata.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/conversationdata.h b/engines/crab/conversationdata.h
index d0f15da2a57..1017281ff8c 100644
--- a/engines/crab/conversationdata.h
+++ b/engines/crab/conversationdata.h
@@ -31,9 +31,9 @@
#ifndef CRAB_CONVERSATIONDATA_H
#define CRAB_CONVERSATIONDATA_H
-#include "changeval.h"
-#include "common_header.h"
-#include "triggerset.h"
+#include "crab/changeval.h"
+#include "crab/common_header.h"
+#include "crab/triggerset.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 0d60e89106a..8c392912d7c 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -59,7 +59,7 @@
#include "crab/detection.h"
#include "crab/loaders.h"
#include "crab/numstr.h"
-#include "engines/crab/XMLDoc.h"
+#include "crab/XMLDoc.h"
#include "engines/util.h"
#include "graphics/palette.h"
diff --git a/engines/crab/cursor.cpp b/engines/crab/cursor.cpp
index 33a896f9f8a..d157571d3b1 100644
--- a/engines/crab/cursor.cpp
+++ b/engines/crab/cursor.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: Cursor class
//=============================================================================
-#include "cursor.h"
+#include "crab/cursor.h"
namespace pyrodactyl {
namespace input {
diff --git a/engines/crab/cursor.h b/engines/crab/cursor.h
index 64fef75708a..5ffc467b07d 100644
--- a/engines/crab/cursor.h
+++ b/engines/crab/cursor.h
@@ -35,10 +35,10 @@
#ifndef CRAB_CURSOR_H
#define CRAB_CURSOR_H
-#include "Image.h"
-#include "common_header.h"
-#include "loaders.h"
-#include "vectors.h"
+#include "crab/Image.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
+#include "crab/vectors.h"
namespace pyrodactyl {
namespace input {
diff --git a/engines/crab/dialogbox.cpp b/engines/crab/dialogbox.cpp
index 834638a2ab9..806fdc02388 100644
--- a/engines/crab/dialogbox.cpp
+++ b/engines/crab/dialogbox.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: Dialog box!
//=============================================================================
-#include "dialogbox.h"
+#include "crab/dialogbox.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/dialogbox.h b/engines/crab/dialogbox.h
index e9c7c450933..5770510de3d 100644
--- a/engines/crab/dialogbox.h
+++ b/engines/crab/dialogbox.h
@@ -35,10 +35,10 @@
#ifndef CRAB_DIALOGBOX_H
#define CRAB_DIALOGBOX_H
-#include "GameEventInfo.h"
-#include "ParagraphData.h"
-#include "button.h"
-#include "common_header.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ParagraphData.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/effect.cpp b/engines/crab/effect.cpp
index 38986d57248..a67f8a96f5d 100644
--- a/engines/crab/effect.cpp
+++ b/engines/crab/effect.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "effect.h"
-#include "MusicManager.h"
+#include "crab/effect.h"
+#include "crab/MusicManager.h"
using namespace pyrodactyl::event;
using namespace pyrodactyl::music;
diff --git a/engines/crab/effect.h b/engines/crab/effect.h
index 49b917b12b2..ce854f7fed7 100644
--- a/engines/crab/effect.h
+++ b/engines/crab/effect.h
@@ -31,11 +31,11 @@
#ifndef CRAB_EFFECT_H
#define CRAB_EFFECT_H
-#include "GameEventInfo.h"
-#include "XMLDoc.h"
-#include "common_header.h"
-#include "loaders.h"
-#include "person.h"
+#include "crab/GameEventInfo.h"
+#include "crab/XMLDoc.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
+#include "crab/person.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/element.cpp b/engines/crab/element.cpp
index 452bea9b1ea..06f68f0edb9 100644
--- a/engines/crab/element.cpp
+++ b/engines/crab/element.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "element.h"
+#include "crab/element.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/element.h b/engines/crab/element.h
index b3144996366..eecc10fef9f 100644
--- a/engines/crab/element.h
+++ b/engines/crab/element.h
@@ -31,10 +31,10 @@
#ifndef CRAB_ELEMENT_H
#define CRAB_ELEMENT_H
-#include "ImageManager.h"
-#include "ScreenSettings.h"
-#include "common_header.h"
-#include "vectors.h"
+#include "crab/ImageManager.h"
+#include "crab/ScreenSettings.h"
+#include "crab/common_header.h"
+#include "crab/vectors.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/emotion.cpp b/engines/crab/emotion.cpp
index 9723f7ae51b..580b9ec0212 100644
--- a/engines/crab/emotion.cpp
+++ b/engines/crab/emotion.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "emotion.h"
+#include "crab/emotion.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
diff --git a/engines/crab/emotion.h b/engines/crab/emotion.h
index 0f36a621218..642370ef6a1 100644
--- a/engines/crab/emotion.h
+++ b/engines/crab/emotion.h
@@ -31,10 +31,10 @@
#ifndef CRAB_EMOTION_H
#define CRAB_EMOTION_H
-#include "ImageManager.h"
-#include "common_header.h"
-#include "eventstore.h"
-#include "textarea.h"
+#include "crab/ImageManager.h"
+#include "crab/common_header.h"
+#include "crab/eventstore.h"
+#include "crab/textarea.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/eventstore.cpp b/engines/crab/eventstore.cpp
index 47ea732a08e..83169655fb5 100644
--- a/engines/crab/eventstore.cpp
+++ b/engines/crab/eventstore.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "eventstore.h"
+#include "crab/eventstore.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/eventstore.h b/engines/crab/eventstore.h
index 49c1a5bc8e2..ce181369f1b 100644
--- a/engines/crab/eventstore.h
+++ b/engines/crab/eventstore.h
@@ -31,10 +31,10 @@
#ifndef CRAB_EVENTSTORE_H
#define CRAB_EVENTSTORE_H
-#include "StateButton.h"
-#include "animation.h"
-#include "common_header.h"
-#include "conversationdata.h"
+#include "crab/StateButton.h"
+#include "crab/animation.h"
+#include "crab/common_header.h"
+#include "crab/conversationdata.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/fightanim.cpp b/engines/crab/fightanim.cpp
index 80b2c3d6ea9..cec387acf01 100644
--- a/engines/crab/fightanim.cpp
+++ b/engines/crab/fightanim.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "fightanim.h"
+#include "crab/fightanim.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/fightanim.h b/engines/crab/fightanim.h
index 0a8bd5408d0..1a6cd80807b 100644
--- a/engines/crab/fightanim.h
+++ b/engines/crab/fightanim.h
@@ -31,13 +31,13 @@
#ifndef CRAB_FIGHTANIM_H
#define CRAB_FIGHTANIM_H
-#include "MusicManager.h"
-#include "common_header.h"
-#include "fightinput.h"
-#include "fm_ai_data.h"
-#include "moveeffect.h"
-#include "shadow.h"
-#include "triggerset.h"
+#include "crab/MusicManager.h"
+#include "crab/common_header.h"
+#include "crab/fightinput.h"
+#include "crab/fm_ai_data.h"
+#include "crab/moveeffect.h"
+#include "crab/shadow.h"
+#include "crab/triggerset.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/fightinput.cpp b/engines/crab/fightinput.cpp
index ec4a67d7e08..1efb7107616 100644
--- a/engines/crab/fightinput.cpp
+++ b/engines/crab/fightinput.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "fightinput.h"
+#include "crab/fightinput.h"
using namespace pyrodactyl::input;
diff --git a/engines/crab/fightinput.h b/engines/crab/fightinput.h
index 8bec03cd8a0..504445ca6c9 100644
--- a/engines/crab/fightinput.h
+++ b/engines/crab/fightinput.h
@@ -31,9 +31,9 @@
#ifndef CRAB_FIGHTINPUT_H
#define CRAB_FIGHTINPUT_H
-#include "common_header.h"
-#include "input.h"
-#include "loaders.h"
+#include "crab/common_header.h"
+#include "crab/input.h"
+#include "crab/loaders.h"
namespace pyrodactyl {
namespace input {
diff --git a/engines/crab/fightmove.cpp b/engines/crab/fightmove.cpp
index 2c8d0ca1454..da54b2f1334 100644
--- a/engines/crab/fightmove.cpp
+++ b/engines/crab/fightmove.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "fightmove.h"
+#include "crab/fightmove.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/fightmove.h b/engines/crab/fightmove.h
index 606c5473f4f..7a517936f0b 100644
--- a/engines/crab/fightmove.h
+++ b/engines/crab/fightmove.h
@@ -31,8 +31,8 @@
#ifndef CRAB_FIGHTMOVE_H
#define CRAB_FIGHTMOVE_H
-#include "common_header.h"
-#include "fightanim.h"
+#include "crab/common_header.h"
+#include "crab/fightanim.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/fightmoves.cpp b/engines/crab/fightmoves.cpp
index 5042fe9da55..7ca0afc6262 100644
--- a/engines/crab/fightmoves.cpp
+++ b/engines/crab/fightmoves.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "fightmoves.h"
+#include "crab/fightmoves.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/fightmoves.h b/engines/crab/fightmoves.h
index 575952e3cdd..9faa4cb675b 100644
--- a/engines/crab/fightmoves.h
+++ b/engines/crab/fightmoves.h
@@ -31,9 +31,9 @@
#ifndef CRAB_FIGHTMOVES_H
#define CRAB_FIGHTMOVES_H
-#include "MusicManager.h"
-#include "common_header.h"
-#include "fightmove.h"
+#include "crab/MusicManager.h"
+#include "crab/common_header.h"
+#include "crab/fightmove.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index cb754a16a74..0d368c20151 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "engines/crab/filesystem.h"
+#include "crab/filesystem.h"
#include "common/file.h"
namespace Crab {
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index 4507a1b63de..5ebf3aa7811 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -30,7 +30,7 @@
#ifndef CRAB_FILESYSTEM_H
#define CRAB_FILESYSTEM_H
-#include "common_header.h"
+#include "crab/common_header.h"
namespace Crab {
bool FileOpen(const Common::Path &path, char *&data);
diff --git a/engines/crab/fm_ai_data.h b/engines/crab/fm_ai_data.h
index 162627074b3..6728e48ac1d 100644
--- a/engines/crab/fm_ai_data.h
+++ b/engines/crab/fm_ai_data.h
@@ -31,8 +31,8 @@
#ifndef CRAB_FM_AI_DATA_H
#define CRAB_FM_AI_DATA_H
-#include "common_header.h"
-#include "range.h"
+#include "crab/common_header.h"
+#include "crab/range.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 0712fde336f..9ef863c6463 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "game.h"
+#include "crab/game.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::ui;
diff --git a/engines/crab/game.h b/engines/crab/game.h
index d3be0442b97..5bfe5df7b04 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -31,19 +31,19 @@
#ifndef CRAB_GAME_H
#define CRAB_GAME_H
-#include "DevConsole.h"
-#include "GameClock.h"
-#include "GameEventInfo.h"
-#include "ImageManager.h"
-#include "LoadingScreen.h"
-#include "common_header.h"
-#include "cursor.h"
-#include "gameeventmanager.h"
-#include "gamestate_container.h"
-#include "hud.h"
-#include "level.h"
-#include "map.h"
-#include "menu.h"
+#include "crab/DevConsole.h"
+#include "crab/GameClock.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ImageManager.h"
+#include "crab/LoadingScreen.h"
+#include "crab/common_header.h"
+#include "crab/cursor.h"
+#include "crab/gameeventmanager.h"
+#include "crab/gamestate_container.h"
+#include "crab/hud.h"
+#include "crab/level.h"
+#include "crab/map.h"
+#include "crab/menu.h"
class Game : public GameState {
private:
diff --git a/engines/crab/gameevent.cpp b/engines/crab/gameevent.cpp
index 9324da74de5..1fe0d9241f0 100644
--- a/engines/crab/gameevent.cpp
+++ b/engines/crab/gameevent.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "gameevent.h"
+#include "crab/gameevent.h"
using namespace pyrodactyl::event;
using namespace pyrodactyl::people;
diff --git a/engines/crab/gameevent.h b/engines/crab/gameevent.h
index 1933bf617c1..b6515e1a0d9 100644
--- a/engines/crab/gameevent.h
+++ b/engines/crab/gameevent.h
@@ -31,13 +31,13 @@
#ifndef CRAB_GAMEEVENT_H
#define CRAB_GAMEEVENT_H
-#include "ImageManager.h"
-#include "common_header.h"
-#include "effect.h"
-#include "eventstore.h"
-#include "person.h"
+#include "crab/ImageManager.h"
+#include "crab/common_header.h"
+#include "crab/effect.h"
+#include "crab/eventstore.h"
+#include "crab/person.h"
#include "personbase.h"
-#include "triggerset.h"
+#include "crab/triggerset.h"
// An unsigned integer is our event id format
typedef unsigned int EventID;
diff --git a/engines/crab/gameeventmanager.cpp b/engines/crab/gameeventmanager.cpp
index 580491cddfc..39bc5cf01aa 100644
--- a/engines/crab/gameeventmanager.cpp
+++ b/engines/crab/gameeventmanager.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "gameeventmanager.h"
+#include "crab/gameeventmanager.h"
using namespace pyrodactyl::people;
using namespace pyrodactyl::event;
diff --git a/engines/crab/gameeventmanager.h b/engines/crab/gameeventmanager.h
index c9d6a384829..be0a1dae3bb 100644
--- a/engines/crab/gameeventmanager.h
+++ b/engines/crab/gameeventmanager.h
@@ -31,16 +31,16 @@
#ifndef CRAB_GAMEEVENTMANAGER_H
#define CRAB_GAMEEVENTMANAGER_H
-#include "ChapterIntro.h"
-#include "EventSeqGroup.h"
-#include "PersonHandler.h"
-#include "PersonScreen.h"
-#include "ReplyMenu.h"
-#include "common_header.h"
-#include "hud.h"
-#include "journal.h"
-#include "level.h"
-#include "textarea.h"
+#include "crab/ChapterIntro.h"
+#include "crab/EventSeqGroup.h"
+#include "crab/PersonHandler.h"
+#include "crab/PersonScreen.h"
+#include "crab/ReplyMenu.h"
+#include "crab/common_header.h"
+#include "crab/hud.h"
+#include "crab/journal.h"
+#include "crab/level.h"
+#include "crab/textarea.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index 1b9c1f8efd9..f157fdfcb05 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -35,8 +35,8 @@
#ifndef CRAB_GAMESTATE_CONTAINER_H
#define CRAB_GAMESTATE_CONTAINER_H
-#include "common_header.h"
-#include "gamestates.h"
+#include "crab/common_header.h"
+#include "crab/gamestates.h"
//------------------------------------------------------------------------
// Purpose: Game State base class
diff --git a/engines/crab/gamestates.h b/engines/crab/gamestates.h
index ce76c54ab6a..fb6d75270c3 100644
--- a/engines/crab/gamestates.h
+++ b/engines/crab/gamestates.h
@@ -30,7 +30,7 @@
#ifndef CRAB_GAMESTATES_H
#define CRAB_GAMESTATES_H
-#include "common_header.h"
+#include "crab/common_header.h"
//------------------------------------------------------------------------
// Purpose: Game State Enumerators
diff --git a/engines/crab/hotkey.cpp b/engines/crab/hotkey.cpp
index 15ee554f440..c15a0c6a6f7 100644
--- a/engines/crab/hotkey.cpp
+++ b/engines/crab/hotkey.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "hotkey.h"
+#include "crab/hotkey.h"
using namespace pyrodactyl::input;
diff --git a/engines/crab/hotkey.h b/engines/crab/hotkey.h
index 640b9b9b198..965f1d9c6c7 100644
--- a/engines/crab/hotkey.h
+++ b/engines/crab/hotkey.h
@@ -31,8 +31,8 @@
#ifndef CRAB_HOTKEY_H
#define CRAB_HOTKEY_H
-#include "common_header.h"
-#include "input.h"
+#include "crab/common_header.h"
+#include "crab/input.h"
namespace pyrodactyl {
namespace input {
diff --git a/engines/crab/hud.cpp b/engines/crab/hud.cpp
index d01f94fc7d8..9cfd71963f4 100644
--- a/engines/crab/hud.cpp
+++ b/engines/crab/hud.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: The tray where you have inventory, map and GameObjectives icons
//=============================================================================
-#include "hud.h"
+#include "crab/hud.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/hud.h b/engines/crab/hud.h
index 1b1f2eaf2a1..3bbd05b7330 100644
--- a/engines/crab/hud.h
+++ b/engines/crab/hud.h
@@ -35,17 +35,17 @@
#ifndef CRAB_HUD_H
#define CRAB_HUD_H
-#include "FileMenu.h"
-#include "GameEventInfo.h"
-#include "GameOverMenu.h"
-#include "HealthIndicator.h"
-#include "PauseMenu.h"
-#include "SlideShow.h"
-#include "StateButton.h"
-#include "common_header.h"
-#include "input.h"
-#include "level_objects.h"
-#include "talknotify.h"
+#include "crab/FileMenu.h"
+#include "crab/GameEventInfo.h"
+#include "crab/GameOverMenu.h"
+#include "crab/HealthIndicator.h"
+#include "crab/PauseMenu.h"
+#include "crab/SlideShow.h"
+#include "crab/StateButton.h"
+#include "crab/common_header.h"
+#include "crab/input.h"
+#include "crab/level_objects.h"
+#include "crab/talknotify.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/imageeffect.cpp b/engines/crab/imageeffect.cpp
index fe7caa045fd..6da576bc9aa 100644
--- a/engines/crab/imageeffect.cpp
+++ b/engines/crab/imageeffect.cpp
@@ -29,7 +29,7 @@
*/
-#include "imageeffect.h"
+#include "crab/imageeffect.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/imageeffect.h b/engines/crab/imageeffect.h
index e9329867146..4af00b2bb08 100644
--- a/engines/crab/imageeffect.h
+++ b/engines/crab/imageeffect.h
@@ -30,9 +30,9 @@
#ifndef CRAB_IMAGEEFFECT_H
#define CRAB_IMAGEEFFECT_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "ImageManager.h"
+#include "crab/ImageManager.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/input.cpp b/engines/crab/input.cpp
index 4f54d290e9d..14323c83d35 100644
--- a/engines/crab/input.cpp
+++ b/engines/crab/input.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "input.h"
+#include "crab/input.h"
namespace pyrodactyl {
namespace input {
diff --git a/engines/crab/input.h b/engines/crab/input.h
index bce8877bf2f..960d11fda92 100644
--- a/engines/crab/input.h
+++ b/engines/crab/input.h
@@ -31,8 +31,8 @@
#ifndef CRAB_INPUT_H
#define CRAB_INPUT_H
-#include "common_header.h"
-#include "inputval.h"
+#include "crab/common_header.h"
+#include "crab/inputval.h"
#define ANALOG_PRESSED 2
diff --git a/engines/crab/inputval.cpp b/engines/crab/inputval.cpp
index 7858fe737c5..65679f0e69c 100644
--- a/engines/crab/inputval.cpp
+++ b/engines/crab/inputval.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "inputval.h"
+#include "crab/inputval.h"
using namespace pyrodactyl::input;
diff --git a/engines/crab/inputval.h b/engines/crab/inputval.h
index 080f8e86008..e3b7e22aa86 100644
--- a/engines/crab/inputval.h
+++ b/engines/crab/inputval.h
@@ -31,10 +31,10 @@
#ifndef CRAB_INPUTVAL_H
#define CRAB_INPUTVAL_H
-#include "GameParam.h"
-#include "XMLDoc.h"
-#include "common_header.h"
-#include "loaders.h"
+#include "crab/GameParam.h"
+#include "crab/XMLDoc.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
namespace pyrodactyl {
namespace input {
diff --git a/engines/crab/journal.cpp b/engines/crab/journal.cpp
index 22299cdf98e..1ea6bcfbffa 100644
--- a/engines/crab/journal.cpp
+++ b/engines/crab/journal.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "journal.h"
+#include "crab/journal.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::ui;
diff --git a/engines/crab/journal.h b/engines/crab/journal.h
index c9ba3e61a73..4caf2347272 100644
--- a/engines/crab/journal.h
+++ b/engines/crab/journal.h
@@ -31,11 +31,11 @@
#ifndef CRAB_JOURNAL_H
#define CRAB_JOURNAL_H
-#include "ImageData.h"
-#include "ImageManager.h"
-#include "StateButton.h"
-#include "common_header.h"
-#include "questmenu.h"
+#include "crab/ImageData.h"
+#include "crab/ImageManager.h"
+#include "crab/StateButton.h"
+#include "crab/common_header.h"
+#include "crab/questmenu.h"
#define JE_CUR_NAME "cur"
#define JE_DONE_NAME "done"
diff --git a/engines/crab/level.cpp b/engines/crab/level.cpp
index 5b1659e90f0..0471d572184 100644
--- a/engines/crab/level.cpp
+++ b/engines/crab/level.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "level.h"
+#include "crab/level.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level.h b/engines/crab/level.h
index 31a2ac3e444..75d375c1188 100644
--- a/engines/crab/level.h
+++ b/engines/crab/level.h
@@ -31,19 +31,19 @@
#ifndef CRAB_LEVEL_H
#define CRAB_LEVEL_H
-#include "GameEventInfo.h"
-#include "ImageManager.h"
-#include "ParagraphData.h"
-#include "PathfindingGrid.h"
-#include "TMXMap.h"
-#include "animset.h"
-#include "button.h"
-#include "common_header.h"
-#include "fightmove.h"
-#include "level_objects.h"
-#include "person.h"
-#include "sprite.h"
-#include "talknotify.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ImageManager.h"
+#include "crab/ParagraphData.h"
+#include "crab/PathfindingGrid.h"
+#include "crab/TMXMap.h"
+#include "crab/animset.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
+#include "crab/fightmove.h"
+#include "crab/level_objects.h"
+#include "crab/person.h"
+#include "crab/sprite.h"
+#include "crab/talknotify.h"
namespace pyrodactyl {
namespace level {
diff --git a/engines/crab/level_ai.cpp b/engines/crab/level_ai.cpp
index 643c21950ec..86f0ddd7ea0 100644
--- a/engines/crab/level_ai.cpp
+++ b/engines/crab/level_ai.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "level.h"
+#include "crab/level.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_collide.cpp b/engines/crab/level_collide.cpp
index f11d31402a0..c20182b4410 100644
--- a/engines/crab/level_collide.cpp
+++ b/engines/crab/level_collide.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "level.h"
+#include "crab/level.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_draw.cpp b/engines/crab/level_draw.cpp
index 8e65e7305a8..4c6fa589df6 100644
--- a/engines/crab/level_draw.cpp
+++ b/engines/crab/level_draw.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "level.h"
+#include "crab/level.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_load.cpp b/engines/crab/level_load.cpp
index ca2654fb953..c633347e92e 100644
--- a/engines/crab/level_load.cpp
+++ b/engines/crab/level_load.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "level.h"
+#include "crab/level.h"
using namespace TMX;
using namespace pyrodactyl::stat;
diff --git a/engines/crab/level_objects.cpp b/engines/crab/level_objects.cpp
index 183399e92fb..83e1e3decde 100644
--- a/engines/crab/level_objects.cpp
+++ b/engines/crab/level_objects.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "level_objects.h"
+#include "crab/level_objects.h"
using namespace pyrodactyl::image;
using namespace pyrodactyl::level;
diff --git a/engines/crab/level_objects.h b/engines/crab/level_objects.h
index a4f9c530612..54c2c478670 100644
--- a/engines/crab/level_objects.h
+++ b/engines/crab/level_objects.h
@@ -31,8 +31,8 @@
#ifndef CRAB_LEVEL_OBJECTS_H
#define CRAB_LEVEL_OBJECTS_H
-#include "ImageManager.h"
-#include "common_header.h"
+#include "crab/ImageManager.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace level {
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 8b0e59bef6d..77148883c5f 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "loaders.h"
+#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 1f38d71e9a2..e5cfa75308b 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -31,10 +31,10 @@
#ifndef CRAB_LOADERS_H
#define CRAB_LOADERS_H
-#include "engines/crab/XMLDoc.h"
-#include "engines/crab/common_header.h"
-#include "engines/crab/gametype.h"
-#include "engines/crab/numstr.h"
+#include "crab/XMLDoc.h"
+#include "crab/common_header.h"
+#include "crab/gametype.h"
+#include "crab/numstr.h"
namespace Crab {
diff --git a/engines/crab/main.cpp b/engines/crab/main.cpp
index 14af0cdecac..3ba7e611b7a 100644
--- a/engines/crab/main.cpp
+++ b/engines/crab/main.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "app.h"
+#include "crab/app.h"
int WinMain(int argc, char *args[]) {
App app;
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 9990248b714..9c60b284a9b 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "mainmenu.h"
-#include "url.h"
+#include "crab/mainmenu.h"
+#include "crab/url.h"
using namespace pyrodactyl::music;
using namespace pyrodactyl::image;
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 619d8a3100b..208bcedc7f6 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -31,22 +31,22 @@
#ifndef CRAB_MAINMENU_H
#define CRAB_MAINMENU_H
-#include "AlphaImage.h"
-#include "CreditScreen.h"
-#include "FileMenu.h"
-#include "ImageData.h"
-#include "KeyBindMenu.h"
-#include "ModMenu.h"
-#include "OptionMenu.h"
-#include "SlideShow.h"
-#include "StateButton.h"
-#include "common_header.h"
-#include "cursor.h"
-#include "gamestate_container.h"
-#include "gamestates.h"
-#include "menu.h"
-#include "slider.h"
-#include "textarea.h"
+#include "crab/AlphaImage.h"
+#include "crab/CreditScreen.h"
+#include "crab/FileMenu.h"
+#include "crab/ImageData.h"
+#include "crab/KeyBindMenu.h"
+#include "crab/ModMenu.h"
+#include "crab/OptionMenu.h"
+#include "crab/SlideShow.h"
+#include "crab/StateButton.h"
+#include "crab/common_header.h"
+#include "crab/cursor.h"
+#include "crab/gamestate_container.h"
+#include "crab/gamestates.h"
+#include "crab/menu.h"
+#include "crab/slider.h"
+#include "crab/textarea.h"
// #define UNREST_DEMO
diff --git a/engines/crab/map.cpp b/engines/crab/map.cpp
index 969aa962cd4..8a32bd8346e 100644
--- a/engines/crab/map.cpp
+++ b/engines/crab/map.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "map.h"
+#include "crab/map.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/map.h b/engines/crab/map.h
index 9967d229f20..6587f45a717 100644
--- a/engines/crab/map.h
+++ b/engines/crab/map.h
@@ -31,16 +31,16 @@
#ifndef CRAB_MAP_H
#define CRAB_MAP_H
-#include "GameEventInfo.h"
-#include "ImageData.h"
-#include "ImageManager.h"
-#include "MapData.h"
-#include "MapMarkerMenu.h"
-#include "StateButton.h"
-#include "ToggleButton.h"
-#include "common_header.h"
-#include "mapbutton.h"
-#include "triggerset.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ImageData.h"
+#include "crab/ImageManager.h"
+#include "crab/MapData.h"
+#include "crab/MapMarkerMenu.h"
+#include "crab/StateButton.h"
+#include "crab/ToggleButton.h"
+#include "crab/common_header.h"
+#include "crab/mapbutton.h"
+#include "crab/triggerset.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/mapbutton.h b/engines/crab/mapbutton.h
index 94c3b0ae95a..1cfa932117f 100644
--- a/engines/crab/mapbutton.h
+++ b/engines/crab/mapbutton.h
@@ -30,10 +30,10 @@
#ifndef CRAB_MAPBUTTON_H
#define CRAB_MAPBUTTON_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "menu.h"
-#include "triggerset.h"
+#include "crab/menu.h"
+#include "crab/triggerset.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/menu.h b/engines/crab/menu.h
index 46fdc399871..94ca3c7a783 100644
--- a/engines/crab/menu.h
+++ b/engines/crab/menu.h
@@ -35,9 +35,9 @@
#ifndef CRAB_MENU_H
#define CRAB_MENU_H
-#include "ImageManager.h"
-#include "button.h"
-#include "common_header.h"
+#include "crab/ImageManager.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/moveeffect.cpp b/engines/crab/moveeffect.cpp
index fb1f368b576..41c52d75bfc 100644
--- a/engines/crab/moveeffect.cpp
+++ b/engines/crab/moveeffect.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "moveeffect.h"
+#include "crab/moveeffect.h"
using namespace pyrodactyl::anim;
diff --git a/engines/crab/moveeffect.h b/engines/crab/moveeffect.h
index 5abc358c495..0f882c2b61f 100644
--- a/engines/crab/moveeffect.h
+++ b/engines/crab/moveeffect.h
@@ -31,9 +31,9 @@
#ifndef CRAB_MOVEEFFECT_H
#define CRAB_MOVEEFFECT_H
-#include "common_header.h"
-#include "imageeffect.h"
-#include "musicparam.h"
+#include "crab/common_header.h"
+#include "crab/imageeffect.h"
+#include "crab/musicparam.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/movement.cpp b/engines/crab/movement.cpp
index 04dd0f1dd77..faa9caabc93 100644
--- a/engines/crab/movement.cpp
+++ b/engines/crab/movement.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "movement.h"
+#include "crab/movement.h"
using namespace pyrodactyl::ai;
diff --git a/engines/crab/movement.h b/engines/crab/movement.h
index fa04e97ec72..483ecf0183b 100644
--- a/engines/crab/movement.h
+++ b/engines/crab/movement.h
@@ -31,10 +31,10 @@
#ifndef CRAB_MOVEMENT_H
#define CRAB_MOVEMENT_H
-#include "Rectangle.h"
-#include "common_header.h"
-#include "timer.h"
-#include "vectors.h"
+#include "crab/Rectangle.h"
+#include "crab/common_header.h"
+#include "crab/timer.h"
+#include "crab/vectors.h"
namespace pyrodactyl {
namespace ai {
diff --git a/engines/crab/musicparam.h b/engines/crab/musicparam.h
index 069d07ff6d9..56ba0d71cf5 100644
--- a/engines/crab/musicparam.h
+++ b/engines/crab/musicparam.h
@@ -30,9 +30,9 @@
#ifndef CRAB_MUSICPARAM_H
#define CRAB_MUSICPARAM_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "loaders.h"
+#include "crab/loaders.h"
namespace pyrodactyl {
namespace music {
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 9faf008a394..50f579e7d1b 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -30,7 +30,7 @@
#ifndef CRAB_NUMSTR_H
#define CRAB_NUMSTR_H
-#include "common_header.h"
+#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/opinion.cpp b/engines/crab/opinion.cpp
index 502a378fe20..c857875f527 100644
--- a/engines/crab/opinion.cpp
+++ b/engines/crab/opinion.cpp
@@ -29,7 +29,7 @@
*/
-#include "opinion.h"
+#include "crab/opinion.h"
namespace pyrodactyl {
namespace people {
diff --git a/engines/crab/opinion.h b/engines/crab/opinion.h
index c1f21b29f56..e87012694d8 100644
--- a/engines/crab/opinion.h
+++ b/engines/crab/opinion.h
@@ -30,9 +30,9 @@
#ifndef CRAB_OPINION_H
#define CRAB_OPINION_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "GameParam.h"
+#include "crab/GameParam.h"
namespace pyrodactyl {
namespace people {
diff --git a/engines/crab/person.cpp b/engines/crab/person.cpp
index ba3a545ef16..a7b665b326d 100644
--- a/engines/crab/person.cpp
+++ b/engines/crab/person.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "person.h"
+#include "crab/person.h"
using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
diff --git a/engines/crab/person.h b/engines/crab/person.h
index b2a9e56eca5..ab8e92f0a7c 100644
--- a/engines/crab/person.h
+++ b/engines/crab/person.h
@@ -31,13 +31,13 @@
#ifndef CRAB_PERSON_H
#define CRAB_PERSON_H
-#include "ImageManager.h"
-#include "Stat.h"
-#include "StatTemplate.h"
-#include "common_header.h"
-#include "opinion.h"
+#include "crab/ImageManager.h"
+#include "crab/Stat.h"
+#include "crab/StatTemplate.h"
+#include "crab/common_header.h"
+#include "crab/opinion.h"
#include "personbase.h"
-#include "trait.h"
+#include "crab/trait.h"
namespace pyrodactyl {
namespace people {
diff --git a/engines/crab/personbase.h b/engines/crab/personbase.h
index cae51aeea59..ca39597e2b6 100644
--- a/engines/crab/personbase.h
+++ b/engines/crab/personbase.h
@@ -31,8 +31,8 @@
#ifndef CRAB_PERSONBASE_H
#define CRAB_PERSONBASE_H
-#include "Stat.h"
-#include "common_header.h"
+#include "crab/Stat.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace people {
diff --git a/engines/crab/quest.cpp b/engines/crab/quest.cpp
index 94179e18739..6dbc6f4da45 100644
--- a/engines/crab/quest.cpp
+++ b/engines/crab/quest.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "quest.h"
+#include "crab/quest.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/quest.h b/engines/crab/quest.h
index 58412154d70..dffc5c19f59 100644
--- a/engines/crab/quest.h
+++ b/engines/crab/quest.h
@@ -31,8 +31,8 @@
#ifndef CRAB_QUEST_H
#define CRAB_QUEST_H
-#include "common_header.h"
-#include "loaders.h"
+#include "crab/common_header.h"
+#include "crab/loaders.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/questmenu.cpp b/engines/crab/questmenu.cpp
index c9ada6be319..8a025536fdc 100644
--- a/engines/crab/questmenu.cpp
+++ b/engines/crab/questmenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "questmenu.h"
+#include "crab/questmenu.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
diff --git a/engines/crab/questmenu.h b/engines/crab/questmenu.h
index 18122a787f7..d5db7728dae 100644
--- a/engines/crab/questmenu.h
+++ b/engines/crab/questmenu.h
@@ -31,11 +31,11 @@
#ifndef CRAB_QUESTMENU_H
#define CRAB_QUESTMENU_H
-#include "PageMenu.h"
-#include "QuestText.h"
-#include "StateButton.h"
-#include "common_header.h"
-#include "quest.h"
+#include "crab/PageMenu.h"
+#include "crab/QuestText.h"
+#include "crab/StateButton.h"
+#include "crab/common_header.h"
+#include "crab/quest.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/range.h b/engines/crab/range.h
index ea62436babb..f515ae98413 100644
--- a/engines/crab/range.h
+++ b/engines/crab/range.h
@@ -31,8 +31,8 @@
#ifndef CRAB_RANGE_H
#define CRAB_RANGE_H
-#include "animframe.h"
-#include "common_header.h"
+#include "crab/animframe.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/shadow.h b/engines/crab/shadow.h
index 70bfa821eab..6fbb35bd447 100644
--- a/engines/crab/shadow.h
+++ b/engines/crab/shadow.h
@@ -31,9 +31,9 @@
#ifndef CRAB_SHADOW_H
#define CRAB_SHADOW_H
-#include "ImageManager.h"
-#include "common_header.h"
-#include "vectors.h"
+#include "crab/ImageManager.h"
+#include "crab/common_header.h"
+#include "crab/vectors.h"
namespace pyrodactyl {
namespace anim {
diff --git a/engines/crab/slider.cpp b/engines/crab/slider.cpp
index 72f71491b6f..a0a50dbe038 100644
--- a/engines/crab/slider.cpp
+++ b/engines/crab/slider.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "slider.h"
+#include "crab/slider.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
diff --git a/engines/crab/slider.h b/engines/crab/slider.h
index 31eb7a0f03a..cfbcb011e5c 100644
--- a/engines/crab/slider.h
+++ b/engines/crab/slider.h
@@ -31,11 +31,11 @@
#ifndef CRAB_SLIDER_H
#define CRAB_SLIDER_H
-#include "Caption.h"
-#include "ImageData.h"
-#include "ImageManager.h"
-#include "button.h"
-#include "common_header.h"
+#include "crab/Caption.h"
+#include "crab/ImageData.h"
+#include "crab/ImageManager.h"
+#include "crab/button.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index ae44a989a85..c1e371158c3 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -33,7 +33,7 @@
// Author: Arvind
// Purpose: Splash functions
//=============================================================================
-#include "splash.h"
+#include "crab/splash.h"
//------------------------------------------------------------------------
// Purpose: Constructor
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 1f4f8a53b61..33231d55926 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -35,15 +35,15 @@
#ifndef CRAB_SPLASH_H
#define CRAB_SPLASH_H
-#include "ImageManager.h"
-#include "LoadingScreen.h"
-#include "MusicManager.h"
-#include "ScreenSettings.h"
-#include "TextManager.h"
-#include "common_header.h"
-#include "gamestate_container.h"
-#include "gamestates.h"
-#include "timer.h"
+#include "crab/ImageManager.h"
+#include "crab/LoadingScreen.h"
+#include "crab/MusicManager.h"
+#include "crab/ScreenSettings.h"
+#include "crab/TextManager.h"
+#include "crab/common_header.h"
+#include "crab/gamestate_container.h"
+#include "crab/gamestates.h"
+#include "crab/timer.h"
//------------------------------------------------------------------------
// Purpose: Splash screen class
diff --git a/engines/crab/sprite.cpp b/engines/crab/sprite.cpp
index 3653de168f6..9ece605f0e5 100644
--- a/engines/crab/sprite.cpp
+++ b/engines/crab/sprite.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "sprite.h"
+#include "crab/sprite.h"
using namespace pyrodactyl::ai;
using namespace pyrodactyl::anim;
diff --git a/engines/crab/sprite.h b/engines/crab/sprite.h
index a31b2b767be..d3092255d58 100644
--- a/engines/crab/sprite.h
+++ b/engines/crab/sprite.h
@@ -31,19 +31,19 @@
#ifndef CRAB_SPRITE_H
#define CRAB_SPRITE_H
-#include "ImageManager.h"
-#include "LevelExit.h"
-#include "MusicManager.h"
-#include "PathfindingAgent.h"
-#include "PopUp.h"
-#include "Shape.h"
-#include "SpriteConstant.h"
-#include "animset.h"
-#include "collision.h"
-#include "common_header.h"
-#include "person.h"
-#include "spriteai.h"
-#include "timer.h"
+#include "crab/ImageManager.h"
+#include "crab/LevelExit.h"
+#include "crab/MusicManager.h"
+#include "crab/PathfindingAgent.h"
+#include "crab/PopUp.h"
+#include "crab/Shape.h"
+#include "crab/SpriteConstant.h"
+#include "crab/animset.h"
+#include "crab/collision.h"
+#include "crab/common_header.h"
+#include "crab/person.h"
+#include "crab/spriteai.h"
+#include "crab/timer.h"
class PathfindingAgent;
diff --git a/engines/crab/spriteai.cpp b/engines/crab/spriteai.cpp
index f0965729e68..d13d2e74762 100644
--- a/engines/crab/spriteai.cpp
+++ b/engines/crab/spriteai.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "sprite.h"
+#include "crab/sprite.h"
using namespace pyrodactyl::anim;
using namespace pyrodactyl::ai;
diff --git a/engines/crab/spriteai.h b/engines/crab/spriteai.h
index a66861493bf..d958ee40f39 100644
--- a/engines/crab/spriteai.h
+++ b/engines/crab/spriteai.h
@@ -31,9 +31,9 @@
#ifndef CRAB_SPRITEAI_H
#define CRAB_SPRITEAI_H
-#include "common_header.h"
-#include "movement.h"
-// #include "PathfindingAgent.h"
+#include "crab/common_header.h"
+#include "crab/movement.h"
+#include "crab/PathfindingAgent.h"
// class PathfindingAgent;
namespace pyrodactyl {
diff --git a/engines/crab/talknotify.cpp b/engines/crab/talknotify.cpp
index bc330212720..f8496718fdf 100644
--- a/engines/crab/talknotify.cpp
+++ b/engines/crab/talknotify.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "talknotify.h"
+#include "crab/talknotify.h"
using namespace pyrodactyl::text;
using namespace pyrodactyl::level;
diff --git a/engines/crab/talknotify.h b/engines/crab/talknotify.h
index 88691137bfc..9c7ed90be81 100644
--- a/engines/crab/talknotify.h
+++ b/engines/crab/talknotify.h
@@ -31,10 +31,10 @@
#ifndef CRAB_TALKNOTIFY_H
#define CRAB_TALKNOTIFY_H
-#include "GameEventInfo.h"
-#include "ImageManager.h"
-#include "common_header.h"
-#include "sprite.h"
+#include "crab/GameEventInfo.h"
+#include "crab/ImageManager.h"
+#include "crab/common_header.h"
+#include "crab/sprite.h"
namespace pyrodactyl {
namespace level {
diff --git a/engines/crab/textarea.cpp b/engines/crab/textarea.cpp
index 2ad5d9be4fb..62810643ae9 100644
--- a/engines/crab/textarea.cpp
+++ b/engines/crab/textarea.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: TextArea functions
//=============================================================================
-#include "textarea.h"
+#include "crab/textarea.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/textarea.h b/engines/crab/textarea.h
index 0ec18f086e1..36505ffdbf6 100644
--- a/engines/crab/textarea.h
+++ b/engines/crab/textarea.h
@@ -35,11 +35,11 @@
#ifndef CRAB_TEXTAREA_H
#define CRAB_TEXTAREA_H
-#include "HoverInfo.h"
-#include "MusicManager.h"
-#include "TextManager.h"
-#include "common_header.h"
-#include "input.h"
+#include "crab/HoverInfo.h"
+#include "crab/MusicManager.h"
+#include "crab/TextManager.h"
+#include "crab/common_header.h"
+#include "crab/input.h"
namespace pyrodactyl {
namespace ui {
diff --git a/engines/crab/textdata.cpp b/engines/crab/textdata.cpp
index 24a84bfea2f..dcc2ec76ba0 100644
--- a/engines/crab/textdata.cpp
+++ b/engines/crab/textdata.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "TextData.h"
+#include "crab/TextData.h"
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index 0d4131eca6d..03bf4baab68 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -33,7 +33,7 @@
// Author: Arvind
// Purpose: Timer functions
//=============================================================================
-#include "timer.h"
+#include "crab/timer.h"
Timer::Timer() {
// Initialize the variables
diff --git a/engines/crab/timer.h b/engines/crab/timer.h
index b66ee6132fc..21bb402f116 100644
--- a/engines/crab/timer.h
+++ b/engines/crab/timer.h
@@ -34,9 +34,9 @@
//=============================================================================
#ifndef CRAB_TIMER_H
#define CRAB_TIMER_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "loaders.h"
+#include "crab/loaders.h"
class Timer {
private:
diff --git a/engines/crab/trait.cpp b/engines/crab/trait.cpp
index a9a975e13d1..0fcd017cffb 100644
--- a/engines/crab/trait.cpp
+++ b/engines/crab/trait.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "trait.h"
+#include "crab/trait.h"
using namespace pyrodactyl::people;
diff --git a/engines/crab/trait.h b/engines/crab/trait.h
index b4754bd1403..96973590ab3 100644
--- a/engines/crab/trait.h
+++ b/engines/crab/trait.h
@@ -31,8 +31,8 @@
#ifndef CRAB_TRAIT_H
#define CRAB_TRAIT_H
-#include "ImageManager.h"
-#include "common_header.h"
+#include "crab/ImageManager.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace people {
diff --git a/engines/crab/trigger.cpp b/engines/crab/trigger.cpp
index 8af68550727..c423a0ffa7c 100644
--- a/engines/crab/trigger.cpp
+++ b/engines/crab/trigger.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "trigger.h"
+#include "crab/trigger.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/trigger.h b/engines/crab/trigger.h
index 4e57fd89bcd..092deb39e59 100644
--- a/engines/crab/trigger.h
+++ b/engines/crab/trigger.h
@@ -30,8 +30,8 @@
#ifndef CRAB_TRIGGER_H
#define CRAB_TRIGGER_H
-#include "GameEventInfo.h"
-#include "common_header.h"
+#include "crab/GameEventInfo.h"
+#include "crab/common_header.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/triggerset.cpp b/engines/crab/triggerset.cpp
index 9bac2bb8cb8..6b03a558be2 100644
--- a/engines/crab/triggerset.cpp
+++ b/engines/crab/triggerset.cpp
@@ -29,7 +29,7 @@
*/
-#include "triggerset.h"
+#include "crab/triggerset.h"
using namespace pyrodactyl::event;
diff --git a/engines/crab/triggerset.h b/engines/crab/triggerset.h
index 24461cda85e..dab880970d1 100644
--- a/engines/crab/triggerset.h
+++ b/engines/crab/triggerset.h
@@ -31,8 +31,8 @@
#ifndef CRAB_TRIGGERSET_H
#define CRAB_TRIGGERSET_H
-#include "common_header.h"
-#include "trigger.h"
+#include "crab/common_header.h"
+#include "crab/trigger.h"
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/url.cpp b/engines/crab/url.cpp
index 3241e83c6f2..2f34b131796 100644
--- a/engines/crab/url.cpp
+++ b/engines/crab/url.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "url.h"
+#include "crab/url.h"
#ifdef __WIN32__
#include <ShellAPI.h>
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index bd203ba123e..dc4d19aaa98 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -30,10 +30,10 @@
#ifndef CRAB_VECTORS_H
#define CRAB_VECTORS_H
-#include "common_header.h"
+#include "crab/common_header.h"
-#include "GameParam.h"
-#include "loaders.h"
+#include "crab/GameParam.h"
+#include "crab/loaders.h"
//------------------------------------------------------------------------
// Purpose: A simple 2D vector class
diff --git a/engines/crab/walkframes.cpp b/engines/crab/walkframes.cpp
index 25445d0de40..dc47e9cbf33 100644
--- a/engines/crab/walkframes.cpp
+++ b/engines/crab/walkframes.cpp
@@ -29,7 +29,7 @@
*/
-#include "walkframes.h"
+#include "crab/walkframes.h"
using namespace pyrodactyl::anim;
using namespace pyrodactyl::people;
diff --git a/engines/crab/walkframes.h b/engines/crab/walkframes.h
index 0c6353b4343..ac0728bad03 100644
--- a/engines/crab/walkframes.h
+++ b/engines/crab/walkframes.h
@@ -31,11 +31,11 @@
#ifndef CRAB_WALKFRAMES_H
#define CRAB_WALKFRAMES_H
-#include "animframe.h"
-#include "common_header.h"
-#include "movement.h"
+#include "crab/animframe.h"
+#include "crab/common_header.h"
+#include "crab/movement.h"
#include "personbase.h"
-#include "timer.h"
+#include "crab/timer.h"
namespace pyrodactyl {
namespace anim {
Commit: 645b6bbf053266876501f3021cb892caa2fcf6df
https://github.com/scummvm/scummvm/commit/645b6bbf053266876501f3021cb892caa2fcf6df
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use PNGDecoder to decode images
Changed paths:
engines/crab/Image.cpp
engines/crab/Image.h
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/common_header.h
engines/crab/crab.h
engines/crab/filesystem.cpp
engines/crab/filesystem.h
engines/crab/module.mk
diff --git a/engines/crab/Image.cpp b/engines/crab/Image.cpp
index 9cd3f3584ca..6fd56b4a3e3 100644
--- a/engines/crab/Image.cpp
+++ b/engines/crab/Image.cpp
@@ -28,14 +28,27 @@
*
*/
+#include "crab/crab.h"
#include "crab/Image.h"
+#include "image/png.h"
-using namespace pyrodactyl::image;
+using ImageDecoder = Image::PNGDecoder;
+
+namespace Crab {
+using namespace pyrodactyl::image;
//------------------------------------------------------------------------
// Purpose: Load a texture
//------------------------------------------------------------------------
-bool Image::Load(SDL_Surface *surface) {
+bool Image::Load(Graphics::Surface *surface) {
+ Delete();
+
+ texture->create(surface->w, surface->h, surface->format);
+ texture->copyFrom(*surface);
+ w = surface->w;
+ h = surface->h;
+ return true;
+#if 0
// Create texture from surface pixels
texture = SDL_CreateTextureFromSurface(gRenderer, surface);
if (texture == NULL) {
@@ -47,13 +60,32 @@ bool Image::Load(SDL_Surface *surface) {
w = surface->w;
h = surface->h;
return true;
+#endif
}
-bool Image::Load(const std::string &path) {
+bool Image::Load(const Common::String &path) {
// Get rid of preexisting texture
Delete();
// Load image at specified path
+ Common::File file;
+ ImageDecoder decoder;
+
+ if (FileOpen(path, &file) && decoder.loadStream(file)) {
+ const Graphics::Surface *s = decoder.getSurface();
+ texture = new Graphics::Surface();
+ texture->copyFrom(*s);
+ w = s->w;
+ h = s->h;
+
+ file.close();
+ }
+
+ warning("Image::Load() Image Texture(%s): w: %d h: %d", path.c_str(), w, h);
+
+ return texture != nullptr;
+
+#if 0
SDL_Surface *loadedSurface = IMG_Load(path.c_str());
if (loadedSurface == NULL) {
fprintf(stderr, "Unable to load image %s! SDL_image Error: %s\n", path.c_str(), IMG_GetError());
@@ -74,8 +106,8 @@ bool Image::Load(const std::string &path) {
}
// Return success
-
return texture != NULL;
+#endif
}
bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
@@ -88,7 +120,10 @@ bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
//------------------------------------------------------------------------
// Purpose: Draw a texture to the screen without cropping
//------------------------------------------------------------------------
-void Image::Draw(const int &x, const int &y, SDL_Rect *clip, const TextureFlipType &flip) {
+void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFlipType &flip) {
+
+ g_engine->_renderSurface->copyRectToSurface(texture->getPixels(), texture->pitch, x, y, texture->w, texture->h);
+#if 0
// Set rendering space and render to screen
SDL_Rect renderQuad = {x, y, w, h};
@@ -138,6 +173,8 @@ void Image::Draw(const int &x, const int &y, SDL_Rect *clip, const TextureFlipTy
default:
break;
}
+#endif
+
}
//------------------------------------------------------------------------
@@ -145,9 +182,12 @@ void Image::Draw(const int &x, const int &y, SDL_Rect *clip, const TextureFlipTy
//------------------------------------------------------------------------
void Image::Delete() {
if (texture != nullptr) {
- SDL_DestroyTexture(texture);
+ texture->free();
+ delete texture;
texture = nullptr;
w = 0;
h = 0;
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/Image.h b/engines/crab/Image.h
index 995311b7b87..ef98f39a3a1 100644
--- a/engines/crab/Image.h
+++ b/engines/crab/Image.h
@@ -31,9 +31,13 @@
#ifndef CRAB_IMAGE_H
#define CRAB_IMAGE_H
+#include "image/png.h"
#include "crab/ScreenSettings.h"
+#include "crab/filesystem.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace image {
// Image data used in Asset Manager
@@ -42,44 +46,62 @@ class Image {
int w, h;
// The actual hardware texture
- SDL_Texture *texture;
+ //SDL_Texture *texture;
+ Graphics::Surface *texture;
public:
Image() : texture(nullptr), w(0), h(0) {}
~Image() {}
// Set color modulation
- void Color(const Uint8 &r, const Uint8 &g, const Uint8 &b) { SDL_SetTextureColorMod(texture, r, g, b); }
+ void Color(const uint8 &r, const uint8 &g, const uint8 &b) {
+#if 0
+ SDL_SetTextureColorMod(texture, r, g, b);
+#endif
+ warning("Setting color modulation for texture: %d %d %d", r, g, b);
+ }
// Set blending
+#if 0
void BlendMode(const SDL_BlendMode &mode) { SDL_SetTextureBlendMode(texture, mode); }
+#endif
// Set alpha modulation
- int Alpha(const Uint8 &alpha) { return SDL_SetTextureAlphaMod(texture, alpha); }
+ int Alpha(const uint8 &alpha) {
+#if 0
+ return SDL_SetTextureAlphaMod(texture, alpha);
+#endif
+ warning("Setting alpha modulation for texture: %d ", alpha);
+ return 0;
+ }
// Get alpha modulation
- Uint8 Alpha() {
- Uint8 res = 255;
+ uint8 Alpha() {
+ uint8 res = 255;
+#if 0
SDL_GetTextureAlphaMod(texture, &res);
+#endif
return res;
}
// Load the image
- bool Load(const std::string &path);
+ bool Load(const Common::String &path);
bool Load(rapidxml::xml_node<char> *node, const char *name);
- bool Load(SDL_Surface *surface);
+ bool Load(Graphics::Surface *surface);
// Draw the openGL texture
- void Draw(const int &x, const int &y, SDL_Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+ void Draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
// Delete the openGL texture
void Delete();
- const int W() { return w; }
- const int H() { return h; }
- const bool Valid() { return texture != nullptr; }
+ int W() { return w; }
+ int H() { return h; }
+ bool Valid() { return texture != nullptr; }
};
} // End of namespace image
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_IMAGE_H
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index b51b03ee8e1..7b1b4f7bfb6 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -30,14 +30,17 @@
#include "crab/ScreenSettings.h"
+namespace Crab {
+
// Our screen settings object
ScreenSettings gScreenSettings;
// Our global renderer
-SDL_Renderer *gRenderer = nullptr;
+//SDL_Renderer *gRenderer = nullptr;
+Graphics::Surface *gRendererSurface = nullptr;
// Our global window object
-SDL_Window *gWindow = nullptr;
+//SDL_Window *gWindow = nullptr;
void ScreenSettings::Load(rapidxml::xml_node<char> *node) {
LoadNum(cur.w, "w", node);
@@ -58,6 +61,7 @@ void ScreenSettings::Load(rapidxml::xml_node<char> *node) {
}
void ScreenSettings::SetVideoFlags() {
+#if 0
if (fullscreen) {
// Window border doesn't matter in fullscreen mode
videoflags = SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN;
@@ -67,6 +71,7 @@ void ScreenSettings::SetVideoFlags() {
else
videoflags = SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS;
}
+#endif
}
void ScreenSettings::CreateBackup() {
@@ -88,6 +93,7 @@ void ScreenSettings::RestoreBackup() {
}
void ScreenSettings::SetResolution() {
+#if 0
// Check the current window flags
Uint32 flags = SDL_GetWindowFlags(gWindow);
@@ -103,32 +109,41 @@ void ScreenSettings::SetResolution() {
}
change_interface = true;
+#endif
}
void ScreenSettings::SetFullscreen() {
SetVideoFlags();
+#if 0
SDL_SetWindowFullscreen(gWindow, videoflags);
+#endif
}
void ScreenSettings::SetWindowBorder() {
+#if 0
if (border)
SDL_SetWindowBordered(gWindow, SDL_TRUE);
else
SDL_SetWindowBordered(gWindow, SDL_FALSE);
+#endif
}
void ScreenSettings::SetVsync() {
+#if 0
if (vsync)
SDL_SetHint("SDL_HINT_RENDER_VSYNC", "1");
else
SDL_SetHint("SDL_HINT_RENDER_VSYNC", "0");
+#endif
}
void ScreenSettings::SetMouseTrap() {
+#if 0
if (mouse_trap)
SDL_SetRelativeMouseMode(SDL_TRUE);
else
SDL_SetRelativeMouseMode(SDL_FALSE);
+#endif
}
void ScreenSettings::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
@@ -152,3 +167,5 @@ void ScreenSettings::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node
root->append_node(child);
CreateBackup();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index 2ff2e8507be..d821da42e8b 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -35,11 +35,16 @@
#include "crab/common_header.h"
#include "crab/loaders.h"
+
+namespace Crab {
+
+#if 0
// Our rendering context
extern SDL_Renderer *gRenderer;
// Our window
extern SDL_Window *gWindow;
+#endif
struct Dimension {
int w, h;
@@ -76,7 +81,7 @@ public:
float gamma;
// The video flags
- Uint32 videoflags;
+ uint32 videoflags;
// should we save on exit?
bool save_on_exit;
@@ -100,7 +105,7 @@ public:
mouse_trap = false;
gamma = 1.0f;
text_speed = 1.0f;
- videoflags = SDL_WINDOW_SHOWN;
+ videoflags = 0; //SDL_WINDOW_SHOWN;
}
};
@@ -139,7 +144,7 @@ public:
void SetFullscreen();
void SetWindowBorder();
void SetVsync();
- void SetGamma() { SDL_SetWindowBrightness(gWindow, gamma); }
+ void SetGamma() { }//SDL_SetWindowBrightness(gWindow, gamma); }
void SetMouseTrap();
void Load(rapidxml::xml_node<char> *node);
@@ -148,4 +153,6 @@ public:
extern ScreenSettings gScreenSettings;
+}
+
#endif // CRAB_SCREENSETTINGS_H
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 12482cf7625..bc60291cd9a 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -53,6 +53,14 @@
#include "common/path.h"
#include "common/str.h"
+#include "common/hashmap.h"
+#include "common/list.h"
+#include "common/rect.h"
+#include "common/stream.h"
+#include "common/file.h"
+
+#include "graphics/surface.h"
+#include "graphics/managed_surface.h"
#define RAPIDXML_NO_EXCEPTIONS
#include "crab/rapidxml/rapidxml.hpp"
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 5ca8032f68d..765dbc9716d 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -81,6 +81,7 @@ protected:
public:
Graphics::Screen *_screen = nullptr;
+ Graphics::ManagedSurface *_renderSurface = nullptr;
public:
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index 0d368c20151..eec5cf9c475 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -29,7 +29,6 @@
*/
#include "crab/filesystem.h"
-#include "common/file.h"
namespace Crab {
@@ -56,6 +55,18 @@ bool FileOpen(const Common::Path &path, char *&data) {
return true;
}
+bool FileOpen(const Common::Path &path, Common::File *file) {
+ if (file->isOpen())
+ file->close();
+
+ if (!file->open(path)) {
+ warning("Unable to open file %s", path.toString().c_str());
+ return false;
+ }
+
+ return true;
+}
+
#if 0
bool PathCompare(const path &p1, const path &p2)
{
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index 5ebf3aa7811..09aca49d005 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -34,6 +34,7 @@
namespace Crab {
bool FileOpen(const Common::Path &path, char *&data);
+bool FileOpen(const Common::Path &path, Common::File *file);
#if 0
bool PathCompare(const boost::filesystem::path &p1, const boost::filesystem::path &p2);
#endif
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 48d881bfb2b..e9124cb56c6 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -6,7 +6,9 @@ MODULE_OBJS = \
metaengine.o \
filesystem.o \
XMLDoc.o \
- loaders.o
+ loaders.o \
+ ScreenSettings.o \
+ Image.o
# This module can be built as a plugin
ifeq ($(ENABLE_CRAB), DYNAMIC_PLUGIN)
Commit: eced6c0e56772bc39ca2c720854c7a522b228d9b
https://github.com/scummvm/scummvm/commit/eced6c0e56772bc39ca2c720854c7a522b228d9b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement parser_error_handler() for rapidXML
Changed paths:
engines/crab/XMLDoc.cpp
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index 92314c446dc..af8671ee874 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -31,6 +31,12 @@
#include "crab/XMLDoc.h"
#include "crab/common_header.h"
+namespace rapidxml {
+ void parse_error_handler(char const* what, void* where) {
+ warning("RapidXML error handler: %s", what);
+ }
+}
+
namespace Crab {
void XMLDoc::Load(const Common::String &filename) {
Commit: 5e134473b71092c3674ba36fb7fd489137272f11
https://github.com/scummvm/scummvm/commit/5e134473b71092c3674ba36fb7fd489137272f11
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make timer compilable
Changed paths:
engines/crab/timer.cpp
engines/crab/timer.h
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index 03bf4baab68..c3db78abc79 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -35,6 +35,8 @@
//=============================================================================
#include "crab/timer.h"
+namespace Crab {
+
Timer::Timer() {
// Initialize the variables
start_ticks = 0;
@@ -45,7 +47,7 @@ Timer::Timer() {
started = false;
}
-void Timer::Load(rapidxml::xml_node<char> *node, const std::string &name, const bool &echo) {
+void Timer::Load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo) {
target_valid = LoadNum(target_ticks, name, node, echo);
}
@@ -57,7 +59,10 @@ void Timer::Start() {
paused = false;
// Get the current clock time
+#if 0
start_ticks = SDL_GetTicks();
+#endif
+ start_ticks = g_system->getMillis();
}
void Timer::Stop() {
@@ -68,7 +73,7 @@ void Timer::Stop() {
paused = false;
}
-Uint32 Timer::Ticks() {
+uint32 Timer::Ticks() {
// If the timer is running
if (started == true) {
// If the timer is paused
@@ -77,7 +82,10 @@ Uint32 Timer::Ticks() {
return paused_ticks;
} else {
// Return the current time minus the start time
+#if 0
return SDL_GetTicks() - start_ticks;
+#endif
+ return g_system->getMillis() - start_ticks;
}
}
// If the timer isn't running
@@ -91,7 +99,10 @@ void Timer::Pause() {
paused = true;
// Calculate the paused ticks
+#if 0
paused_ticks = SDL_GetTicks() - start_ticks;
+#endif
+ paused_ticks = g_system->getMillis() - start_ticks;
}
}
@@ -102,8 +113,10 @@ void Timer::Resume() {
paused = false;
// Reset the starting ticks
+#if 0
start_ticks = SDL_GetTicks() - paused_ticks;
-
+#endif
+ paused_ticks = g_system->getMillis() - start_ticks;
// Reset the paused ticks
paused_ticks = 0;
}
@@ -118,3 +131,5 @@ bool Timer::TargetReached(const float &factor) {
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/timer.h b/engines/crab/timer.h
index 21bb402f116..4c64ad81c2f 100644
--- a/engines/crab/timer.h
+++ b/engines/crab/timer.h
@@ -34,20 +34,23 @@
//=============================================================================
#ifndef CRAB_TIMER_H
#define CRAB_TIMER_H
-#include "crab/common_header.h"
+#include "crab/crab.h"
+#include "crab/common_header.h"
#include "crab/loaders.h"
+namespace Crab {
+
class Timer {
private:
// The clock time when the timer started
- Uint32 start_ticks;
+ uint32 start_ticks;
// The ticks stored when the timer was paused
- Uint32 paused_ticks;
+ uint32 paused_ticks;
// Since most timers usually only check one value, we might as well as store it here
- Uint32 target_ticks;
+ uint32 target_ticks;
// See if we have a target loaded or set
bool target_valid;
@@ -59,12 +62,12 @@ private:
public:
// Initialize variables
Timer();
- void Target(const Uint32 &val) {
+ void Target(const uint32 &val) {
target_valid = true;
target_ticks = val;
}
- void Load(rapidxml::xml_node<char> *node, const std::string &name, const bool &echo = true);
+ void Load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo = true);
// The various clock actions
void Start();
@@ -73,18 +76,20 @@ public:
void Resume();
// Gets the timer's time
- Uint32 Ticks();
+ uint32 Ticks();
// Get the time remaining
- Uint32 RemainingTicks() { return target_ticks - Ticks(); }
+ uint32 RemainingTicks() { return target_ticks - Ticks(); }
// Have we reached the target yet?
bool TargetReached(const float &factor = 1.0f);
// Checks the status of the timer
- const bool Started() { return started; }
- const bool Paused() { return paused; }
- const bool TargetValid() { return target_valid; }
+ bool Started() { return started; }
+ bool Paused() { return paused; }
+ bool TargetValid() { return target_valid; }
};
+} // End of namespace Crab
+
#endif // CRAB_TIMER_H
Commit: 343fab6d9af5fe5fdbe83c6afd4b2f8021ab2bb1
https://github.com/scummvm/scummvm/commit/343fab6d9af5fe5fdbe83c6afd4b2f8021ab2bb1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make some misc game related classes compilable
Changed paths:
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/common_header.h
engines/crab/gamestate_container.h
engines/crab/gamestates.h
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index 3a968c8c83e..ec7e3dad5a2 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -30,6 +30,8 @@
#include "crab/GameParam.h"
+namespace Crab {
+
// Temporary values go here
TempValue gTemp;
@@ -43,7 +45,7 @@ bool GameDebug = false;
StringPool gStrPool;
// Generate random numbers using this
-RandomNumberGen gRandom;
+//RandomNumberGen gRandom;
FilePaths::FilePaths() : common("res/levels/common.xml"),
mod_path("mods/"),
@@ -63,12 +65,16 @@ FilePaths::FilePaths() : common("res/levels/common.xml"),
level.clear();
loaded = false;
+#if 0
char *path = SDL_GetPrefPath("Pyrodactyl", "Unrest");
appdata = path;
SDL_free(path);
+#endif
+ warning("FilePaths::FilePaths() setting appdata directory to game dir");
+ appdata = "./";
}
-void FilePaths::LoadLevel(const std::string &filename) {
+void FilePaths::LoadLevel(const Common::String &filename) {
level.clear();
XMLDoc lev_list(filename);
if (lev_list.ready()) {
@@ -78,7 +84,7 @@ void FilePaths::LoadLevel(const std::string &filename) {
LevelPath l;
l.Load(n);
- std::string id;
+ Common::String id;
LoadStr(id, "id", n);
level[id] = l;
@@ -86,7 +92,7 @@ void FilePaths::LoadLevel(const std::string &filename) {
}
}
-void FilePaths::Load(const std::string &filename) {
+void FilePaths::Load(const Common::String &filename) {
XMLDoc settings(filename);
if (settings.ready()) {
rapidxml::xml_node<char> *node = settings.Doc()->first_node("paths");
@@ -142,14 +148,17 @@ void FilePaths::Load(const std::string &filename) {
LoadStr(save_dir, "dir", savenode);
LoadStr(save_ext, "ext", savenode);
- std::string custom_path;
+ Common::String custom_path;
if (LoadStr(custom_path, "custom", savenode)) {
+#if 0
using namespace boost::filesystem;
path customdir(custom_path);
if (exists(customdir) && is_directory(customdir)) {
appdata = custom_path;
}
+#endif
+ warning("In FilePaths::Load(), customPath : %s", custom_path.c_str());
}
}
@@ -157,3 +166,5 @@ void FilePaths::Load(const std::string &filename) {
}
}
}
+
+}
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index a341c7c0bdf..a53347a9d9d 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -35,13 +35,15 @@
#include "crab/common_header.h"
#include "crab/loaders.h"
+namespace Crab {
+
// The index for all levels in the game
struct LevelPath {
// The file paths
- std::string layout, asset;
+ Common::String layout, asset;
// The name of the level
- std::string name;
+ Common::String name;
LevelPath() : layout(""), asset(""), name("") {}
@@ -55,60 +57,62 @@ struct LevelPath {
// Stores all layout paths for the game
struct FilePaths {
// Resources common to all levels and states
- std::string common;
+ Common::String common;
// Mod file location, current mod and their extension
- std::string mod_path, mod_ext, mod_cur;
+ Common::String mod_path, mod_ext, mod_cur;
// Main menu resources
- std::string mainmenu_l, mainmenu_r;
+ Common::String mainmenu_l, mainmenu_r;
// Sounds
- std::string sound_effect, sound_music;
+ Common::String sound_effect, sound_music;
// Fonts and window icon file
- std::string font, icon;
+ Common::String font, icon;
// Save directory and extension
- std::string save_dir, save_ext;
+ Common::String save_dir, save_ext;
// The location of the shader index file
- std::string shaders;
+ Common::String shaders;
// The location of the color index file
- std::string colors;
+ Common::String colors;
// The list of levels in the game
- std::unordered_map<std::string, LevelPath> level;
+ Common::HashMap<Common::String, LevelPath> level;
// The file path of the current resource file
- std::string current_r;
+ Common::String current_r;
// The application data path (where saves and settings are stored)
- std::string appdata;
+ Common::String appdata;
// Has this been loaded?
bool loaded;
FilePaths();
- void Load(const std::string &filename);
- void LoadLevel(const std::string &filename);
+ void Load(const Common::String &filename);
+ void LoadLevel(const Common::String &filename);
};
// Storage pool used for saving numbers as strings
class StringPool {
// Store integer strings here
- std::unordered_map<int, std::string> pool_i;
+ // std::unordered_map<int, Common::String> pool_i;
+ Common::HashMap<int, Common::String> pool_i;
// Store floating point strings here
struct FloatString {
float val;
- std::string str;
+ Common::String str;
FloatString() { val = 0.0f; }
};
- std::list<FloatString> pool_f;
+ // std::list<FloatString> pool_f;
+ Common::List<FloatString> pool_f;
public:
StringPool() {
@@ -117,10 +121,16 @@ public:
}
const char *Get(const int &num) {
+#if 0
if (pool_i.count(num) == 0)
pool_i[num] = NumberToString<int>(num);
return pool_i.at(num).c_str();
+#endif
+ if (pool_i.contains(num) == false)
+ pool_i[num] = NumberToString<int>(num);
+
+ return pool_i.getVal(num).c_str();
}
const char *FGet(const float &num) {
@@ -130,15 +140,16 @@ public:
FloatString fs;
fs.val = num;
- fs.str = NumberToString<float>(num);
+ //fs.str = NumberToString<float>(num);
pool_f.push_back(fs);
- auto ret = pool_f.rbegin();
- return ret->str.c_str();
+ auto ret = pool_f.back();
+ return ret.str.c_str();
}
};
// Our source of random numbers
+#if 0
class RandomNumberGen {
std::random_device rd;
std::default_random_engine dre;
@@ -148,6 +159,7 @@ public:
int Num() { return dre(); }
};
+#endif
struct TempValue {
// Differences between normal mode and iron man mode
@@ -158,7 +170,7 @@ struct TempValue {
bool ironman;
// This is the filename a player chose when selecting "new game" + iron man mode
- std::string filename;
+ Common::String filename;
// We use this to see whether the player is exiting to main menu or to credits
bool credits;
@@ -184,6 +196,8 @@ extern FilePaths gFilePath;
extern StringPool gStrPool;
// Generate random numbers using this
-extern RandomNumberGen gRandom;
+//extern RandomNumberGen gRandom;
+
+}
#endif // CRAB_GAMEPARAM_H
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index bc60291cd9a..e501d2efa4e 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -58,6 +58,7 @@
#include "common/rect.h"
#include "common/stream.h"
#include "common/file.h"
+#include "common/events.h"
#include "graphics/surface.h"
#include "graphics/managed_surface.h"
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index f157fdfcb05..c67328582fe 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -38,12 +38,14 @@
#include "crab/common_header.h"
#include "crab/gamestates.h"
+namespace Crab {
+
//------------------------------------------------------------------------
// Purpose: Game State base class
//------------------------------------------------------------------------
class GameState {
public:
- virtual void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
+ virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void Draw() = 0;
virtual void SetUI() = 0;
@@ -51,4 +53,6 @@ public:
virtual ~GameState(){};
};
+} // End of namespace Crab
+
#endif // CRAB_GAMESTATE_CONTAINER_H
diff --git a/engines/crab/gamestates.h b/engines/crab/gamestates.h
index fb6d75270c3..036f61f8bac 100644
--- a/engines/crab/gamestates.h
+++ b/engines/crab/gamestates.h
@@ -32,6 +32,8 @@
#define CRAB_GAMESTATES_H
#include "crab/common_header.h"
+namespace Crab {
+
//------------------------------------------------------------------------
// Purpose: Game State Enumerators
//------------------------------------------------------------------------
@@ -45,4 +47,6 @@ enum GameStateID {
TOTAL_GAMESTATES // ALWAYS THE LAST VALUE
};
+} // End of namespace Crab
+
#endif // CRAB_GAMESTATES_H
Commit: 699fcbdaa405edf5e24a69e6903b03d232c438c0
https://github.com/scummvm/scummvm/commit/699fcbdaa405edf5e24a69e6903b03d232c438c0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make app class compilable
Changed paths:
engines/crab/app.cpp
engines/crab/app.h
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index dd6b6070d77..705cd048193 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -28,9 +28,14 @@
*
*/
+#include "common/events.h"
#include "crab/app.h"
+namespace Crab {
+
bool App::Init() {
+
+#if 0
// Load all SDL subsystems and the TrueType font subsystem
if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to initialize SDL", "Please install libsdl2", NULL);
@@ -47,13 +52,14 @@ bool App::Init() {
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to initialize PNG support", "Please install libsdl2_image", NULL);
return false;
}
+#endif
// Load paths for important files
gFilePath.Load("res/paths.xml");
// Initialize Steam
// SteamAPI_Init();
-
+#if 0
// Load the settings corresponding to the latest version
{
const std::string DEFAULT_FILENAME = "res/settings.xml";
@@ -113,12 +119,16 @@ bool App::Init() {
// Initial check for controllers on the system
pyrodactyl::input::gInput.AddController();
-
+#endif
+ LoadSettings("res/settings.xml");
+ gScreenSettings.cur.w = 1920;
+ gScreenSettings.cur.h = 1080;
gScreenSettings.in_game = false;
return true;
}
void App::Run() {
+ Init();
// State IDs
GameStateID CurrentStateID = GAMESTATE_NULL, NextStateID = GAMESTATE_TITLE;
bool ShouldChangeState = true;
@@ -126,7 +136,7 @@ void App::Run() {
// Set the current game state object
GameState *CurrentState = NULL;
Timer fps;
- SDL_Event Event;
+ Common::Event e;
int fpscount = 0, fpsval = 1, lasts = 0;
// While the user hasn't quit - This is the main game loop
@@ -145,7 +155,7 @@ void App::Run() {
// Change the state
switch (NextStateID) {
case GAMESTATE_TITLE:
- CurrentState = new Splash();
+ //CurrentState = new Splash();
gScreenSettings.in_game = false;
// Now apply all settings - except resolution because that's already set at the start
@@ -157,16 +167,17 @@ void App::Run() {
break;
case GAMESTATE_MAIN_MENU:
- CurrentState = new MainMenu();
+ //CurrentState = new MainMenu();
gScreenSettings.in_game = false;
break;
case GAMESTATE_NEW_GAME:
- CurrentState = new Game();
+ // CurrentState = new Game();
gScreenSettings.in_game = true;
break;
case GAMESTATE_LOAD_GAME:
+#if 0
if (boost::filesystem::exists(pyrodactyl::ui::gLoadMenu.SelectedPath()))
CurrentState = new Game(pyrodactyl::ui::gLoadMenu.SelectedPath());
else
@@ -174,6 +185,7 @@ void App::Run() {
gScreenSettings.in_game = true;
break;
+#endif
default:
// Encountering an undefined state, exit with an error code
@@ -193,6 +205,7 @@ void App::Run() {
// Do state InternalEvents
CurrentState->InternalEvents(ShouldChangeState, NextStateID);
+#if 0
while (SDL_PollEvent(&Event)) {
// Do state Event handling
CurrentState->HandleEvents(Event, ShouldChangeState, NextStateID);
@@ -213,6 +226,7 @@ void App::Run() {
GameDebug = !GameDebug;
pyrodactyl::input::gInput.HandleController(Event);
}
+#endif
// Do we have to reposition our interface?
if (gScreenSettings.change_interface) {
@@ -223,6 +237,7 @@ void App::Run() {
// Do state Drawing
CurrentState->Draw();
+#if 0
if (GameDebug) {
if (SDL_GetTicks() - lasts > 1000) {
lasts = SDL_GetTicks();
@@ -234,17 +249,29 @@ void App::Run() {
if (CurrentStateID >= 0)
pyrodactyl::text::gTextManager.Draw(0, 0, NumberToString(fpsval), 0);
}
+#endif
+ const Graphics::ManagedSurface *s = g_engine->_renderSurface;
+ g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
+ g_system->updateScreen();
+#if 0
// Update the screen
SDL_RenderPresent(gRenderer);
+#endif
// Cap the frame rate
- if (fps.Ticks() < 1000u / gScreenSettings.fps)
+ if (fps.Ticks() < 1000u / gScreenSettings.fps) {
+#if 0
SDL_Delay((1000u / gScreenSettings.fps) - fps.Ticks());
+#endif
+ uint32 delay = (1000u / gScreenSettings.fps) - fps.Ticks();
+ warning("Delay by %d ms", delay);
+ g_system->delayMillis(delay);
+ }
}
}
-void App::LoadSettings(const std::string &filename) {
+void App::LoadSettings(const Common::String &filename) {
XMLDoc settings(filename);
if (settings.ready()) {
rapidxml::xml_node<char> *node = settings.Doc()->first_node("settings");
@@ -257,12 +284,15 @@ void App::LoadSettings(const std::string &filename) {
gScreenSettings.Load(node->first_node("screen"));
// Start the sound subsystem
+#if 0
pyrodactyl::music::gMusicManager.Load(node);
+#endif
}
}
}
App::~App() {
+#if 0
// SteamAPI_Shutdown();
pyrodactyl::image::gImageManager.Quit();
@@ -286,4 +316,8 @@ App::~App() {
// Quit SDL
SDL_Quit();
+#endif
+
}
+
+} // End of namespace Crab
diff --git a/engines/crab/app.h b/engines/crab/app.h
index dda5562dec0..1a09a53e645 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -31,21 +31,26 @@
#ifndef CRAB_APP_H
#define CRAB_APP_H
-#include "crab/ImageManager.h"
-#include "crab/MusicManager.h"
+#include "crab/crab.h"
+//#include "crab/ImageManager.h"
+//#include "crab/MusicManager.h"
#include "crab/common_header.h"
-#include "crab/game.h"
+//#include "crab/game.h"
#include "crab/gamestates.h"
-#include "crab/mainmenu.h"
-#include "crab/splash.h"
+#include "crab/gamestate_container.h"
+#include "crab/ScreenSettings.h"
+//#include "crab/mainmenu.h"
+//#include "crab/splash.h"
#include "crab/timer.h"
+namespace Crab {
+
class App {
- void LoadSettings(const std::string &filename);
+ void LoadSettings(const Common::String &filename);
public:
App(void) {
-#ifdef __APPLE__
+#if 0
// OS X .app files need to set the working directory
char *working_directory = SDL_GetBasePath();
chdir(working_directory);
@@ -58,4 +63,6 @@ public:
void Run();
};
+} // End of namespace Crab
+
#endif // CRAB_APP_H
Commit: 160cfb9321cf3a45c5fb738b72a15986d48a7f88
https://github.com/scummvm/scummvm/commit/160cfb9321cf3a45c5fb738b72a15986d48a7f88
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Hook app class to crab
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 8c392912d7c..bd853ee7745 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -52,14 +52,13 @@
#include "crab/crab.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
-#include "common/events.h"
#include "common/scummsys.h"
#include "common/system.h"
#include "crab/console.h"
#include "crab/detection.h"
-#include "crab/loaders.h"
-#include "crab/numstr.h"
-#include "crab/XMLDoc.h"
+#include "crab/Image.h"
+#include "crab/ScreenSettings.h"
+#include "crab/app.h"
#include "engines/util.h"
#include "graphics/palette.h"
@@ -86,8 +85,9 @@ Common::String CrabEngine::getGameId() const {
Common::Error CrabEngine::run() {
// Initialize 320x200 paletted graphics mode
- initGraphics(320, 200);
- _screen = new Graphics::Screen();
+ Graphics::PixelFormat *format = new Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
+ initGraphics(1920, 1080, format);
+ _renderSurface = new Graphics::ManagedSurface(1920, 1080, *format);
// Set the engine's debugger console
setDebugger(new Console());
@@ -97,32 +97,9 @@ Common::Error CrabEngine::run() {
if (saveSlot != -1)
(void)loadGameState(saveSlot);
- // Draw a series of boxes on screen as a sample
- for (int i = 0; i < 100; ++i)
- _screen->frameRect(Common::Rect(i, i, 320 - i, 200 - i), i);
- _screen->update();
-
- // Simple event handling loop
- byte pal[256 * 3] = {0};
- Common::Event e;
- int offset = 0;
-
- while (!shouldQuit()) {
- while (g_system->getEventManager()->pollEvent(e)) {
- }
-
- // Cycle through a simple palette
- ++offset;
- for (int i = 0; i < 256; ++i)
- pal[i * 3 + 1] = (i + offset) % 256;
- g_system->getPaletteManager()->setPalette(pal, 0, 256);
- _screen->update();
-
- // Delay for a bit. All events loops should have a delay
- // to prevent the system being unduly loaded
- g_system->delayMillis(10);
- }
+ _app = new App();
+ _app->Run();
return Common::kNoError;
}
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 765dbc9716d..72436e482f3 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -68,12 +68,14 @@
namespace Crab {
+class App;
struct CrabGameDescription;
class CrabEngine : public Engine {
private:
const ADGameDescription *_gameDescription;
Common::RandomSource _randomSource;
+ App *_app;
protected:
// Engine APIs
@@ -131,7 +133,7 @@ public:
};
extern CrabEngine *g_engine;
-#define SHOULD_QUIT::Crab::g_engine->shouldQuit()
+#define SHOULD_QUIT ::Crab::g_engine->shouldQuit()
} // End of namespace Crab
Commit: 7ffd0bfee1e345747139117cc2d74152d72118fb
https://github.com/scummvm/scummvm/commit/7ffd0bfee1e345747139117cc2d74152d72118fb
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make splash class compilable
Changed paths:
engines/crab/app.cpp
engines/crab/app.h
engines/crab/module.mk
engines/crab/splash.cpp
engines/crab/splash.h
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 705cd048193..3aa195e8817 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -155,7 +155,7 @@ void App::Run() {
// Change the state
switch (NextStateID) {
case GAMESTATE_TITLE:
- //CurrentState = new Splash();
+ CurrentState = new Splash();
gScreenSettings.in_game = false;
// Now apply all settings - except resolution because that's already set at the start
diff --git a/engines/crab/app.h b/engines/crab/app.h
index 1a09a53e645..449b06337a7 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -40,7 +40,7 @@
#include "crab/gamestate_container.h"
#include "crab/ScreenSettings.h"
//#include "crab/mainmenu.h"
-//#include "crab/splash.h"
+#include "crab/splash.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index e9124cb56c6..8378bff9663 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -8,7 +8,11 @@ MODULE_OBJS = \
XMLDoc.o \
loaders.o \
ScreenSettings.o \
- Image.o
+ GameParam.o \
+ Image.o \
+ timer.o \
+ app.o \
+ splash.o
# This module can be built as a plugin
ifeq ($(ENABLE_CRAB), DYNAMIC_PLUGIN)
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index c1e371158c3..da2fb257d16 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -35,6 +35,8 @@
//=============================================================================
#include "crab/splash.h"
+namespace Crab {
+
//------------------------------------------------------------------------
// Purpose: Constructor
//------------------------------------------------------------------------
@@ -59,9 +61,11 @@ Splash::~Splash() {
//------------------------------------------------------------------------
void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
- gLoadScreen.Load();
+ // gLoadScreen.Load();
+#if 0
pyrodactyl::image::gImageManager.Init();
pyrodactyl::text::gTextManager.Init();
+#endif
load_complete = true;
}
@@ -85,6 +89,9 @@ void Splash::Draw() {
// Purpose: Reset UI position
//------------------------------------------------------------------------
void Splash::SetUI() {
+ warning("gScreenSettings cur w : %d h : %d", gScreenSettings.cur.w, gScreenSettings.cur.h);
x = (gScreenSettings.cur.w - background.W()) / 2;
y = (gScreenSettings.cur.h - background.H()) / 2;
}
+
+}
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 33231d55926..cf7dc0f2dd4 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -35,16 +35,19 @@
#ifndef CRAB_SPLASH_H
#define CRAB_SPLASH_H
-#include "crab/ImageManager.h"
-#include "crab/LoadingScreen.h"
-#include "crab/MusicManager.h"
+#include "crab/crab.h"
+//#include "crab/ImageManager.h"
+//#include "crab/LoadingScreen.h"
+//#include "crab/MusicManager.h"
+#include "crab/Image.h"
#include "crab/ScreenSettings.h"
-#include "crab/TextManager.h"
+//#include "crab/TextManager.h"
#include "crab/common_header.h"
#include "crab/gamestate_container.h"
#include "crab/gamestates.h"
#include "crab/timer.h"
+namespace Crab {
//------------------------------------------------------------------------
// Purpose: Splash screen class
//------------------------------------------------------------------------
@@ -57,7 +60,7 @@ class Splash : public GameState {
public:
Splash();
~Splash();
- void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {}
+ void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {}
void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void Draw();
void SetUI();
@@ -66,4 +69,6 @@ public:
void AutoSave() {}
};
+}
+
#endif // CRAB_SPLASH_H
Commit: 485b9274701e77796b07b6586a7e0c5a72a51dd1
https://github.com/scummvm/scummvm/commit/485b9274701e77796b07b6586a7e0c5a72a51dd1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: fix warnings in ScreenSettings
Changed paths:
engines/crab/ScreenSettings.h
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index d821da42e8b..eb6278f1967 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -134,7 +134,7 @@ public:
}
~ScreenSettings() {}
- const bool ValidDimension(Dimension d) { return d.w <= desktop.w && d.h <= desktop.h; }
+ bool ValidDimension(Dimension d) { return d.w <= desktop.w && d.h <= desktop.h; }
void SetVideoFlags();
void CreateBackup();
Commit: c3b90fa5a1325ad149b4f669523774bdf69cc748
https://github.com/scummvm/scummvm/commit/c3b90fa5a1325ad149b4f669523774bdf69cc748
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Declutter engine directory by moving compenents to their own folder
Changed paths:
A engines/crab/TMX/TMXLayer.cpp
A engines/crab/TMX/TMXLayer.h
A engines/crab/TMX/TMXMap.cpp
A engines/crab/TMX/TMXMap.h
A engines/crab/TMX/TMXTileSet.cpp
A engines/crab/TMX/TMXTileSet.h
A engines/crab/TMX/TileInfo.h
A engines/crab/ai/SpriteConstant.cpp
A engines/crab/ai/SpriteConstant.h
A engines/crab/ai/moveeffect.cpp
A engines/crab/ai/moveeffect.h
A engines/crab/ai/movement.cpp
A engines/crab/ai/movement.h
A engines/crab/ai/spriteai.cpp
A engines/crab/ai/spriteai.h
A engines/crab/animation/AnimationEffect.h
A engines/crab/animation/AnimationFrame.cpp
A engines/crab/animation/AnimationFrame.h
A engines/crab/animation/PopUp.cpp
A engines/crab/animation/PopUp.h
A engines/crab/animation/animation.cpp
A engines/crab/animation/animation.h
A engines/crab/animation/animframe.cpp
A engines/crab/animation/animframe.h
A engines/crab/animation/animset.cpp
A engines/crab/animation/animset.h
A engines/crab/animation/fightanim.cpp
A engines/crab/animation/fightanim.h
A engines/crab/animation/fightmove.cpp
A engines/crab/animation/fightmove.h
A engines/crab/animation/fightmoves.cpp
A engines/crab/animation/fightmoves.h
A engines/crab/animation/fm_ai_data.h
A engines/crab/animation/imageeffect.cpp
A engines/crab/animation/imageeffect.h
A engines/crab/animation/range.h
A engines/crab/animation/shadow.h
A engines/crab/animation/sprite.cpp
A engines/crab/animation/sprite.h
A engines/crab/animation/walkframes.cpp
A engines/crab/animation/walkframes.h
A engines/crab/event/EventSeqGroup.cpp
A engines/crab/event/EventSeqGroup.h
A engines/crab/event/EventSequence.cpp
A engines/crab/event/EventSequence.h
A engines/crab/event/GameEventInfo.cpp
A engines/crab/event/GameEventInfo.h
A engines/crab/event/changeval.h
A engines/crab/event/conversationdata.cpp
A engines/crab/event/conversationdata.h
A engines/crab/event/effect.cpp
A engines/crab/event/effect.h
A engines/crab/event/eventstore.cpp
A engines/crab/event/eventstore.h
A engines/crab/event/gameevent.cpp
A engines/crab/event/gameevent.h
A engines/crab/event/gameeventmanager.cpp
A engines/crab/event/gameeventmanager.h
A engines/crab/event/quest.cpp
A engines/crab/event/quest.h
A engines/crab/event/trigger.cpp
A engines/crab/event/trigger.h
A engines/crab/event/triggerset.cpp
A engines/crab/event/triggerset.h
A engines/crab/image/Image.cpp
A engines/crab/image/Image.h
A engines/crab/image/ImageManager.cpp
A engines/crab/image/ImageManager.h
A engines/crab/input/cursor.cpp
A engines/crab/input/cursor.h
A engines/crab/input/fightinput.cpp
A engines/crab/input/fightinput.h
A engines/crab/input/hotkey.cpp
A engines/crab/input/hotkey.h
A engines/crab/input/input.cpp
A engines/crab/input/input.h
A engines/crab/input/inputval.cpp
A engines/crab/input/inputval.h
A engines/crab/item/Item.cpp
A engines/crab/item/Item.h
A engines/crab/item/ItemCollection.cpp
A engines/crab/item/ItemCollection.h
A engines/crab/item/ItemMenu.cpp
A engines/crab/item/ItemMenu.h
A engines/crab/item/ItemSlot.cpp
A engines/crab/item/ItemSlot.h
A engines/crab/item/StatPreview.cpp
A engines/crab/item/StatPreview.h
A engines/crab/level/LevelExit.cpp
A engines/crab/level/LevelExit.h
A engines/crab/level/MusicArea.cpp
A engines/crab/level/MusicArea.h
A engines/crab/level/Stairs.cpp
A engines/crab/level/Stairs.h
A engines/crab/level/level.cpp
A engines/crab/level/level.h
A engines/crab/level/level_ai.cpp
A engines/crab/level/level_collide.cpp
A engines/crab/level/level_draw.cpp
A engines/crab/level/level_load.cpp
A engines/crab/level/level_objects.cpp
A engines/crab/level/level_objects.h
A engines/crab/level/talknotify.cpp
A engines/crab/level/talknotify.h
A engines/crab/music/MusicManager.cpp
A engines/crab/music/MusicManager.h
A engines/crab/music/musicparam.h
A engines/crab/people/opinion.cpp
A engines/crab/people/opinion.h
A engines/crab/people/person.cpp
A engines/crab/people/person.h
A engines/crab/people/personbase.cpp
A engines/crab/people/personbase.h
A engines/crab/people/trait.cpp
A engines/crab/people/trait.h
A engines/crab/stat/Stat.cpp
A engines/crab/stat/Stat.h
A engines/crab/stat/StatDrawHelper.cpp
A engines/crab/stat/StatDrawHelper.h
A engines/crab/stat/StatTemplate.cpp
A engines/crab/stat/StatTemplate.h
A engines/crab/stat/bonus.h
A engines/crab/text/TextManager.cpp
A engines/crab/text/TextManager.h
A engines/crab/text/color.cpp
A engines/crab/text/color.h
A engines/crab/ui/AlphaImage.cpp
A engines/crab/ui/AlphaImage.h
A engines/crab/ui/Caption.cpp
A engines/crab/ui/Caption.h
A engines/crab/ui/ChapterIntro.cpp
A engines/crab/ui/ChapterIntro.h
A engines/crab/ui/ClipButton.cpp
A engines/crab/ui/ClipButton.h
A engines/crab/ui/CreditScreen.cpp
A engines/crab/ui/CreditScreen.h
A engines/crab/ui/DevConsole.cpp
A engines/crab/ui/DevConsole.h
A engines/crab/ui/FileData.cpp
A engines/crab/ui/FileData.h
A engines/crab/ui/FileMenu.cpp
A engines/crab/ui/FileMenu.h
A engines/crab/ui/GameOverMenu.cpp
A engines/crab/ui/GameOverMenu.h
A engines/crab/ui/GeneralSettingMenu.cpp
A engines/crab/ui/GeneralSettingMenu.h
A engines/crab/ui/GfxSettingMenu.cpp
A engines/crab/ui/GfxSettingMenu.h
A engines/crab/ui/HealthIndicator.cpp
A engines/crab/ui/HealthIndicator.h
A engines/crab/ui/HoverInfo.cpp
A engines/crab/ui/HoverInfo.h
A engines/crab/ui/ImageData.cpp
A engines/crab/ui/ImageData.h
A engines/crab/ui/Inventory.cpp
A engines/crab/ui/Inventory.h
A engines/crab/ui/ItemDesc.h
A engines/crab/ui/KeyBindMenu.cpp
A engines/crab/ui/KeyBindMenu.h
A engines/crab/ui/MapData.cpp
A engines/crab/ui/MapData.h
A engines/crab/ui/MapMarkerMenu.cpp
A engines/crab/ui/MapMarkerMenu.h
A engines/crab/ui/ModMenu.cpp
A engines/crab/ui/ModMenu.h
A engines/crab/ui/OptionMenu.cpp
A engines/crab/ui/OptionMenu.h
A engines/crab/ui/OptionSelect.cpp
A engines/crab/ui/OptionSelect.h
A engines/crab/ui/PageMenu.h
A engines/crab/ui/ParagraphData.cpp
A engines/crab/ui/ParagraphData.h
A engines/crab/ui/PauseMenu.cpp
A engines/crab/ui/PauseMenu.h
A engines/crab/ui/PersonHandler.cpp
A engines/crab/ui/PersonHandler.h
A engines/crab/ui/PersonScreen.cpp
A engines/crab/ui/PersonScreen.h
A engines/crab/ui/ProgressBar.cpp
A engines/crab/ui/ProgressBar.h
A engines/crab/ui/QuestText.cpp
A engines/crab/ui/QuestText.h
A engines/crab/ui/RadioButton.h
A engines/crab/ui/RadioButtonMenu.h
A engines/crab/ui/ReplyButton.cpp
A engines/crab/ui/ReplyButton.h
A engines/crab/ui/ReplyMenu.cpp
A engines/crab/ui/ReplyMenu.h
A engines/crab/ui/ResolutionMenu.cpp
A engines/crab/ui/ResolutionMenu.h
A engines/crab/ui/SaveGameMenu.cpp
A engines/crab/ui/SaveGameMenu.h
A engines/crab/ui/SectionHeader.cpp
A engines/crab/ui/SectionHeader.h
A engines/crab/ui/SlideShow.cpp
A engines/crab/ui/SlideShow.h
A engines/crab/ui/StateButton.cpp
A engines/crab/ui/StateButton.h
A engines/crab/ui/TextData.h
A engines/crab/ui/ToggleButton.cpp
A engines/crab/ui/ToggleButton.h
A engines/crab/ui/TraitButton.cpp
A engines/crab/ui/TraitButton.h
A engines/crab/ui/TraitMenu.cpp
A engines/crab/ui/TraitMenu.h
A engines/crab/ui/button.cpp
A engines/crab/ui/button.h
A engines/crab/ui/dialogbox.cpp
A engines/crab/ui/dialogbox.h
A engines/crab/ui/element.cpp
A engines/crab/ui/element.h
A engines/crab/ui/emotion.cpp
A engines/crab/ui/emotion.h
A engines/crab/ui/hud.cpp
A engines/crab/ui/hud.h
A engines/crab/ui/journal.cpp
A engines/crab/ui/journal.h
A engines/crab/ui/map.cpp
A engines/crab/ui/map.h
A engines/crab/ui/mapbutton.h
A engines/crab/ui/menu.h
A engines/crab/ui/questmenu.cpp
A engines/crab/ui/questmenu.h
A engines/crab/ui/slider.cpp
A engines/crab/ui/slider.h
A engines/crab/ui/textarea.cpp
A engines/crab/ui/textarea.h
A engines/crab/ui/textdata.cpp
R engines/crab/AlphaImage.cpp
R engines/crab/AlphaImage.h
R engines/crab/AnimationEffect.h
R engines/crab/AnimationFrame.cpp
R engines/crab/AnimationFrame.h
R engines/crab/Caption.cpp
R engines/crab/Caption.h
R engines/crab/ChapterIntro.cpp
R engines/crab/ChapterIntro.h
R engines/crab/ClipButton.cpp
R engines/crab/ClipButton.h
R engines/crab/CreditScreen.cpp
R engines/crab/CreditScreen.h
R engines/crab/DevConsole.cpp
R engines/crab/DevConsole.h
R engines/crab/EventSeqGroup.cpp
R engines/crab/EventSeqGroup.h
R engines/crab/EventSequence.cpp
R engines/crab/EventSequence.h
R engines/crab/FileData.cpp
R engines/crab/FileData.h
R engines/crab/FileMenu.cpp
R engines/crab/FileMenu.h
R engines/crab/GameEventInfo.cpp
R engines/crab/GameEventInfo.h
R engines/crab/GameOverMenu.cpp
R engines/crab/GameOverMenu.h
R engines/crab/GeneralSettingMenu.cpp
R engines/crab/GeneralSettingMenu.h
R engines/crab/GfxSettingMenu.cpp
R engines/crab/GfxSettingMenu.h
R engines/crab/HealthIndicator.cpp
R engines/crab/HealthIndicator.h
R engines/crab/HoverInfo.cpp
R engines/crab/HoverInfo.h
R engines/crab/Image.cpp
R engines/crab/Image.h
R engines/crab/ImageData.cpp
R engines/crab/ImageData.h
R engines/crab/ImageManager.cpp
R engines/crab/ImageManager.h
R engines/crab/Inventory.cpp
R engines/crab/Inventory.h
R engines/crab/Item.cpp
R engines/crab/Item.h
R engines/crab/ItemCollection.cpp
R engines/crab/ItemCollection.h
R engines/crab/ItemDesc.h
R engines/crab/ItemMenu.cpp
R engines/crab/ItemMenu.h
R engines/crab/ItemSlot.cpp
R engines/crab/ItemSlot.h
R engines/crab/KeyBindMenu.cpp
R engines/crab/KeyBindMenu.h
R engines/crab/LevelExit.cpp
R engines/crab/LevelExit.h
R engines/crab/MapData.cpp
R engines/crab/MapData.h
R engines/crab/MapMarkerMenu.cpp
R engines/crab/MapMarkerMenu.h
R engines/crab/ModMenu.cpp
R engines/crab/ModMenu.h
R engines/crab/MusicArea.cpp
R engines/crab/MusicArea.h
R engines/crab/MusicManager.cpp
R engines/crab/MusicManager.h
R engines/crab/OptionMenu.cpp
R engines/crab/OptionMenu.h
R engines/crab/OptionSelect.cpp
R engines/crab/OptionSelect.h
R engines/crab/PageMenu.h
R engines/crab/ParagraphData.cpp
R engines/crab/ParagraphData.h
R engines/crab/PauseMenu.cpp
R engines/crab/PauseMenu.h
R engines/crab/PersonHandler.cpp
R engines/crab/PersonHandler.h
R engines/crab/PersonScreen.cpp
R engines/crab/PersonScreen.h
R engines/crab/PopUp.cpp
R engines/crab/PopUp.h
R engines/crab/ProgressBar.cpp
R engines/crab/ProgressBar.h
R engines/crab/QuestText.cpp
R engines/crab/QuestText.h
R engines/crab/RadioButton.h
R engines/crab/RadioButtonMenu.h
R engines/crab/ReplyButton.cpp
R engines/crab/ReplyButton.h
R engines/crab/ReplyMenu.cpp
R engines/crab/ReplyMenu.h
R engines/crab/ResolutionMenu.cpp
R engines/crab/ResolutionMenu.h
R engines/crab/SaveGameMenu.cpp
R engines/crab/SaveGameMenu.h
R engines/crab/SectionHeader.cpp
R engines/crab/SectionHeader.h
R engines/crab/SlideShow.cpp
R engines/crab/SlideShow.h
R engines/crab/SpriteConstant.cpp
R engines/crab/SpriteConstant.h
R engines/crab/Stairs.cpp
R engines/crab/Stairs.h
R engines/crab/Stat.cpp
R engines/crab/Stat.h
R engines/crab/StatDrawHelper.cpp
R engines/crab/StatDrawHelper.h
R engines/crab/StatPreview.cpp
R engines/crab/StatPreview.h
R engines/crab/StatTemplate.cpp
R engines/crab/StatTemplate.h
R engines/crab/StateButton.cpp
R engines/crab/StateButton.h
R engines/crab/TMXLayer.cpp
R engines/crab/TMXLayer.h
R engines/crab/TMXMap.cpp
R engines/crab/TMXMap.h
R engines/crab/TMXTileSet.cpp
R engines/crab/TMXTileSet.h
R engines/crab/TextData.h
R engines/crab/TextManager.cpp
R engines/crab/TextManager.h
R engines/crab/TileInfo.h
R engines/crab/ToggleButton.cpp
R engines/crab/ToggleButton.h
R engines/crab/TraitButton.cpp
R engines/crab/TraitButton.h
R engines/crab/TraitMenu.cpp
R engines/crab/TraitMenu.h
R engines/crab/animation.cpp
R engines/crab/animation.h
R engines/crab/animframe.cpp
R engines/crab/animframe.h
R engines/crab/animset.cpp
R engines/crab/animset.h
R engines/crab/bonus.h
R engines/crab/button.cpp
R engines/crab/button.h
R engines/crab/changeval.h
R engines/crab/color.cpp
R engines/crab/color.h
R engines/crab/conversationdata.cpp
R engines/crab/conversationdata.h
R engines/crab/cursor.cpp
R engines/crab/cursor.h
R engines/crab/dialogbox.cpp
R engines/crab/dialogbox.h
R engines/crab/effect.cpp
R engines/crab/effect.h
R engines/crab/element.cpp
R engines/crab/element.h
R engines/crab/emotion.cpp
R engines/crab/emotion.h
R engines/crab/eventstore.cpp
R engines/crab/eventstore.h
R engines/crab/fightanim.cpp
R engines/crab/fightanim.h
R engines/crab/fightinput.cpp
R engines/crab/fightinput.h
R engines/crab/fightmove.cpp
R engines/crab/fightmove.h
R engines/crab/fightmoves.cpp
R engines/crab/fightmoves.h
R engines/crab/fm_ai_data.h
R engines/crab/gameevent.cpp
R engines/crab/gameevent.h
R engines/crab/gameeventmanager.cpp
R engines/crab/gameeventmanager.h
R engines/crab/hotkey.cpp
R engines/crab/hotkey.h
R engines/crab/hud.cpp
R engines/crab/hud.h
R engines/crab/imageeffect.cpp
R engines/crab/imageeffect.h
R engines/crab/input.cpp
R engines/crab/input.h
R engines/crab/inputval.cpp
R engines/crab/inputval.h
R engines/crab/journal.cpp
R engines/crab/journal.h
R engines/crab/level.cpp
R engines/crab/level.h
R engines/crab/level_ai.cpp
R engines/crab/level_collide.cpp
R engines/crab/level_draw.cpp
R engines/crab/level_load.cpp
R engines/crab/level_objects.cpp
R engines/crab/level_objects.h
R engines/crab/map.cpp
R engines/crab/map.h
R engines/crab/mapbutton.h
R engines/crab/menu.h
R engines/crab/moveeffect.cpp
R engines/crab/moveeffect.h
R engines/crab/movement.cpp
R engines/crab/movement.h
R engines/crab/musicparam.h
R engines/crab/opinion.cpp
R engines/crab/opinion.h
R engines/crab/person.cpp
R engines/crab/person.h
R engines/crab/personbase.cpp
R engines/crab/personbase.h
R engines/crab/quest.cpp
R engines/crab/quest.h
R engines/crab/questmenu.cpp
R engines/crab/questmenu.h
R engines/crab/range.h
R engines/crab/shadow.h
R engines/crab/slider.cpp
R engines/crab/slider.h
R engines/crab/sprite.cpp
R engines/crab/sprite.h
R engines/crab/spriteai.cpp
R engines/crab/spriteai.h
R engines/crab/talknotify.cpp
R engines/crab/talknotify.h
R engines/crab/textarea.cpp
R engines/crab/textarea.h
R engines/crab/textdata.cpp
R engines/crab/trait.cpp
R engines/crab/trait.h
R engines/crab/trigger.cpp
R engines/crab/trigger.h
R engines/crab/triggerset.cpp
R engines/crab/triggerset.h
R engines/crab/walkframes.cpp
R engines/crab/walkframes.h
engines/crab/crab.cpp
engines/crab/module.mk
engines/crab/splash.h
diff --git a/engines/crab/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
similarity index 100%
rename from engines/crab/TMXLayer.cpp
rename to engines/crab/TMX/TMXLayer.cpp
diff --git a/engines/crab/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
similarity index 100%
rename from engines/crab/TMXLayer.h
rename to engines/crab/TMX/TMXLayer.h
diff --git a/engines/crab/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
similarity index 100%
rename from engines/crab/TMXMap.cpp
rename to engines/crab/TMX/TMXMap.cpp
diff --git a/engines/crab/TMXMap.h b/engines/crab/TMX/TMXMap.h
similarity index 100%
rename from engines/crab/TMXMap.h
rename to engines/crab/TMX/TMXMap.h
diff --git a/engines/crab/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
similarity index 100%
rename from engines/crab/TMXTileSet.cpp
rename to engines/crab/TMX/TMXTileSet.cpp
diff --git a/engines/crab/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
similarity index 100%
rename from engines/crab/TMXTileSet.h
rename to engines/crab/TMX/TMXTileSet.h
diff --git a/engines/crab/TileInfo.h b/engines/crab/TMX/TileInfo.h
similarity index 100%
rename from engines/crab/TileInfo.h
rename to engines/crab/TMX/TileInfo.h
diff --git a/engines/crab/SpriteConstant.cpp b/engines/crab/ai/SpriteConstant.cpp
similarity index 100%
rename from engines/crab/SpriteConstant.cpp
rename to engines/crab/ai/SpriteConstant.cpp
diff --git a/engines/crab/SpriteConstant.h b/engines/crab/ai/SpriteConstant.h
similarity index 100%
rename from engines/crab/SpriteConstant.h
rename to engines/crab/ai/SpriteConstant.h
diff --git a/engines/crab/moveeffect.cpp b/engines/crab/ai/moveeffect.cpp
similarity index 100%
rename from engines/crab/moveeffect.cpp
rename to engines/crab/ai/moveeffect.cpp
diff --git a/engines/crab/moveeffect.h b/engines/crab/ai/moveeffect.h
similarity index 100%
rename from engines/crab/moveeffect.h
rename to engines/crab/ai/moveeffect.h
diff --git a/engines/crab/movement.cpp b/engines/crab/ai/movement.cpp
similarity index 100%
rename from engines/crab/movement.cpp
rename to engines/crab/ai/movement.cpp
diff --git a/engines/crab/movement.h b/engines/crab/ai/movement.h
similarity index 100%
rename from engines/crab/movement.h
rename to engines/crab/ai/movement.h
diff --git a/engines/crab/spriteai.cpp b/engines/crab/ai/spriteai.cpp
similarity index 100%
rename from engines/crab/spriteai.cpp
rename to engines/crab/ai/spriteai.cpp
diff --git a/engines/crab/spriteai.h b/engines/crab/ai/spriteai.h
similarity index 100%
rename from engines/crab/spriteai.h
rename to engines/crab/ai/spriteai.h
diff --git a/engines/crab/AnimationEffect.h b/engines/crab/animation/AnimationEffect.h
similarity index 100%
rename from engines/crab/AnimationEffect.h
rename to engines/crab/animation/AnimationEffect.h
diff --git a/engines/crab/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
similarity index 100%
rename from engines/crab/AnimationFrame.cpp
rename to engines/crab/animation/AnimationFrame.cpp
diff --git a/engines/crab/AnimationFrame.h b/engines/crab/animation/AnimationFrame.h
similarity index 100%
rename from engines/crab/AnimationFrame.h
rename to engines/crab/animation/AnimationFrame.h
diff --git a/engines/crab/PopUp.cpp b/engines/crab/animation/PopUp.cpp
similarity index 100%
rename from engines/crab/PopUp.cpp
rename to engines/crab/animation/PopUp.cpp
diff --git a/engines/crab/PopUp.h b/engines/crab/animation/PopUp.h
similarity index 100%
rename from engines/crab/PopUp.h
rename to engines/crab/animation/PopUp.h
diff --git a/engines/crab/animation.cpp b/engines/crab/animation/animation.cpp
similarity index 100%
rename from engines/crab/animation.cpp
rename to engines/crab/animation/animation.cpp
diff --git a/engines/crab/animation.h b/engines/crab/animation/animation.h
similarity index 100%
rename from engines/crab/animation.h
rename to engines/crab/animation/animation.h
diff --git a/engines/crab/animframe.cpp b/engines/crab/animation/animframe.cpp
similarity index 100%
rename from engines/crab/animframe.cpp
rename to engines/crab/animation/animframe.cpp
diff --git a/engines/crab/animframe.h b/engines/crab/animation/animframe.h
similarity index 100%
rename from engines/crab/animframe.h
rename to engines/crab/animation/animframe.h
diff --git a/engines/crab/animset.cpp b/engines/crab/animation/animset.cpp
similarity index 100%
rename from engines/crab/animset.cpp
rename to engines/crab/animation/animset.cpp
diff --git a/engines/crab/animset.h b/engines/crab/animation/animset.h
similarity index 100%
rename from engines/crab/animset.h
rename to engines/crab/animation/animset.h
diff --git a/engines/crab/fightanim.cpp b/engines/crab/animation/fightanim.cpp
similarity index 100%
rename from engines/crab/fightanim.cpp
rename to engines/crab/animation/fightanim.cpp
diff --git a/engines/crab/fightanim.h b/engines/crab/animation/fightanim.h
similarity index 100%
rename from engines/crab/fightanim.h
rename to engines/crab/animation/fightanim.h
diff --git a/engines/crab/fightmove.cpp b/engines/crab/animation/fightmove.cpp
similarity index 100%
rename from engines/crab/fightmove.cpp
rename to engines/crab/animation/fightmove.cpp
diff --git a/engines/crab/fightmove.h b/engines/crab/animation/fightmove.h
similarity index 100%
rename from engines/crab/fightmove.h
rename to engines/crab/animation/fightmove.h
diff --git a/engines/crab/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
similarity index 100%
rename from engines/crab/fightmoves.cpp
rename to engines/crab/animation/fightmoves.cpp
diff --git a/engines/crab/fightmoves.h b/engines/crab/animation/fightmoves.h
similarity index 100%
rename from engines/crab/fightmoves.h
rename to engines/crab/animation/fightmoves.h
diff --git a/engines/crab/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
similarity index 100%
rename from engines/crab/fm_ai_data.h
rename to engines/crab/animation/fm_ai_data.h
diff --git a/engines/crab/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
similarity index 100%
rename from engines/crab/imageeffect.cpp
rename to engines/crab/animation/imageeffect.cpp
diff --git a/engines/crab/imageeffect.h b/engines/crab/animation/imageeffect.h
similarity index 100%
rename from engines/crab/imageeffect.h
rename to engines/crab/animation/imageeffect.h
diff --git a/engines/crab/range.h b/engines/crab/animation/range.h
similarity index 100%
rename from engines/crab/range.h
rename to engines/crab/animation/range.h
diff --git a/engines/crab/shadow.h b/engines/crab/animation/shadow.h
similarity index 100%
rename from engines/crab/shadow.h
rename to engines/crab/animation/shadow.h
diff --git a/engines/crab/sprite.cpp b/engines/crab/animation/sprite.cpp
similarity index 100%
rename from engines/crab/sprite.cpp
rename to engines/crab/animation/sprite.cpp
diff --git a/engines/crab/sprite.h b/engines/crab/animation/sprite.h
similarity index 100%
rename from engines/crab/sprite.h
rename to engines/crab/animation/sprite.h
diff --git a/engines/crab/walkframes.cpp b/engines/crab/animation/walkframes.cpp
similarity index 100%
rename from engines/crab/walkframes.cpp
rename to engines/crab/animation/walkframes.cpp
diff --git a/engines/crab/walkframes.h b/engines/crab/animation/walkframes.h
similarity index 100%
rename from engines/crab/walkframes.h
rename to engines/crab/animation/walkframes.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index bd853ee7745..340c8dd7b06 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -56,7 +56,6 @@
#include "common/system.h"
#include "crab/console.h"
#include "crab/detection.h"
-#include "crab/Image.h"
#include "crab/ScreenSettings.h"
#include "crab/app.h"
#include "engines/util.h"
diff --git a/engines/crab/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
similarity index 100%
rename from engines/crab/EventSeqGroup.cpp
rename to engines/crab/event/EventSeqGroup.cpp
diff --git a/engines/crab/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
similarity index 100%
rename from engines/crab/EventSeqGroup.h
rename to engines/crab/event/EventSeqGroup.h
diff --git a/engines/crab/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
similarity index 100%
rename from engines/crab/EventSequence.cpp
rename to engines/crab/event/EventSequence.cpp
diff --git a/engines/crab/EventSequence.h b/engines/crab/event/EventSequence.h
similarity index 100%
rename from engines/crab/EventSequence.h
rename to engines/crab/event/EventSequence.h
diff --git a/engines/crab/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
similarity index 100%
rename from engines/crab/GameEventInfo.cpp
rename to engines/crab/event/GameEventInfo.cpp
diff --git a/engines/crab/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
similarity index 100%
rename from engines/crab/GameEventInfo.h
rename to engines/crab/event/GameEventInfo.h
diff --git a/engines/crab/changeval.h b/engines/crab/event/changeval.h
similarity index 100%
rename from engines/crab/changeval.h
rename to engines/crab/event/changeval.h
diff --git a/engines/crab/conversationdata.cpp b/engines/crab/event/conversationdata.cpp
similarity index 100%
rename from engines/crab/conversationdata.cpp
rename to engines/crab/event/conversationdata.cpp
diff --git a/engines/crab/conversationdata.h b/engines/crab/event/conversationdata.h
similarity index 100%
rename from engines/crab/conversationdata.h
rename to engines/crab/event/conversationdata.h
diff --git a/engines/crab/effect.cpp b/engines/crab/event/effect.cpp
similarity index 100%
rename from engines/crab/effect.cpp
rename to engines/crab/event/effect.cpp
diff --git a/engines/crab/effect.h b/engines/crab/event/effect.h
similarity index 100%
rename from engines/crab/effect.h
rename to engines/crab/event/effect.h
diff --git a/engines/crab/eventstore.cpp b/engines/crab/event/eventstore.cpp
similarity index 100%
rename from engines/crab/eventstore.cpp
rename to engines/crab/event/eventstore.cpp
diff --git a/engines/crab/eventstore.h b/engines/crab/event/eventstore.h
similarity index 100%
rename from engines/crab/eventstore.h
rename to engines/crab/event/eventstore.h
diff --git a/engines/crab/gameevent.cpp b/engines/crab/event/gameevent.cpp
similarity index 100%
rename from engines/crab/gameevent.cpp
rename to engines/crab/event/gameevent.cpp
diff --git a/engines/crab/gameevent.h b/engines/crab/event/gameevent.h
similarity index 100%
rename from engines/crab/gameevent.h
rename to engines/crab/event/gameevent.h
diff --git a/engines/crab/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
similarity index 100%
rename from engines/crab/gameeventmanager.cpp
rename to engines/crab/event/gameeventmanager.cpp
diff --git a/engines/crab/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
similarity index 100%
rename from engines/crab/gameeventmanager.h
rename to engines/crab/event/gameeventmanager.h
diff --git a/engines/crab/quest.cpp b/engines/crab/event/quest.cpp
similarity index 100%
rename from engines/crab/quest.cpp
rename to engines/crab/event/quest.cpp
diff --git a/engines/crab/quest.h b/engines/crab/event/quest.h
similarity index 100%
rename from engines/crab/quest.h
rename to engines/crab/event/quest.h
diff --git a/engines/crab/trigger.cpp b/engines/crab/event/trigger.cpp
similarity index 100%
rename from engines/crab/trigger.cpp
rename to engines/crab/event/trigger.cpp
diff --git a/engines/crab/trigger.h b/engines/crab/event/trigger.h
similarity index 100%
rename from engines/crab/trigger.h
rename to engines/crab/event/trigger.h
diff --git a/engines/crab/triggerset.cpp b/engines/crab/event/triggerset.cpp
similarity index 100%
rename from engines/crab/triggerset.cpp
rename to engines/crab/event/triggerset.cpp
diff --git a/engines/crab/triggerset.h b/engines/crab/event/triggerset.h
similarity index 100%
rename from engines/crab/triggerset.h
rename to engines/crab/event/triggerset.h
diff --git a/engines/crab/Image.cpp b/engines/crab/image/Image.cpp
similarity index 99%
rename from engines/crab/Image.cpp
rename to engines/crab/image/Image.cpp
index 6fd56b4a3e3..d3b39c1dc22 100644
--- a/engines/crab/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -29,7 +29,7 @@
*/
#include "crab/crab.h"
-#include "crab/Image.h"
+#include "crab/image/Image.h"
#include "image/png.h"
using ImageDecoder = Image::PNGDecoder;
diff --git a/engines/crab/Image.h b/engines/crab/image/Image.h
similarity index 100%
rename from engines/crab/Image.h
rename to engines/crab/image/Image.h
diff --git a/engines/crab/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
similarity index 100%
rename from engines/crab/ImageManager.cpp
rename to engines/crab/image/ImageManager.cpp
diff --git a/engines/crab/ImageManager.h b/engines/crab/image/ImageManager.h
similarity index 100%
rename from engines/crab/ImageManager.h
rename to engines/crab/image/ImageManager.h
diff --git a/engines/crab/cursor.cpp b/engines/crab/input/cursor.cpp
similarity index 100%
rename from engines/crab/cursor.cpp
rename to engines/crab/input/cursor.cpp
diff --git a/engines/crab/cursor.h b/engines/crab/input/cursor.h
similarity index 100%
rename from engines/crab/cursor.h
rename to engines/crab/input/cursor.h
diff --git a/engines/crab/fightinput.cpp b/engines/crab/input/fightinput.cpp
similarity index 100%
rename from engines/crab/fightinput.cpp
rename to engines/crab/input/fightinput.cpp
diff --git a/engines/crab/fightinput.h b/engines/crab/input/fightinput.h
similarity index 100%
rename from engines/crab/fightinput.h
rename to engines/crab/input/fightinput.h
diff --git a/engines/crab/hotkey.cpp b/engines/crab/input/hotkey.cpp
similarity index 100%
rename from engines/crab/hotkey.cpp
rename to engines/crab/input/hotkey.cpp
diff --git a/engines/crab/hotkey.h b/engines/crab/input/hotkey.h
similarity index 100%
rename from engines/crab/hotkey.h
rename to engines/crab/input/hotkey.h
diff --git a/engines/crab/input.cpp b/engines/crab/input/input.cpp
similarity index 100%
rename from engines/crab/input.cpp
rename to engines/crab/input/input.cpp
diff --git a/engines/crab/input.h b/engines/crab/input/input.h
similarity index 100%
rename from engines/crab/input.h
rename to engines/crab/input/input.h
diff --git a/engines/crab/inputval.cpp b/engines/crab/input/inputval.cpp
similarity index 100%
rename from engines/crab/inputval.cpp
rename to engines/crab/input/inputval.cpp
diff --git a/engines/crab/inputval.h b/engines/crab/input/inputval.h
similarity index 100%
rename from engines/crab/inputval.h
rename to engines/crab/input/inputval.h
diff --git a/engines/crab/Item.cpp b/engines/crab/item/Item.cpp
similarity index 100%
rename from engines/crab/Item.cpp
rename to engines/crab/item/Item.cpp
diff --git a/engines/crab/Item.h b/engines/crab/item/Item.h
similarity index 100%
rename from engines/crab/Item.h
rename to engines/crab/item/Item.h
diff --git a/engines/crab/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
similarity index 100%
rename from engines/crab/ItemCollection.cpp
rename to engines/crab/item/ItemCollection.cpp
diff --git a/engines/crab/ItemCollection.h b/engines/crab/item/ItemCollection.h
similarity index 100%
rename from engines/crab/ItemCollection.h
rename to engines/crab/item/ItemCollection.h
diff --git a/engines/crab/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
similarity index 100%
rename from engines/crab/ItemMenu.cpp
rename to engines/crab/item/ItemMenu.cpp
diff --git a/engines/crab/ItemMenu.h b/engines/crab/item/ItemMenu.h
similarity index 100%
rename from engines/crab/ItemMenu.h
rename to engines/crab/item/ItemMenu.h
diff --git a/engines/crab/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
similarity index 100%
rename from engines/crab/ItemSlot.cpp
rename to engines/crab/item/ItemSlot.cpp
diff --git a/engines/crab/ItemSlot.h b/engines/crab/item/ItemSlot.h
similarity index 100%
rename from engines/crab/ItemSlot.h
rename to engines/crab/item/ItemSlot.h
diff --git a/engines/crab/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
similarity index 100%
rename from engines/crab/StatPreview.cpp
rename to engines/crab/item/StatPreview.cpp
diff --git a/engines/crab/StatPreview.h b/engines/crab/item/StatPreview.h
similarity index 100%
rename from engines/crab/StatPreview.h
rename to engines/crab/item/StatPreview.h
diff --git a/engines/crab/LevelExit.cpp b/engines/crab/level/LevelExit.cpp
similarity index 100%
rename from engines/crab/LevelExit.cpp
rename to engines/crab/level/LevelExit.cpp
diff --git a/engines/crab/LevelExit.h b/engines/crab/level/LevelExit.h
similarity index 100%
rename from engines/crab/LevelExit.h
rename to engines/crab/level/LevelExit.h
diff --git a/engines/crab/MusicArea.cpp b/engines/crab/level/MusicArea.cpp
similarity index 100%
rename from engines/crab/MusicArea.cpp
rename to engines/crab/level/MusicArea.cpp
diff --git a/engines/crab/MusicArea.h b/engines/crab/level/MusicArea.h
similarity index 100%
rename from engines/crab/MusicArea.h
rename to engines/crab/level/MusicArea.h
diff --git a/engines/crab/Stairs.cpp b/engines/crab/level/Stairs.cpp
similarity index 100%
rename from engines/crab/Stairs.cpp
rename to engines/crab/level/Stairs.cpp
diff --git a/engines/crab/Stairs.h b/engines/crab/level/Stairs.h
similarity index 100%
rename from engines/crab/Stairs.h
rename to engines/crab/level/Stairs.h
diff --git a/engines/crab/level.cpp b/engines/crab/level/level.cpp
similarity index 100%
rename from engines/crab/level.cpp
rename to engines/crab/level/level.cpp
diff --git a/engines/crab/level.h b/engines/crab/level/level.h
similarity index 100%
rename from engines/crab/level.h
rename to engines/crab/level/level.h
diff --git a/engines/crab/level_ai.cpp b/engines/crab/level/level_ai.cpp
similarity index 100%
rename from engines/crab/level_ai.cpp
rename to engines/crab/level/level_ai.cpp
diff --git a/engines/crab/level_collide.cpp b/engines/crab/level/level_collide.cpp
similarity index 100%
rename from engines/crab/level_collide.cpp
rename to engines/crab/level/level_collide.cpp
diff --git a/engines/crab/level_draw.cpp b/engines/crab/level/level_draw.cpp
similarity index 100%
rename from engines/crab/level_draw.cpp
rename to engines/crab/level/level_draw.cpp
diff --git a/engines/crab/level_load.cpp b/engines/crab/level/level_load.cpp
similarity index 100%
rename from engines/crab/level_load.cpp
rename to engines/crab/level/level_load.cpp
diff --git a/engines/crab/level_objects.cpp b/engines/crab/level/level_objects.cpp
similarity index 100%
rename from engines/crab/level_objects.cpp
rename to engines/crab/level/level_objects.cpp
diff --git a/engines/crab/level_objects.h b/engines/crab/level/level_objects.h
similarity index 100%
rename from engines/crab/level_objects.h
rename to engines/crab/level/level_objects.h
diff --git a/engines/crab/talknotify.cpp b/engines/crab/level/talknotify.cpp
similarity index 100%
rename from engines/crab/talknotify.cpp
rename to engines/crab/level/talknotify.cpp
diff --git a/engines/crab/talknotify.h b/engines/crab/level/talknotify.h
similarity index 100%
rename from engines/crab/talknotify.h
rename to engines/crab/level/talknotify.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 8378bff9663..409aad718b3 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -9,7 +9,7 @@ MODULE_OBJS = \
loaders.o \
ScreenSettings.o \
GameParam.o \
- Image.o \
+ image/Image.o \
timer.o \
app.o \
splash.o
diff --git a/engines/crab/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
similarity index 100%
rename from engines/crab/MusicManager.cpp
rename to engines/crab/music/MusicManager.cpp
diff --git a/engines/crab/MusicManager.h b/engines/crab/music/MusicManager.h
similarity index 100%
rename from engines/crab/MusicManager.h
rename to engines/crab/music/MusicManager.h
diff --git a/engines/crab/musicparam.h b/engines/crab/music/musicparam.h
similarity index 100%
rename from engines/crab/musicparam.h
rename to engines/crab/music/musicparam.h
diff --git a/engines/crab/opinion.cpp b/engines/crab/people/opinion.cpp
similarity index 100%
rename from engines/crab/opinion.cpp
rename to engines/crab/people/opinion.cpp
diff --git a/engines/crab/opinion.h b/engines/crab/people/opinion.h
similarity index 100%
rename from engines/crab/opinion.h
rename to engines/crab/people/opinion.h
diff --git a/engines/crab/person.cpp b/engines/crab/people/person.cpp
similarity index 100%
rename from engines/crab/person.cpp
rename to engines/crab/people/person.cpp
diff --git a/engines/crab/person.h b/engines/crab/people/person.h
similarity index 100%
rename from engines/crab/person.h
rename to engines/crab/people/person.h
diff --git a/engines/crab/personbase.cpp b/engines/crab/people/personbase.cpp
similarity index 100%
rename from engines/crab/personbase.cpp
rename to engines/crab/people/personbase.cpp
diff --git a/engines/crab/personbase.h b/engines/crab/people/personbase.h
similarity index 100%
rename from engines/crab/personbase.h
rename to engines/crab/people/personbase.h
diff --git a/engines/crab/trait.cpp b/engines/crab/people/trait.cpp
similarity index 100%
rename from engines/crab/trait.cpp
rename to engines/crab/people/trait.cpp
diff --git a/engines/crab/trait.h b/engines/crab/people/trait.h
similarity index 100%
rename from engines/crab/trait.h
rename to engines/crab/people/trait.h
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index cf7dc0f2dd4..1c48792b18c 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -39,7 +39,7 @@
//#include "crab/ImageManager.h"
//#include "crab/LoadingScreen.h"
//#include "crab/MusicManager.h"
-#include "crab/Image.h"
+#include "crab/image/Image.h"
#include "crab/ScreenSettings.h"
//#include "crab/TextManager.h"
#include "crab/common_header.h"
diff --git a/engines/crab/Stat.cpp b/engines/crab/stat/Stat.cpp
similarity index 100%
rename from engines/crab/Stat.cpp
rename to engines/crab/stat/Stat.cpp
diff --git a/engines/crab/Stat.h b/engines/crab/stat/Stat.h
similarity index 100%
rename from engines/crab/Stat.h
rename to engines/crab/stat/Stat.h
diff --git a/engines/crab/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
similarity index 100%
rename from engines/crab/StatDrawHelper.cpp
rename to engines/crab/stat/StatDrawHelper.cpp
diff --git a/engines/crab/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
similarity index 100%
rename from engines/crab/StatDrawHelper.h
rename to engines/crab/stat/StatDrawHelper.h
diff --git a/engines/crab/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
similarity index 100%
rename from engines/crab/StatTemplate.cpp
rename to engines/crab/stat/StatTemplate.cpp
diff --git a/engines/crab/StatTemplate.h b/engines/crab/stat/StatTemplate.h
similarity index 100%
rename from engines/crab/StatTemplate.h
rename to engines/crab/stat/StatTemplate.h
diff --git a/engines/crab/bonus.h b/engines/crab/stat/bonus.h
similarity index 100%
rename from engines/crab/bonus.h
rename to engines/crab/stat/bonus.h
diff --git a/engines/crab/TextManager.cpp b/engines/crab/text/TextManager.cpp
similarity index 100%
rename from engines/crab/TextManager.cpp
rename to engines/crab/text/TextManager.cpp
diff --git a/engines/crab/TextManager.h b/engines/crab/text/TextManager.h
similarity index 100%
rename from engines/crab/TextManager.h
rename to engines/crab/text/TextManager.h
diff --git a/engines/crab/color.cpp b/engines/crab/text/color.cpp
similarity index 100%
rename from engines/crab/color.cpp
rename to engines/crab/text/color.cpp
diff --git a/engines/crab/color.h b/engines/crab/text/color.h
similarity index 100%
rename from engines/crab/color.h
rename to engines/crab/text/color.h
diff --git a/engines/crab/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
similarity index 100%
rename from engines/crab/AlphaImage.cpp
rename to engines/crab/ui/AlphaImage.cpp
diff --git a/engines/crab/AlphaImage.h b/engines/crab/ui/AlphaImage.h
similarity index 100%
rename from engines/crab/AlphaImage.h
rename to engines/crab/ui/AlphaImage.h
diff --git a/engines/crab/Caption.cpp b/engines/crab/ui/Caption.cpp
similarity index 100%
rename from engines/crab/Caption.cpp
rename to engines/crab/ui/Caption.cpp
diff --git a/engines/crab/Caption.h b/engines/crab/ui/Caption.h
similarity index 100%
rename from engines/crab/Caption.h
rename to engines/crab/ui/Caption.h
diff --git a/engines/crab/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
similarity index 100%
rename from engines/crab/ChapterIntro.cpp
rename to engines/crab/ui/ChapterIntro.cpp
diff --git a/engines/crab/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
similarity index 100%
rename from engines/crab/ChapterIntro.h
rename to engines/crab/ui/ChapterIntro.h
diff --git a/engines/crab/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
similarity index 100%
rename from engines/crab/ClipButton.cpp
rename to engines/crab/ui/ClipButton.cpp
diff --git a/engines/crab/ClipButton.h b/engines/crab/ui/ClipButton.h
similarity index 100%
rename from engines/crab/ClipButton.h
rename to engines/crab/ui/ClipButton.h
diff --git a/engines/crab/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
similarity index 100%
rename from engines/crab/CreditScreen.cpp
rename to engines/crab/ui/CreditScreen.cpp
diff --git a/engines/crab/CreditScreen.h b/engines/crab/ui/CreditScreen.h
similarity index 100%
rename from engines/crab/CreditScreen.h
rename to engines/crab/ui/CreditScreen.h
diff --git a/engines/crab/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
similarity index 100%
rename from engines/crab/DevConsole.cpp
rename to engines/crab/ui/DevConsole.cpp
diff --git a/engines/crab/DevConsole.h b/engines/crab/ui/DevConsole.h
similarity index 100%
rename from engines/crab/DevConsole.h
rename to engines/crab/ui/DevConsole.h
diff --git a/engines/crab/FileData.cpp b/engines/crab/ui/FileData.cpp
similarity index 100%
rename from engines/crab/FileData.cpp
rename to engines/crab/ui/FileData.cpp
diff --git a/engines/crab/FileData.h b/engines/crab/ui/FileData.h
similarity index 100%
rename from engines/crab/FileData.h
rename to engines/crab/ui/FileData.h
diff --git a/engines/crab/FileMenu.cpp b/engines/crab/ui/FileMenu.cpp
similarity index 100%
rename from engines/crab/FileMenu.cpp
rename to engines/crab/ui/FileMenu.cpp
diff --git a/engines/crab/FileMenu.h b/engines/crab/ui/FileMenu.h
similarity index 100%
rename from engines/crab/FileMenu.h
rename to engines/crab/ui/FileMenu.h
diff --git a/engines/crab/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
similarity index 100%
rename from engines/crab/GameOverMenu.cpp
rename to engines/crab/ui/GameOverMenu.cpp
diff --git a/engines/crab/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
similarity index 100%
rename from engines/crab/GameOverMenu.h
rename to engines/crab/ui/GameOverMenu.h
diff --git a/engines/crab/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
similarity index 100%
rename from engines/crab/GeneralSettingMenu.cpp
rename to engines/crab/ui/GeneralSettingMenu.cpp
diff --git a/engines/crab/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
similarity index 100%
rename from engines/crab/GeneralSettingMenu.h
rename to engines/crab/ui/GeneralSettingMenu.h
diff --git a/engines/crab/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
similarity index 100%
rename from engines/crab/GfxSettingMenu.cpp
rename to engines/crab/ui/GfxSettingMenu.cpp
diff --git a/engines/crab/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
similarity index 100%
rename from engines/crab/GfxSettingMenu.h
rename to engines/crab/ui/GfxSettingMenu.h
diff --git a/engines/crab/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
similarity index 100%
rename from engines/crab/HealthIndicator.cpp
rename to engines/crab/ui/HealthIndicator.cpp
diff --git a/engines/crab/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
similarity index 100%
rename from engines/crab/HealthIndicator.h
rename to engines/crab/ui/HealthIndicator.h
diff --git a/engines/crab/HoverInfo.cpp b/engines/crab/ui/HoverInfo.cpp
similarity index 100%
rename from engines/crab/HoverInfo.cpp
rename to engines/crab/ui/HoverInfo.cpp
diff --git a/engines/crab/HoverInfo.h b/engines/crab/ui/HoverInfo.h
similarity index 100%
rename from engines/crab/HoverInfo.h
rename to engines/crab/ui/HoverInfo.h
diff --git a/engines/crab/ImageData.cpp b/engines/crab/ui/ImageData.cpp
similarity index 100%
rename from engines/crab/ImageData.cpp
rename to engines/crab/ui/ImageData.cpp
diff --git a/engines/crab/ImageData.h b/engines/crab/ui/ImageData.h
similarity index 100%
rename from engines/crab/ImageData.h
rename to engines/crab/ui/ImageData.h
diff --git a/engines/crab/Inventory.cpp b/engines/crab/ui/Inventory.cpp
similarity index 100%
rename from engines/crab/Inventory.cpp
rename to engines/crab/ui/Inventory.cpp
diff --git a/engines/crab/Inventory.h b/engines/crab/ui/Inventory.h
similarity index 100%
rename from engines/crab/Inventory.h
rename to engines/crab/ui/Inventory.h
diff --git a/engines/crab/ItemDesc.h b/engines/crab/ui/ItemDesc.h
similarity index 100%
rename from engines/crab/ItemDesc.h
rename to engines/crab/ui/ItemDesc.h
diff --git a/engines/crab/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
similarity index 100%
rename from engines/crab/KeyBindMenu.cpp
rename to engines/crab/ui/KeyBindMenu.cpp
diff --git a/engines/crab/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
similarity index 100%
rename from engines/crab/KeyBindMenu.h
rename to engines/crab/ui/KeyBindMenu.h
diff --git a/engines/crab/MapData.cpp b/engines/crab/ui/MapData.cpp
similarity index 100%
rename from engines/crab/MapData.cpp
rename to engines/crab/ui/MapData.cpp
diff --git a/engines/crab/MapData.h b/engines/crab/ui/MapData.h
similarity index 100%
rename from engines/crab/MapData.h
rename to engines/crab/ui/MapData.h
diff --git a/engines/crab/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
similarity index 100%
rename from engines/crab/MapMarkerMenu.cpp
rename to engines/crab/ui/MapMarkerMenu.cpp
diff --git a/engines/crab/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
similarity index 100%
rename from engines/crab/MapMarkerMenu.h
rename to engines/crab/ui/MapMarkerMenu.h
diff --git a/engines/crab/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
similarity index 100%
rename from engines/crab/ModMenu.cpp
rename to engines/crab/ui/ModMenu.cpp
diff --git a/engines/crab/ModMenu.h b/engines/crab/ui/ModMenu.h
similarity index 100%
rename from engines/crab/ModMenu.h
rename to engines/crab/ui/ModMenu.h
diff --git a/engines/crab/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
similarity index 100%
rename from engines/crab/OptionMenu.cpp
rename to engines/crab/ui/OptionMenu.cpp
diff --git a/engines/crab/OptionMenu.h b/engines/crab/ui/OptionMenu.h
similarity index 100%
rename from engines/crab/OptionMenu.h
rename to engines/crab/ui/OptionMenu.h
diff --git a/engines/crab/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
similarity index 100%
rename from engines/crab/OptionSelect.cpp
rename to engines/crab/ui/OptionSelect.cpp
diff --git a/engines/crab/OptionSelect.h b/engines/crab/ui/OptionSelect.h
similarity index 100%
rename from engines/crab/OptionSelect.h
rename to engines/crab/ui/OptionSelect.h
diff --git a/engines/crab/PageMenu.h b/engines/crab/ui/PageMenu.h
similarity index 100%
rename from engines/crab/PageMenu.h
rename to engines/crab/ui/PageMenu.h
diff --git a/engines/crab/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
similarity index 100%
rename from engines/crab/ParagraphData.cpp
rename to engines/crab/ui/ParagraphData.cpp
diff --git a/engines/crab/ParagraphData.h b/engines/crab/ui/ParagraphData.h
similarity index 100%
rename from engines/crab/ParagraphData.h
rename to engines/crab/ui/ParagraphData.h
diff --git a/engines/crab/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
similarity index 100%
rename from engines/crab/PauseMenu.cpp
rename to engines/crab/ui/PauseMenu.cpp
diff --git a/engines/crab/PauseMenu.h b/engines/crab/ui/PauseMenu.h
similarity index 100%
rename from engines/crab/PauseMenu.h
rename to engines/crab/ui/PauseMenu.h
diff --git a/engines/crab/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
similarity index 100%
rename from engines/crab/PersonHandler.cpp
rename to engines/crab/ui/PersonHandler.cpp
diff --git a/engines/crab/PersonHandler.h b/engines/crab/ui/PersonHandler.h
similarity index 100%
rename from engines/crab/PersonHandler.h
rename to engines/crab/ui/PersonHandler.h
diff --git a/engines/crab/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
similarity index 100%
rename from engines/crab/PersonScreen.cpp
rename to engines/crab/ui/PersonScreen.cpp
diff --git a/engines/crab/PersonScreen.h b/engines/crab/ui/PersonScreen.h
similarity index 100%
rename from engines/crab/PersonScreen.h
rename to engines/crab/ui/PersonScreen.h
diff --git a/engines/crab/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
similarity index 100%
rename from engines/crab/ProgressBar.cpp
rename to engines/crab/ui/ProgressBar.cpp
diff --git a/engines/crab/ProgressBar.h b/engines/crab/ui/ProgressBar.h
similarity index 100%
rename from engines/crab/ProgressBar.h
rename to engines/crab/ui/ProgressBar.h
diff --git a/engines/crab/QuestText.cpp b/engines/crab/ui/QuestText.cpp
similarity index 100%
rename from engines/crab/QuestText.cpp
rename to engines/crab/ui/QuestText.cpp
diff --git a/engines/crab/QuestText.h b/engines/crab/ui/QuestText.h
similarity index 100%
rename from engines/crab/QuestText.h
rename to engines/crab/ui/QuestText.h
diff --git a/engines/crab/RadioButton.h b/engines/crab/ui/RadioButton.h
similarity index 100%
rename from engines/crab/RadioButton.h
rename to engines/crab/ui/RadioButton.h
diff --git a/engines/crab/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
similarity index 100%
rename from engines/crab/RadioButtonMenu.h
rename to engines/crab/ui/RadioButtonMenu.h
diff --git a/engines/crab/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
similarity index 100%
rename from engines/crab/ReplyButton.cpp
rename to engines/crab/ui/ReplyButton.cpp
diff --git a/engines/crab/ReplyButton.h b/engines/crab/ui/ReplyButton.h
similarity index 100%
rename from engines/crab/ReplyButton.h
rename to engines/crab/ui/ReplyButton.h
diff --git a/engines/crab/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
similarity index 100%
rename from engines/crab/ReplyMenu.cpp
rename to engines/crab/ui/ReplyMenu.cpp
diff --git a/engines/crab/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
similarity index 100%
rename from engines/crab/ReplyMenu.h
rename to engines/crab/ui/ReplyMenu.h
diff --git a/engines/crab/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
similarity index 100%
rename from engines/crab/ResolutionMenu.cpp
rename to engines/crab/ui/ResolutionMenu.cpp
diff --git a/engines/crab/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
similarity index 100%
rename from engines/crab/ResolutionMenu.h
rename to engines/crab/ui/ResolutionMenu.h
diff --git a/engines/crab/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
similarity index 100%
rename from engines/crab/SaveGameMenu.cpp
rename to engines/crab/ui/SaveGameMenu.cpp
diff --git a/engines/crab/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
similarity index 100%
rename from engines/crab/SaveGameMenu.h
rename to engines/crab/ui/SaveGameMenu.h
diff --git a/engines/crab/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
similarity index 100%
rename from engines/crab/SectionHeader.cpp
rename to engines/crab/ui/SectionHeader.cpp
diff --git a/engines/crab/SectionHeader.h b/engines/crab/ui/SectionHeader.h
similarity index 100%
rename from engines/crab/SectionHeader.h
rename to engines/crab/ui/SectionHeader.h
diff --git a/engines/crab/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
similarity index 100%
rename from engines/crab/SlideShow.cpp
rename to engines/crab/ui/SlideShow.cpp
diff --git a/engines/crab/SlideShow.h b/engines/crab/ui/SlideShow.h
similarity index 100%
rename from engines/crab/SlideShow.h
rename to engines/crab/ui/SlideShow.h
diff --git a/engines/crab/StateButton.cpp b/engines/crab/ui/StateButton.cpp
similarity index 100%
rename from engines/crab/StateButton.cpp
rename to engines/crab/ui/StateButton.cpp
diff --git a/engines/crab/StateButton.h b/engines/crab/ui/StateButton.h
similarity index 100%
rename from engines/crab/StateButton.h
rename to engines/crab/ui/StateButton.h
diff --git a/engines/crab/TextData.h b/engines/crab/ui/TextData.h
similarity index 100%
rename from engines/crab/TextData.h
rename to engines/crab/ui/TextData.h
diff --git a/engines/crab/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
similarity index 100%
rename from engines/crab/ToggleButton.cpp
rename to engines/crab/ui/ToggleButton.cpp
diff --git a/engines/crab/ToggleButton.h b/engines/crab/ui/ToggleButton.h
similarity index 100%
rename from engines/crab/ToggleButton.h
rename to engines/crab/ui/ToggleButton.h
diff --git a/engines/crab/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
similarity index 100%
rename from engines/crab/TraitButton.cpp
rename to engines/crab/ui/TraitButton.cpp
diff --git a/engines/crab/TraitButton.h b/engines/crab/ui/TraitButton.h
similarity index 100%
rename from engines/crab/TraitButton.h
rename to engines/crab/ui/TraitButton.h
diff --git a/engines/crab/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
similarity index 100%
rename from engines/crab/TraitMenu.cpp
rename to engines/crab/ui/TraitMenu.cpp
diff --git a/engines/crab/TraitMenu.h b/engines/crab/ui/TraitMenu.h
similarity index 100%
rename from engines/crab/TraitMenu.h
rename to engines/crab/ui/TraitMenu.h
diff --git a/engines/crab/button.cpp b/engines/crab/ui/button.cpp
similarity index 100%
rename from engines/crab/button.cpp
rename to engines/crab/ui/button.cpp
diff --git a/engines/crab/button.h b/engines/crab/ui/button.h
similarity index 100%
rename from engines/crab/button.h
rename to engines/crab/ui/button.h
diff --git a/engines/crab/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
similarity index 100%
rename from engines/crab/dialogbox.cpp
rename to engines/crab/ui/dialogbox.cpp
diff --git a/engines/crab/dialogbox.h b/engines/crab/ui/dialogbox.h
similarity index 100%
rename from engines/crab/dialogbox.h
rename to engines/crab/ui/dialogbox.h
diff --git a/engines/crab/element.cpp b/engines/crab/ui/element.cpp
similarity index 100%
rename from engines/crab/element.cpp
rename to engines/crab/ui/element.cpp
diff --git a/engines/crab/element.h b/engines/crab/ui/element.h
similarity index 100%
rename from engines/crab/element.h
rename to engines/crab/ui/element.h
diff --git a/engines/crab/emotion.cpp b/engines/crab/ui/emotion.cpp
similarity index 100%
rename from engines/crab/emotion.cpp
rename to engines/crab/ui/emotion.cpp
diff --git a/engines/crab/emotion.h b/engines/crab/ui/emotion.h
similarity index 100%
rename from engines/crab/emotion.h
rename to engines/crab/ui/emotion.h
diff --git a/engines/crab/hud.cpp b/engines/crab/ui/hud.cpp
similarity index 100%
rename from engines/crab/hud.cpp
rename to engines/crab/ui/hud.cpp
diff --git a/engines/crab/hud.h b/engines/crab/ui/hud.h
similarity index 100%
rename from engines/crab/hud.h
rename to engines/crab/ui/hud.h
diff --git a/engines/crab/journal.cpp b/engines/crab/ui/journal.cpp
similarity index 100%
rename from engines/crab/journal.cpp
rename to engines/crab/ui/journal.cpp
diff --git a/engines/crab/journal.h b/engines/crab/ui/journal.h
similarity index 100%
rename from engines/crab/journal.h
rename to engines/crab/ui/journal.h
diff --git a/engines/crab/map.cpp b/engines/crab/ui/map.cpp
similarity index 100%
rename from engines/crab/map.cpp
rename to engines/crab/ui/map.cpp
diff --git a/engines/crab/map.h b/engines/crab/ui/map.h
similarity index 100%
rename from engines/crab/map.h
rename to engines/crab/ui/map.h
diff --git a/engines/crab/mapbutton.h b/engines/crab/ui/mapbutton.h
similarity index 100%
rename from engines/crab/mapbutton.h
rename to engines/crab/ui/mapbutton.h
diff --git a/engines/crab/menu.h b/engines/crab/ui/menu.h
similarity index 100%
rename from engines/crab/menu.h
rename to engines/crab/ui/menu.h
diff --git a/engines/crab/questmenu.cpp b/engines/crab/ui/questmenu.cpp
similarity index 100%
rename from engines/crab/questmenu.cpp
rename to engines/crab/ui/questmenu.cpp
diff --git a/engines/crab/questmenu.h b/engines/crab/ui/questmenu.h
similarity index 100%
rename from engines/crab/questmenu.h
rename to engines/crab/ui/questmenu.h
diff --git a/engines/crab/slider.cpp b/engines/crab/ui/slider.cpp
similarity index 100%
rename from engines/crab/slider.cpp
rename to engines/crab/ui/slider.cpp
diff --git a/engines/crab/slider.h b/engines/crab/ui/slider.h
similarity index 100%
rename from engines/crab/slider.h
rename to engines/crab/ui/slider.h
diff --git a/engines/crab/textarea.cpp b/engines/crab/ui/textarea.cpp
similarity index 100%
rename from engines/crab/textarea.cpp
rename to engines/crab/ui/textarea.cpp
diff --git a/engines/crab/textarea.h b/engines/crab/ui/textarea.h
similarity index 100%
rename from engines/crab/textarea.h
rename to engines/crab/ui/textarea.h
diff --git a/engines/crab/textdata.cpp b/engines/crab/ui/textdata.cpp
similarity index 100%
rename from engines/crab/textdata.cpp
rename to engines/crab/ui/textdata.cpp
Commit: a0eb2c17411f33647a02a33050d2cfad9f2e396a
https://github.com/scummvm/scummvm/commit/a0eb2c17411f33647a02a33050d2cfad9f2e396a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unneeded file
Changed paths:
R engines/crab/main.cpp
diff --git a/engines/crab/main.cpp b/engines/crab/main.cpp
deleted file mode 100644
index 3ba7e611b7a..00000000000
--- a/engines/crab/main.cpp
+++ /dev/null
@@ -1,40 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#include "crab/app.h"
-
-int WinMain(int argc, char *args[]) {
- App app;
-
- if (app.Init())
- app.Run();
-
- return 0;
-}
Commit: 611cb4b7627d9462c0e5a220bf54342778e2737a
https://github.com/scummvm/scummvm/commit/611cb4b7627d9462c0e5a220bf54342778e2737a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix issue related to transparent PNGs
Changed paths:
engines/crab/image/Image.cpp
engines/crab/image/Image.h
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index d3b39c1dc22..46bf7681fd6 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -72,16 +72,15 @@ bool Image::Load(const Common::String &path) {
ImageDecoder decoder;
if (FileOpen(path, &file) && decoder.loadStream(file)) {
- const Graphics::Surface *s = decoder.getSurface();
- texture = new Graphics::Surface();
- texture->copyFrom(*s);
- w = s->w;
- h = s->h;
+ texture = new Graphics::ManagedSurface(decoder.getSurface());
+ w = texture->w;
+ h = texture->h;
file.close();
- }
- warning("Image::Load() Image Texture(%s): w: %d h: %d", path.c_str(), w, h);
+ warning("Image::Load() Image Texture(%s): w: %d h: %d", path.c_str(), w, h);
+
+ }
return texture != nullptr;
@@ -122,7 +121,8 @@ bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
//------------------------------------------------------------------------
void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFlipType &flip) {
- g_engine->_renderSurface->copyRectToSurface(texture->getPixels(), texture->pitch, x, y, texture->w, texture->h);
+ g_engine->_renderSurface->blitFrom(*texture, Common::Point(x, y));
+ //g_engine->_renderSurface->copyRectToSurface(texture->getPixels(), texture->pitch, x, y, texture->w, texture->h);
#if 0
// Set rendering space and render to screen
SDL_Rect renderQuad = {x, y, w, h};
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index ef98f39a3a1..026afd2c675 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -47,7 +47,7 @@ class Image {
// The actual hardware texture
//SDL_Texture *texture;
- Graphics::Surface *texture;
+ Graphics::ManagedSurface *texture;
public:
Image() : texture(nullptr), w(0), h(0) {}
Commit: aa3b7cc05480b4e11d46d8c01f87f8ce979febcf
https://github.com/scummvm/scummvm/commit/aa3b7cc05480b4e11d46d8c01f87f8ce979febcf
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port ImageManager class
Changed paths:
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 06195616723..015096057ca 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -32,9 +32,11 @@
// Author: Arvind
// Purpose: Contains the image manager class - used to manage in-game images
//=============================================================================
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/XMLDoc.h"
+namespace Crab {
+
using namespace pyrodactyl::image;
// Stuff we use throughout the game
@@ -47,9 +49,9 @@ ImageManager gImageManager;
//------------------------------------------------------------------------
// Purpose: Load assets here.
//------------------------------------------------------------------------
-void ImageManager::LoadMap(const std::string &filename, const MapID &mapid) {
+void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
for (auto it = map[mapid].begin(); it != map[mapid].end(); ++it)
- it->second.Delete();
+ it->_value.Delete();
map[mapid].clear();
XMLDoc image_list(filename);
@@ -63,7 +65,7 @@ void ImageManager::LoadMap(const std::string &filename, const MapID &mapid) {
// if yes, load it - if no, just load the higher quality one
bool valid = false;
- std::string path;
+ Common::String path;
if (!gScreenSettings.quality)
valid = LoadStr(path, "path_low", n, false);
@@ -74,7 +76,10 @@ void ImageManager::LoadMap(const std::string &filename, const MapID &mapid) {
if (valid)
map[mapid][key].Load(path);
else
+ error("ImageManager::LoadMap : Unable to load image id %u from %s!", key, path.c_str());
+#if 0
fprintf(stderr, "Unable to load image id %u from %s! SDL Error: %s\n", key, path.c_str(), SDL_GetError());
+#endif
}
}
@@ -104,37 +109,39 @@ bool ImageManager::Init() {
//------------------------------------------------------------------------
// Purpose: Add texture to image map
//------------------------------------------------------------------------
-void ImageManager::AddTexture(const ImageKey &id, SDL_Surface *surface, int mapindex) {
- if (map[mapindex].count(id) > 0)
+void ImageManager::AddTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex) {
+ if (map[mapindex].contains(id))
FreeTexture(id, mapindex);
map[mapindex][id].Load(surface);
+#if 0
SDL_FreeSurface(surface);
+#endif
}
//------------------------------------------------------------------------
// Purpose: Get texture for a particular id
//------------------------------------------------------------------------
void ImageManager::GetTexture(const ImageKey &id, Image &data) {
- if (map[MAP_CURRENT].count(id) > 0)
+ if (map[MAP_CURRENT].contains(id))
data = map[MAP_CURRENT][id];
- else if (map[MAP_COMMON].count(id) > 0)
+ else if (map[MAP_COMMON].contains(id))
data = map[MAP_COMMON][id];
else
data = invalid_img;
}
Image &ImageManager::GetTexture(const ImageKey &id) {
- if (map[MAP_CURRENT].count(id) > 0)
+ if (map[MAP_CURRENT].contains(id))
return map[MAP_CURRENT][id];
- else if (map[MAP_COMMON].count(id) > 0)
+ else if (map[MAP_COMMON].contains(id))
return map[MAP_COMMON][id];
return invalid_img;
}
bool ImageManager::ValidTexture(const ImageKey &id) {
- if (id != 0 && (map[MAP_CURRENT].count(id) > 0 || map[MAP_COMMON].count(id) > 0))
+ if (id != 0 && (map[MAP_CURRENT].contains(id) || map[MAP_COMMON].contains(id)))
return true;
return false;
@@ -143,7 +150,7 @@ bool ImageManager::ValidTexture(const ImageKey &id) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Rect *clip,
+void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Common::Rect *clip,
const TextureFlipType &flip) {
GetTexture(id).Draw(x, y, clip, flip);
}
@@ -152,15 +159,19 @@ void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Rect *cl
// Purpose: Dim the screen by drawing a 128 alpha black rectangle over it
//------------------------------------------------------------------------
void ImageManager::DimScreen() {
+#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 128);
SDL_RenderFillRect(gRenderer, NULL);
+#endif
}
void ImageManager::BlackScreen() {
+#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 255);
SDL_RenderFillRect(gRenderer, NULL);
+#endif
}
//------------------------------------------------------------------------
// Purpose: free resources
@@ -168,10 +179,12 @@ void ImageManager::BlackScreen() {
void ImageManager::Quit() {
for (int i = 0; i < MAP_TOTAL; i++) {
for (auto it = map[i].begin(); it != map[i].end(); ++it)
- it->second.Delete();
+ it->_value.Delete();
map[i].clear();
}
invalid_img.Delete();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index 80b5a5b25c4..a5433027729 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -36,13 +36,15 @@
#define CRAB_IMAGEMANAGER_H
#include "crab/GameParam.h"
-#include "crab/Image.h"
-#include "crab/LoadingScreen.h"
-#include "crab/TMXTileSet.h"
+#include "crab/Image/Image.h"
+//#include "crab/LoadingScreen.h"
+//#include "crab/TMXTileSet.h"
#include "crab/common_header.h"
-#include "crab/cursor.h"
+#include "crab/input/cursor.h"
#include "crab/loaders.h"
+namespace Crab {
+
// We use this object as the key for all image assets
typedef unsigned int ImageKey;
@@ -52,12 +54,14 @@ typedef unsigned int ImageKey;
namespace pyrodactyl {
namespace image {
// We store images here
-typedef std::unordered_map<ImageKey, Image> TextureMap;
+typedef Common::HashMap<ImageKey, Image> TextureMap;
// Two image maps are used in the game - current (changes with level) and common
-enum MapID { MAP_CURRENT,
- MAP_COMMON,
- MAP_TOTAL };
+enum MapID {
+ MAP_CURRENT,
+ MAP_COMMON,
+ MAP_TOTAL
+};
class ImageManager {
// Assets are stored in images
@@ -69,7 +73,7 @@ class ImageManager {
public:
// The tile sets used in the level
- TMX::TileSetGroup tileset;
+ //TMX::TileSetGroup tileset;
// This image is used to notify player about changes to quests and inventory
ImageKey notify;
@@ -85,16 +89,16 @@ public:
// image related stuff
// Load all images specified in an xml file in a map
- void LoadMap(const std::string &filename, const MapID &mapid = MAP_CURRENT);
+ void LoadMap(const Common::String &filename, const MapID &mapid = MAP_CURRENT);
- void AddTexture(const ImageKey &id, SDL_Surface *surface, int mapindex = MAP_COMMON);
+ void AddTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex = MAP_COMMON);
void FreeTexture(const ImageKey &id, int mapindex = MAP_COMMON) { map[mapindex][id].Delete(); }
void GetTexture(const ImageKey &id, Image &data);
Image &GetTexture(const ImageKey &id);
bool ValidTexture(const ImageKey &id);
void Draw(const int &x, const int &y, const ImageKey &id,
- Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+ Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
void DimScreen();
void BlackScreen();
@@ -110,4 +114,6 @@ extern ImageManager gImageManager;
} // End of namespace image
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_IMAGEMANAGER_H
Commit: 0c51adcb04acf24731c4b62963f3c52c7129fa28
https://github.com/scummvm/scummvm/commit/0c51adcb04acf24731c4b62963f3c52c7129fa28
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Index 5 levels deep in the res folder
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 340c8dd7b06..50b040d15a2 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -102,6 +102,11 @@ Common::Error CrabEngine::run() {
return Common::kNoError;
}
+void CrabEngine::initializePath(const Common::FSNode &gamePath) {
+ Engine::initializePath(gamePath);
+ SearchMan.addDirectory("res", gamePath, 0, 5);
+}
+
Common::Error CrabEngine::syncGame(Common::Serializer &s) {
// The Serializer has methods isLoading() and isSaving()
// if you need to specific steps; for example setting
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 72436e482f3..648904f3424 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -84,10 +84,12 @@ protected:
public:
Graphics::Screen *_screen = nullptr;
Graphics::ManagedSurface *_renderSurface = nullptr;
+ Common::FSNode _gameDataDir;
public:
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
~CrabEngine() override;
+ void initializePath(const Common::FSNode &gamePath) override;
uint32 getFeatures() const;
Commit: 62908b6c4d6aa23bef2c4a22c02494d984bb44f8
https://github.com/scummvm/scummvm/commit/62908b6c4d6aa23bef2c4a22c02494d984bb44f8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port and make cursor compilable
Changed paths:
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index d157571d3b1..574a98c15d1 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -32,7 +32,9 @@
// Author: Arvind
// Purpose: Cursor class
//=============================================================================
-#include "crab/cursor.h"
+#include "crab/input/cursor.h"
+
+namespace Crab {
namespace pyrodactyl {
namespace input {
@@ -79,9 +81,10 @@ void Cursor::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-void Cursor::HandleEvents(const SDL_Event &Event) {
+void Cursor::HandleEvents(const Common::Event &event) {
gMouse.hover = false;
- if (Event.type == SDL_MOUSEMOTION) {
+#if 0
+ if (event.type == SDL_MOUSEMOTION) {
motion.x = Event.motion.x;
motion.y = Event.motion.y;
@@ -96,12 +99,32 @@ void Cursor::HandleEvents(const SDL_Event &Event) {
button.x = Event.button.x;
button.y = Event.button.y;
}
+#endif
+
+ if (event.type == Common::EVENT_MOUSEMOVE) {
+ motion.x = event.mouse.x;
+ motion.y = event.mouse.y;
+
+ rel.x = event.relMouse.x;
+ rel.y = event.relMouse.y;
+ } else if (event.type == Common::EVENT_LBUTTONDOWN) {
+ pressed = true;
+
+ button.x = event.mouse.x;
+ button.y = event.mouse.y;
+ } else if (event.type == Common::EVENT_LBUTTONUP) {
+ pressed = false;
+
+ button.x = event.mouse.x;
+ button.y = event.mouse.y;
+ }
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
void Cursor::Draw() {
+ //warning("Drawing cursor: %d %d", motion.x, motion.y);
if (hover) {
if (pressed)
img_hover_s.Draw(motion.x + hover_offset.x, motion.y + hover_offset.y);
@@ -114,3 +137,5 @@ void Cursor::Draw() {
img.Draw(motion.x, motion.y);
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index 5ffc467b07d..648e02c27a4 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -35,11 +35,13 @@
#ifndef CRAB_CURSOR_H
#define CRAB_CURSOR_H
-#include "crab/Image.h"
+#include "crab/image/Image.h"
#include "crab/common_header.h"
#include "crab/loaders.h"
#include "crab/vectors.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace input {
class Cursor {
@@ -76,14 +78,16 @@ public:
void Reset();
void Load(rapidxml::xml_node<char> *node);
- void HandleEvents(const SDL_Event &Event);
+ void HandleEvents(const Common::Event &event);
void Draw();
- const bool Pressed() { return pressed; }
+ bool Pressed() { return pressed; }
};
extern Cursor gMouse;
} // End of namespace input
} // End of namespace pyrodactyl
+};
+
#endif // CRAB_CURSOR_H
Commit: 3205f795abb97bb31023f826a53f00458a143c94
https://github.com/scummvm/scummvm/commit/3205f795abb97bb31023f826a53f00458a143c94
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use ImageManager class in splash since its compilable
Changed paths:
engines/crab/module.mk
engines/crab/splash.cpp
engines/crab/splash.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 409aad718b3..5300b5e94e8 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -10,6 +10,8 @@ MODULE_OBJS = \
ScreenSettings.o \
GameParam.o \
image/Image.o \
+ image/ImageManager.o \
+ input/cursor.o \
timer.o \
app.o \
splash.o
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index da2fb257d16..2ce169c856a 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -62,8 +62,8 @@ Splash::~Splash() {
void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
// gLoadScreen.Load();
-#if 0
pyrodactyl::image::gImageManager.Init();
+#if 0
pyrodactyl::text::gTextManager.Init();
#endif
load_complete = true;
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 1c48792b18c..7ea13657964 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -36,10 +36,10 @@
#define CRAB_SPLASH_H
#include "crab/crab.h"
-//#include "crab/ImageManager.h"
+#include "crab/ImageManager.h"
//#include "crab/LoadingScreen.h"
//#include "crab/MusicManager.h"
-#include "crab/image/Image.h"
+//#include "crab/image/Image.h"
#include "crab/ScreenSettings.h"
//#include "crab/TextManager.h"
#include "crab/common_header.h"
Commit: 2eff515139a32ee6ddcdc85b031bdc36218fdf83
https://github.com/scummvm/scummvm/commit/2eff515139a32ee6ddcdc85b031bdc36218fdf83
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: bring remaining files under Crab namespace
Changed paths:
engines/crab/GameClock.h
engines/crab/LevelResult.h
engines/crab/Line.cpp
engines/crab/Line.h
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGraphNode.h
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/PriorityQueue.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/Shape.cpp
engines/crab/Shape.h
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/TMX/TileInfo.h
engines/crab/ai/SpriteConstant.cpp
engines/crab/ai/SpriteConstant.h
engines/crab/ai/moveeffect.cpp
engines/crab/ai/moveeffect.h
engines/crab/ai/movement.cpp
engines/crab/ai/movement.h
engines/crab/ai/spriteai.cpp
engines/crab/ai/spriteai.h
engines/crab/animation/AnimationEffect.h
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/AnimationFrame.h
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/animation.cpp
engines/crab/animation/animation.h
engines/crab/animation/animframe.cpp
engines/crab/animation/animframe.h
engines/crab/animation/animset.cpp
engines/crab/animation/animset.h
engines/crab/animation/fightanim.cpp
engines/crab/animation/fightanim.h
engines/crab/animation/fightmove.cpp
engines/crab/animation/fightmove.h
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fightmoves.h
engines/crab/animation/fm_ai_data.h
engines/crab/animation/imageeffect.cpp
engines/crab/animation/imageeffect.h
engines/crab/animation/range.h
engines/crab/animation/shadow.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/animation/walkframes.cpp
engines/crab/animation/walkframes.h
engines/crab/collision.cpp
engines/crab/collision.h
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/changeval.h
engines/crab/event/conversationdata.cpp
engines/crab/event/conversationdata.h
engines/crab/event/effect.cpp
engines/crab/event/effect.h
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/gameevent.cpp
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/event/quest.cpp
engines/crab/event/quest.h
engines/crab/event/trigger.cpp
engines/crab/event/trigger.h
engines/crab/event/triggerset.cpp
engines/crab/event/triggerset.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/input/fightinput.cpp
engines/crab/input/fightinput.h
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/input/inputval.cpp
engines/crab/input/inputval.h
engines/crab/item/Item.cpp
engines/crab/item/Item.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/item/StatPreview.cpp
engines/crab/item/StatPreview.h
engines/crab/level/LevelExit.cpp
engines/crab/level/LevelExit.h
engines/crab/level/MusicArea.cpp
engines/crab/level/MusicArea.h
engines/crab/level/Stairs.cpp
engines/crab/level/Stairs.h
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/level/level_objects.cpp
engines/crab/level/level_objects.h
engines/crab/level/talknotify.cpp
engines/crab/level/talknotify.h
engines/crab/levelpaths.h
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
engines/crab/music/musicparam.h
engines/crab/people/opinion.cpp
engines/crab/people/opinion.h
engines/crab/people/person.cpp
engines/crab/people/person.h
engines/crab/people/personbase.cpp
engines/crab/people/personbase.h
engines/crab/people/trait.cpp
engines/crab/people/trait.h
engines/crab/stat/Stat.cpp
engines/crab/stat/Stat.h
engines/crab/stat/StatDrawHelper.cpp
engines/crab/stat/StatDrawHelper.h
engines/crab/stat/StatTemplate.cpp
engines/crab/stat/StatTemplate.h
engines/crab/stat/bonus.h
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.cpp
engines/crab/text/color.h
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/AlphaImage.h
engines/crab/ui/Caption.cpp
engines/crab/ui/Caption.h
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/ClipButton.cpp
engines/crab/ui/ClipButton.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/FileData.cpp
engines/crab/ui/FileData.h
engines/crab/ui/FileMenu.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/HealthIndicator.h
engines/crab/ui/HoverInfo.cpp
engines/crab/ui/HoverInfo.h
engines/crab/ui/ImageData.cpp
engines/crab/ui/ImageData.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/ItemDesc.h
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapData.cpp
engines/crab/ui/MapData.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/ParagraphData.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButton.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SectionHeader.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/StateButton.cpp
engines/crab/ui/StateButton.h
engines/crab/ui/TextData.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitButton.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/element.cpp
engines/crab/ui/element.h
engines/crab/ui/emotion.cpp
engines/crab/ui/emotion.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/mapbutton.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
engines/crab/ui/textdata.cpp
engines/crab/url.cpp
engines/crab/url.h
engines/crab/vectors.h
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index a9e6b20ecfd..aa60dd74b9b 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/timer.h"
+namespace Crab {
+
class GameClock {
Timer timer;
Uint32 start;
@@ -83,4 +85,6 @@ public:
}
};
+} // End of namespace Crab
+
#endif // CRAB_GAMECLOCK_H
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index f10d6d05e57..345129a52d8 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -34,6 +34,8 @@
#include "crab/ImageManager.h"
+namespace Crab {
+
enum LevelResultType { LR_NONE,
LR_LEVEL,
LR_GAMEOVER };
@@ -50,4 +52,6 @@ struct LevelResult {
}
};
+} // End of namespace Crab
+
#endif // CRAB_LEVELRESULT_H
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index 47be27ea81a..3908a694dc9 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -30,6 +30,8 @@
#include "crab/Line.h"
+namespace Crab {
+
//------------------------------------------------------------------------
// Purpose: Draw a line from start to end
//------------------------------------------------------------------------
@@ -38,3 +40,5 @@ void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
SDL_SetRenderDrawColor(gRenderer, r, g, b, a);
SDL_RenderDrawLine(gRenderer, x1, y1, x2, y2);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index 35f1fc4f4e6..f20f6f2f2f8 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/vectors.h"
+namespace Crab {
+
// Find if 2 lines intersect and store the point of intersection
template<typename T>
bool CollideLine(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y,
@@ -71,4 +73,6 @@ bool CollideLine(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y,
void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a);
+} // End of namespace Crab
+
#endif // CRAB_LINE_H
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index d7d8acf0178..7d3933a5f8a 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -31,6 +31,8 @@
#include "crab/LoadingScreen.h"
#include "crab/XMLDoc.h"
+namespace Crab {
+
void LoadingScreen::Load() {
const std::string &filename = "res/layout/loading.xml";
XMLDoc doc(filename);
@@ -83,3 +85,5 @@ void LoadingScreen::Quit() {
}
LoadingScreen gLoadScreen;
+
+} // End of namespace Crab
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 52c9d01f441..3422c6a5e87 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -36,6 +36,8 @@
#include "crab/timer.h"
#include "crab/vectors.h"
+namespace Crab {
+
class LoadingScreen {
struct Screen {
// The background image
@@ -69,4 +71,6 @@ public:
extern LoadingScreen gLoadScreen;
+} // End of namespace Crab
+
#endif // CRAB_LOADINGSCREEN_H
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 0245910f17c..3b49dd6d068 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -30,6 +30,8 @@
#include "crab/PathfindingAgent.h"
+namespace Crab {
+
PathfindingAgent::PathfindingAgent(void) : nodeQueue(compareNodes) {
grid = NULL;
@@ -329,3 +331,5 @@ bool PathfindingAgent::AdjacentToGoal(PathfindingGraphNode *node) {
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 0efbfa09524..715a2b6728f 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -35,6 +35,8 @@
#include "crab/PriorityQueue.h"
#include "crab/vectors.h"
+namespace Crab {
+
// This class represents the actual pathfinding and following agent that utilizes
// the pathfinding grid
class PlannerNode {
@@ -163,4 +165,6 @@ public:
bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB);
+} // End of namespace Crab
+
#endif // CRAB_PATHFINDINGAGENT_H
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index eae9ff23ade..6571c4506ed 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -30,6 +30,8 @@
#include "crab/PathfindingGraphNode.h"
+namespace Crab {
+
PathfindingGraphNode::PathfindingGraphNode(void) {
id = -1;
movementCost = -1.0f;
@@ -94,3 +96,5 @@ bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode *otherNode) {
//{
// return neighborNodes;
//}
+
+} // End of namespace Crab
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
index 69f0dd99a61..9a92ea8da34 100644
--- a/engines/crab/PathfindingGraphNode.h
+++ b/engines/crab/PathfindingGraphNode.h
@@ -34,6 +34,8 @@
#include "crab/Rectangle.h"
#include "crab/vectors.h"
+namespace Crab {
+
// This is the basic pathfinding node that will construct the pathfinding graph. (SZ)
// Although Unrest is using a square grid based pathfinding map, this is made to be a general use pathfinding node.
class PathfindingGraphNode {
@@ -78,4 +80,6 @@ public:
bool AdjacentToNode(PathfindingGraphNode *otherNode);
};
+} // End of namespace Crab
+
#endif // CRAB_PATHFINDINGGRAPHNODE_H
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 2ea285f914b..7db706c589e 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -31,6 +31,8 @@
#include "crab/PathfindingGrid.h"
#include "crab/TMXMap.h"
+namespace Crab {
+
using namespace TMX;
PathfindingGrid::PathfindingGrid(void) {
@@ -254,3 +256,5 @@ PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vect
return NULL;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index ad014b417d3..637c32b63a4 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -33,7 +33,10 @@
#include "crab/PathfindingGraphNode.h"
#include "crab/common_header.h"
-#include <math.h>
+
+namespace Crab {
+
+include <math.h>
namespace TMX {
class TMXMap;
@@ -86,4 +89,6 @@ public:
std::vector<PathfindingGraphNode *> CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2);
};
+} // End of namespace Crab
+
#endif // CRAB_PATHFINDINGGRID_H
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 453854acd94..362c82d0ac6 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -30,6 +30,8 @@
#include "crab/Polygon.h"
+namespace Crab {
+
// Calculate the distance between [minA, maxA] and [minB, maxB]
// The distance will be negative if the intervals overlap
float IntervalDistance(float minA, float maxA, float minB, float maxB) {
@@ -267,3 +269,5 @@ void Polygon2D::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, con
DrawLine(p1.x + XOffset, p1.y + YOffset, p2.x + XOffset, p2.y + YOffset, r, g, b, a);
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index 8a32dca7432..e216ce006a5 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/vectors.h"
+namespace Crab {
+
//------------------------------------------------------------------------
// Purpose: The result of a collision
//------------------------------------------------------------------------
@@ -91,4 +93,6 @@ public:
const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0.0f, const Uint8 &a = 255);
};
+} // End of namespace Crab
+
#endif // CRAB_POLYGON_H
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index d4c7f9f0b7f..901adfaebdc 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -35,6 +35,8 @@
#include <deque>
#include <vector>
+namespace Crab {
+
//! \brief The open heap used by all cost-based search algorithms.
//!
//! This class template is basically a thin wrapper on top of both the <code>std::deque</code>
@@ -143,4 +145,6 @@ void PriorityQueue<Node>::enumerate(std::vector<Node const *> &sorted) const {
std::copy(open.begin(), open.end(), sorted.begin());
}
+} // End of namespace Crab
+
#endif // CRAB_PRIORITYQUEUE_H
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 7605daca833..d6b3de90840 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -30,6 +30,8 @@
#include "crab/Rectangle.h"
+namespace Crab {
+
bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const std::string &x_name, const std::string &y_name,
const std::string &w_name, const std::string &h_name) {
return LoadNum(x, x_name, node, echo) && LoadNum(y, y_name, node, echo) && LoadNum(w, w_name, node, echo) && LoadNum(h, h_name, node, echo);
@@ -100,3 +102,5 @@ void Rect::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
child->append_attribute(doc.allocate_attribute("h", gStrPool.Get(h)));
root->append_node(child);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index a91ad896765..0d6d1cd58c2 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/vectors.h"
+namespace Crab {
+
//------------------------------------------------------------------------
// Purpose: A simple rectangle class
//------------------------------------------------------------------------
@@ -82,4 +84,6 @@ public:
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name);
};
+} // End of namespace Crab
+
#endif // CRAB_RECTANGLE_H
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index 6b90af2ee1a..bea79818819 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -30,6 +30,8 @@
#include "crab/Shape.h"
+namespace Crab {
+
void Shape::Load(rapidxml::xml_node<char> *node, const bool &echo) {
if (NodeValid("polygon", node, echo)) {
type = SHAPE_POLYGON;
@@ -79,3 +81,5 @@ void Shape::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, const U
else
rect.Draw(XOffset, YOffset, r, g, b, a);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index 18248d793ca..815c21aacd0 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -34,6 +34,8 @@
#include "crab/Polygon.h"
#include "crab/vectors.h"
+namespace Crab {
+
// The kind of shape
enum ShapeType { SHAPE_RECT,
SHAPE_POLYGON,
@@ -79,4 +81,6 @@ public:
const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0.0f, const Uint8 &a = 255);
};
+} // End of namespace Crab
+
#endif // CRAB_SHAPE_H
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index ab651be149c..a689d676fb1 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -31,6 +31,8 @@
#include "crab/TMXLayer.h"
+namespace Crab {
+
using namespace TMX;
bool Layer::Load(rapidxml::xml_node<char> *node) {
@@ -102,3 +104,5 @@ bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index 0bcb40d272a..c2a621ac361 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -36,6 +36,8 @@
#include "crab/TileInfo.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace TMX {
enum LayerType {
// Run of the mill layer full of tiles
@@ -105,4 +107,6 @@ public:
};
} // End of namespace TMX
+} // End of namespace Crab
+
#endif // CRAB_TMXLAYER_H
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 665fc905f75..cf6498bf049 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -32,6 +32,8 @@
#include "crab/TextManager.h"
#include "crab/collision.h"
+namespace Crab {
+
using namespace TMX;
using namespace pyrodactyl::image;
@@ -403,3 +405,5 @@ bool TMXMap::CollideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &mus
//------------------------------------------------------------------------
// Purpose: Path finding functions
//------------------------------------------------------------------------
+
+} // End of namespace Crab
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 6e855490e42..0de847c2b38 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -42,6 +42,8 @@
#include "crab/common_header.h"
#include "crab/spriteai.h"
+namespace Crab {
+
namespace TMX {
// For TMX version 1.0, orthogonal maps only
class TMXMap {
@@ -129,4 +131,6 @@ public:
};
} // End of namespace TMX
+} // End of namespace Crab
+
#endif // CRAB_TMXMAP_H
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 7e8a0424466..5c01a65db5b 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -31,6 +31,8 @@
#include "crab/TMXTileSet.h"
#include "crab/TextManager.h"
+namespace Crab {
+
using namespace TMX;
void TileSet::Load(const std::string &path, rapidxml::xml_node<char> *node) {
@@ -162,3 +164,5 @@ void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &til
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 51e4d6058cb..8297ec58a24 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -35,6 +35,8 @@
#include "crab/TMXLayer.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace TMX {
struct TileSet {
// The name of the tileset
@@ -97,4 +99,6 @@ public:
};
}; // End of namespace TMX
+} // End of namespace Crab
+
#endif // CRAB_TMXTILESET_H
diff --git a/engines/crab/TMX/TileInfo.h b/engines/crab/TMX/TileInfo.h
index 63e9634ff12..92df34933ce 100644
--- a/engines/crab/TMX/TileInfo.h
+++ b/engines/crab/TMX/TileInfo.h
@@ -34,6 +34,8 @@
#include "crab/loaders.h"
+namespace Crab {
+
namespace TMX {
typedef unsigned int GidFormat;
@@ -89,4 +91,6 @@ struct TileInfo {
};
} // End of namespace TMX
+} // End of namespace Crab
+
#endif // CRAB_TILEINFO_H
diff --git a/engines/crab/ai/SpriteConstant.cpp b/engines/crab/ai/SpriteConstant.cpp
index 928fdd3743a..2174692d490 100644
--- a/engines/crab/ai/SpriteConstant.cpp
+++ b/engines/crab/ai/SpriteConstant.cpp
@@ -30,6 +30,8 @@
#include "crab/SpriteConstant.h"
+namespace Crab {
+
using namespace pyrodactyl::ai;
FlyerConstant::FlyerConstant() : start(10, 40), vel(8.0f, 0.0f) {
@@ -66,3 +68,5 @@ void SpriteConstant::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("fly", node))
fly.Load(node->first_node("fly"));
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ai/SpriteConstant.h b/engines/crab/ai/SpriteConstant.h
index ff29ab8f161..7cbae61efa2 100644
--- a/engines/crab/ai/SpriteConstant.h
+++ b/engines/crab/ai/SpriteConstant.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/vectors.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ai {
// These parameters control aspects of sprites flying across the screen
@@ -73,4 +75,6 @@ struct SpriteConstant {
} // End of namespace ai
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_SPRITECONSTANT_H
diff --git a/engines/crab/ai/moveeffect.cpp b/engines/crab/ai/moveeffect.cpp
index 41c52d75bfc..e4dc67f397d 100644
--- a/engines/crab/ai/moveeffect.cpp
+++ b/engines/crab/ai/moveeffect.cpp
@@ -30,6 +30,8 @@
#include "crab/moveeffect.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
FightMoveEffect::FightMoveEffect() {
@@ -60,3 +62,5 @@ void FightMoveEffect::Load(rapidxml::xml_node<char> *node) {
activate = -1;
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ai/moveeffect.h b/engines/crab/ai/moveeffect.h
index 0f882c2b61f..b4de8894c07 100644
--- a/engines/crab/ai/moveeffect.h
+++ b/engines/crab/ai/moveeffect.h
@@ -35,6 +35,8 @@
#include "crab/imageeffect.h"
#include "crab/musicparam.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
struct FightMoveEffect {
@@ -66,4 +68,6 @@ struct FightMoveEffect {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MOVEEFFECT_H
diff --git a/engines/crab/ai/movement.cpp b/engines/crab/ai/movement.cpp
index faa9caabc93..04699b7601f 100644
--- a/engines/crab/ai/movement.cpp
+++ b/engines/crab/ai/movement.cpp
@@ -30,6 +30,8 @@
#include "crab/movement.h"
+namespace Crab {
+
using namespace pyrodactyl::ai;
//------------------------------------------------------------------------
@@ -60,3 +62,5 @@ bool MovementSet::InternalEvents(const Rect rect) {
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index 483ecf0183b..c179c469e7f 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -36,6 +36,8 @@
#include "crab/timer.h"
#include "crab/vectors.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ai {
struct MovementSet {
@@ -85,4 +87,6 @@ struct MovementSet {
} // End of namespace ai
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MOVEMENT_H
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index d13d2e74762..9c6ef9904f1 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -30,6 +30,8 @@
#include "crab/sprite.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
using namespace pyrodactyl::ai;
@@ -307,3 +309,5 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ai/spriteai.h b/engines/crab/ai/spriteai.h
index d958ee40f39..4ee18193705 100644
--- a/engines/crab/ai/spriteai.h
+++ b/engines/crab/ai/spriteai.h
@@ -35,6 +35,8 @@
#include "crab/movement.h"
#include "crab/PathfindingAgent.h"
+namespace Crab {
+
// class PathfindingAgent;
namespace pyrodactyl {
namespace ai {
@@ -98,4 +100,6 @@ struct SpriteAIData {
} // End of namespace ai
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_SPRITEAI_H
diff --git a/engines/crab/animation/AnimationEffect.h b/engines/crab/animation/AnimationEffect.h
index c294463032f..850c091276d 100644
--- a/engines/crab/animation/AnimationEffect.h
+++ b/engines/crab/animation/AnimationEffect.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/loaders.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
// Types of fade effects
@@ -92,4 +94,6 @@ struct AnimationEffect {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ANIMATIONEFFECT_H
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index b09ddc172ec..71920e58a5d 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -30,6 +30,8 @@
#include "crab/AnimationFrame.h"
+namespace Crab {
+
using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
@@ -93,3 +95,5 @@ DrawType AnimationFrame::InternalEvents(const Uint32 ×tamp) {
return DRAW_SAME;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/AnimationFrame.h b/engines/crab/animation/AnimationFrame.h
index a8ee74bc469..40a18c8c6b4 100644
--- a/engines/crab/animation/AnimationFrame.h
+++ b/engines/crab/animation/AnimationFrame.h
@@ -37,6 +37,8 @@
#include "crab/TextManager.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
struct AnimationFrame : public Vector2i {
@@ -73,4 +75,6 @@ struct AnimationFrame : public Vector2i {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ANIMATIONFRAME_H
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index e5f0702acee..4f96b63eee5 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -30,6 +30,8 @@
#include "crab/PopUp.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
using namespace pyrodactyl::event;
@@ -126,3 +128,5 @@ void PopUpCollection::Draw(const int &x, const int &y, pyrodactyl::ui::Paragraph
if (cur >= 0 && cur < element.size())
element.at(cur).Draw(x, y, pop, camera);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index efc95003269..c6fd1da50e6 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -38,6 +38,8 @@
#include "crab/effect.h"
#include "crab/triggerset.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
struct PopUp {
@@ -120,4 +122,6 @@ struct PopUpCollection {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_POPUP_H
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index abb28514f6d..1fdec47460b 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -30,6 +30,8 @@
#include "crab/animation.h"
+namespace Crab {
+
using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
@@ -60,3 +62,5 @@ void Animation::Reset() {
for (auto i = frame.begin(); i != frame.end(); ++i)
i->Reset();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/animation.h b/engines/crab/animation/animation.h
index c86195e21d5..e357a9cebe1 100644
--- a/engines/crab/animation/animation.h
+++ b/engines/crab/animation/animation.h
@@ -36,6 +36,8 @@
#include "common_header.h"
#include "timer.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
class Animation {
@@ -64,4 +66,6 @@ public:
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB__ANIMATION_H
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index 38db4a3ce79..dbe466fed3f 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -30,6 +30,8 @@
#include "crab/animframe.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
void AnimFrame::Load(rapidxml::xml_node<char> *node, const Rect &VBOX, const Uint32 &rep, const int &AX, const int &AY) {
@@ -103,3 +105,5 @@ bool AnimationFrames::UpdateClip() {
const AnimFrame &AnimationFrames::CurrentFrame() {
return frame.at(current_clip);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/animframe.h b/engines/crab/animation/animframe.h
index 108f8d10969..81234209c97 100644
--- a/engines/crab/animation/animframe.h
+++ b/engines/crab/animation/animframe.h
@@ -36,6 +36,8 @@
#include "crab/shadow.h"
#include "crab/vectors.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
struct AnimFrame {
@@ -103,4 +105,6 @@ public:
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ANIMFRAME_H
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 8240dea6502..6d1c5200950 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -30,6 +30,8 @@
#include "crab/animset.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
void AnimSet::Load(const std::string &filename) {
@@ -82,3 +84,5 @@ const int AnimSet::AnchorY(const Direction &dir) {
return walk.AnchorY(dir);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/animset.h b/engines/crab/animation/animset.h
index 42bab18bad8..7db59fda539 100644
--- a/engines/crab/animation/animset.h
+++ b/engines/crab/animation/animset.h
@@ -36,6 +36,8 @@
#include "crab/shadow.h"
#include "crab/walkframes.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
// Container for all the possible animations an object can have
@@ -68,4 +70,6 @@ struct AnimSet {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ANIMSET_H
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index cec387acf01..c5b495e2026 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -30,6 +30,8 @@
#include "crab/fightanim.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
//------------------------------------------------------------------------
@@ -80,3 +82,5 @@ void FightAnimFrames::Load(rapidxml::xml_node<char> *node) {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/fightanim.h b/engines/crab/animation/fightanim.h
index 1a6cd80807b..c1e17125027 100644
--- a/engines/crab/animation/fightanim.h
+++ b/engines/crab/animation/fightanim.h
@@ -39,6 +39,8 @@
#include "crab/shadow.h"
#include "crab/triggerset.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
// A single frame of a fighting move
@@ -104,4 +106,6 @@ public:
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_FIGHTANIM_H
diff --git a/engines/crab/animation/fightmove.cpp b/engines/crab/animation/fightmove.cpp
index da54b2f1334..6605d55da36 100644
--- a/engines/crab/animation/fightmove.cpp
+++ b/engines/crab/animation/fightmove.cpp
@@ -30,6 +30,8 @@
#include "crab/fightmove.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
void FightMove::Load(rapidxml::xml_node<char> *node) {
@@ -50,3 +52,5 @@ void FightMove::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("ai", node, false))
ai.Load(node->first_node("ai"));
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/fightmove.h b/engines/crab/animation/fightmove.h
index 7a517936f0b..372fa5e3003 100644
--- a/engines/crab/animation/fightmove.h
+++ b/engines/crab/animation/fightmove.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/fightanim.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
// All info for a single fighting move in all four directions
@@ -61,4 +63,6 @@ struct FightMove {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_FIGHTMOVE_H
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 7ca0afc6262..3622a4b2023 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -30,6 +30,8 @@
#include "crab/fightmoves.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
//------------------------------------------------------------------------
@@ -195,3 +197,5 @@ bool FightMoves::Flip(TextureFlipType &flip, Direction d) {
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index 9faa4cb675b..b1a29ca2536 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/fightmove.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
enum FrameUpdateResult { FUR_FAIL,
@@ -101,4 +103,6 @@ public:
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_FIGHTMOVES_H
diff --git a/engines/crab/animation/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
index 6728e48ac1d..60e35193a6f 100644
--- a/engines/crab/animation/fm_ai_data.h
+++ b/engines/crab/animation/fm_ai_data.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/range.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
enum AIMoveType {
@@ -76,4 +78,6 @@ struct FightMoveAIData {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_FM_AI_DATA_H
diff --git a/engines/crab/animation/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
index 6da576bc9aa..23ea1d507c6 100644
--- a/engines/crab/animation/imageeffect.cpp
+++ b/engines/crab/animation/imageeffect.cpp
@@ -31,6 +31,8 @@
#include "crab/imageeffect.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
void ImageEffect::Load(rapidxml::xml_node<char> *node) {
@@ -44,3 +46,5 @@ void ImageEffect::Draw(const int &XOffset, const int &YOffset) {
if (visible)
pyrodactyl::image::gImageManager.Draw(x + XOffset, y + YOffset, img);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/imageeffect.h b/engines/crab/animation/imageeffect.h
index 4af00b2bb08..ef4cc6d407a 100644
--- a/engines/crab/animation/imageeffect.h
+++ b/engines/crab/animation/imageeffect.h
@@ -34,6 +34,8 @@
#include "crab/ImageManager.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
struct ImageEffect : public Vector2i {
@@ -51,4 +53,6 @@ struct ImageEffect : public Vector2i {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_IMAGEEFFECT_H
diff --git a/engines/crab/animation/range.h b/engines/crab/animation/range.h
index f515ae98413..71e106acb9a 100644
--- a/engines/crab/animation/range.h
+++ b/engines/crab/animation/range.h
@@ -34,6 +34,8 @@
#include "crab/animframe.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
struct Range {
@@ -57,4 +59,6 @@ struct Range {
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_RANGE_H
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index 6fbb35bd447..dc318f7b6e9 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/vectors.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
struct ShadowData {
@@ -72,4 +74,6 @@ public:
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_SHADOW_H
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 9ece605f0e5..b635a2c431b 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -30,6 +30,8 @@
#include "crab/sprite.h"
+namespace Crab {
+
using namespace pyrodactyl::ai;
using namespace pyrodactyl::anim;
using namespace pyrodactyl::input;
@@ -671,3 +673,5 @@ void Sprite::LoadState(rapidxml::xml_node<char> *node) {
LoadNum(pos.x, "x", node);
LoadNum(pos.y, "y", node);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index d3092255d58..cb71ce73699 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -45,6 +45,8 @@
#include "crab/spriteai.h"
#include "crab/timer.h"
+namespace Crab {
+
class PathfindingAgent;
namespace pyrodactyl {
@@ -238,4 +240,6 @@ public:
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_SPRITE_H
diff --git a/engines/crab/animation/walkframes.cpp b/engines/crab/animation/walkframes.cpp
index dc47e9cbf33..c6c08071a1c 100644
--- a/engines/crab/animation/walkframes.cpp
+++ b/engines/crab/animation/walkframes.cpp
@@ -31,6 +31,8 @@
#include "crab/walkframes.h"
+namespace Crab {
+
using namespace pyrodactyl::anim;
using namespace pyrodactyl::people;
@@ -149,3 +151,5 @@ bool WalkFrames::Type(const Vector2f &vel, Direction &dir, const pyrodactyl::peo
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index ac0728bad03..ef323fd9219 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -37,6 +37,8 @@
#include "personbase.h"
#include "crab/timer.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace anim {
enum WalkAnimType { WT_STAND,
@@ -101,4 +103,6 @@ public:
} // End of namespace anim
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_WALKFRAMES_H
diff --git a/engines/crab/collision.cpp b/engines/crab/collision.cpp
index bdadad73eed..84a76e8886b 100644
--- a/engines/crab/collision.cpp
+++ b/engines/crab/collision.cpp
@@ -30,6 +30,8 @@
#include "crab/collision.h"
+namespace Crab {
+
// Find if a line and a rectangle intersect
bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect) {
int q0_x = rect.x;
@@ -217,3 +219,5 @@ bool LineOfSight(const Rect &a, const Rect &b, const Rect &obstacle) {
//
// return result;
// }
+
+} // End of namespace Crab
diff --git a/engines/crab/collision.h b/engines/crab/collision.h
index 9f4de4fdcfb..5579ca7ecb9 100644
--- a/engines/crab/collision.h
+++ b/engines/crab/collision.h
@@ -35,6 +35,8 @@
#include "crab/Rectangle.h"
#include "crab/common_header.h"
+namespace Crab {
+
// Find if a line and a rectangle intersect
bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect);
@@ -47,4 +49,6 @@ double Distance2D(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y) {
return sqrt((p0_x - p1_x) * (p0_x - p1_x) + (p0_y - p1_y) * (p0_y - p1_y));
}
+} // End of namespace Crab
+
#endif // CRAB_COLLISION_H
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 43e6b5d6820..33da8899b01 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -31,6 +31,8 @@
#include "crab/EventSeqGroup.h"
+namespace Crab {
+
using namespace pyrodactyl::event;
void EventSeqGroup::EndSeq(const unsigned int &id) {
@@ -93,3 +95,5 @@ void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node) {
seq[id].LoadState(n);
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index 06d15971e09..ec55c0ad9bb 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -34,6 +34,8 @@
#include "crab/EventSequence.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
class EventSeqGroup {
@@ -66,4 +68,6 @@ public:
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_EVENTSEQGROUP_H
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 37ae336b15e..39746f91171 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -31,6 +31,8 @@
#include "crab/EventSequence.h"
+namespace Crab {
+
using namespace pyrodactyl::event;
//------------------------------------------------------------------------
@@ -141,3 +143,5 @@ void EventSequence::LoadState(rapidxml::xml_node<char> *node) {
if (next.empty())
next.push_back(0);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index 8db93e24943..5c43785ae9b 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -38,6 +38,8 @@
#include "crab/gameevent.h"
#include "crab/journal.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
class EventSequence {
@@ -79,4 +81,6 @@ public:
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_EVENTSEQUENCE_H
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 60422a3f7a2..92ca1089463 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -31,6 +31,8 @@
#include "crab/GameEventInfo.h"
#include "crab/eventstore.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
bool IsChar(char c) {
@@ -393,3 +395,5 @@ void Info::SetUI() {
journal.SetUI();
inv.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index d747f82d839..b09ea7b5ba1 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -37,6 +37,8 @@
#include "crab/journal.h"
#include "crab/person.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
bool IsChar(char c);
@@ -205,4 +207,6 @@ public:
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_GAMEEVENTINFO_H
diff --git a/engines/crab/event/changeval.h b/engines/crab/event/changeval.h
index 61714626208..c7410c24c06 100644
--- a/engines/crab/event/changeval.h
+++ b/engines/crab/event/changeval.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/opinion.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
struct ChangeVal {
@@ -63,4 +65,6 @@ struct ChangeVal {
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_CHANGEVAL_H
diff --git a/engines/crab/event/conversationdata.cpp b/engines/crab/event/conversationdata.cpp
index f1e1d52e00c..893e84d723b 100644
--- a/engines/crab/event/conversationdata.cpp
+++ b/engines/crab/event/conversationdata.cpp
@@ -30,6 +30,8 @@
#include "crab/conversationdata.h"
+namespace Crab {
+
using namespace pyrodactyl::event;
void ReplyChoice::Load(rapidxml::xml_node<char> *node) {
@@ -49,3 +51,5 @@ void ConversationData::Load(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("reply"); n != NULL; n = n->next_sibling("reply"))
reply.push_back(n);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/conversationdata.h b/engines/crab/event/conversationdata.h
index 1017281ff8c..50a0e493957 100644
--- a/engines/crab/event/conversationdata.h
+++ b/engines/crab/event/conversationdata.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/triggerset.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
struct ReplyChoice {
@@ -74,4 +76,6 @@ struct ConversationData {
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_CONVERSATIONDATA_H
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index a67f8a96f5d..27ed85c890c 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -31,6 +31,8 @@
#include "crab/effect.h"
#include "crab/MusicManager.h"
+namespace Crab {
+
using namespace pyrodactyl::event;
using namespace pyrodactyl::music;
@@ -284,3 +286,5 @@ bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index ce854f7fed7..58c69046c2a 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -37,6 +37,8 @@
#include "crab/loaders.h"
#include "crab/person.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
enum EventResultType {
@@ -113,4 +115,6 @@ struct Effect {
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_EFFECT_H
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 83169655fb5..68973a35683 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -30,6 +30,8 @@
#include "crab/eventstore.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
GameEventStore gEventStore;
@@ -100,3 +102,5 @@ void GameEventStore::SetAchievement(const int &id) {
}
*/
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index ce181369f1b..6c6513528e4 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -36,6 +36,8 @@
#include "crab/common_header.h"
#include "crab/conversationdata.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
// This structure is responsible for storing the special data structures for events like replies, conversations
@@ -85,4 +87,6 @@ extern GameEventStore gEventStore;
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_EVENTSTORE_H
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index 1fe0d9241f0..4d2d2937d0f 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -30,6 +30,8 @@
#include "crab/gameevent.h"
+namespace Crab {
+
using namespace pyrodactyl::event;
using namespace pyrodactyl::people;
@@ -85,3 +87,5 @@ void GameEvent::Load(rapidxml::xml_node<char> *node) {
effect.push_back(e);
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index b6515e1a0d9..1193e7a8649 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -39,6 +39,8 @@
#include "personbase.h"
#include "crab/triggerset.h"
+namespace Crab {
+
// An unsigned integer is our event id format
typedef unsigned int EventID;
@@ -91,4 +93,6 @@ struct GameEvent {
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_GAMEEVENT_H
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 39bc5cf01aa..148898550da 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -30,6 +30,8 @@
#include "crab/gameeventmanager.h"
+namespace Crab {
+
using namespace pyrodactyl::people;
using namespace pyrodactyl::event;
using namespace pyrodactyl::level;
@@ -349,3 +351,5 @@ void Manager::SetUI() {
textin.SetUI();
per.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index be0a1dae3bb..899c3a9eea0 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -42,6 +42,8 @@
#include "crab/level.h"
#include "crab/textarea.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
class Manager {
@@ -109,4 +111,6 @@ public:
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_GAMEEVENTMANAGER_H
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index 6dbc6f4da45..38794e9a6a7 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -30,6 +30,8 @@
#include "crab/quest.h"
+namespace Crab {
+
using namespace pyrodactyl::event;
Quest::Quest(const std::string &Title, const std::string &Text, const bool &Unread, const bool &Marker) : title(Title) {
@@ -62,3 +64,5 @@ void Quest::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *r
root->append_node(child);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/quest.h b/engines/crab/event/quest.h
index dffc5c19f59..60eb332d98e 100644
--- a/engines/crab/event/quest.h
+++ b/engines/crab/event/quest.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/loaders.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
struct Quest {
@@ -61,4 +63,6 @@ struct Quest {
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_QUEST_H
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index c423a0ffa7c..98baa1879a2 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -30,6 +30,8 @@
#include "crab/trigger.h"
+namespace Crab {
+
using namespace pyrodactyl::event;
void Trigger::Load(rapidxml::xml_node<char> *node) {
@@ -195,3 +197,5 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/trigger.h b/engines/crab/event/trigger.h
index 092deb39e59..b4f180ffbf1 100644
--- a/engines/crab/event/trigger.h
+++ b/engines/crab/event/trigger.h
@@ -33,6 +33,8 @@
#include "crab/GameEventInfo.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
enum RelOp { OP_AND,
@@ -75,4 +77,6 @@ struct Trigger {
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TRIGGER_H
diff --git a/engines/crab/event/triggerset.cpp b/engines/crab/event/triggerset.cpp
index 6b03a558be2..5043017cf34 100644
--- a/engines/crab/event/triggerset.cpp
+++ b/engines/crab/event/triggerset.cpp
@@ -31,6 +31,8 @@
#include "crab/triggerset.h"
+namespace Crab {
+
using namespace pyrodactyl::event;
void TriggerSet::Load(rapidxml::xml_node<char> *node) {
@@ -70,3 +72,5 @@ bool TriggerSet::Evaluate(pyrodactyl::event::Info &info) {
return result;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/event/triggerset.h b/engines/crab/event/triggerset.h
index dab880970d1..e6412a7717f 100644
--- a/engines/crab/event/triggerset.h
+++ b/engines/crab/event/triggerset.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/trigger.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace event {
class TriggerSet {
@@ -63,4 +65,6 @@ public:
} // End of namespace event
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TRIGGERSET_H
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 9ef863c6463..2e968dc7094 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -30,6 +30,8 @@
#include "crab/game.h"
+namespace Crab {
+
using namespace pyrodactyl::image;
using namespace pyrodactyl::ui;
using namespace pyrodactyl::input;
@@ -705,3 +707,5 @@ void Game::SetUI() {
info.SetUI();
level.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 5bfe5df7b04..dce641aea5a 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -45,6 +45,8 @@
#include "crab/map.h"
#include "crab/menu.h"
+namespace Crab {
+
class Game : public GameState {
private:
enum State {
@@ -138,4 +140,6 @@ public:
void SetUI();
};
+} // End of namespace Crab
+
#endif // CRAB_GAME_H
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index 1efb7107616..e81e9aef97d 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -30,6 +30,8 @@
#include "crab/fightinput.h"
+namespace Crab {
+
using namespace pyrodactyl::input;
void FightInput::Load(rapidxml::xml_node<char> *node) {
@@ -45,3 +47,5 @@ FightAnimationType FightInput::HandleEvents(const SDL_Event &Event) {
return FA_IDLE;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 504445ca6c9..14123cf7c7b 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -35,6 +35,8 @@
#include "crab/input.h"
#include "crab/loaders.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace input {
// The animations a sprite can play
@@ -77,4 +79,6 @@ struct FightInput {
} // End of namespace input
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_FIGHTINPUT_H
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index c15a0c6a6f7..79e8e278550 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -30,6 +30,8 @@
#include "crab/hotkey.h"
+namespace Crab {
+
using namespace pyrodactyl::input;
void HotKey::Load(rapidxml::xml_node<char> *node) {
@@ -57,3 +59,5 @@ const char *HotKey::Name() {
return "";
}
+
+} // End of namespace Crab
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 965f1d9c6c7..83a8fa43c68 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/input.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace input {
// This class is built to integrate the input check for hotkeys bound to buttons
@@ -59,4 +61,6 @@ public:
} // End of namespace input
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_HOTKEY_H
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 14323c83d35..e5be1d87e0b 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -30,6 +30,8 @@
#include "crab/input.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace input {
InputManager gInput;
@@ -209,3 +211,5 @@ void InputManager::Save() {
doc.clear();
CreateBackup();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 960d11fda92..e4334187209 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/inputval.h"
+namespace Crab {
+
#define ANALOG_PRESSED 2
namespace pyrodactyl {
@@ -139,4 +141,6 @@ extern InputManager gInput;
} // End of namespace input
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_INPUT_H
diff --git a/engines/crab/input/inputval.cpp b/engines/crab/input/inputval.cpp
index 65679f0e69c..d61cd53810f 100644
--- a/engines/crab/input/inputval.cpp
+++ b/engines/crab/input/inputval.cpp
@@ -30,6 +30,8 @@
#include "crab/inputval.h"
+namespace Crab {
+
using namespace pyrodactyl::input;
InputVal::InputVal() {
@@ -100,3 +102,5 @@ const bool InputVal::Equals(const SDL_ControllerButtonEvent &Event) {
const bool InputVal::Equals(const SDL_KeyboardEvent &Event) {
return (key == Event.keysym.scancode || alt == Event.keysym.scancode);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/input/inputval.h b/engines/crab/input/inputval.h
index e3b7e22aa86..135178255e6 100644
--- a/engines/crab/input/inputval.h
+++ b/engines/crab/input/inputval.h
@@ -36,6 +36,8 @@
#include "crab/common_header.h"
#include "crab/loaders.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace input {
class InputVal {
@@ -103,4 +105,6 @@ public:
} // End of namespace input
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_INPUTVAL_H
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 1d8a24c48d7..05aa199145c 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -30,6 +30,8 @@
#include "crab/Item.h"
+namespace Crab {
+
using namespace pyrodactyl::image;
using namespace pyrodactyl::item;
using namespace pyrodactyl::stat;
@@ -115,3 +117,5 @@ void Item::StatChange(Person &obj, bool increase) {
void Item::Draw(const int &x, const int &y) {
gImageManager.Draw(x, y, img);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index 0d61c3b2d93..b62cad65342 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -36,6 +36,8 @@
#include "crab/common_header.h"
#include "crab/person.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace item {
struct Item {
@@ -68,4 +70,6 @@ struct Item {
} // End of namespace item
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ITEM_H
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 3e496bb4c18..ff5afa1996e 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -30,6 +30,8 @@
#include "crab/ItemCollection.h"
+namespace Crab {
+
using namespace pyrodactyl::people;
using namespace pyrodactyl::item;
using namespace pyrodactyl::ui;
@@ -140,3 +142,5 @@ void ItemCollection::SetUI() {
for (auto i = item.begin(); i != item.end(); ++i)
i->second.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index a7236865f38..dd78494ec39 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -35,6 +35,8 @@
#include "crab/StatDrawHelper.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace item {
// All the items owned by characters controlled by the player
@@ -90,4 +92,6 @@ public:
} // End of namespace item
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ITEMCOLLECTION_H
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index b67c76e06bd..49a891ae492 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/ItemMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::item;
using namespace pyrodactyl::people;
@@ -163,3 +165,5 @@ bool ItemMenu::Swap(ItemMenu &target, int index) {
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index b5fcf65939f..2cd0daa3329 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -39,6 +39,8 @@
#include "crab/menu.h"
#include "crab/person.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace item {
// The menu is used to handle interactions like the player clicking on an item to equip it
@@ -85,4 +87,6 @@ public:
} // End of namespace item
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ITEMMENU_H
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index ab5a4e0881e..578b111a477 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -30,6 +30,8 @@
#include "crab/ItemSlot.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::item;
using namespace pyrodactyl::input;
@@ -162,3 +164,5 @@ void ItemSlot::StatChange(Person &obj, bool increase) {
if (enabled)
item.StatChange(obj, increase);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index e11bce1c0dd..1bfc9b3d9a6 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -36,6 +36,8 @@
#include "crab/StateButton.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace item {
enum SlotType { SLOT_EQUIP,
@@ -91,4 +93,6 @@ public:
} // End of namespace item
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ITEMSLOT_H
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index 1564ae9e420..b20885287fc 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -31,6 +31,8 @@
#include "crab/StatPreview.h"
+namespace Crab {
+
using namespace pyrodactyl::item;
void StatPreview::Load(rapidxml::xml_node<char> *node) {
@@ -60,3 +62,5 @@ void StatPreview::Draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/item/StatPreview.h b/engines/crab/item/StatPreview.h
index 327d02ffcd2..6a3935c9840 100644
--- a/engines/crab/item/StatPreview.h
+++ b/engines/crab/item/StatPreview.h
@@ -36,6 +36,8 @@
#include "crab/SectionHeader.h"
#include "crab/StatDrawHelper.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace item {
struct StatPreview {
@@ -54,4 +56,6 @@ struct StatPreview {
} // End of namespace item
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_STATPREVIEW_H
diff --git a/engines/crab/level/LevelExit.cpp b/engines/crab/level/LevelExit.cpp
index 58814c03262..d31b4525041 100644
--- a/engines/crab/level/LevelExit.cpp
+++ b/engines/crab/level/LevelExit.cpp
@@ -30,6 +30,8 @@
#include "crab/LevelExit.h"
+namespace Crab {
+
using namespace pyrodactyl::level;
void Exit::Load(rapidxml::xml_node<char> *node) {
@@ -51,3 +53,5 @@ void Exit::Load(rapidxml::xml_node<char> *node) {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/LevelExit.h b/engines/crab/level/LevelExit.h
index 1a66231f3f5..87618594586 100644
--- a/engines/crab/level/LevelExit.h
+++ b/engines/crab/level/LevelExit.h
@@ -36,6 +36,8 @@
#include "crab/Shape.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace level {
struct Exit {
@@ -51,4 +53,6 @@ struct Exit {
} // End of namespace level
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_LEVELEXIT_H
diff --git a/engines/crab/level/MusicArea.cpp b/engines/crab/level/MusicArea.cpp
index f8145ab0d2f..5f4badd522e 100644
--- a/engines/crab/level/MusicArea.cpp
+++ b/engines/crab/level/MusicArea.cpp
@@ -30,6 +30,8 @@
#include "crab/MusicArea.h"
+namespace Crab {
+
using namespace pyrodactyl::level;
void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo) {
@@ -50,3 +52,5 @@ void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo) {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/MusicArea.h b/engines/crab/level/MusicArea.h
index 7ba0652a5c2..daf8ddb8d02 100644
--- a/engines/crab/level/MusicArea.h
+++ b/engines/crab/level/MusicArea.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/musicparam.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace level {
struct MusicInfo {
@@ -65,4 +67,6 @@ public:
} // End of namespace level
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MUSICAREA_H
diff --git a/engines/crab/level/Stairs.cpp b/engines/crab/level/Stairs.cpp
index 0ed3d836130..1ee2052a8fc 100644
--- a/engines/crab/level/Stairs.cpp
+++ b/engines/crab/level/Stairs.cpp
@@ -30,6 +30,8 @@
#include "crab/Stairs.h"
+namespace Crab {
+
using namespace pyrodactyl::level;
void Stairs::Load(rapidxml::xml_node<char> *node, const bool &echo) {
@@ -48,3 +50,5 @@ void Stairs::Load(rapidxml::xml_node<char> *node, const bool &echo) {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/Stairs.h b/engines/crab/level/Stairs.h
index 9c202a2cf11..3224d9a00e4 100644
--- a/engines/crab/level/Stairs.h
+++ b/engines/crab/level/Stairs.h
@@ -34,6 +34,8 @@
#include "crab/Shape.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace level {
class Stairs : public Shape {
@@ -49,4 +51,6 @@ public:
} // End of namespace level
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_STAIRS_H
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 0471d572184..f11f0d287dc 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -30,6 +30,8 @@
#include "crab/level.h"
+namespace Crab {
+
using namespace TMX;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::anim;
@@ -138,3 +140,5 @@ void Level::SetUI() {
camera.h = gScreenSettings.cur.h;
SetCamera();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 75d375c1188..7641113621c 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -45,6 +45,8 @@
#include "crab/sprite.h"
#include "crab/talknotify.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace level {
class Level {
@@ -195,4 +197,6 @@ public:
} // End of namespace level
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_LEVEL_H
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 86f0ddd7ea0..a2c6d6eeb08 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -30,6 +30,8 @@
#include "crab/level.h"
+namespace Crab {
+
using namespace TMX;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::anim;
@@ -213,3 +215,5 @@ bool Level::PlayerInCombat(Info &info) {
return false;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index c20182b4410..373536626bf 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -30,6 +30,8 @@
#include "crab/level.h"
+namespace Crab {
+
using namespace TMX;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::anim;
@@ -142,3 +144,5 @@ bool Level::CollidingWithLevel(Info &info, Sprite &s) {
// If we are colliding with something, return true
return !s.collide_data.empty();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 4c6fa589df6..63d3e488547 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -30,6 +30,8 @@
#include "crab/level.h"
+namespace Crab {
+
using namespace TMX;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::anim;
@@ -182,3 +184,5 @@ void Level::SetCamera() {
if (camera.y < 0)
camera.y = 0;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index c633347e92e..a39b9bdf269 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -30,6 +30,8 @@
#include "crab/level.h"
+namespace Crab {
+
using namespace TMX;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::anim;
@@ -228,3 +230,5 @@ void Level::LoadState(rapidxml::xml_node<char> *node) {
for (auto *n = node->first_node("sprite"); n != NULL && i != objects.end(); n = n->next_sibling("sprite"), ++i)
i->LoadState(n);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index 83e1e3decde..aeb955f52f1 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -30,6 +30,8 @@
#include "crab/level_objects.h"
+namespace Crab {
+
using namespace pyrodactyl::image;
using namespace pyrodactyl::level;
@@ -42,3 +44,5 @@ void PlayerDestMarker::Load(rapidxml::xml_node<char> *node) {
void PlayerDestMarker::Draw(const Vector2i &pos, const Rect &camera) {
gImageManager.Draw(pos.x - (size.x / 2) - camera.x, pos.y - (size.y / 2) - camera.y, img);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/level_objects.h b/engines/crab/level/level_objects.h
index 54c2c478670..ff91ce6c8d0 100644
--- a/engines/crab/level/level_objects.h
+++ b/engines/crab/level/level_objects.h
@@ -34,6 +34,8 @@
#include "crab/ImageManager.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace level {
// Is the world map accessible from this level?
@@ -60,4 +62,6 @@ struct PlayerDestMarker {
} // End of namespace level
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_LEVEL_OBJECTS_H
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index f8496718fdf..b2afbc152a0 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -30,6 +30,8 @@
#include "crab/talknotify.h"
+namespace Crab {
+
using namespace pyrodactyl::text;
using namespace pyrodactyl::level;
using namespace pyrodactyl::image;
@@ -54,3 +56,5 @@ void TalkNotify::Draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s
gTextManager.Draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/level/talknotify.h b/engines/crab/level/talknotify.h
index 9c7ed90be81..62c51be90b2 100644
--- a/engines/crab/level/talknotify.h
+++ b/engines/crab/level/talknotify.h
@@ -36,6 +36,8 @@
#include "crab/common_header.h"
#include "crab/sprite.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace level {
class TalkNotify {
@@ -58,4 +60,6 @@ public:
} // End of namespace level
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TALKNOTIFY_H
diff --git a/engines/crab/levelpaths.h b/engines/crab/levelpaths.h
index 83c253d48e1..eae5cb56110 100644
--- a/engines/crab/levelpaths.h
+++ b/engines/crab/levelpaths.h
@@ -33,6 +33,8 @@
#include <string>
+namespace Crab {
+
class LevelPaths {
std::string layout, asset;
@@ -54,4 +56,6 @@ public:
void AssetPath(const char *str) { asset = str; }
};
+} // End of namespace Crab
+
#endif // LEVELPATHS_H
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 9c60b284a9b..621ae1e3d63 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -31,6 +31,8 @@
#include "crab/mainmenu.h"
#include "crab/url.h"
+namespace Crab {
+
using namespace pyrodactyl::music;
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
@@ -448,3 +450,5 @@ void MainMenu::SetUI() {
direct.SetUI();
#endif
}
+
+} // End of namespace Crab
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 208bcedc7f6..a1818874a71 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -48,6 +48,8 @@
#include "crab/slider.h"
#include "crab/textarea.h"
+namespace Crab {
+
// #define UNREST_DEMO
//------------------------------------------------------------------------
@@ -133,4 +135,6 @@ public:
void AutoSave() {}
};
+} // End of namespace Crab
+
#endif // CRAB_MAINMENU_H
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 53544f49ac4..16c0e4c6ca4 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -33,6 +33,8 @@
#include "crab/ScreenSettings.h"
#include "crab/XMLDoc.h"
+namespace Crab {
+
using namespace pyrodactyl::music;
namespace pyrodactyl {
@@ -144,3 +146,5 @@ void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<c
child->append_attribute(doc.allocate_attribute("chunk_size", gStrPool.Get(chunksize)));
root->append_node(child);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index 4fed66dd274..30d7586b154 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/musicparam.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace music {
class MusicManager {
@@ -91,4 +93,6 @@ extern MusicManager gMusicManager;
} // End of namespace music
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MUSICMANAGER_H
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index 56ba0d71cf5..1cbc7352ad0 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -34,6 +34,8 @@
#include "crab/loaders.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace music {
// We use this object as key for music tracks
@@ -73,4 +75,6 @@ struct MusicData {
} // End of namespace music
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MUSICPARAM_H
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index c857875f527..4ed20fe4644 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -31,6 +31,8 @@
#include "crab/opinion.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace people {
int OPINION_MIN = 0, OPINION_MAX = 100;
@@ -75,3 +77,5 @@ void Opinion::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
child->append_attribute(doc.allocate_attribute("respect", gStrPool.Get(val[OPI_RESPECT])));
root->append_node(child);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/people/opinion.h b/engines/crab/people/opinion.h
index e87012694d8..14beda3bac3 100644
--- a/engines/crab/people/opinion.h
+++ b/engines/crab/people/opinion.h
@@ -34,6 +34,8 @@
#include "crab/GameParam.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace people {
// What each opinion type is
@@ -66,4 +68,6 @@ struct Opinion {
} // End of namespace people
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_OPINION_H
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index a7b665b326d..ba146b47fc4 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -30,6 +30,8 @@
#include "crab/person.h"
+namespace Crab {
+
using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
@@ -146,3 +148,5 @@ void Person::LoadState(rapidxml::xml_node<char> *node) {
trait.push_back(n);
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index ab8e92f0a7c..ad378722cca 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -39,6 +39,8 @@
#include "personbase.h"
#include "crab/trait.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace people {
struct Person {
@@ -89,4 +91,6 @@ typedef std::unordered_map<std::string, Person> PersonMap;
} // End of namespace people
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_PERSON_H
diff --git a/engines/crab/people/personbase.cpp b/engines/crab/people/personbase.cpp
index 18cfafb3383..71975d1239b 100644
--- a/engines/crab/people/personbase.cpp
+++ b/engines/crab/people/personbase.cpp
@@ -31,6 +31,8 @@
#include "personbase.h"
+namespace Crab {
+
using namespace pyrodactyl::stat;
namespace pyrodactyl {
@@ -62,3 +64,5 @@ PersonState StringToPersonState(const std::string &val) {
}
} // End of namespace people
} // End of namespace pyrodactyl
+
+} // End of namespace Crab
diff --git a/engines/crab/people/personbase.h b/engines/crab/people/personbase.h
index ca39597e2b6..c7bb30401dc 100644
--- a/engines/crab/people/personbase.h
+++ b/engines/crab/people/personbase.h
@@ -34,6 +34,8 @@
#include "crab/Stat.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace people {
// What each type is, and what it does
@@ -63,4 +65,6 @@ PersonState StringToPersonState(const std::string &val);
} // End of namespace people
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_PERSONBASE_H
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 0fcd017cffb..da3d4eb0413 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -30,6 +30,8 @@
#include "crab/trait.h"
+namespace Crab {
+
using namespace pyrodactyl::people;
//------------------------------------------------------------------------
@@ -68,3 +70,5 @@ void Trait::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *r
root->append_node(child);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/people/trait.h b/engines/crab/people/trait.h
index 96973590ab3..5ca89a46e08 100644
--- a/engines/crab/people/trait.h
+++ b/engines/crab/people/trait.h
@@ -34,6 +34,8 @@
#include "crab/ImageManager.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace people {
struct Trait {
@@ -70,4 +72,6 @@ struct Trait {
} // End of namespace people
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TRAIT_H
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index 926331e7760..182bf6cb152 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -31,6 +31,8 @@
#include "crab/Stat.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace stat {
StatType StringToStatType(const std::string &val) {
@@ -108,3 +110,5 @@ void Stat::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
child->append_attribute(doc.allocate_attribute("max", gStrPool.Get(max)));
root->append_node(child);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index 2bc03672be0..49744bfbb87 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -35,6 +35,8 @@
#include "crab/ImageManager.h"
#include "crab/TextManager.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace stat {
struct Stat {
@@ -73,4 +75,6 @@ const char *StatTypeToString(const StatType &val);
} // End of namespace stat
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_STAT_H
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index 90dc5ae677d..e37980a3254 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -31,6 +31,8 @@
#include "crab/StatDrawHelper.h"
+namespace Crab {
+
using namespace pyrodactyl::text;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
@@ -78,3 +80,5 @@ void StatDrawHelper::DrawInfo(const Person &obj) {
for (int i = 0; i < STAT_TOTAL; i++)
info[i].Draw(obj.stat.val[i].cur, obj.stat.val[i].max);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index 1d58a289eb3..d60e64dfc11 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -35,6 +35,8 @@
#include "crab/TextData.h"
#include "crab/person.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace stat {
struct StatInfo {
@@ -71,4 +73,6 @@ public:
} // End of namespace stat
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_STATDRAWHELPER_H
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index 25f7ce771d2..d2a9bec7bfb 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -32,6 +32,8 @@
#include "crab/StatTemplate.h"
#include "crab/XMLDoc.h"
+namespace Crab {
+
using namespace pyrodactyl::stat;
void StatTemplates::Load(const std::string &filename) {
@@ -42,3 +44,5 @@ void StatTemplates::Load(const std::string &filename) {
collection.push_back(n);
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index 87c5d919c0b..e48e68a67f6 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -34,6 +34,8 @@
#include "crab/Stat.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace stat {
struct StatTemplates {
@@ -48,4 +50,6 @@ public:
} // End of namespace stat
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_STATTEMPLATE_H
diff --git a/engines/crab/stat/bonus.h b/engines/crab/stat/bonus.h
index 5bc90967c66..4a0a35d332d 100644
--- a/engines/crab/stat/bonus.h
+++ b/engines/crab/stat/bonus.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/loaders.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace stat {
// Stat bonuses for an item
@@ -49,4 +51,6 @@ struct Bonus {
} // End of namespace stat
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_BONUS_H
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 41e1fe18c8f..f20bd05506c 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -31,6 +31,8 @@
#include "crab/TextManager.h"
#include "crab/XMLDoc.h"
+namespace Crab {
+
using namespace pyrodactyl::text;
namespace pyrodactyl {
@@ -222,3 +224,5 @@ void TextManager::Quit() {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 0b8ef725783..104599a74eb 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -37,6 +37,8 @@
#include "crab/common_header.h"
#include "crab/vectors.h"
+namespace Crab {
+
// We use this object as the key for all fonts
typedef unsigned int FontKey;
@@ -114,4 +116,6 @@ extern TextManager gTextManager;
} // End of namespace text
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TEXTMANAGER_H
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index 540f13ed766..16e64fd7de1 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -30,6 +30,8 @@
#include "crab/color.h"
+namespace Crab {
+
using namespace pyrodactyl::text;
void ColorPool::Load(const std::string &filename) {
@@ -51,3 +53,5 @@ SDL_Color &ColorPool::Get(const int &num) {
return pool.at(num);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index 834d69916a2..074dd91255e 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/loaders.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace text {
// Storage pool for saving colors from one file, then using them
@@ -58,4 +60,6 @@ public:
} // End of namespace text
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_COLOR_H
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index e08f89b6db8..93aa4786f69 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -31,6 +31,8 @@
#include "crab/AlphaImage.h"
#include "crab/TextManager.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -68,3 +70,5 @@ void AlphaImage::Draw(const int &XOffset, const int &YOffset) {
if (gImageManager.ValidTexture(img))
gImageManager.GetTexture(img).Draw(pos.x + XOffset, pos.y + YOffset);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/AlphaImage.h b/engines/crab/ui/AlphaImage.h
index 5a84913ea95..02159a54275 100644
--- a/engines/crab/ui/AlphaImage.h
+++ b/engines/crab/ui/AlphaImage.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/element.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class AlphaImage {
@@ -82,4 +84,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ALPHAIMAGE_H
diff --git a/engines/crab/ui/Caption.cpp b/engines/crab/ui/Caption.cpp
index c83ed82331e..9adb15fee6a 100644
--- a/engines/crab/ui/Caption.cpp
+++ b/engines/crab/ui/Caption.cpp
@@ -31,6 +31,8 @@
#include "crab/Caption.h"
+namespace Crab {
+
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
@@ -56,3 +58,5 @@ void Caption::Draw(bool selected, const int &XOffset, const int &YOffset) {
TextData::Draw(text, XOffset, YOffset);
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index faef16da380..9c7a5517db5 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -34,6 +34,8 @@
#include "crab/TextData.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
// Caption for buttons
@@ -58,4 +60,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_CAPTION_H
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 3152f2cc3b1..bdc7f25f87f 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -30,6 +30,8 @@
#include "crab/ChapterIntro.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -63,3 +65,5 @@ void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
gImageManager.Draw(pos.x, pos.y, cur_sp->Img(), &clip);
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index 38238fa7060..e00bedaf052 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -36,6 +36,8 @@
#include "crab/dialogbox.h"
#include "crab/sprite.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class ChapterIntro {
@@ -62,4 +64,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_CHAPTERINTRO_H
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index 53775d70d52..c2a4a58a82c 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -31,6 +31,8 @@
#include "crab/ClipButton.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -50,3 +52,5 @@ void ClipButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
void ClipButton::Draw(const int &XOffset, const int &YOffset) {
Button::Draw(XOffset, YOffset, &clip);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ClipButton.h b/engines/crab/ui/ClipButton.h
index addc773e076..7cbc9589786 100644
--- a/engines/crab/ui/ClipButton.h
+++ b/engines/crab/ui/ClipButton.h
@@ -33,6 +33,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
// Sometimes we need to display a clipped version of the button image
@@ -50,4 +52,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_CLIPBUTTON_H
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 45804947ddf..03c262d62b4 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -31,6 +31,8 @@
#include "crab/CreditScreen.h"
#include "crab/url.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
@@ -173,3 +175,5 @@ void CreditScreen::SetUI() {
twitter.SetUI();
website.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 74063dcb51c..80f251489bd 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -38,6 +38,8 @@
#include "crab/common_header.h"
#include "crab/timer.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class CreditScreen {
@@ -120,4 +122,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_CREDITSCREEN_H
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 361c5d44660..11a17c05836 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -30,6 +30,8 @@
#include "crab/DevConsole.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
void DebugConsole::Load(const std::string &filename) {
@@ -120,3 +122,5 @@ void DebugConsole::HandleEvents(const SDL_Event &Event) {
void DebugConsole::InternalEvents() {
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index aefd86ec2ce..ff7c8d877ef 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/textarea.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class DebugConsole {
@@ -70,4 +72,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_DEVCONSOLE_H
diff --git a/engines/crab/ui/FileData.cpp b/engines/crab/ui/FileData.cpp
index 8fd1b8a3491..c8dbec08ba8 100644
--- a/engines/crab/ui/FileData.cpp
+++ b/engines/crab/ui/FileData.cpp
@@ -29,7 +29,10 @@
*/
#include "crab/FileData.h"
-#include <iomanip>
+
+namespace Crab {
+
+include <iomanip>
using namespace pyrodactyl::ui;
@@ -86,3 +89,5 @@ ModFileData::ModFileData(boost::filesystem::path filepath) : FileData(filepath)
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/FileData.h b/engines/crab/ui/FileData.h
index 2d31152bf9d..72486f14029 100644
--- a/engines/crab/ui/FileData.h
+++ b/engines/crab/ui/FileData.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/loaders.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class FileData {
@@ -78,4 +80,6 @@ const int DATA_HOVER_TOTAL = 4;
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_FILEDATA_H
diff --git a/engines/crab/ui/FileMenu.cpp b/engines/crab/ui/FileMenu.cpp
index b1cd6800b0d..2b1867208c7 100644
--- a/engines/crab/ui/FileMenu.cpp
+++ b/engines/crab/ui/FileMenu.cpp
@@ -30,8 +30,12 @@
#include "crab/FileMenu.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
FileMenu<SaveFileData> gLoadMenu;
}
} // End of namespace pyrodactyl
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index e8742035faf..85fb701cbe7 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -37,6 +37,8 @@
#include "crab/TextData.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
// Used for menus that are responsible for reading multiple files from disk
@@ -254,4 +256,6 @@ extern FileMenu<SaveFileData> gLoadMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_FILEMENU_H
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index 51b1d2e43e0..b8713b3a7b0 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -31,6 +31,8 @@
#include "crab/GameOverMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -71,3 +73,5 @@ void GameOverMenu::SetUI() {
title.SetUI();
menu.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index a1de1f8ff1d..bf934fe6139 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -36,6 +36,8 @@
#include "crab/common_header.h"
#include "crab/menu.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class GameOverMenu {
@@ -69,4 +71,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_GAMEOVERMENU_H
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index aaa1db9d4a5..802c5ec2036 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/GeneralSettingMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::music;
@@ -136,3 +138,5 @@ void GeneralSettingMenu::SetUI() {
text_speed.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 55545a99f6d..649e4bae8ef 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -36,6 +36,8 @@
#include "crab/common_header.h"
#include "crab/slider.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class GeneralSettingMenu {
@@ -70,4 +72,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_GENERALSETTINGMENU_H
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index ee396ccb340..26648a018f4 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/GfxSettingMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
@@ -144,3 +146,5 @@ void GfxSettingMenu::SetUI() {
notice_quality.SetUI();
brightness.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 891a7f202e8..2e44339ced1 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -38,6 +38,8 @@
#include "crab/common_header.h"
#include "crab/slider.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class GfxSettingMenu {
@@ -69,4 +71,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_GFXSETTINGMENU_H
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 22cd679bd1c..4ad25a20a58 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -31,6 +31,8 @@
#include "crab/HealthIndicator.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
void HealthIndicator::Load(rapidxml::xml_node<char> *node) {
@@ -69,3 +71,5 @@ void HealthIndicator::Draw(int num) {
break;
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
index b217a3044bd..9beff16a362 100644
--- a/engines/crab/ui/HealthIndicator.h
+++ b/engines/crab/ui/HealthIndicator.h
@@ -34,6 +34,8 @@
#include "crab/ImageManager.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class HealthIndicator {
@@ -64,4 +66,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_HEALTHINDICATOR_H
diff --git a/engines/crab/ui/HoverInfo.cpp b/engines/crab/ui/HoverInfo.cpp
index 9244c42e92f..d47fb8a2745 100644
--- a/engines/crab/ui/HoverInfo.cpp
+++ b/engines/crab/ui/HoverInfo.cpp
@@ -31,6 +31,8 @@
#include "crab/HoverInfo.h"
+namespace Crab {
+
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
@@ -51,3 +53,5 @@ void HoverInfo::Draw(const int &XOffset, const int &YOffset) {
if (enabled)
TextData::Draw(text, XOffset, YOffset);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index 8d914f6c20a..81cae87d9b9 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -34,6 +34,8 @@
#include "crab/TextData.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
// Tooltip for buttons
@@ -53,4 +55,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_HOVERINFO_H
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 78ed2a94ce8..7f60536fa5c 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -30,6 +30,8 @@
#include "crab/ImageData.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -49,3 +51,5 @@ void ImageData::Draw(const int &XOffset, const int &YOffset) {
else
gImageManager.Draw(x + XOffset, y + YOffset, key);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ImageData.h b/engines/crab/ui/ImageData.h
index 00e4a53ef04..ba8e2add872 100644
--- a/engines/crab/ui/ImageData.h
+++ b/engines/crab/ui/ImageData.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/element.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class ImageData : public Element {
@@ -60,4 +62,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_IMAGEDATA_H
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index e821adbaed0..1c8f9d1aa23 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -30,6 +30,8 @@
#include "crab/Inventory.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::item;
@@ -127,3 +129,5 @@ void Inventory::SetUI() {
collection.SetUI();
money.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index a85bea4e1f7..d65d3d26b2e 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -38,6 +38,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class Inventory {
@@ -81,4 +83,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_INVENTORY_H
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index 57121a60b67..397c34bd0d5 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -35,6 +35,8 @@
#include "crab/ParagraphData.h"
#include "crab/SectionHeader.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class ItemDesc {
@@ -69,4 +71,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ITEMDESC_H
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index ea9f57b5989..461447edf2d 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/KeyBindMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
@@ -194,3 +196,5 @@ void KeyBindMenu::SetUI() {
desc.SetUI();
sel_controls.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 1ebad3d8f92..bbb59e311bf 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -36,6 +36,8 @@
#include "crab/common_header.h"
#include "crab/menu.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class KeyBindMenu {
@@ -119,4 +121,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_KEYBINDMENU_H
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index b057516578a..1ea4485a4bc 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -30,6 +30,8 @@
#include "crab/MapData.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
void MapData::Load(rapidxml::xml_node<char> *node) {
@@ -84,3 +86,5 @@ void MapData::LoadState(rapidxml::xml_node<char> *node) {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/MapData.h b/engines/crab/ui/MapData.h
index c4428bbe067..1f9cad6e60f 100644
--- a/engines/crab/ui/MapData.h
+++ b/engines/crab/ui/MapData.h
@@ -34,6 +34,8 @@
#include "crab/Rectangle.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
struct MapData {
@@ -67,4 +69,6 @@ struct MapData {
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MAPDATA_H
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 2ae55cfd892..2b1323a8f05 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/MapMarkerMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
@@ -130,3 +132,5 @@ void MapMarkerMenu::SetUI() {
player.SetUI();
menu.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 8d2ff36feef..50eeb0e8efa 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/menu.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class MapMarkerMenu {
@@ -92,4 +94,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MAPMARKERMENU_H
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 53ba5447cfa..66f58210166 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/ModMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
void ModMenu::Load(const std::string &filename) {
@@ -117,3 +119,5 @@ void ModMenu::Draw() {
} else if (hover)
Reset();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index c7b4a7f1f50..1dcd96606aa 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -34,6 +34,8 @@
#include "crab/FileMenu.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class ModMenu : public FileMenu<ModFileData> {
@@ -48,4 +50,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MODMENU_H
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index b542f47db3e..065a015c6ec 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/OptionMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::music;
@@ -349,3 +351,5 @@ void OptionMenu::SetUI() {
accept.SetUI();
cancel.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 112e772c7b3..19d0572acda 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -40,6 +40,8 @@
#include "crab/common_header.h"
#include "crab/slider.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class OptionMenu {
@@ -112,4 +114,6 @@ extern OptionMenu gOptionMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_OPTIONMENU_H
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 089a321cce0..867450f7124 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -31,6 +31,8 @@
#include "crab/OptionSelect.h"
+namespace Crab {
+
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
@@ -87,3 +89,5 @@ void OptionSelect::SetUI() {
prev.SetUI();
next.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index c331f8a6002..ee10083dfce 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -35,6 +35,8 @@
#include "crab/TextData.h"
#include "crab/button.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class OptionSelect {
@@ -69,4 +71,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_OPTIONSELECT_H
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index a7fbdd93ef9..5a0c62dd021 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -34,6 +34,8 @@
#include "crab/common_header.h"
#include "crab/menu.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
// Sometimes we need multiple pages in a menu, this object does that
@@ -232,4 +234,6 @@ typedef PageMenu<Button> PageButtonMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_PAGEMENU_H
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index 8ae0e88ef45..7773d281516 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -30,6 +30,8 @@
#include "crab/ParagraphData.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
@@ -42,3 +44,5 @@ bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const boo
void ParagraphData::Draw(const std::string &val, const int &XOffset, const int &YOffset) {
pyrodactyl::text::gTextManager.Draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ParagraphData.h b/engines/crab/ui/ParagraphData.h
index a2b84dc46bf..966bb1b8194 100644
--- a/engines/crab/ui/ParagraphData.h
+++ b/engines/crab/ui/ParagraphData.h
@@ -34,6 +34,8 @@
#include "crab/TextData.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class ParagraphData : public TextData {
@@ -50,4 +52,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_PARAGRAPHDATA_H
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 8560f176c7c..0a69899b278 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/PauseMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -134,3 +136,5 @@ void PauseMenu::SetUI() {
menu.SetUI();
save.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 271b516e924..be6d8eecea6 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -41,6 +41,8 @@
#include "crab/slider.h"
#include "crab/textarea.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
enum PauseSignal { PS_NONE,
@@ -101,4 +103,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_PAUSEMENU_H
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 648d5bf6082..181d72e7f06 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -30,6 +30,8 @@
#include "crab/PersonHandler.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
@@ -167,3 +169,5 @@ void PersonHandler::SetUI() {
for (auto i = 0; i < pyrodactyl::people::OPI_TOTAL; ++i)
opinion[i].SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index ddb36660f24..31f9340a0d1 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -39,6 +39,8 @@
#include "crab/person.h"
#include "crab/sprite.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class PersonHandler {
@@ -106,4 +108,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_PERSONHANDLER_H
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index dc3f5b8a180..d360049aed1 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -30,6 +30,8 @@
#include "crab/PersonScreen.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
using namespace pyrodactyl::image;
@@ -97,3 +99,5 @@ void PersonScreen::SetUI() {
img.SetUI();
menu.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 279aad5ec56..97f862f67e1 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -40,6 +40,8 @@
#include "crab/person.h"
#include "crab/sprite.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class PersonScreen {
@@ -74,4 +76,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_PERSONSCREEN_H
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index c86e1a2f495..e0e34eae850 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -30,6 +30,8 @@
#include "crab/ProgressBar.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -112,3 +114,5 @@ void ProgressBar::Effect(const int &value, const int &prev) {
type = NONE;
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index e3bd9c314ff..b03239d7038 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/timer.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class ProgressBar : public ClipButton {
@@ -109,4 +111,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_PROGRESSBAR_H
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 899c4b076e3..788089d0d03 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -30,6 +30,8 @@
#include "crab/QuestText.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::input;
@@ -156,3 +158,5 @@ void QuestText::SetUI() {
next.SetUI();
status.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index cc7b547e5e9..f56a84e2486 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -37,6 +37,8 @@
#include "crab/common_header.h"
#include "crab/quest.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class QuestText : public ParagraphData {
@@ -88,4 +90,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_QUESTTEXT_H
diff --git a/engines/crab/ui/RadioButton.h b/engines/crab/ui/RadioButton.h
index 5fbfc800737..d30f67e1501 100644
--- a/engines/crab/ui/RadioButton.h
+++ b/engines/crab/ui/RadioButton.h
@@ -33,6 +33,8 @@
#include "crab/ToggleButton.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class RadioButton : public ToggleButton {
@@ -51,4 +53,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_RADIOBUTTON_H
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index e1a00f383cf..e40d8532343 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -34,6 +34,8 @@
#include "crab/RadioButton.h"
#include "crab/menu.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class RadioButtonMenu : public Menu<RadioButton> {
@@ -81,4 +83,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_RADIOBUTTONMENU_H
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 47b63c9e19f..0ae92444719 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -30,6 +30,8 @@
#include "crab/ReplyButton.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
@@ -82,3 +84,5 @@ void ReplyButton::Cache(const std::string &val, const int &spacing, const int &b
if (orig.y < bottom_edge)
y = bottom_edge + spacing;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index 0f120f8dd44..2078e605b77 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -34,6 +34,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
// This button is used to draw multiple lines of text instead of an image
@@ -75,4 +77,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_REPLYBUTTON_H
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index f601e61ae09..34ff741866b 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/ReplyMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
@@ -140,3 +142,5 @@ void ReplyMenu::SetUI() {
bg.SetUI();
tone.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index 3c6c85eba88..739ddd7f935 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -41,6 +41,8 @@
#include "crab/eventstore.h"
#include "crab/menu.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class ReplyMenu : public Menu<ReplyButton> {
@@ -69,4 +71,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_REPLYMENU_H
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 69402c709f5..802c609eb9e 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -31,6 +31,8 @@
#include "crab/ResolutionMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
@@ -130,3 +132,5 @@ void ResolutionMenu::SetUI() {
ref.SetUI();
ButtonMenu::SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 90b7da89e96..ea50e8d554a 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -35,6 +35,8 @@
#include "crab/menu.h"
#include "crab/textarea.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class ResolutionMenu : public ButtonMenu {
@@ -78,4 +80,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_RESOLUTIONMENU_H
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 4e0ee6b7725..cef35183d03 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/SaveGameMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::input;
@@ -138,3 +140,5 @@ void GameSaveMenu::SetUI() {
FileMenu<SaveFileData>::SetUI();
ta_name.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 84ac7530c4d..70a9583ecd3 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/textarea.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class GameSaveMenu : public FileMenu<SaveFileData> {
@@ -70,4 +72,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_SAVEGAMEMENU_H
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 584d736d08e..09b6816a538 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -30,6 +30,8 @@
#include "crab/SectionHeader.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
@@ -84,3 +86,5 @@ void SectionHeader::Draw(const std::string &str, const int &XOffset, const int &
TextData::Draw(str, XOffset, YOffset);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/SectionHeader.h b/engines/crab/ui/SectionHeader.h
index 102001c29b5..d31f434a1e2 100644
--- a/engines/crab/ui/SectionHeader.h
+++ b/engines/crab/ui/SectionHeader.h
@@ -36,6 +36,8 @@
#include "crab/TextManager.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class SectionHeader : public TextData {
@@ -67,4 +69,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_SECTIONHEADER_H
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 5e885301a31..2416a1e968f 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -30,6 +30,8 @@
#include "crab/SlideShow.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
SlideShow gHelpScreen;
@@ -111,3 +113,5 @@ void SlideShow::SetUI() {
prev.SetUI();
next.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 55e81fad7e8..0533c330c9c 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -36,6 +36,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class SlideShow {
@@ -78,4 +80,6 @@ extern SlideShow gHelpScreen;
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_SLIDESHOW_H
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index cc020b557ae..36628f3c4bd 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -30,6 +30,8 @@
#include "crab/StateButton.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -85,3 +87,5 @@ void StateButton::Img(const StateButtonImage &sbi) {
img_set = sbi;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/StateButton.h b/engines/crab/ui/StateButton.h
index 0f71101f09c..7b47d3e9963 100644
--- a/engines/crab/ui/StateButton.h
+++ b/engines/crab/ui/StateButton.h
@@ -34,6 +34,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
struct StateButtonImage {
@@ -86,4 +88,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_STATEBUTTON_H
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index 97eb31cdcad..d15379ab0a4 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/element.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class TextData : public Element {
@@ -63,4 +65,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TEXTDATA_H
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 474c15153e8..88a1a4a0a0e 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -30,6 +30,8 @@
#include "crab/ToggleButton.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -59,3 +61,5 @@ ButtonAction ToggleButton::HandleEvents(const SDL_Event &Event, const int &XOffs
return action;
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index e40da60cb73..acc7d1662a0 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -34,6 +34,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
// This button has two states that can be switched between by clicking the button
@@ -63,4 +65,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TOGGLEBUTTON_H
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index 3809e1a864c..3a7ee6904ae 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -30,6 +30,8 @@
#include "crab/TraitButton.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
@@ -62,3 +64,5 @@ void TraitButton::Empty() {
trait_img = 0;
caption.text = "";
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/TraitButton.h b/engines/crab/ui/TraitButton.h
index a7f885477ec..a9db91f2401 100644
--- a/engines/crab/ui/TraitButton.h
+++ b/engines/crab/ui/TraitButton.h
@@ -35,6 +35,8 @@
#include "crab/common_header.h"
#include "crab/trait.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class TraitButton : public StateButton {
@@ -59,4 +61,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TRAITBUTTON_H
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index f2c300fb32d..e375584faf3 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -30,6 +30,8 @@
#include "crab/TraitMenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
void TraitMenu::Load(rapidxml::xml_node<char> *node) {
@@ -117,3 +119,5 @@ void TraitMenu::SetUI() {
desc.SetUI();
menu.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index d8b1d7d146a..673656e226b 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -37,6 +37,8 @@
#include "crab/menu.h"
#include "crab/person.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class TraitMenu {
@@ -80,4 +82,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TRAITMENU_H
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index d28ba61e3c1..7344d991456 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -34,6 +34,8 @@
//=============================================================================
#include "crab/button.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
@@ -195,3 +197,5 @@ void Button::SetUI(Rect *parent) {
tooltip.SetUI(this);
caption.SetUI(this);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index d1d1f757da4..59b88a87d6a 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -44,6 +44,8 @@
#include "crab/element.h"
#include "crab/hotkey.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
enum ButtonAction { BUAC_IGNORE,
@@ -124,4 +126,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_BUTTON_H
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index 806fdc02388..9aa0ee740b1 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -34,6 +34,8 @@
//=============================================================================
#include "crab/dialogbox.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
@@ -87,3 +89,5 @@ void GameDialogBox::SetUI() {
text.SetUI(&pos);
button.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index 5770510de3d..a783448d675 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -40,6 +40,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class GameDialogBox {
@@ -77,4 +79,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_DIALOGBOX_H
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 06f68f0edb9..ef0208aad47 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -30,6 +30,8 @@
#include "crab/element.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
@@ -130,3 +132,5 @@ void Element::SetUI(Rect *parent) {
}
}
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index eecc10fef9f..8c012622010 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -36,6 +36,8 @@
#include "crab/common_header.h"
#include "crab/vectors.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class Element : public Rect {
@@ -78,4 +80,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_ELEMENT_H
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 580b9ec0212..bc230964ccd 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -30,6 +30,8 @@
#include "crab/emotion.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
@@ -48,3 +50,5 @@ void EmotionIndicator::Draw(const int &select) {
void EmotionIndicator::SetUI() {
text.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index 642370ef6a1..1efab7861d3 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -36,6 +36,8 @@
#include "crab/eventstore.h"
#include "crab/textarea.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
struct EmotionIndicator {
@@ -54,4 +56,6 @@ struct EmotionIndicator {
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_EMOTION_H
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 9cfd71963f4..ed08b19cdc1 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -34,6 +34,8 @@
//=============================================================================
#include "crab/hud.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
@@ -157,3 +159,5 @@ void HUD::SetUI() {
pause.SetUI();
back.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 3bbd05b7330..7d1801532a2 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -47,6 +47,8 @@
#include "crab/level_objects.h"
#include "crab/talknotify.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
enum HUDSignal { HS_NONE = -1,
@@ -110,4 +112,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_HUD_H
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 1ea6bcfbffa..00fd7498f89 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -30,6 +30,8 @@
#include "crab/journal.h"
+namespace Crab {
+
using namespace pyrodactyl::image;
using namespace pyrodactyl::ui;
@@ -281,3 +283,5 @@ void Journal::SetUI() {
for (auto i = 0; i < JE_TOTAL; ++i)
m.menu[i].SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 4caf2347272..1a01021014c 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -37,6 +37,8 @@
#include "crab/common_header.h"
#include "crab/questmenu.h"
+namespace Crab {
+
#define JE_CUR_NAME "cur"
#define JE_DONE_NAME "done"
#define JE_PEOPLE_NAME "people"
@@ -116,4 +118,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_JOURNAL_H
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 8a32bd8346e..d4fc089c084 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -30,6 +30,8 @@
#include "crab/map.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
@@ -412,3 +414,5 @@ void Map::SetUI() {
CalcBounds();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 6587f45a717..5f4d47353eb 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -42,6 +42,8 @@
#include "crab/mapbutton.h"
#include "crab/triggerset.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class Map {
@@ -139,4 +141,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MAP_H
diff --git a/engines/crab/ui/mapbutton.h b/engines/crab/ui/mapbutton.h
index 1cfa932117f..09309d5a528 100644
--- a/engines/crab/ui/mapbutton.h
+++ b/engines/crab/ui/mapbutton.h
@@ -35,6 +35,8 @@
#include "crab/menu.h"
#include "crab/triggerset.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class MapButton : public Button {
@@ -61,4 +63,6 @@ typedef Menu<MapButton> MapButtonMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MAPBUTTON_H
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 94ca3c7a783..cee53bcdda9 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -39,6 +39,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
template<typename T>
@@ -313,4 +315,6 @@ typedef Menu<Button> ButtonMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_MENU_H
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 8a025536fdc..1a989a91e5b 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -30,6 +30,8 @@
#include "crab/questmenu.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
@@ -238,3 +240,5 @@ void QuestMenu::SetUI() {
menu.SetUI();
text.SetUI();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index d5db7728dae..ea8e6faef2a 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -37,6 +37,8 @@
#include "crab/common_header.h"
#include "crab/quest.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class QuestMenu {
@@ -95,4 +97,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_QUESTMENU_H
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index a0a50dbe038..2fd3c1f50b0 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -30,6 +30,8 @@
#include "crab/slider.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
@@ -110,3 +112,5 @@ void Slider::SetUI() {
knob.w = gImageManager.GetTexture(knob.img.normal).W();
knob.h = gImageManager.GetTexture(knob.img.normal).H();
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index cfbcb011e5c..c7927ae18c2 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -37,6 +37,8 @@
#include "crab/button.h"
#include "crab/common_header.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class Slider {
@@ -81,4 +83,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_SLIDER_H
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 62810643ae9..25b78ed40aa 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -34,6 +34,8 @@
//=============================================================================
#include "crab/textarea.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::input;
@@ -89,3 +91,5 @@ void TextArea::Draw() {
title.Draw();
TextData::Draw(text + "_");
}
+
+} // End of namespace Crab
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 36505ffdbf6..0303e947d59 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -41,6 +41,8 @@
#include "crab/common_header.h"
#include "crab/input.h"
+namespace Crab {
+
namespace pyrodactyl {
namespace ui {
class TextArea : public TextData {
@@ -76,4 +78,6 @@ public:
} // End of namespace ui
} // End of namespace pyrodactyl
+} // End of namespace Crab
+
#endif // CRAB_TEXTAREA_H
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index dcc2ec76ba0..1e27df44a13 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -30,6 +30,8 @@
#include "crab/TextData.h"
+namespace Crab {
+
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
@@ -53,3 +55,5 @@ void TextData::Draw(const std::string &val, const int &XOffset, const int &YOffs
void TextData::DrawColor(const std::string &val, const int &color, const int &XOffset, const int &YOffset) {
pyrodactyl::text::gTextManager.Draw(x + XOffset, y + YOffset, val, color, font, align, background);
}
+
+} // End of namespace Crab
diff --git a/engines/crab/url.cpp b/engines/crab/url.cpp
index 2f34b131796..ec8a07f419c 100644
--- a/engines/crab/url.cpp
+++ b/engines/crab/url.cpp
@@ -30,6 +30,8 @@
#include "crab/url.h"
+namespace Crab {
+
#ifdef __WIN32__
#include <ShellAPI.h>
#include <windows.h>
@@ -63,3 +65,5 @@ void OpenURL(const std::string &url_str) {
system(command.c_str());
#endif
}
+
+} // End of namespace Crab
diff --git a/engines/crab/url.h b/engines/crab/url.h
index e60fd32c7a5..49df1d2ae11 100644
--- a/engines/crab/url.h
+++ b/engines/crab/url.h
@@ -33,6 +33,10 @@
#include <string>
+namespace Crab {
+
void OpenURL(const std::string &url_str);
+} // End of namespace Crab
+
#endif // CRAB_URL_H
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index dc4d19aaa98..4af5ce3c66a 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -35,6 +35,8 @@
#include "crab/GameParam.h"
#include "crab/loaders.h"
+namespace Crab {
+
//------------------------------------------------------------------------
// Purpose: A simple 2D vector class
//------------------------------------------------------------------------
@@ -124,4 +126,6 @@ public:
typedef Vector3D<int> Vector3i;
typedef Vector3D<float> Vector3f;
+} // End of namespace Crab
+
#endif // CRAB_VECTORS_H
Commit: d1e191629981b0629ce46ea5efcafefa987b1779
https://github.com/scummvm/scummvm/commit/d1e191629981b0629ce46ea5efcafefa987b1779
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix all includes
Changed paths:
engines/crab/LevelResult.h
engines/crab/LoadingScreen.h
engines/crab/PathfindingGrid.cpp
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/ai/SpriteConstant.cpp
engines/crab/ai/moveeffect.cpp
engines/crab/ai/moveeffect.h
engines/crab/ai/movement.cpp
engines/crab/ai/spriteai.cpp
engines/crab/ai/spriteai.h
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/AnimationFrame.h
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/animation.cpp
engines/crab/animation/animation.h
engines/crab/animation/animframe.cpp
engines/crab/animation/animframe.h
engines/crab/animation/animset.cpp
engines/crab/animation/animset.h
engines/crab/animation/fightanim.cpp
engines/crab/animation/fightanim.h
engines/crab/animation/fightmove.cpp
engines/crab/animation/fightmove.h
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fightmoves.h
engines/crab/animation/fm_ai_data.h
engines/crab/animation/imageeffect.cpp
engines/crab/animation/imageeffect.h
engines/crab/animation/range.h
engines/crab/animation/shadow.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/animation/walkframes.cpp
engines/crab/animation/walkframes.h
engines/crab/app.h
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/changeval.h
engines/crab/event/conversationdata.cpp
engines/crab/event/conversationdata.h
engines/crab/event/effect.cpp
engines/crab/event/effect.h
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/gameevent.cpp
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/event/quest.cpp
engines/crab/event/trigger.cpp
engines/crab/event/trigger.h
engines/crab/event/triggerset.cpp
engines/crab/event/triggerset.h
engines/crab/game.h
engines/crab/image/ImageManager.h
engines/crab/input/fightinput.cpp
engines/crab/input/fightinput.h
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/input/inputval.cpp
engines/crab/item/Item.cpp
engines/crab/item/Item.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/item/StatPreview.cpp
engines/crab/item/StatPreview.h
engines/crab/level/LevelExit.cpp
engines/crab/level/LevelExit.h
engines/crab/level/MusicArea.cpp
engines/crab/level/MusicArea.h
engines/crab/level/Stairs.cpp
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/level/level_objects.cpp
engines/crab/level/level_objects.h
engines/crab/level/talknotify.cpp
engines/crab/level/talknotify.h
engines/crab/mainmenu.h
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
engines/crab/people/opinion.cpp
engines/crab/people/person.cpp
engines/crab/people/person.h
engines/crab/people/personbase.cpp
engines/crab/people/personbase.h
engines/crab/people/trait.cpp
engines/crab/people/trait.h
engines/crab/resource.h
engines/crab/splash.h
engines/crab/stat/Stat.cpp
engines/crab/stat/Stat.h
engines/crab/stat/StatDrawHelper.cpp
engines/crab/stat/StatDrawHelper.h
engines/crab/stat/StatTemplate.cpp
engines/crab/stat/StatTemplate.h
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.cpp
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/AlphaImage.h
engines/crab/ui/Caption.cpp
engines/crab/ui/Caption.h
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/ClipButton.cpp
engines/crab/ui/ClipButton.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/FileData.cpp
engines/crab/ui/FileMenu.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/HealthIndicator.h
engines/crab/ui/HoverInfo.cpp
engines/crab/ui/HoverInfo.h
engines/crab/ui/ImageData.cpp
engines/crab/ui/ImageData.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/ItemDesc.h
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapData.cpp
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/ParagraphData.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButton.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SectionHeader.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/StateButton.cpp
engines/crab/ui/StateButton.h
engines/crab/ui/TextData.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitButton.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/element.cpp
engines/crab/ui/element.h
engines/crab/ui/emotion.cpp
engines/crab/ui/emotion.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/mapbutton.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
engines/crab/ui/textdata.cpp
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index 345129a52d8..a32350dc712 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -32,7 +32,7 @@
#define CRAB_LEVELRESULT_H
#include "crab/common_header.h"
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
namespace Crab {
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 3422c6a5e87..af349d890c9 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -31,7 +31,7 @@
#ifndef CRAB_LOADINGSCREEN_H
#define CRAB_LOADINGSCREEN_H
-#include "crab/Image.h"
+#include "crab/image/Image.h"
#include "crab/common_header.h"
#include "crab/timer.h"
#include "crab/vectors.h"
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 7db706c589e..fd54ed3e75d 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -29,7 +29,7 @@
*/
#include "crab/PathfindingGrid.h"
-#include "crab/TMXMap.h"
+#include "crab/TMX/TMXMap.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index a689d676fb1..765d4144df4 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/TMXLayer.h"
+#include "crab/TMX/TMXLayer.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index c2a621ac361..6b92564b104 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -31,9 +31,9 @@
#ifndef CRAB_TMXLAYER_H
#define CRAB_TMXLAYER_H
-#include "crab/Image.h"
+#include "crab/image/Image.h"
#include "crab/Rectangle.h"
-#include "crab/TileInfo.h"
+#include "crab/TMX/TileInfo.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index cf6498bf049..e1f74f70be5 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "crab/TMXMap.h"
-#include "crab/TextManager.h"
+#include "crab/TMX/TMXMap.h"
+#include "crab/text/TextManager.h"
#include "crab/collision.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 0de847c2b38..856aa549a3c 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -31,16 +31,16 @@
#ifndef CRAB_TMXMAP_H
#define CRAB_TMXMAP_H
-#include "crab/ImageManager.h"
-#include "crab/LevelExit.h"
+#include "crab/image/ImageManager.h"
+#include "crab/level/LevelExit.h"
#include "crab/LevelResult.h"
-#include "crab/MusicArea.h"
+#include "crab/level/MusicArea.h"
#include "crab/PathfindingGrid.h"
#include "crab/Shape.h"
-#include "crab/Stairs.h"
-#include "crab/TMXTileSet.h"
+#include "crab/level/Stairs.h"
+#include "crab/TMX/TMXTileSet.h"
#include "crab/common_header.h"
-#include "crab/spriteai.h"
+#include "crab/ai/spriteai.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 5c01a65db5b..ae0fe469282 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "crab/TMXTileSet.h"
-#include "crab/TextManager.h"
+#include "crab/TMX/TMXTileSet.h"
+#include "crab/text/TextManager.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 8297ec58a24..25a9e81482f 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -31,8 +31,8 @@
#ifndef CRAB_TMXTILESET_H
#define CRAB_TMXTILESET_H
-#include "crab/Image.h"
-#include "crab/TMXLayer.h"
+#include "crab/image/Image.h"
+#include "crab/TMX/TMXLayer.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ai/SpriteConstant.cpp b/engines/crab/ai/SpriteConstant.cpp
index 2174692d490..c05b6917845 100644
--- a/engines/crab/ai/SpriteConstant.cpp
+++ b/engines/crab/ai/SpriteConstant.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/SpriteConstant.h"
+#include "crab/ai/SpriteConstant.h"
namespace Crab {
diff --git a/engines/crab/ai/moveeffect.cpp b/engines/crab/ai/moveeffect.cpp
index e4dc67f397d..f0f5b8a0c28 100644
--- a/engines/crab/ai/moveeffect.cpp
+++ b/engines/crab/ai/moveeffect.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/moveeffect.h"
+#include "crab/ai/moveeffect.h"
namespace Crab {
diff --git a/engines/crab/ai/moveeffect.h b/engines/crab/ai/moveeffect.h
index b4de8894c07..59712df530f 100644
--- a/engines/crab/ai/moveeffect.h
+++ b/engines/crab/ai/moveeffect.h
@@ -32,8 +32,8 @@
#define CRAB_MOVEEFFECT_H
#include "crab/common_header.h"
-#include "crab/imageeffect.h"
-#include "crab/musicparam.h"
+#include "crab/animation/imageeffect.h"
+#include "crab/music/musicparam.h"
namespace Crab {
diff --git a/engines/crab/ai/movement.cpp b/engines/crab/ai/movement.cpp
index 04699b7601f..9976f77f9a1 100644
--- a/engines/crab/ai/movement.cpp
+++ b/engines/crab/ai/movement.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/movement.h"
+#include "crab/ai/movement.h"
namespace Crab {
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 9c6ef9904f1..3d88972c8f3 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/sprite.h"
+#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/ai/spriteai.h b/engines/crab/ai/spriteai.h
index 4ee18193705..cc90eec6a39 100644
--- a/engines/crab/ai/spriteai.h
+++ b/engines/crab/ai/spriteai.h
@@ -32,7 +32,7 @@
#define CRAB_SPRITEAI_H
#include "crab/common_header.h"
-#include "crab/movement.h"
+#include "crab/ai/movement.h"
#include "crab/PathfindingAgent.h"
namespace Crab {
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index 71920e58a5d..5bc5f5dcb47 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/AnimationFrame.h"
+#include "crab/animation/AnimationFrame.h"
namespace Crab {
diff --git a/engines/crab/animation/AnimationFrame.h b/engines/crab/animation/AnimationFrame.h
index 40a18c8c6b4..a921c68ea82 100644
--- a/engines/crab/animation/AnimationFrame.h
+++ b/engines/crab/animation/AnimationFrame.h
@@ -31,10 +31,10 @@
#ifndef CRAB_ANIMATIONFRAME_H
#define CRAB_ANIMATIONFRAME_H
-#include "crab/AnimationEffect.h"
-#include "crab/HoverInfo.h"
-#include "crab/ImageManager.h"
-#include "crab/TextManager.h"
+#include "crab/animation/AnimationEffect.h"
+#include "crab/ui/HoverInfo.h"
+#include "crab/image/ImageManager.h"
+#include "crab/text/TextManager.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 4f96b63eee5..87eeb6e7e5c 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/PopUp.h"
+#include "crab/animation/PopUp.h"
namespace Crab {
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index c6fd1da50e6..70b8d872133 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -31,12 +31,12 @@
#ifndef CRAB_POPUP_H
#define CRAB_POPUP_H
-#include "crab/GameEventInfo.h"
-#include "crab/ParagraphData.h"
-#include "crab/TextManager.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/ParagraphData.h"
+#include "crab/text/TextManager.h"
#include "crab/common_header.h"
-#include "crab/effect.h"
-#include "crab/triggerset.h"
+#include "crab/event/effect.h"
+#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index 1fdec47460b..bae600503c4 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/animation.h"
+#include "crab/animation/animation.h"
namespace Crab {
diff --git a/engines/crab/animation/animation.h b/engines/crab/animation/animation.h
index e357a9cebe1..ecfb2eea70c 100644
--- a/engines/crab/animation/animation.h
+++ b/engines/crab/animation/animation.h
@@ -28,13 +28,13 @@
*
*/
-#ifndef CRAB__ANIMATION_H
-#define CRAB__ANIMATION_H
+#ifndef CRAB_ANIMATION_H
+#define CRAB_ANIMATION_H
-#include "AnimationEffect.h"
-#include "AnimationFrame.h"
-#include "common_header.h"
-#include "timer.h"
+#include "crab/animation/AnimationEffect.h"
+#include "crab/animation/AnimationFrame.h"
+#include "crab/common_header.h"
+#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index dbe466fed3f..97c0fd65626 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/animframe.h"
+#include "crab/animation/animframe.h"
namespace Crab {
diff --git a/engines/crab/animation/animframe.h b/engines/crab/animation/animframe.h
index 81234209c97..b611a016d8c 100644
--- a/engines/crab/animation/animframe.h
+++ b/engines/crab/animation/animframe.h
@@ -33,7 +33,7 @@
#include "crab/Rectangle.h"
#include "crab/common_header.h"
-#include "crab/shadow.h"
+#include "crab/animation/shadow.h"
#include "crab/vectors.h"
namespace Crab {
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 6d1c5200950..5190cfd90ec 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/animset.h"
+#include "crab/animation/animset.h"
namespace Crab {
diff --git a/engines/crab/animation/animset.h b/engines/crab/animation/animset.h
index 7db59fda539..439e82f5f73 100644
--- a/engines/crab/animation/animset.h
+++ b/engines/crab/animation/animset.h
@@ -32,9 +32,9 @@
#define CRAB_ANIMSET_H
#include "crab/common_header.h"
-#include "crab/fightmoves.h"
-#include "crab/shadow.h"
-#include "crab/walkframes.h"
+#include "crab/animation/fightmoves.h"
+#include "crab/animation/shadow.h"
+#include "crab/animation/walkframes.h"
namespace Crab {
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index c5b495e2026..002c9858f12 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/fightanim.h"
+#include "crab/animation/fightanim.h"
namespace Crab {
diff --git a/engines/crab/animation/fightanim.h b/engines/crab/animation/fightanim.h
index c1e17125027..e3df9d81401 100644
--- a/engines/crab/animation/fightanim.h
+++ b/engines/crab/animation/fightanim.h
@@ -31,13 +31,13 @@
#ifndef CRAB_FIGHTANIM_H
#define CRAB_FIGHTANIM_H
-#include "crab/MusicManager.h"
+#include "crab/music/MusicManager.h"
#include "crab/common_header.h"
-#include "crab/fightinput.h"
-#include "crab/fm_ai_data.h"
-#include "crab/moveeffect.h"
-#include "crab/shadow.h"
-#include "crab/triggerset.h"
+#include "crab/input/fightinput.h"
+#include "crab/animation/fm_ai_data.h"
+#include "crab/ai/moveeffect.h"
+#include "crab/animation/shadow.h"
+#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/animation/fightmove.cpp b/engines/crab/animation/fightmove.cpp
index 6605d55da36..da823234df2 100644
--- a/engines/crab/animation/fightmove.cpp
+++ b/engines/crab/animation/fightmove.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/fightmove.h"
+#include "crab/animation/fightmove.h"
namespace Crab {
diff --git a/engines/crab/animation/fightmove.h b/engines/crab/animation/fightmove.h
index 372fa5e3003..4e33b26d186 100644
--- a/engines/crab/animation/fightmove.h
+++ b/engines/crab/animation/fightmove.h
@@ -32,7 +32,7 @@
#define CRAB_FIGHTMOVE_H
#include "crab/common_header.h"
-#include "crab/fightanim.h"
+#include "crab/animation/fightanim.h"
namespace Crab {
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 3622a4b2023..5896a318913 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/fightmoves.h"
+#include "crab/animation/fightmoves.h"
namespace Crab {
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index b1a29ca2536..cbca0617ef4 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -31,9 +31,9 @@
#ifndef CRAB_FIGHTMOVES_H
#define CRAB_FIGHTMOVES_H
-#include "crab/MusicManager.h"
+#include "crab/music/MusicManager.h"
#include "crab/common_header.h"
-#include "crab/fightmove.h"
+#include "crab/animation/fightmove.h"
namespace Crab {
diff --git a/engines/crab/animation/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
index 60e35193a6f..01833d53133 100644
--- a/engines/crab/animation/fm_ai_data.h
+++ b/engines/crab/animation/fm_ai_data.h
@@ -32,7 +32,7 @@
#define CRAB_FM_AI_DATA_H
#include "crab/common_header.h"
-#include "crab/range.h"
+#include "crab/animation/range.h"
namespace Crab {
diff --git a/engines/crab/animation/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
index 23ea1d507c6..7633b5c48e2 100644
--- a/engines/crab/animation/imageeffect.cpp
+++ b/engines/crab/animation/imageeffect.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/imageeffect.h"
+#include "crab/animation/imageeffect.h"
namespace Crab {
diff --git a/engines/crab/animation/imageeffect.h b/engines/crab/animation/imageeffect.h
index ef4cc6d407a..ca9cb873f4e 100644
--- a/engines/crab/animation/imageeffect.h
+++ b/engines/crab/animation/imageeffect.h
@@ -32,7 +32,7 @@
#define CRAB_IMAGEEFFECT_H
#include "crab/common_header.h"
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
namespace Crab {
diff --git a/engines/crab/animation/range.h b/engines/crab/animation/range.h
index 71e106acb9a..f0d39416501 100644
--- a/engines/crab/animation/range.h
+++ b/engines/crab/animation/range.h
@@ -31,7 +31,7 @@
#ifndef CRAB_RANGE_H
#define CRAB_RANGE_H
-#include "crab/animframe.h"
+#include "crab/animation/animframe.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index dc318f7b6e9..4724c323f90 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -31,7 +31,7 @@
#ifndef CRAB_SHADOW_H
#define CRAB_SHADOW_H
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
#include "crab/vectors.h"
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index b635a2c431b..0ee885a2042 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/sprite.h"
+#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index cb71ce73699..2da5c4f4792 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -31,18 +31,18 @@
#ifndef CRAB_SPRITE_H
#define CRAB_SPRITE_H
-#include "crab/ImageManager.h"
-#include "crab/LevelExit.h"
-#include "crab/MusicManager.h"
+#include "crab/image/ImageManager.h"
+#include "crab/level/LevelExit.h"
+#include "crab/music/MusicManager.h"
#include "crab/PathfindingAgent.h"
-#include "crab/PopUp.h"
+#include "crab/animation/PopUp.h"
#include "crab/Shape.h"
-#include "crab/SpriteConstant.h"
-#include "crab/animset.h"
+#include "crab/ai/SpriteConstant.h"
+#include "crab/animation/animset.h"
#include "crab/collision.h"
#include "crab/common_header.h"
-#include "crab/person.h"
-#include "crab/spriteai.h"
+#include "crab/people/person.h"
+#include "crab/ai/spriteai.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/animation/walkframes.cpp b/engines/crab/animation/walkframes.cpp
index c6c08071a1c..3d1bd1b0119 100644
--- a/engines/crab/animation/walkframes.cpp
+++ b/engines/crab/animation/walkframes.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/walkframes.h"
+#include "crab/animation/walkframes.h"
namespace Crab {
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index ef323fd9219..9a6fc2bbad5 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -31,10 +31,10 @@
#ifndef CRAB_WALKFRAMES_H
#define CRAB_WALKFRAMES_H
-#include "crab/animframe.h"
+#include "crab/animation/animframe.h"
#include "crab/common_header.h"
-#include "crab/movement.h"
-#include "personbase.h"
+#include "crab/ai/movement.h"
+#include "crab/people/personbase.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/app.h b/engines/crab/app.h
index 449b06337a7..a7e31a0dff3 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -32,8 +32,8 @@
#define CRAB_APP_H
#include "crab/crab.h"
-//#include "crab/ImageManager.h"
-//#include "crab/MusicManager.h"
+//#include "crab/image/ImageManager.h"
+//#include "crab/music/MusicManager.h"
#include "crab/common_header.h"
//#include "crab/game.h"
#include "crab/gamestates.h"
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 33da8899b01..c54ca60a4a8 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/EventSeqGroup.h"
+#include "crab/event/EventSeqGroup.h"
namespace Crab {
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index ec55c0ad9bb..71db34978f4 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -32,7 +32,7 @@
#define CRAB_EVENTSEQGROUP_H
#include "crab/common_header.h"
-#include "crab/EventSequence.h"
+#include "crab/event/EventSequence.h"
namespace Crab {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 39746f91171..797b0e0c6f1 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/EventSequence.h"
+#include "crab/event/EventSequence.h"
namespace Crab {
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index 5c43785ae9b..18ada894f51 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -32,11 +32,11 @@
#define CRAB_EVENTSEQUENCE_H
#include "crab/common_header.h"
-#include "crab/GameEventInfo.h"
-#include "crab/ImageManager.h"
-#include "crab/Inventory.h"
-#include "crab/gameevent.h"
-#include "crab/journal.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/image/ImageManager.h"
+#include "crab/ui/Inventory.h"
+#include "crab/event/gameevent.h"
+#include "crab/ui/journal.h"
namespace Crab {
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 92ca1089463..d25421f71da 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "crab/GameEventInfo.h"
-#include "crab/eventstore.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/event/eventstore.h"
namespace Crab {
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index b09ea7b5ba1..5378b13b60c 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -31,11 +31,11 @@
#ifndef CRAB_GAMEEVENTINFO_H
#define CRAB_GAMEEVENTINFO_H
-#include "crab/Inventory.h"
-#include "crab/StatTemplate.h"
+#include "crab/ui/Inventory.h"
+#include "crab/stat/StatTemplate.h"
#include "crab/common_header.h"
-#include "crab/journal.h"
-#include "crab/person.h"
+#include "crab/ui/journal.h"
+#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/event/changeval.h b/engines/crab/event/changeval.h
index c7410c24c06..9db9d4cee79 100644
--- a/engines/crab/event/changeval.h
+++ b/engines/crab/event/changeval.h
@@ -32,7 +32,7 @@
#define CRAB_CHANGEVAL_H
#include "crab/common_header.h"
-#include "crab/opinion.h"
+#include "crab/people/opinion.h"
namespace Crab {
diff --git a/engines/crab/event/conversationdata.cpp b/engines/crab/event/conversationdata.cpp
index 893e84d723b..d6ee875cc5d 100644
--- a/engines/crab/event/conversationdata.cpp
+++ b/engines/crab/event/conversationdata.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/conversationdata.h"
+#include "crab/event/conversationdata.h"
namespace Crab {
diff --git a/engines/crab/event/conversationdata.h b/engines/crab/event/conversationdata.h
index 50a0e493957..118c38d96ae 100644
--- a/engines/crab/event/conversationdata.h
+++ b/engines/crab/event/conversationdata.h
@@ -31,9 +31,9 @@
#ifndef CRAB_CONVERSATIONDATA_H
#define CRAB_CONVERSATIONDATA_H
-#include "crab/changeval.h"
+#include "crab/event/changeval.h"
#include "crab/common_header.h"
-#include "crab/triggerset.h"
+#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 27ed85c890c..218c4f5e752 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "crab/effect.h"
-#include "crab/MusicManager.h"
+#include "crab/event/effect.h"
+#include "crab/music/MusicManager.h"
namespace Crab {
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index 58c69046c2a..01ba13816ed 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -31,11 +31,11 @@
#ifndef CRAB_EFFECT_H
#define CRAB_EFFECT_H
-#include "crab/GameEventInfo.h"
+#include "crab/event/GameEventInfo.h"
#include "crab/XMLDoc.h"
#include "crab/common_header.h"
#include "crab/loaders.h"
-#include "crab/person.h"
+#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 68973a35683..9370467610d 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/eventstore.h"
+#include "crab/event/eventstore.h"
namespace Crab {
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 6c6513528e4..11e3131372e 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -31,10 +31,10 @@
#ifndef CRAB_EVENTSTORE_H
#define CRAB_EVENTSTORE_H
-#include "crab/StateButton.h"
-#include "crab/animation.h"
+#include "crab/ui/StateButton.h"
+#include "crab/animation/animation.h"
#include "crab/common_header.h"
-#include "crab/conversationdata.h"
+#include "crab/event/conversationdata.h"
namespace Crab {
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index 4d2d2937d0f..b7bcf71166a 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/gameevent.h"
+#include "crab/event/gameevent.h"
namespace Crab {
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index 1193e7a8649..58047e374fd 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -31,13 +31,13 @@
#ifndef CRAB_GAMEEVENT_H
#define CRAB_GAMEEVENT_H
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
-#include "crab/effect.h"
-#include "crab/eventstore.h"
-#include "crab/person.h"
-#include "personbase.h"
-#include "crab/triggerset.h"
+#include "crab/event/effect.h"
+#include "crab/event/eventstore.h"
+#include "crab/people/person.h"
+#include "crab/people/personbase.h"
+#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 148898550da..23c1a55ed8d 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/gameeventmanager.h"
+#include "crab/event/gameeventmanager.h"
namespace Crab {
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 899c3a9eea0..e505dbd1fd5 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -31,16 +31,16 @@
#ifndef CRAB_GAMEEVENTMANAGER_H
#define CRAB_GAMEEVENTMANAGER_H
-#include "crab/ChapterIntro.h"
-#include "crab/EventSeqGroup.h"
-#include "crab/PersonHandler.h"
-#include "crab/PersonScreen.h"
-#include "crab/ReplyMenu.h"
+#include "crab/ui/ChapterIntro.h"
+#include "crab/event/EventSeqGroup.h"
+#include "crab/ui/PersonHandler.h"
+#include "crab/ui/PersonScreen.h"
+#include "crab/ui/ReplyMenu.h"
#include "crab/common_header.h"
-#include "crab/hud.h"
-#include "crab/journal.h"
-#include "crab/level.h"
-#include "crab/textarea.h"
+#include "crab/ui/hud.h"
+#include "crab/ui/journal.h"
+#include "crab/level/level.h"
+#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index 38794e9a6a7..44a58625e4f 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/quest.h"
+#include "crab/event/quest.h"
namespace Crab {
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 98baa1879a2..c3b0cebef4c 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/trigger.h"
+#include "crab/event/trigger.h"
namespace Crab {
diff --git a/engines/crab/event/trigger.h b/engines/crab/event/trigger.h
index b4f180ffbf1..e974bcfe1cd 100644
--- a/engines/crab/event/trigger.h
+++ b/engines/crab/event/trigger.h
@@ -30,7 +30,7 @@
#ifndef CRAB_TRIGGER_H
#define CRAB_TRIGGER_H
-#include "crab/GameEventInfo.h"
+#include "crab/event/GameEventInfo.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/event/triggerset.cpp b/engines/crab/event/triggerset.cpp
index 5043017cf34..5bc20ed27bf 100644
--- a/engines/crab/event/triggerset.cpp
+++ b/engines/crab/event/triggerset.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/triggerset.h"
+#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/event/triggerset.h b/engines/crab/event/triggerset.h
index e6412a7717f..8539278ee38 100644
--- a/engines/crab/event/triggerset.h
+++ b/engines/crab/event/triggerset.h
@@ -32,7 +32,7 @@
#define CRAB_TRIGGERSET_H
#include "crab/common_header.h"
-#include "crab/trigger.h"
+#include "crab/event/trigger.h"
namespace Crab {
diff --git a/engines/crab/game.h b/engines/crab/game.h
index dce641aea5a..03eaf785c8e 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -31,19 +31,19 @@
#ifndef CRAB_GAME_H
#define CRAB_GAME_H
-#include "crab/DevConsole.h"
+#include "crab/ui/DevConsole.h"
#include "crab/GameClock.h"
-#include "crab/GameEventInfo.h"
-#include "crab/ImageManager.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/image/ImageManager.h"
#include "crab/LoadingScreen.h"
#include "crab/common_header.h"
-#include "crab/cursor.h"
-#include "crab/gameeventmanager.h"
+#include "crab/input/cursor.h"
+#include "crab/event/gameeventmanager.h"
#include "crab/gamestate_container.h"
-#include "crab/hud.h"
-#include "crab/level.h"
-#include "crab/map.h"
-#include "crab/menu.h"
+#include "crab/ui/hud.h"
+#include "crab/level/level.h"
+#include "crab/ui/map.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index a5433027729..d090ad33274 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -36,9 +36,9 @@
#define CRAB_IMAGEMANAGER_H
#include "crab/GameParam.h"
-#include "crab/Image/Image.h"
+#include "crab/image/Image.h"
//#include "crab/LoadingScreen.h"
-//#include "crab/TMXTileSet.h"
+//#include "crab/TMX/TMXTileSet.h"
#include "crab/common_header.h"
#include "crab/input/cursor.h"
#include "crab/loaders.h"
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index e81e9aef97d..b5169d93930 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/fightinput.h"
+#include "crab/input/fightinput.h"
namespace Crab {
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 14123cf7c7b..07bcc652ab1 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -32,7 +32,7 @@
#define CRAB_FIGHTINPUT_H
#include "crab/common_header.h"
-#include "crab/input.h"
+#include "crab/input/input.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index 79e8e278550..583cee92fe7 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/hotkey.h"
+#include "crab/input/hotkey.h"
namespace Crab {
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 83a8fa43c68..7a7bb2ff650 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -32,7 +32,7 @@
#define CRAB_HOTKEY_H
#include "crab/common_header.h"
-#include "crab/input.h"
+#include "crab/input/input.h"
namespace Crab {
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index e5be1d87e0b..895c9426a59 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/input.h"
+#include "crab/input/input.h"
namespace Crab {
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index e4334187209..aefd2a9570a 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -32,7 +32,7 @@
#define CRAB_INPUT_H
#include "crab/common_header.h"
-#include "crab/inputval.h"
+#include "crab/input/inputval.h"
namespace Crab {
diff --git a/engines/crab/input/inputval.cpp b/engines/crab/input/inputval.cpp
index d61cd53810f..102dba49426 100644
--- a/engines/crab/input/inputval.cpp
+++ b/engines/crab/input/inputval.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/inputval.h"
+#include "crab/input/inputval.h"
namespace Crab {
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 05aa199145c..2430c2f0828 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/Item.h"
+#include "crab/item/Item.h"
namespace Crab {
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index b62cad65342..3b7184d6572 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -31,10 +31,10 @@
#ifndef CRAB_ITEM_H
#define CRAB_ITEM_H
-#include "crab/ImageManager.h"
-#include "crab/bonus.h"
+#include "crab/image/ImageManager.h"
+#include "crab/stat/bonus.h"
#include "crab/common_header.h"
-#include "crab/person.h"
+#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index ff5afa1996e..9ac3fac23ae 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ItemCollection.h"
+#include "crab/item/ItemCollection.h"
namespace Crab {
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index dd78494ec39..3e38bd773fd 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -31,8 +31,8 @@
#ifndef CRAB_ITEMCOLLECTION_H
#define CRAB_ITEMCOLLECTION_H
-#include "crab/ItemMenu.h"
-#include "crab/StatDrawHelper.h"
+#include "crab/item/ItemMenu.h"
+#include "crab/stat/StatDrawHelper.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 49a891ae492..e8e4c965e1b 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ItemMenu.h"
+#include "crab/item/ItemMenu.h"
namespace Crab {
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index 2cd0daa3329..9b427c8c5f8 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -31,13 +31,13 @@
#ifndef CRAB_ITEMMENU_H
#define CRAB_ITEMMENU_H
-#include "crab/ItemDesc.h"
-#include "crab/ItemSlot.h"
-#include "crab/StatDrawHelper.h"
-#include "crab/StatPreview.h"
+#include "crab/ui/ItemDesc.h"
+#include "crab/item/ItemSlot.h"
+#include "crab/stat/StatDrawHelper.h"
+#include "crab/item/StatPreview.h"
#include "crab/common_header.h"
-#include "crab/menu.h"
-#include "crab/person.h"
+#include "crab/ui/menu.h"
+#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 578b111a477..c4e725be5d6 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ItemSlot.h"
+#include "crab/item/ItemSlot.h"
namespace Crab {
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index 1bfc9b3d9a6..e67350f8862 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -31,9 +31,9 @@
#ifndef CRAB_ITEMSLOT_H
#define CRAB_ITEMSLOT_H
-#include "crab/ImageManager.h"
-#include "crab/Item.h"
-#include "crab/StateButton.h"
+#include "crab/image/ImageManager.h"
+#include "crab/item/Item.h"
+#include "crab/ui/StateButton.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index b20885287fc..a00f393465c 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/StatPreview.h"
+#include "crab/item/StatPreview.h"
namespace Crab {
diff --git a/engines/crab/item/StatPreview.h b/engines/crab/item/StatPreview.h
index 6a3935c9840..a847a2e4a4e 100644
--- a/engines/crab/item/StatPreview.h
+++ b/engines/crab/item/StatPreview.h
@@ -32,9 +32,9 @@
#define CRAB_STATPREVIEW_H
#include "crab/common_header.h"
-#include "crab/Item.h"
-#include "crab/SectionHeader.h"
-#include "crab/StatDrawHelper.h"
+#include "crab/item/Item.h"
+#include "crab/ui/SectionHeader.h"
+#include "crab/stat/StatDrawHelper.h"
namespace Crab {
diff --git a/engines/crab/level/LevelExit.cpp b/engines/crab/level/LevelExit.cpp
index d31b4525041..743074ccdad 100644
--- a/engines/crab/level/LevelExit.cpp
+++ b/engines/crab/level/LevelExit.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/LevelExit.h"
+#include "crab/level/LevelExit.h"
namespace Crab {
diff --git a/engines/crab/level/LevelExit.h b/engines/crab/level/LevelExit.h
index 87618594586..9914c67b422 100644
--- a/engines/crab/level/LevelExit.h
+++ b/engines/crab/level/LevelExit.h
@@ -31,8 +31,8 @@
#ifndef CRAB_LEVELEXIT_H
#define CRAB_LEVELEXIT_H
-#include "crab/GameEventInfo.h"
-#include "crab/ImageManager.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/image/ImageManager.h"
#include "crab/Shape.h"
#include "crab/common_header.h"
diff --git a/engines/crab/level/MusicArea.cpp b/engines/crab/level/MusicArea.cpp
index 5f4badd522e..dcbb123a25d 100644
--- a/engines/crab/level/MusicArea.cpp
+++ b/engines/crab/level/MusicArea.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/MusicArea.h"
+#include "crab/level/MusicArea.h"
namespace Crab {
diff --git a/engines/crab/level/MusicArea.h b/engines/crab/level/MusicArea.h
index daf8ddb8d02..d64f15cbe18 100644
--- a/engines/crab/level/MusicArea.h
+++ b/engines/crab/level/MusicArea.h
@@ -33,7 +33,7 @@
#include "crab/Shape.h"
#include "crab/common_header.h"
-#include "crab/musicparam.h"
+#include "crab/music/musicparam.h"
namespace Crab {
diff --git a/engines/crab/level/Stairs.cpp b/engines/crab/level/Stairs.cpp
index 1ee2052a8fc..58859ed968e 100644
--- a/engines/crab/level/Stairs.cpp
+++ b/engines/crab/level/Stairs.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/Stairs.h"
+#include "crab/level/Stairs.h"
namespace Crab {
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index f11f0d287dc..8b799f7496c 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/level.h"
+#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 7641113621c..973ada7385f 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -31,19 +31,19 @@
#ifndef CRAB_LEVEL_H
#define CRAB_LEVEL_H
-#include "crab/GameEventInfo.h"
-#include "crab/ImageManager.h"
-#include "crab/ParagraphData.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/image/ImageManager.h"
+#include "crab/ui/ParagraphData.h"
#include "crab/PathfindingGrid.h"
-#include "crab/TMXMap.h"
-#include "crab/animset.h"
-#include "crab/button.h"
+#include "crab/TMX/TMXMap.h"
+#include "crab/animation/animset.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
-#include "crab/fightmove.h"
-#include "crab/level_objects.h"
-#include "crab/person.h"
-#include "crab/sprite.h"
-#include "crab/talknotify.h"
+#include "crab/animation/fightmove.h"
+#include "crab/level/level_objects.h"
+#include "crab/people/person.h"
+#include "crab/animation/sprite.h"
+#include "crab/level/talknotify.h"
namespace Crab {
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index a2c6d6eeb08..8f421d21783 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/level.h"
+#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 373536626bf..8de530d2cf1 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/level.h"
+#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 63d3e488547..77faab8cac6 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/level.h"
+#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index a39b9bdf269..d74a645b1e6 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/level.h"
+#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index aeb955f52f1..54bdfa5486b 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/level_objects.h"
+#include "crab/level/level_objects.h"
namespace Crab {
diff --git a/engines/crab/level/level_objects.h b/engines/crab/level/level_objects.h
index ff91ce6c8d0..29d569de533 100644
--- a/engines/crab/level/level_objects.h
+++ b/engines/crab/level/level_objects.h
@@ -31,7 +31,7 @@
#ifndef CRAB_LEVEL_OBJECTS_H
#define CRAB_LEVEL_OBJECTS_H
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index b2afbc152a0..7464df714f1 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/talknotify.h"
+#include "crab/level/talknotify.h"
namespace Crab {
diff --git a/engines/crab/level/talknotify.h b/engines/crab/level/talknotify.h
index 62c51be90b2..81d9446a36e 100644
--- a/engines/crab/level/talknotify.h
+++ b/engines/crab/level/talknotify.h
@@ -31,10 +31,10 @@
#ifndef CRAB_TALKNOTIFY_H
#define CRAB_TALKNOTIFY_H
-#include "crab/GameEventInfo.h"
-#include "crab/ImageManager.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
-#include "crab/sprite.h"
+#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index a1818874a71..5f15ea0c818 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -31,22 +31,22 @@
#ifndef CRAB_MAINMENU_H
#define CRAB_MAINMENU_H
-#include "crab/AlphaImage.h"
-#include "crab/CreditScreen.h"
-#include "crab/FileMenu.h"
-#include "crab/ImageData.h"
-#include "crab/KeyBindMenu.h"
-#include "crab/ModMenu.h"
-#include "crab/OptionMenu.h"
-#include "crab/SlideShow.h"
-#include "crab/StateButton.h"
+#include "crab/ui/AlphaImage.h"
+#include "crab/ui/CreditScreen.h"
+#include "crab/ui/FileMenu.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/KeyBindMenu.h"
+#include "crab/ui/ModMenu.h"
+#include "crab/ui/OptionMenu.h"
+#include "crab/ui/SlideShow.h"
+#include "crab/ui/StateButton.h"
#include "crab/common_header.h"
-#include "crab/cursor.h"
+#include "crab/input/cursor.h"
#include "crab/gamestate_container.h"
#include "crab/gamestates.h"
-#include "crab/menu.h"
-#include "crab/slider.h"
-#include "crab/textarea.h"
+#include "crab/ui/menu.h"
+#include "crab/ui/slider.h"
+#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 16c0e4c6ca4..a1ef6fdbdcd 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/MusicManager.h"
+#include "crab/music/MusicManager.h"
#include "crab/ScreenSettings.h"
#include "crab/XMLDoc.h"
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index 30d7586b154..a1349ce7943 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -33,7 +33,7 @@
#include "crab/GameParam.h"
#include "crab/common_header.h"
-#include "crab/musicparam.h"
+#include "crab/music/musicparam.h"
namespace Crab {
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index 4ed20fe4644..e0e35ed67b0 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/opinion.h"
+#include "crab/people/opinion.h"
namespace Crab {
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index ba146b47fc4..83a938eaff8 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/person.h"
+#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index ad378722cca..9d8bc79895a 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -31,13 +31,13 @@
#ifndef CRAB_PERSON_H
#define CRAB_PERSON_H
-#include "crab/ImageManager.h"
-#include "crab/Stat.h"
-#include "crab/StatTemplate.h"
+#include "crab/image/ImageManager.h"
+#include "crab/stat/Stat.h"
+#include "crab/stat/StatTemplate.h"
#include "crab/common_header.h"
-#include "crab/opinion.h"
-#include "personbase.h"
-#include "crab/trait.h"
+#include "crab/people/opinion.h"
+#include "crab/people/personbase.h"
+#include "crab/people/trait.h"
namespace Crab {
diff --git a/engines/crab/people/personbase.cpp b/engines/crab/people/personbase.cpp
index 71975d1239b..a51b6298240 100644
--- a/engines/crab/people/personbase.cpp
+++ b/engines/crab/people/personbase.cpp
@@ -29,7 +29,7 @@
*/
-#include "personbase.h"
+#include "crab/people/personbase.h"
namespace Crab {
diff --git a/engines/crab/people/personbase.h b/engines/crab/people/personbase.h
index c7bb30401dc..a13e0641e67 100644
--- a/engines/crab/people/personbase.h
+++ b/engines/crab/people/personbase.h
@@ -31,7 +31,7 @@
#ifndef CRAB_PERSONBASE_H
#define CRAB_PERSONBASE_H
-#include "crab/Stat.h"
+#include "crab/stat/Stat.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index da3d4eb0413..00326beec11 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/trait.h"
+#include "crab/people/trait.h"
namespace Crab {
diff --git a/engines/crab/people/trait.h b/engines/crab/people/trait.h
index 5ca89a46e08..35059b64319 100644
--- a/engines/crab/people/trait.h
+++ b/engines/crab/people/trait.h
@@ -31,7 +31,7 @@
#ifndef CRAB_TRAIT_H
#define CRAB_TRAIT_H
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/resource.h b/engines/crab/resource.h
index b284952124e..aaf4dab4a0a 100644
Binary files a/engines/crab/resource.h and b/engines/crab/resource.h differ
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 7ea13657964..beb813c9322 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -36,12 +36,12 @@
#define CRAB_SPLASH_H
#include "crab/crab.h"
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
//#include "crab/LoadingScreen.h"
-//#include "crab/MusicManager.h"
+//#include "crab/music/MusicManager.h"
//#include "crab/image/Image.h"
#include "crab/ScreenSettings.h"
-//#include "crab/TextManager.h"
+//#include "crab/text/TextManager.h"
#include "crab/common_header.h"
#include "crab/gamestate_container.h"
#include "crab/gamestates.h"
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index 182bf6cb152..c4ae1cc07b8 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/Stat.h"
+#include "crab/stat/Stat.h"
namespace Crab {
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index 49744bfbb87..6dc23c1f63b 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -32,8 +32,8 @@
#define CRAB_STAT_H
#include "crab/common_header.h"
-#include "crab/ImageManager.h"
-#include "crab/TextManager.h"
+#include "crab/image/ImageManager.h"
+#include "crab/text/TextManager.h"
namespace Crab {
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index e37980a3254..212aba34509 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/StatDrawHelper.h"
+#include "crab/stat/StatDrawHelper.h"
namespace Crab {
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index d60e64dfc11..67596974316 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -32,8 +32,8 @@
#define CRAB_STATDRAWHELPER_H
#include "crab/common_header.h"
-#include "crab/TextData.h"
-#include "crab/person.h"
+#include "crab/ui/TextData.h"
+#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index d2a9bec7bfb..7adf7f65dd9 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/StatTemplate.h"
+#include "crab/stat/StatTemplate.h"
#include "crab/XMLDoc.h"
namespace Crab {
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index e48e68a67f6..c3cb1020efd 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -32,7 +32,7 @@
#define CRAB_STATTEMPLATE_H
#include "crab/common_header.h"
-#include "crab/Stat.h"
+#include "crab/stat/Stat.h"
namespace Crab {
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index f20bd05506c..439daf71907 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/TextManager.h"
+#include "crab/text/TextManager.h"
#include "crab/XMLDoc.h"
namespace Crab {
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 104599a74eb..010b8383a3c 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -32,8 +32,8 @@
#define CRAB_TEXTMANAGER_H
#include "crab/GameParam.h"
-#include "crab/Image.h"
-#include "crab/color.h"
+#include "crab/image/Image.h"
+#include "crab/text/color.h"
#include "crab/common_header.h"
#include "crab/vectors.h"
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index 16e64fd7de1..41ab986cb9c 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/color.h"
+#include "crab/text/color.h"
namespace Crab {
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 93aa4786f69..37b00551e54 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "crab/AlphaImage.h"
-#include "crab/TextManager.h"
+#include "crab/ui/AlphaImage.h"
+#include "crab/text/TextManager.h"
namespace Crab {
diff --git a/engines/crab/ui/AlphaImage.h b/engines/crab/ui/AlphaImage.h
index 02159a54275..393ef7bf685 100644
--- a/engines/crab/ui/AlphaImage.h
+++ b/engines/crab/ui/AlphaImage.h
@@ -31,9 +31,9 @@
#ifndef CRAB_ALPHAIMAGE_H
#define CRAB_ALPHAIMAGE_H
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
-#include "crab/element.h"
+#include "crab/ui/element.h"
namespace Crab {
diff --git a/engines/crab/ui/Caption.cpp b/engines/crab/ui/Caption.cpp
index 9adb15fee6a..42ac991bc55 100644
--- a/engines/crab/ui/Caption.cpp
+++ b/engines/crab/ui/Caption.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/Caption.h"
+#include "crab/ui/Caption.h"
namespace Crab {
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index 9c7a5517db5..5723cc5c6b6 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -32,7 +32,7 @@
#define CRAB_CAPTION_H
#include "crab/common_header.h"
-#include "crab/TextData.h"
+#include "crab/ui/TextData.h"
namespace Crab {
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index bdc7f25f87f..39e75cf5721 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ChapterIntro.h"
+#include "crab/ui/ChapterIntro.h"
namespace Crab {
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index e00bedaf052..3ef54dd596f 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -31,10 +31,10 @@
#ifndef CRAB_CHAPTERINTRO_H
#define CRAB_CHAPTERINTRO_H
-#include "crab/GameEventInfo.h"
-#include "crab/button.h"
-#include "crab/dialogbox.h"
-#include "crab/sprite.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/button.h"
+#include "crab/ui/dialogbox.h"
+#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index c2a4a58a82c..a78e61272f2 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/ClipButton.h"
+#include "crab/ui/ClipButton.h"
namespace Crab {
diff --git a/engines/crab/ui/ClipButton.h b/engines/crab/ui/ClipButton.h
index 7cbc9589786..9280a7ec9cb 100644
--- a/engines/crab/ui/ClipButton.h
+++ b/engines/crab/ui/ClipButton.h
@@ -30,7 +30,7 @@
#ifndef CRAB_CLIPBUTTON_H
#define CRAB_CLIPBUTTON_H
-#include "crab/button.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 03c262d62b4..5183c2d3b58 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/CreditScreen.h"
+#include "crab/ui/CreditScreen.h"
#include "crab/url.h"
namespace Crab {
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 80f251489bd..03fa2d9bdd9 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -31,10 +31,10 @@
#ifndef CRAB_CREDITSCREEN_H
#define CRAB_CREDITSCREEN_H
-#include "crab/ImageData.h"
-#include "crab/TextData.h"
-#include "crab/TextManager.h"
-#include "crab/button.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/TextData.h"
+#include "crab/text/TextManager.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
#include "crab/timer.h"
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 11a17c05836..42f92147604 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/DevConsole.h"
+#include "crab/ui/DevConsole.h"
namespace Crab {
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index ff7c8d877ef..f58b05b91ba 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -31,9 +31,9 @@
#ifndef CRAB_DEVCONSOLE_H
#define CRAB_DEVCONSOLE_H
-#include "crab/GameEventInfo.h"
+#include "crab/event/GameEventInfo.h"
#include "crab/common_header.h"
-#include "crab/textarea.h"
+#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/FileData.cpp b/engines/crab/ui/FileData.cpp
index c8dbec08ba8..7063c424d0a 100644
--- a/engines/crab/ui/FileData.cpp
+++ b/engines/crab/ui/FileData.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/FileData.h"
+#include "crab/ui/FileData.h"
namespace Crab {
diff --git a/engines/crab/ui/FileMenu.cpp b/engines/crab/ui/FileMenu.cpp
index 2b1867208c7..3cec57efef0 100644
--- a/engines/crab/ui/FileMenu.cpp
+++ b/engines/crab/ui/FileMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/FileMenu.h"
+#include "crab/ui/FileMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 85fb701cbe7..046f03a618e 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -31,10 +31,10 @@
#ifndef CRAB_FILEMENU_H
#define CRAB_FILEMENU_H
-#include "crab/FileData.h"
-#include "crab/ImageData.h"
-#include "crab/PageMenu.h"
-#include "crab/TextData.h"
+#include "crab/ui/FileData.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/PageMenu.h"
+#include "crab/ui/TextData.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index b8713b3a7b0..49db78ef479 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/GameOverMenu.h"
+#include "crab/ui/GameOverMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index bf934fe6139..e0a6676b651 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -31,10 +31,10 @@
#ifndef CRAB_GAMEOVERMENU_H
#define CRAB_GAMEOVERMENU_H
-#include "crab/ImageData.h"
-#include "crab/TextData.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/TextData.h"
#include "crab/common_header.h"
-#include "crab/menu.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 802c5ec2036..6f014a82031 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/GeneralSettingMenu.h"
+#include "crab/ui/GeneralSettingMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 649e4bae8ef..8a037c5bf73 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -31,10 +31,10 @@
#ifndef CRAB_GENERALSETTINGMENU_H
#define CRAB_GENERALSETTINGMENU_H
-#include "crab/RadioButtonMenu.h"
-#include "crab/ToggleButton.h"
+#include "crab/ui/RadioButtonMenu.h"
+#include "crab/ui/ToggleButton.h"
#include "crab/common_header.h"
-#include "crab/slider.h"
+#include "crab/ui/slider.h"
namespace Crab {
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 26648a018f4..341c3af2404 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/GfxSettingMenu.h"
+#include "crab/ui/GfxSettingMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 2e44339ced1..12b6d5789ee 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -31,12 +31,12 @@
#ifndef CRAB_GFXSETTINGMENU_H
#define CRAB_GFXSETTINGMENU_H
-#include "crab/ImageData.h"
-#include "crab/ResolutionMenu.h"
-#include "crab/StateButton.h"
-#include "crab/ToggleButton.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/ResolutionMenu.h"
+#include "crab/ui/StateButton.h"
+#include "crab/ui/ToggleButton.h"
#include "crab/common_header.h"
-#include "crab/slider.h"
+#include "crab/ui/slider.h"
namespace Crab {
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 4ad25a20a58..23cf27ac1b8 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/HealthIndicator.h"
+#include "crab/ui/HealthIndicator.h"
namespace Crab {
diff --git a/engines/crab/ui/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
index 9beff16a362..08df7bbcbd0 100644
--- a/engines/crab/ui/HealthIndicator.h
+++ b/engines/crab/ui/HealthIndicator.h
@@ -32,7 +32,7 @@
#define CRAB_HEALTHINDICATOR_H
#include "crab/common_header.h"
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
namespace Crab {
diff --git a/engines/crab/ui/HoverInfo.cpp b/engines/crab/ui/HoverInfo.cpp
index d47fb8a2745..6a43c8ae68b 100644
--- a/engines/crab/ui/HoverInfo.cpp
+++ b/engines/crab/ui/HoverInfo.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/HoverInfo.h"
+#include "crab/ui/HoverInfo.h"
namespace Crab {
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index 81cae87d9b9..d0f4286b744 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -32,7 +32,7 @@
#define CRAB_HOVERINFO_H
#include "crab/common_header.h"
-#include "crab/TextData.h"
+#include "crab/ui/TextData.h"
namespace Crab {
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 7f60536fa5c..72877fe486a 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ImageData.h"
+#include "crab/ui/ImageData.h"
namespace Crab {
diff --git a/engines/crab/ui/ImageData.h b/engines/crab/ui/ImageData.h
index ba8e2add872..60cd4551402 100644
--- a/engines/crab/ui/ImageData.h
+++ b/engines/crab/ui/ImageData.h
@@ -31,9 +31,9 @@
#ifndef CRAB_IMAGEDATA_H
#define CRAB_IMAGEDATA_H
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
-#include "crab/element.h"
+#include "crab/ui/element.h"
namespace Crab {
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 1c8f9d1aa23..0ca8340505a 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/Inventory.h"
+#include "crab/ui/Inventory.h"
namespace Crab {
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index d65d3d26b2e..0f113f117ab 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -31,11 +31,11 @@
#ifndef CRAB_INVENTORY_H
#define CRAB_INVENTORY_H
-#include "crab/ImageData.h"
-#include "crab/ItemCollection.h"
-#include "crab/ItemSlot.h"
-#include "crab/Stat.h"
-#include "crab/button.h"
+#include "crab/ui/ImageData.h"
+#include "crab/item/ItemCollection.h"
+#include "crab/item/ItemSlot.h"
+#include "crab/stat/Stat.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index 397c34bd0d5..adba91a2ffd 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -31,9 +31,9 @@
#ifndef CRAB_ITEMDESC_H
#define CRAB_ITEMDESC_H
-#include "crab/Item.h"
-#include "crab/ParagraphData.h"
-#include "crab/SectionHeader.h"
+#include "crab/item/Item.h"
+#include "crab/ui/ParagraphData.h"
+#include "crab/ui/SectionHeader.h"
namespace Crab {
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index 461447edf2d..9b604f2c215 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/KeyBindMenu.h"
+#include "crab/ui/KeyBindMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index bbb59e311bf..d3538e052e3 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -31,10 +31,10 @@
#ifndef CRAB_KEYBINDMENU_H
#define CRAB_KEYBINDMENU_H
-#include "crab/ImageData.h"
-#include "crab/OptionSelect.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/OptionSelect.h"
#include "crab/common_header.h"
-#include "crab/menu.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index 1ea4485a4bc..904fa2a4608 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/MapData.h"
+#include "crab/ui/MapData.h"
namespace Crab {
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 2b1323a8f05..3c0197a14eb 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/MapMarkerMenu.h"
+#include "crab/ui/MapMarkerMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 50eeb0e8efa..53ead0b93c2 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -31,9 +31,9 @@
#ifndef CRAB_MAPMARKERMENU_H
#define CRAB_MAPMARKERMENU_H
-#include "crab/StateButton.h"
+#include "crab/ui/StateButton.h"
#include "crab/common_header.h"
-#include "crab/menu.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 66f58210166..41068525cf2 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ModMenu.h"
+#include "crab/ui/ModMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index 1dcd96606aa..14d2cab7d28 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -31,7 +31,7 @@
#ifndef CRAB_MODMENU_H
#define CRAB_MODMENU_H
-#include "crab/FileMenu.h"
+#include "crab/ui/FileMenu.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 065a015c6ec..7595c6b60c9 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/OptionMenu.h"
+#include "crab/ui/OptionMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 19d0572acda..08d5912caaf 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -31,14 +31,14 @@
#ifndef CRAB_OPTIONMENU_H
#define CRAB_OPTIONMENU_H
-#include "crab/GeneralSettingMenu.h"
-#include "crab/GfxSettingMenu.h"
-#include "crab/ImageData.h"
-#include "crab/KeyBindMenu.h"
-#include "crab/StateButton.h"
-#include "crab/ToggleButton.h"
+#include "crab/ui/GeneralSettingMenu.h"
+#include "crab/ui/GfxSettingMenu.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/KeyBindMenu.h"
+#include "crab/ui/StateButton.h"
+#include "crab/ui/ToggleButton.h"
#include "crab/common_header.h"
-#include "crab/slider.h"
+#include "crab/ui/slider.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 867450f7124..ba11985be82 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/OptionSelect.h"
+#include "crab/ui/OptionSelect.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index ee10083dfce..3257bba1e09 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -32,8 +32,8 @@
#define CRAB_OPTIONSELECT_H
#include "crab/common_header.h"
-#include "crab/TextData.h"
-#include "crab/button.h"
+#include "crab/ui/TextData.h"
+#include "crab/ui/button.h"
namespace Crab {
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 5a0c62dd021..2ee22204185 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -32,7 +32,7 @@
#define CRAB_PAGEMENU_H
#include "crab/common_header.h"
-#include "crab/menu.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index 7773d281516..46997c66e0e 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ParagraphData.h"
+#include "crab/ui/ParagraphData.h"
namespace Crab {
diff --git a/engines/crab/ui/ParagraphData.h b/engines/crab/ui/ParagraphData.h
index 966bb1b8194..9a7bca17a4b 100644
--- a/engines/crab/ui/ParagraphData.h
+++ b/engines/crab/ui/ParagraphData.h
@@ -31,7 +31,7 @@
#ifndef CRAB_PARAGRAPHDATA_H
#define CRAB_PARAGRAPHDATA_H
-#include "crab/TextData.h"
+#include "crab/ui/TextData.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 0a69899b278..60eb2e34544 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/PauseMenu.h"
+#include "crab/ui/PauseMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index be6d8eecea6..4201fe2f9ff 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -31,15 +31,15 @@
#ifndef CRAB_PAUSEMENU_H
#define CRAB_PAUSEMENU_H
-#include "crab/FileMenu.h"
-#include "crab/GameEventInfo.h"
-#include "crab/OptionMenu.h"
-#include "crab/SaveGameMenu.h"
-#include "crab/SlideShow.h"
+#include "crab/ui/FileMenu.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/OptionMenu.h"
+#include "crab/ui/SaveGameMenu.h"
+#include "crab/ui/SlideShow.h"
#include "crab/common_header.h"
-#include "crab/menu.h"
-#include "crab/slider.h"
-#include "crab/textarea.h"
+#include "crab/ui/menu.h"
+#include "crab/ui/slider.h"
+#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 181d72e7f06..1c60f260045 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/PersonHandler.h"
+#include "crab/ui/PersonHandler.h"
namespace Crab {
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index 31f9340a0d1..c79fc1a5855 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -31,13 +31,13 @@
#ifndef CRAB_PERSONHANDLER_H
#define CRAB_PERSONHANDLER_H
-#include "crab/GameEventInfo.h"
-#include "crab/ProgressBar.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/ProgressBar.h"
#include "crab/common_header.h"
-#include "crab/dialogbox.h"
-#include "crab/gameevent.h"
-#include "crab/person.h"
-#include "crab/sprite.h"
+#include "crab/ui/dialogbox.h"
+#include "crab/event/gameevent.h"
+#include "crab/people/person.h"
+#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index d360049aed1..fa7be7554cb 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/PersonScreen.h"
+#include "crab/ui/PersonScreen.h"
namespace Crab {
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 97f862f67e1..7c6f851683b 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -31,14 +31,14 @@
#ifndef CRAB_PERSONSCREEN_H
#define CRAB_PERSONSCREEN_H
-#include "crab/GameEventInfo.h"
-#include "crab/ImageData.h"
-#include "crab/TraitMenu.h"
-#include "crab/gameevent.h"
-#include "crab/level.h"
-#include "crab/menu.h"
-#include "crab/person.h"
-#include "crab/sprite.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/TraitMenu.h"
+#include "crab/event/gameevent.h"
+#include "crab/level/level.h"
+#include "crab/ui/menu.h"
+#include "crab/people/person.h"
+#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index e0e34eae850..99a70976fed 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ProgressBar.h"
+#include "crab/ui/ProgressBar.h"
namespace Crab {
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index b03239d7038..f23d7239e44 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -31,7 +31,7 @@
#ifndef CRAB_PROGRESSBAR_H
#define CRAB_PROGRESSBAR_H
-#include "crab/ClipButton.h"
+#include "crab/ui/ClipButton.h"
#include "crab/common_header.h"
#include "crab/timer.h"
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 788089d0d03..bde2980deb5 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/QuestText.h"
+#include "crab/ui/QuestText.h"
namespace Crab {
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index f56a84e2486..ed03d2e9119 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -31,11 +31,11 @@
#ifndef CRAB_QUESTTEXT_H
#define CRAB_QUESTTEXT_H
-#include "crab/ImageData.h"
-#include "crab/ParagraphData.h"
-#include "crab/button.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/ParagraphData.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
-#include "crab/quest.h"
+#include "crab/event/quest.h"
namespace Crab {
diff --git a/engines/crab/ui/RadioButton.h b/engines/crab/ui/RadioButton.h
index d30f67e1501..d4507b670fc 100644
--- a/engines/crab/ui/RadioButton.h
+++ b/engines/crab/ui/RadioButton.h
@@ -31,7 +31,7 @@
#ifndef CRAB_RADIOBUTTON_H
#define CRAB_RADIOBUTTON_H
-#include "crab/ToggleButton.h"
+#include "crab/ui/ToggleButton.h"
namespace Crab {
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index e40d8532343..1ed55c16e71 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -31,8 +31,8 @@
#ifndef CRAB_RADIOBUTTONMENU_H
#define CRAB_RADIOBUTTONMENU_H
-#include "crab/RadioButton.h"
-#include "crab/menu.h"
+#include "crab/ui/RadioButton.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 0ae92444719..24bb91587f4 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ReplyButton.h"
+#include "crab/ui/ReplyButton.h"
namespace Crab {
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index 2078e605b77..da051d8a458 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -31,7 +31,7 @@
#ifndef CRAB_REPLYBUTTON_H
#define CRAB_REPLYBUTTON_H
-#include "crab/button.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 34ff741866b..e0487d1776a 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ReplyMenu.h"
+#include "crab/ui/ReplyMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index 739ddd7f935..33b5d34c83c 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -31,15 +31,15 @@
#ifndef CRAB_REPLYMENU_H
#define CRAB_REPLYMENU_H
-#include "crab/GameEventInfo.h"
-#include "crab/ImageData.h"
-#include "crab/PersonHandler.h"
-#include "crab/ReplyButton.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/PersonHandler.h"
+#include "crab/ui/ReplyButton.h"
#include "crab/common_header.h"
-#include "crab/conversationdata.h"
-#include "crab/emotion.h"
-#include "crab/eventstore.h"
-#include "crab/menu.h"
+#include "crab/event/conversationdata.h"
+#include "crab/ui/emotion.h"
+#include "crab/event/eventstore.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 802c609eb9e..501d2c17df5 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -29,7 +29,7 @@
*/
-#include "crab/ResolutionMenu.h"
+#include "crab/ui/ResolutionMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index ea50e8d554a..e4d66d0144e 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -32,8 +32,8 @@
#define CRAB_RESOLUTIONMENU_H
#include "crab/common_header.h"
-#include "crab/menu.h"
-#include "crab/textarea.h"
+#include "crab/ui/menu.h"
+#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index cef35183d03..2c22b99065a 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/SaveGameMenu.h"
+#include "crab/ui/SaveGameMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 70a9583ecd3..ece98d0c7d9 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -31,9 +31,9 @@
#ifndef CRAB_SAVEGAMEMENU_H
#define CRAB_SAVEGAMEMENU_H
-#include "crab/FileMenu.h"
+#include "crab/ui/FileMenu.h"
#include "crab/common_header.h"
-#include "crab/textarea.h"
+#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 09b6816a538..03891374858 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/SectionHeader.h"
+#include "crab/ui/SectionHeader.h"
namespace Crab {
diff --git a/engines/crab/ui/SectionHeader.h b/engines/crab/ui/SectionHeader.h
index d31f434a1e2..ea90169c4bb 100644
--- a/engines/crab/ui/SectionHeader.h
+++ b/engines/crab/ui/SectionHeader.h
@@ -31,9 +31,9 @@
#ifndef CRAB_SECTIONHEADER_H
#define CRAB_SECTIONHEADER_H
-#include "crab/ImageManager.h"
-#include "crab/TextData.h"
-#include "crab/TextManager.h"
+#include "crab/image/ImageManager.h"
+#include "crab/ui/TextData.h"
+#include "crab/text/TextManager.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 2416a1e968f..2318df3f2a0 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/SlideShow.h"
+#include "crab/ui/SlideShow.h"
namespace Crab {
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 0533c330c9c..75bb2000908 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -31,9 +31,9 @@
#ifndef CRAB_SLIDESHOW_H
#define CRAB_SLIDESHOW_H
-#include "crab/Image.h"
-#include "crab/ImageData.h"
-#include "crab/button.h"
+#include "crab/image/Image.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index 36628f3c4bd..5481d7c1024 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/StateButton.h"
+#include "crab/ui/StateButton.h"
namespace Crab {
diff --git a/engines/crab/ui/StateButton.h b/engines/crab/ui/StateButton.h
index 7b47d3e9963..6732b779939 100644
--- a/engines/crab/ui/StateButton.h
+++ b/engines/crab/ui/StateButton.h
@@ -31,7 +31,7 @@
#ifndef CRAB_STATEBUTTON_H
#define CRAB_STATEBUTTON_H
-#include "crab/button.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index d15379ab0a4..a71386f203a 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -31,9 +31,9 @@
#ifndef CRAB_TEXTDATA_H
#define CRAB_TEXTDATA_H
-#include "crab/TextManager.h"
+#include "crab/text/TextManager.h"
#include "crab/common_header.h"
-#include "crab/element.h"
+#include "crab/ui/element.h"
namespace Crab {
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 88a1a4a0a0e..cc5af5a33a4 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/ToggleButton.h"
+#include "crab/ui/ToggleButton.h"
namespace Crab {
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index acc7d1662a0..38c682141c1 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -31,7 +31,7 @@
#ifndef CRAB_TOGGLEBUTTON_H
#define CRAB_TOGGLEBUTTON_H
-#include "crab/button.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index 3a7ee6904ae..29b17e62947 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/TraitButton.h"
+#include "crab/ui/TraitButton.h"
namespace Crab {
diff --git a/engines/crab/ui/TraitButton.h b/engines/crab/ui/TraitButton.h
index a9db91f2401..5f5fd7738a3 100644
--- a/engines/crab/ui/TraitButton.h
+++ b/engines/crab/ui/TraitButton.h
@@ -31,9 +31,9 @@
#ifndef CRAB_TRAITBUTTON_H
#define CRAB_TRAITBUTTON_H
-#include "crab/StateButton.h"
+#include "crab/ui/StateButton.h"
#include "crab/common_header.h"
-#include "crab/trait.h"
+#include "crab/people/trait.h"
namespace Crab {
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index e375584faf3..25a12e3542f 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/TraitMenu.h"
+#include "crab/ui/TraitMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index 673656e226b..6420636fa58 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -31,11 +31,11 @@
#ifndef CRAB_TRAITMENU_H
#define CRAB_TRAITMENU_H
-#include "crab/ParagraphData.h"
-#include "crab/TraitButton.h"
+#include "crab/ui/ParagraphData.h"
+#include "crab/ui/TraitButton.h"
#include "crab/common_header.h"
-#include "crab/menu.h"
-#include "crab/person.h"
+#include "crab/ui/menu.h"
+#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 7344d991456..e8674cf7808 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: Contains the button functions
//=============================================================================
-#include "crab/button.h"
+#include "crab/ui/button.h"
namespace Crab {
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index 59b88a87d6a..6ab8244df67 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -35,14 +35,14 @@
#ifndef CRAB_BUTTON_H
#define CRAB_BUTTON_H
-#include "crab/Caption.h"
-#include "crab/HoverInfo.h"
-#include "crab/ImageManager.h"
-#include "crab/MusicManager.h"
-#include "crab/TextManager.h"
+#include "crab/ui/Caption.h"
+#include "crab/ui/HoverInfo.h"
+#include "crab/image/ImageManager.h"
+#include "crab/music/MusicManager.h"
+#include "crab/text/TextManager.h"
#include "crab/common_header.h"
-#include "crab/element.h"
-#include "crab/hotkey.h"
+#include "crab/ui/element.h"
+#include "crab/input/hotkey.h"
namespace Crab {
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index 9aa0ee740b1..b208d8378c1 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: Dialog box!
//=============================================================================
-#include "crab/dialogbox.h"
+#include "crab/ui/dialogbox.h"
namespace Crab {
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index a783448d675..32dd2434538 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -35,9 +35,9 @@
#ifndef CRAB_DIALOGBOX_H
#define CRAB_DIALOGBOX_H
-#include "crab/GameEventInfo.h"
-#include "crab/ParagraphData.h"
-#include "crab/button.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/ParagraphData.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index ef0208aad47..3e211408808 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/element.h"
+#include "crab/ui/element.h"
namespace Crab {
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index 8c012622010..7f30fefcb8d 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -31,7 +31,7 @@
#ifndef CRAB_ELEMENT_H
#define CRAB_ELEMENT_H
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/ScreenSettings.h"
#include "crab/common_header.h"
#include "crab/vectors.h"
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index bc230964ccd..9677182aa6e 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/emotion.h"
+#include "crab/ui/emotion.h"
namespace Crab {
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index 1efab7861d3..7405697c0c6 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -31,10 +31,10 @@
#ifndef CRAB_EMOTION_H
#define CRAB_EMOTION_H
-#include "crab/ImageManager.h"
+#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
-#include "crab/eventstore.h"
-#include "crab/textarea.h"
+#include "crab/event/eventstore.h"
+#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index ed08b19cdc1..7e9fb63db74 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: The tray where you have inventory, map and GameObjectives icons
//=============================================================================
-#include "crab/hud.h"
+#include "crab/ui/hud.h"
namespace Crab {
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 7d1801532a2..f630c35cedc 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -35,17 +35,17 @@
#ifndef CRAB_HUD_H
#define CRAB_HUD_H
-#include "crab/FileMenu.h"
-#include "crab/GameEventInfo.h"
-#include "crab/GameOverMenu.h"
-#include "crab/HealthIndicator.h"
-#include "crab/PauseMenu.h"
-#include "crab/SlideShow.h"
-#include "crab/StateButton.h"
+#include "crab/ui/FileMenu.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/GameOverMenu.h"
+#include "crab/ui/HealthIndicator.h"
+#include "crab/ui/PauseMenu.h"
+#include "crab/ui/SlideShow.h"
+#include "crab/ui/StateButton.h"
#include "crab/common_header.h"
-#include "crab/input.h"
-#include "crab/level_objects.h"
-#include "crab/talknotify.h"
+#include "crab/input/input.h"
+#include "crab/level/level_objects.h"
+#include "crab/level/talknotify.h"
namespace Crab {
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 00fd7498f89..8c2f8dcd332 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/journal.h"
+#include "crab/ui/journal.h"
namespace Crab {
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 1a01021014c..15cbd910e0a 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -31,11 +31,11 @@
#ifndef CRAB_JOURNAL_H
#define CRAB_JOURNAL_H
-#include "crab/ImageData.h"
-#include "crab/ImageManager.h"
-#include "crab/StateButton.h"
+#include "crab/ui/ImageData.h"
+#include "crab/image/ImageManager.h"
+#include "crab/ui/StateButton.h"
#include "crab/common_header.h"
-#include "crab/questmenu.h"
+#include "crab/ui/questmenu.h"
namespace Crab {
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index d4fc089c084..dfa0543a101 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/map.h"
+#include "crab/ui/map.h"
namespace Crab {
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 5f4d47353eb..052888b607d 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -31,16 +31,16 @@
#ifndef CRAB_MAP_H
#define CRAB_MAP_H
-#include "crab/GameEventInfo.h"
-#include "crab/ImageData.h"
-#include "crab/ImageManager.h"
-#include "crab/MapData.h"
-#include "crab/MapMarkerMenu.h"
-#include "crab/StateButton.h"
-#include "crab/ToggleButton.h"
+#include "crab/event/GameEventInfo.h"
+#include "crab/ui/ImageData.h"
+#include "crab/image/ImageManager.h"
+#include "crab/ui/MapData.h"
+#include "crab/ui/MapMarkerMenu.h"
+#include "crab/ui/StateButton.h"
+#include "crab/ui/ToggleButton.h"
#include "crab/common_header.h"
-#include "crab/mapbutton.h"
-#include "crab/triggerset.h"
+#include "crab/ui/mapbutton.h"
+#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/ui/mapbutton.h b/engines/crab/ui/mapbutton.h
index 09309d5a528..56e694fb8b3 100644
--- a/engines/crab/ui/mapbutton.h
+++ b/engines/crab/ui/mapbutton.h
@@ -32,8 +32,8 @@
#define CRAB_MAPBUTTON_H
#include "crab/common_header.h"
-#include "crab/menu.h"
-#include "crab/triggerset.h"
+#include "crab/ui/menu.h"
+#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index cee53bcdda9..3bd1d017519 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -35,8 +35,8 @@
#ifndef CRAB_MENU_H
#define CRAB_MENU_H
-#include "crab/ImageManager.h"
-#include "crab/button.h"
+#include "crab/image/ImageManager.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 1a989a91e5b..1d1f05a4698 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/questmenu.h"
+#include "crab/ui/questmenu.h"
namespace Crab {
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index ea8e6faef2a..74c62c5c69b 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -31,11 +31,11 @@
#ifndef CRAB_QUESTMENU_H
#define CRAB_QUESTMENU_H
-#include "crab/PageMenu.h"
-#include "crab/QuestText.h"
-#include "crab/StateButton.h"
+#include "crab/ui/PageMenu.h"
+#include "crab/ui/QuestText.h"
+#include "crab/ui/StateButton.h"
#include "crab/common_header.h"
-#include "crab/quest.h"
+#include "crab/event/quest.h"
namespace Crab {
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 2fd3c1f50b0..e4aee95c942 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/slider.h"
+#include "crab/ui/slider.h"
namespace Crab {
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index c7927ae18c2..f710fce8a07 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -31,10 +31,10 @@
#ifndef CRAB_SLIDER_H
#define CRAB_SLIDER_H
-#include "crab/Caption.h"
-#include "crab/ImageData.h"
-#include "crab/ImageManager.h"
-#include "crab/button.h"
+#include "crab/ui/Caption.h"
+#include "crab/ui/ImageData.h"
+#include "crab/image/ImageManager.h"
+#include "crab/ui/button.h"
#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 25b78ed40aa..5347391cef7 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -32,7 +32,7 @@
// Author: Arvind
// Purpose: TextArea functions
//=============================================================================
-#include "crab/textarea.h"
+#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 0303e947d59..d35b370d4d2 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -35,11 +35,11 @@
#ifndef CRAB_TEXTAREA_H
#define CRAB_TEXTAREA_H
-#include "crab/HoverInfo.h"
-#include "crab/MusicManager.h"
-#include "crab/TextManager.h"
+#include "crab/ui/HoverInfo.h"
+#include "crab/music/MusicManager.h"
+#include "crab/text/TextManager.h"
#include "crab/common_header.h"
-#include "crab/input.h"
+#include "crab/input/input.h"
namespace Crab {
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index 1e27df44a13..6414ed13735 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -28,7 +28,7 @@
*
*/
-#include "crab/TextData.h"
+#include "crab/ui/TextData.h"
namespace Crab {
Commit: c8bf335029bc5c54903bca9ad70d338e9db7d3b6
https://github.com/scummvm/scummvm/commit/c8bf335029bc5c54903bca9ad70d338e9db7d3b6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Start making item component compilable
This doesn't compile yet.
Changed paths:
engines/crab/common_header.h
engines/crab/crab.cpp
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/loaders.h
engines/crab/module.mk
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index e501d2efa4e..c04806aa35f 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -31,20 +31,20 @@
#ifndef CRAB_COMMON_HEADER_H
#define CRAB_COMMON_HEADER_H
-#if 0
-#include <algorithm>
+//#include <algorithm>
#include <cmath>
-#include <ctime>
+//#include <ctime>
#include <deque>
-#include <fstream>
+//#include <fstream>
#include <limits.h>
#include <map>
-#include <random>
-#include <sstream>
+//#include <random>
+//#include <sstream>
#include <string>
#include <unordered_map>
#include <vector>
+#if 0
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include <SDL2/SDL_mixer.h>
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 50b040d15a2..a26a62a27d4 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -49,6 +49,9 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
+
#include "crab/crab.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 9ac3fac23ae..6feec3b65c6 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -66,6 +66,7 @@ void ItemCollection::Init(const std::string &char_id) {
item[char_id].Init(ref, inc, rows, cols, usekeyboard);
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
@@ -73,6 +74,7 @@ void ItemCollection::HandleEvents(const std::string &char_id, const SDL_Event &E
if (item.count(char_id) > 0)
item[char_id].HandleEvents(Event);
}
+#endif
//------------------------------------------------------------------------
// Purpose: Draw
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 3e38bd773fd..29fe0163ed0 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -70,7 +70,10 @@ public:
~ItemCollection() {}
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
void HandleEvents(const std::string &char_id, const SDL_Event &Event);
+#endif
void Init(const std::string &char_id);
void Draw(const std::string &char_id);
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index e8e4c965e1b..80af6b975e8 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -69,6 +69,7 @@ void ItemMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
i->SaveState(doc, root);
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
//------------------------------------------------------------------------
@@ -80,6 +81,7 @@ void ItemMenu::HandleEvents(const SDL_Event &Event, const int &XOffset, const in
element.at(i).State(i == select_index);
}
}
+#endif
//------------------------------------------------------------------------
// Purpose: Draw the slot backgrounds first, then the items
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index 9b427c8c5f8..c13bda07137 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -70,7 +70,9 @@ public:
void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
const unsigned int &cols, const bool &keyboard);
+#if 0
void HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+#endif
/* pyrodactyl::people::Person &obj,*/
bool Swap(ItemMenu &target, int index);
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index c4e725be5d6..920055870b9 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -103,6 +103,9 @@ void ItemSlot::LoadState(rapidxml::xml_node<char> *node) {
// Purpose: Draw
//------------------------------------------------------------------------
void ItemSlot::Draw() {
+
+ warning("STUB: ItemSlot::Draw()");
+#if 0
StateButton::Draw();
if (!empty)
@@ -110,8 +113,10 @@ void ItemSlot::Draw() {
if (unread)
pyrodactyl::image::gImageManager.NotifyDraw(x + w, y);
+#endif
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
@@ -122,6 +127,7 @@ ButtonAction ItemSlot::HandleEvents(const SDL_Event &Event, const int &XOffset,
return ac;
}
+#endif
//------------------------------------------------------------------------
// Purpose: Exchange items with another slot
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index e67350f8862..effde4bc014 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -79,7 +79,10 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw();
+
+#if 0
pyrodactyl::ui::ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+#endif
bool CanSwap(ItemSlot &target) { return target.no_type || item.type == target.item_type; }
bool Swap(ItemSlot &target);
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index e5cfa75308b..79ef9cf4039 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -46,6 +46,7 @@ bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node
// Functions to load attributes from xml files
// return true on success, false on failure
bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
+bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true) {}
// Used for loading numerical types
template<typename T>
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 5300b5e94e8..a6d94c0727c 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -12,6 +12,11 @@ MODULE_OBJS = \
image/Image.o \
image/ImageManager.o \
input/cursor.o \
+ item/Item.o \
+ item/ItemCollection.o \
+ item/ItemMenu.o \
+ item/ItemSlot.o \
+ item/StatPreview.o \
timer.o \
app.o \
splash.o
Commit: fe58e46312bd72ad1c7dd9f10df23e1cce617cf5
https://github.com/scummvm/scummvm/commit/fe58e46312bd72ad1c7dd9f10df23e1cce617cf5
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make people and stat components compilable
Changed paths:
engines/crab/loaders.h
engines/crab/module.mk
engines/crab/people/trait.cpp
engines/crab/stat/Stat.h
engines/crab/stat/StatDrawHelper.cpp
engines/crab/stat/StatDrawHelper.h
engines/crab/stat/StatTemplate.cpp
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 79ef9cf4039..ce61ce0bce9 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -46,7 +46,7 @@ bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node
// Functions to load attributes from xml files
// return true on success, false on failure
bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
-bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true) {}
+static inline bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true) {}
// Used for loading numerical types
template<typename T>
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index a6d94c0727c..e967d7b99c8 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -13,10 +13,13 @@ MODULE_OBJS = \
image/ImageManager.o \
input/cursor.o \
item/Item.o \
- item/ItemCollection.o \
- item/ItemMenu.o \
- item/ItemSlot.o \
- item/StatPreview.o \
+ people/opinion.o \
+ people/person.o \
+ people/personbase.o \
+ people/trait.o \
+ stat/Stat.o \
+ stat/StatDrawHelper.o \
+ stat/StatTemplate.o \
timer.o \
app.o \
splash.o
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 00326beec11..80fe69d954a 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
void Trait::Load(rapidxml::xml_node<char> *node) {
LoadStr(id_str, "id", node);
- id = StringToNumber<int>(id_str);
+ id = StringToNumber<int>(id_str.c_str());
LoadStr(name, "name", node);
LoadStr(desc, "desc", node);
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index 6dc23c1f63b..3a26dd3c4f3 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -33,7 +33,7 @@
#include "crab/common_header.h"
#include "crab/image/ImageManager.h"
-#include "crab/text/TextManager.h"
+//#include "crab/text/TextManager.h"
namespace Crab {
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index 212aba34509..7fe0d7e3d3e 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -33,19 +33,19 @@
namespace Crab {
-using namespace pyrodactyl::text;
+//using namespace pyrodactyl::text;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
void StatInfo::Load(rapidxml::xml_node<char> *node) {
if (NodeValid(node)) {
LoadBool(active, "active", node);
- desc.Load(node->first_node("info"));
+ //desc.Load(node->first_node("info"));
LoadStr(text, "text", node->first_node("info"));
if (NodeValid("value", node)) {
rapidxml::xml_node<char> *valuenode = node->first_node("value");
- dim.Load(valuenode);
+ //dim.Load(valuenode);
LoadImgKey(full, "full", valuenode);
LoadImgKey(empty, "empty", valuenode);
}
@@ -53,6 +53,8 @@ void StatInfo::Load(rapidxml::xml_node<char> *node) {
}
void StatInfo::Draw(const int &val, const int &max) {
+ warning("STUB: StatInfo::Draw()");
+#if 0
if (active) {
using namespace pyrodactyl::image;
desc.Draw(text);
@@ -63,6 +65,7 @@ void StatInfo::Draw(const int &val, const int &max) {
for (; i < max; ++i)
gImageManager.Draw(dim.x + i * dim.w, dim.y + i * dim.h, empty);
}
+#endif
}
void StatDrawHelper::Load(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index 67596974316..f62648028c1 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -32,7 +32,7 @@
#define CRAB_STATDRAWHELPER_H
#include "crab/common_header.h"
-#include "crab/ui/TextData.h"
+//#include "crab/ui/TextData.h"
#include "crab/people/person.h"
namespace Crab {
@@ -41,10 +41,10 @@ namespace pyrodactyl {
namespace stat {
struct StatInfo {
// Used to draw stat value and description
- pyrodactyl::ui::TextData desc;
+ //pyrodactyl::ui::TextData desc;
std::string text;
- Rect dim;
+ //Rect dim;
ImageKey full, empty;
bool active;
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index 7adf7f65dd9..b5100c46239 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -37,12 +37,16 @@ namespace Crab {
using namespace pyrodactyl::stat;
void StatTemplates::Load(const std::string &filename) {
+ warning("STUB: StatTemplates::Load()");
+
+#if 0
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("templates");
for (auto n = node->first_node("stats"); n != NULL; n = n->next_sibling("stats"))
collection.push_back(n);
}
+#endif
}
} // End of namespace Crab
Commit: ee8c5627a3cf1b6df86070bf1ada43913dddb8e2
https://github.com/scummvm/scummvm/commit/ee8c5627a3cf1b6df86070bf1ada43913dddb8e2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Stub out music component and make it compilable
Changed paths:
engines/crab/module.mk
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
engines/crab/music/musicparam.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index e967d7b99c8..9c80c40ef30 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -13,6 +13,7 @@ MODULE_OBJS = \
image/ImageManager.o \
input/cursor.o \
item/Item.o \
+ music/MusicManager.o \
people/opinion.o \
people/person.o \
people/personbase.o \
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index a1ef6fdbdcd..e3826258e4e 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -47,18 +47,31 @@ MusicManager gMusicManager;
// Purpose: Clear stored data
//------------------------------------------------------------------------
void MusicManager::FreeMusic() {
+ warning("STUB: MusicManager::FreeMusic()");
+
+#if 0
Mix_FreeMusic(bg.track);
+#endif
+
}
void MusicManager::FreeChunk() {
+ warning("STUB: MusicManager::FreeChunk()");
+
+#if 0
for (auto i = effect.begin(); i != effect.end(); ++i)
Mix_FreeChunk(i->second);
+#endif
+
}
//------------------------------------------------------------------------
// Purpose: Play or queue music
//------------------------------------------------------------------------
void MusicManager::PlayMusic(const MusicKey &id) {
+ warning("STUB: MusicManager::PlayMusic()");
+
+#if 0
if (bg.id != id) {
XMLDoc track_list(gFilePath.sound_music);
if (track_list.ready()) {
@@ -75,20 +88,30 @@ void MusicManager::PlayMusic(const MusicKey &id) {
if (bg.track != NULL)
Mix_FadeInMusic(bg.track, -1, bg.fade_in_duration);
}
+#endif
+
}
//------------------------------------------------------------------------
// Purpose: Play or queue sound effects
//------------------------------------------------------------------------
void MusicManager::PlayEffect(const ChunkKey &id, const int &loops) {
+ warning("STUB: MusicManager::PlayEffect()");
+
+#if 0
if (effect.count(id) > 0)
Mix_PlayChannel(-1, effect[id], loops);
+#endif
+
}
//------------------------------------------------------------------------
// Purpose: Initialize the music subsystem (currently SDL_mixer) and load sound effects
//------------------------------------------------------------------------
bool MusicManager::Load(rapidxml::xml_node<char> *node) {
+ warning("STUB: MusicManager::Load()");
+
+#if 0
// Initialize music parameters
int volume_mus = 100, volume_eff = 100;
@@ -133,11 +156,15 @@ bool MusicManager::Load(rapidxml::xml_node<char> *node) {
}
}
}
+#endif
return true;
}
void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ warning("STUB: MusicManager::SaveState()");
+
+#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sound");
child->append_attribute(doc.allocate_attribute("music", gStrPool.Get(Mix_VolumeMusic(-1))));
child->append_attribute(doc.allocate_attribute("effects", gStrPool.Get(Mix_Volume(0, -1))));
@@ -145,6 +172,7 @@ void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<c
child->append_attribute(doc.allocate_attribute("channels", gStrPool.Get(channels)));
child->append_attribute(doc.allocate_attribute("chunk_size", gStrPool.Get(chunksize)));
root->append_node(child);
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index a1349ce7943..b2f193f2833 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -43,8 +43,10 @@ class MusicManager {
// The background music for our current level
MusicData bg;
+#if 0
// The sound effects in the game
std::unordered_map<ChunkKey, Mix_Chunk *> effect;
+#endif
// Data about the audio
int freq, channels, chunksize;
@@ -54,8 +56,10 @@ public:
ChunkKey notify, rep_inc, rep_dec;
MusicManager() {
+#if 0
freq = MIX_DEFAULT_FREQUENCY;
channels = MIX_DEFAULT_CHANNELS;
+#endif
chunksize = 1024;
notify = -1;
@@ -69,15 +73,69 @@ public:
void PlayMusic(const MusicKey &id);
void PlayEffect(const ChunkKey &id, const int &loops);
- static void Pause() { Mix_PauseMusic(); }
- static void Resume() { Mix_ResumeMusic(); }
- static void Stop() { Mix_HaltMusic(); }
+ static void Pause() {
+ warning("STUB: MusicManager::Pause()");
- static void VolEffects(const int &volume) { Mix_Volume(-1, volume); }
- static int VolEffects() { return Mix_Volume(0, -1); }
+#if 0
+ Mix_PauseMusic();
+#endif
- static void VolMusic(const int &volume) { Mix_VolumeMusic(volume); }
- static int VolMusic() { return Mix_VolumeMusic(-1); }
+ }
+
+ static void Resume() {
+ warning("STUB: MusicManager::Resume()");
+
+#if 0
+ Mix_ResumeMusic();
+#endif
+
+ }
+
+ static void Stop() {
+ warning("STUB: MusicManager::Stop()");
+
+#if 0
+ Mix_HaltMusic();
+#endif
+
+ }
+
+ static void VolEffects(const int &volume) {
+ warning("STUB: MusicManager::Stop()");
+
+#if 0
+ Mix_Volume(-1, volume);
+#endif
+
+ }
+
+ static int VolEffects() {
+ warning("STUB: MusicManager::VolEffects()");
+ return 0;
+#if 0
+ return Mix_Volume(0, -1);
+#endif
+
+ }
+
+ static void VolMusic(const int &volume) {
+ warning("STUB: MusicManager::VolMusic() %d", volume);
+
+#if 0
+ Mix_VolumeMusic(volume);
+#endif
+
+ }
+
+ static int VolMusic() {
+ warning("STUB: MusicManager::VolMusic()");
+ return 0;
+
+#if 0
+ return Mix_VolumeMusic(-1);
+#endif
+
+ }
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index 1cbc7352ad0..8a6337e96be 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -50,19 +50,24 @@ struct MusicData {
// The id of this track
MusicKey id;
+#if 0
// The track data
Mix_Music *track;
+#endif
// Sound parameters
- Uint32 fade_in_duration;
+ uint32 fade_in_duration;
MusicData() {
id = -1;
+#if 0
track = nullptr;
+#endif
fade_in_duration = 100;
}
void Load(rapidxml::xml_node<char> *node) {
+#if 0
LoadNum(id, "id", node);
LoadNum(fade_in_duration, "fade_in", node);
@@ -70,6 +75,7 @@ struct MusicData {
Mix_FreeMusic(track);
track = Mix_LoadMUS(node->first_attribute("path")->value());
+#endif
}
};
} // End of namespace music
Commit: 1a0c39123d1ca7a4455998681006911e2f0e5ed1
https://github.com/scummvm/scummvm/commit/1a0c39123d1ca7a4455998681006911e2f0e5ed1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add define to allow forbidden symbols where necessary
Changed paths:
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/image/Image.cpp
engines/crab/splash.cpp
engines/crab/timer.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 3aa195e8817..67c69af3860 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/events.h"
#include "crab/app.h"
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index a26a62a27d4..86022a7e393 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -50,7 +50,6 @@
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL
-#define FORBIDDEN_SYMBOL_EXCEPTION_FILE
#include "crab/crab.h"
#include "common/config-manager.h"
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 46bf7681fd6..b5c25b08d29 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -27,6 +27,7 @@
* Licensed under MIT
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/image/Image.h"
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 2ce169c856a..90fd3a9b154 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -33,6 +33,7 @@
// Author: Arvind
// Purpose: Splash functions
//=============================================================================
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/splash.h"
namespace Crab {
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index c3db78abc79..5bded77745c 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -33,6 +33,7 @@
// Author: Arvind
// Purpose: Timer functions
//=============================================================================
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/timer.h"
namespace Crab {
Commit: d1b716dbdfb62097dde5a1a907c72514b0a81ce4
https://github.com/scummvm/scummvm/commit/d1b716dbdfb62097dde5a1a907c72514b0a81ce4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Create a overload for converting string to number using std::string
Changed paths:
engines/crab/numstr.h
engines/crab/people/trait.cpp
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 50f579e7d1b..15505368028 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -82,6 +82,11 @@ T StringToNumber(const Common::String &Text) {
return StringToNumber<T>(const_cast<char *>(Text.c_str()));
}
+template<typename T>
+T StringToNumber(const std::string &Text) {
+ return StringToNumber<T>(const_cast<char *>(Text.c_str()));
+}
+
template<typename T>
void GetPoint(T &v, Common::String &coords) {
int comma = coords.findFirstOf(',');
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 80fe69d954a..00326beec11 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
void Trait::Load(rapidxml::xml_node<char> *node) {
LoadStr(id_str, "id", node);
- id = StringToNumber<int>(id_str.c_str());
+ id = StringToNumber<int>(id_str);
LoadStr(name, "name", node);
LoadStr(desc, "desc", node);
Commit: 1149de1fee925f89632f529eae415bc58af8e94d
https://github.com/scummvm/scummvm/commit/1149de1fee925f89632f529eae415bc58af8e94d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make most of event component compilable
Changed paths:
engines/crab/common_header.h
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/effect.cpp
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/trigger.cpp
engines/crab/input/cursor.cpp
engines/crab/module.mk
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index c04806aa35f..c93911d1b04 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -31,7 +31,7 @@
#ifndef CRAB_COMMON_HEADER_H
#define CRAB_COMMON_HEADER_H
-//#include <algorithm>
+#include <algorithm>
#include <cmath>
//#include <ctime>
#include <deque>
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 797b0e0c6f1..fccc2c3a0ad 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -39,6 +39,9 @@ using namespace pyrodactyl::event;
// Purpose: Load
//------------------------------------------------------------------------
void EventSequence::Load(const std::string &filename) {
+ warning("STUB: EventSequence::Load()");
+
+#if 0
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("events");
@@ -47,6 +50,7 @@ void EventSequence::Load(const std::string &filename) {
events.push_back(e);
}
}
+#endif
}
//------------------------------------------------------------------------
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index 18ada894f51..9bd98830c5e 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -34,9 +34,10 @@
#include "crab/event/GameEventInfo.h"
#include "crab/image/ImageManager.h"
-#include "crab/ui/Inventory.h"
+#include "crab/music/MusicManager.h"
+//#include "crab/ui/Inventory.h"
#include "crab/event/gameevent.h"
-#include "crab/ui/journal.h"
+//#include "crab/ui/journal.h"
namespace Crab {
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index d25421f71da..a14413df736 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/event/GameEventInfo.h"
#include "crab/event/eventstore.h"
@@ -48,6 +49,9 @@ using namespace pyrodactyl::event;
// Purpose: Load from xml
//------------------------------------------------------------------------
void Info::Load(rapidxml::xml_node<char> *node) {
+ warning("STUB: Info::Load()");
+
+#if 0
if (NodeValid("people", node)) {
rapidxml::xml_node<char> *pnode = node->first_node("people");
@@ -76,9 +80,13 @@ void Info::Load(rapidxml::xml_node<char> *node) {
CurLocID(node->first_node("level")->first_attribute("start")->value());
inv.ItemFile(node->first_node("item")->first_attribute("list")->value());
+#endif
}
void Info::LoadPeople(const std::string &filename) {
+ warning("STUB: Info::LoadPeople()");
+
+#if 0
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("people");
@@ -90,6 +98,7 @@ void Info::LoadPeople(const std::string &filename) {
}
}
}
+#endif
}
//------------------------------------------------------------------------
@@ -329,6 +338,9 @@ std::string Info::GetName(const std::string &id) {
// Purpose: Save and load object state
//------------------------------------------------------------------------
void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ warning("Info::SaveState()");
+
+#if 0
for (auto v = var.begin(); v != var.end(); ++v) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
child->append_attribute(doc.allocate_attribute("id", v->first.c_str()));
@@ -358,9 +370,13 @@ void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
journal.SaveState(doc, root);
inv.SaveState(doc, root);
+#endif
}
void Info::LoadState(rapidxml::xml_node<char> *node) {
+ warning("STUB: Info::LoadState()");
+
+#if 0
for (rapidxml::xml_node<char> *v = node->first_node("var"); v != NULL; v = v->next_sibling("var"))
var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
@@ -386,14 +402,19 @@ void Info::LoadState(rapidxml::xml_node<char> *node) {
journal.LoadState(node);
inv.LoadState(node);
+#endif
}
//------------------------------------------------------------------------
// Purpose: Calculate UI positions after change in screen size
//------------------------------------------------------------------------
void Info::SetUI() {
+ warning("STUB: Info::SetUI()");
+
+#if 0
journal.SetUI();
inv.SetUI();
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 5378b13b60c..3225d2065de 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -31,10 +31,10 @@
#ifndef CRAB_GAMEEVENTINFO_H
#define CRAB_GAMEEVENTINFO_H
-#include "crab/ui/Inventory.h"
+//#include "crab/ui/Inventory.h"
#include "crab/stat/StatTemplate.h"
#include "crab/common_header.h"
-#include "crab/ui/journal.h"
+//#include "crab/ui/journal.h"
#include "crab/people/person.h"
namespace Crab {
@@ -79,10 +79,10 @@ class Info {
public:
// The player's one stop shop for objectives and lore
- pyrodactyl::ui::Journal journal;
+ //pyrodactyl::ui::Journal journal;
// The current player inventory
- pyrodactyl::ui::Inventory inv;
+ //pyrodactyl::ui::Inventory inv;
// This structure keeps track of unread indicators
struct UnreadData {
@@ -184,10 +184,12 @@ public:
// Draw the inventory
void InvDraw(const std::string &id) {
+#if 0
if (var.count(money_var) > 0)
inv.Draw(people.at(id), var.at(money_var));
else
inv.Draw(people.at(id), 0);
+#endif
}
// Get whether game is iron man or not
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 218c4f5e752..ec872d2eca7 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -129,6 +129,10 @@ void Effect::ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::Op
bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id,
std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
+
+ warning("STUB: Effect::Execute()");
+
+#if 0
if (type < EFF_MOVE) {
switch (type) {
case EFF_VAR:
@@ -283,6 +287,7 @@ bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id
result.push_back(r);
}
+#endif
return false;
}
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 9370467610d..6bb3e9a0a68 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -50,6 +50,9 @@ void GameEventStore::AddConv(rapidxml::xml_node<char> *node, unsigned int &index
}
void GameEventStore::Load(const std::string &filename) {
+ warning("STUB: GameEventStore::Load()");
+
+#if 0
// Request current user stats from Steam
// m_pSteamUserStats = SteamUserStats();
@@ -87,6 +90,7 @@ void GameEventStore::Load(const std::string &filename) {
trait.push_back(n);
}
}
+#endif
}
void GameEventStore::SetAchievement(const int &id) {
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 11e3131372e..ac40ff51613 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -31,8 +31,8 @@
#ifndef CRAB_EVENTSTORE_H
#define CRAB_EVENTSTORE_H
-#include "crab/ui/StateButton.h"
-#include "crab/animation/animation.h"
+//#include "crab/ui/StateButton.h"
+//#include "crab/animation/animation.h"
#include "crab/common_header.h"
#include "crab/event/conversationdata.h"
@@ -46,7 +46,7 @@ struct GameEventStore {
std::vector<ConversationData> con;
// Data related to animations
- std::vector<pyrodactyl::anim::Animation> anim;
+ //std::vector<pyrodactyl::anim::Animation> anim;
// Data related to the tones of a character
struct ToneData {
@@ -57,7 +57,7 @@ struct GameEventStore {
std::vector<ToneData> tone;
// We need to change player character images when switching between characters
- std::vector<pyrodactyl::ui::StateButtonImage> img;
+ //std::vector<pyrodactyl::ui::StateButtonImage> img;
// The set of traits for various characters
std::vector<pyrodactyl::people::Trait> trait;
@@ -75,7 +75,7 @@ struct GameEventStore {
void Clear() {
con.clear();
- anim.clear();
+ // anim.clear();
}
void Load(const std::string &filename);
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index c3b0cebef4c..8a0b92a8a1b 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -103,6 +103,10 @@ bool Trigger::Evaluate(int lhs, int rhs) {
}
bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
+
+ warning("STUB: Trigger::Evaluate()");
+
+#if 0
using namespace pyrodactyl::people;
using namespace pyrodactyl::stat;
@@ -195,6 +199,8 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
break;
}
+#endif
+
return false;
}
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 574a98c15d1..8f2630e80d5 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -32,6 +32,7 @@
// Author: Arvind
// Purpose: Cursor class
//=============================================================================
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/input/cursor.h"
namespace Crab {
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 9c80c40ef30..9e00d441373 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -9,6 +9,16 @@ MODULE_OBJS = \
loaders.o \
ScreenSettings.o \
GameParam.o \
+ event/conversationdata.o \
+ event/effect.o \
+ event/EventSeqGroup.o \
+ event/EventSequence.o \
+ event/eventstore.o \
+ event/gameevent.o \
+ event/GameEventInfo.o \
+ event/quest.o \
+ event/trigger.o \
+ event/triggerset.o \
image/Image.o \
image/ImageManager.o \
input/cursor.o \
Commit: ac4a22a6a0712ad0266ad45a654b8f27283e5a23
https://github.com/scummvm/scummvm/commit/ac4a22a6a0712ad0266ad45a654b8f27283e5a23
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Stub out and make text component compilable
Changed paths:
engines/crab/module.mk
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.cpp
engines/crab/text/color.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 9e00d441373..80fe681d9f9 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -31,6 +31,8 @@ MODULE_OBJS = \
stat/Stat.o \
stat/StatDrawHelper.o \
stat/StatTemplate.o \
+ text/color.o \
+ text/TextManager.o \
timer.o \
app.o \
splash.o
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 439daf71907..84bb8dc6897 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -45,6 +45,9 @@ TextManager gTextManager;
// Purpose: Initialize, set cache etc
//------------------------------------------------------------------------
void TextManager::Init() {
+ warning("STUB: TextManager::Init()");
+
+#if 0
// First, delete everything that exists
Quit();
@@ -77,6 +80,7 @@ void TextManager::Init() {
}
colpool.Load(gFilePath.colors);
+#endif
}
void TextManager::Reset() {
@@ -110,18 +114,23 @@ int TextManager::FindFreeSlot() {
//------------------------------------------------------------------------
// Purpose: Render the SDL surface for text
//------------------------------------------------------------------------
+#if 0
SDL_Surface *TextManager::RenderTextBlended(const FontKey &font, const std::string &text, const int &color) {
if (text.empty())
return TTF_RenderText_Blended(GetFont(font), " ", colpool.Get(color));
return TTF_RenderText_Blended(GetFont(font), text.c_str(), colpool.Get(color));
}
+#endif
//------------------------------------------------------------------------
// Purpose: Draw text
//------------------------------------------------------------------------
void TextManager::Draw(const int &x, const int &y, const std::string &text, const int &color,
const FontKey &font, const Align &align, const bool &background) {
+ warning("STUB: TextManager::Draw()");
+
+#if 0
int pos = Search(text, color, font);
if (pos == -1) {
pos = FindFreeSlot();
@@ -172,6 +181,7 @@ void TextManager::Draw(const int &x, const int &y, const std::string &text, cons
else
cache[pos].img.Draw(x - cache[pos].img.W(), y);
}
+#endif
}
void TextManager::Draw(const int &x, int y, const std::string &text, const int &color, const FontKey &font, const Align &align,
@@ -214,6 +224,9 @@ void TextManager::Draw(const int &x, int y, const std::string &text, const int &
// Purpose: Quit
//------------------------------------------------------------------------
void TextManager::Quit() {
+ warning("TextManager::Quit()");
+
+#if 0
for (auto i = font.begin(); i != font.end(); ++i)
TTF_CloseFont(*i);
@@ -223,6 +236,7 @@ void TextManager::Quit() {
i->empty = true;
}
}
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 010b8383a3c..51afc0fb685 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -49,7 +49,7 @@ namespace pyrodactyl {
namespace text {
class TextManager {
// The collection of stored fonts
- std::vector<TTF_Font *> font;
+ // std::vector<TTF_Font *> font;
// The size of the cache
int cache_size;
@@ -86,7 +86,7 @@ class TextManager {
ColorPool colpool;
// The rectangle used to store the darkened rectangle coordinates
- SDL_Rect rect;
+ //SDL_Rect rect;
int Search(const std::string &text, int col, FontKey fontid);
int FindFreeSlot();
@@ -102,8 +102,10 @@ public:
void Quit();
void Reset();
+#if 0
TTF_Font *GetFont(const FontKey &fontid) { return font[fontid]; }
SDL_Surface *RenderTextBlended(const FontKey &font, const std::string &text, const int &color);
+#endif
void Draw(const int &x, const int &y, const std::string &text, const int &color,
const FontKey &font = 0, const Align &align = ALIGN_LEFT, const bool &background = false);
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index 41ab986cb9c..76198ab94f2 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -35,6 +35,8 @@ namespace Crab {
using namespace pyrodactyl::text;
void ColorPool::Load(const std::string &filename) {
+ warning("STUB: ColorPool::Load()");
+#if 0
pool.clear();
XMLDoc col_list(filename);
if (col_list.ready()) {
@@ -45,6 +47,7 @@ void ColorPool::Load(const std::string &filename) {
pool.push_back(c);
}
}
+#endif
}
SDL_Color &ColorPool::Get(const int &num) {
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index 074dd91255e..82a5b491c0e 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -40,7 +40,16 @@ namespace Crab {
namespace pyrodactyl {
namespace text {
// Storage pool for saving colors from one file, then using them
+
+// Make linker happy by temporarily defining SDL_COLOR
+struct SDL_Color {
+ uint32 r;
+ uint32 g;
+ uint32 b;
+};
+
class ColorPool {
+
std::vector<SDL_Color> pool;
// Default invalid color
Commit: 4e6ad3d2d3ee9d5a5191db7b2087a615b28958f7
https://github.com/scummvm/scummvm/commit/4e6ad3d2d3ee9d5a5191db7b2087a615b28958f7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Shape related classes compilable
Changed paths:
engines/crab/Line.cpp
engines/crab/Line.h
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/Shape.cpp
engines/crab/Shape.h
engines/crab/module.mk
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index 3908a694dc9..c56546c5014 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -36,9 +36,13 @@ namespace Crab {
// Purpose: Draw a line from start to end
//------------------------------------------------------------------------
void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
- const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a) {
+ const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
+ warning("STUB: DrawLine()");
+
+#if 0
SDL_SetRenderDrawColor(gRenderer, r, g, b, a);
SDL_RenderDrawLine(gRenderer, x1, y1, x2, y2);
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index f20f6f2f2f8..b03d38d9afc 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -71,7 +71,7 @@ bool CollideLine(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y,
// Draw a line OpenGL style
void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
- const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a);
+ const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a);
} // End of namespace Crab
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 362c82d0ac6..e72320741c1 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -257,7 +257,7 @@ bool Polygon2D::Contains(const float &X, const float &Y) {
return result;
}
-void Polygon2D::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a) {
+void Polygon2D::Draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
Vector2f p1, p2;
for (int i = 0; i < point.size(); i++) {
p1 = point[i];
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index e216ce006a5..5ce2f321339 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -90,7 +90,7 @@ public:
void Project(const Vector2f &axis, float &min, float &max) const;
void Draw(const int &XOffset = 0, const int &YOffset = 0,
- const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0.0f, const Uint8 &a = 255);
+ const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0.0f, const uint8 &a = 255);
};
} // End of namespace Crab
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index d6b3de90840..1edef77d737 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -34,7 +34,7 @@ namespace Crab {
bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const std::string &x_name, const std::string &y_name,
const std::string &w_name, const std::string &h_name) {
- return LoadNum(x, x_name, node, echo) && LoadNum(y, y_name, node, echo) && LoadNum(w, w_name, node, echo) && LoadNum(h, h_name, node, echo);
+ return LoadNum(x, x_name.c_str(), node, echo) && LoadNum(y, y_name.c_str(), node, echo) && LoadNum(w, w_name.c_str(), node, echo) && LoadNum(h, h_name.c_str(), node, echo);
}
bool Rect::Collide(Rect box) {
@@ -85,7 +85,7 @@ void Rect::Flip(const TextureFlipType &flip, const Vector2i &axis) {
y = 2 * axis.y - y - h;
}
-void Rect::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a) {
+void Rect::Draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
int X = x + XOffset, Y = y + YOffset;
DrawLine(X, Y, X + w, Y, r, g, b, a);
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index 0d6d1cd58c2..8938560f101 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -37,6 +37,13 @@
namespace Crab {
+struct SDL_Rect {
+ int x;
+ int y;
+ int w;
+ int h;
+};
+
//------------------------------------------------------------------------
// Purpose: A simple rectangle class
//------------------------------------------------------------------------
@@ -75,7 +82,7 @@ public:
void Flip(const TextureFlipType &flip, const Vector2i &axis);
// Draw the borders of the rectangle
- void Draw(const int &XOffset = 0, const int &YOffset = 0, const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0, const Uint8 &a = 255);
+ void Draw(const int &XOffset = 0, const int &YOffset = 0, const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0, const uint8 &a = 255);
// Check if a rectangle is the same as another
bool operator==(const Rect &r) { return r.x == x && r.y == y && r.w == w && r.h == h; }
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index bea79818819..c6e81184f5b 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -75,7 +75,7 @@ bool Shape::Contains(const Vector2i &pos) {
return false;
}
-void Shape::Draw(const int &XOffset, const int &YOffset, const Uint8 &r, const Uint8 &g, const Uint8 &b, const Uint8 &a) {
+void Shape::Draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
if (type == SHAPE_POLYGON)
poly.Draw(XOffset, YOffset, r, g, b, a);
else
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index 815c21aacd0..0ed692d937e 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -78,7 +78,7 @@ public:
bool Contains(const Vector2i &pos);
void Draw(const int &XOffset = 0, const int &YOffset = 0,
- const Uint8 &r = 0, const Uint8 &g = 0, const Uint8 &b = 0.0f, const Uint8 &a = 255);
+ const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0, const uint8 &a = 255);
};
} // End of namespace Crab
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 80fe681d9f9..8fbb6afd4b7 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -35,7 +35,11 @@ MODULE_OBJS = \
text/TextManager.o \
timer.o \
app.o \
- splash.o
+ splash.o \
+ Line.o \
+ Polygon.o \
+ Rectangle.o \
+ Shape.o
# This module can be built as a plugin
ifeq ($(ENABLE_CRAB), DYNAMIC_PLUGIN)
Commit: 6da6468b81767719dd17228b59fb9a2ef06b2c77
https://github.com/scummvm/scummvm/commit/6da6468b81767719dd17228b59fb9a2ef06b2c77
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make most of TMX component compilable
Changed paths:
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/module.mk
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 765d4144df4..8becdee1e86 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -28,7 +28,7 @@
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/TMX/TMXLayer.h"
namespace Crab {
@@ -43,6 +43,9 @@ bool Layer::Load(rapidxml::xml_node<char> *node) {
}
bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
+ warning("STUB: MapLayer::Load()");
+
+#if 0
if (Layer::Load(node)) {
if (NodeValid("image", node, false)) {
type = LAYER_IMAGE;
@@ -101,6 +104,7 @@ bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
return true;
}
+#endif
return false;
}
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index ae0fe469282..c085101e1c7 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/TMX/TMXTileSet.h"
#include "crab/text/TextManager.h"
@@ -51,7 +52,7 @@ void TileSet::Load(const std::string &path, rapidxml::xml_node<char> *node) {
LoadStr(filename, "source", imgnode);
loc = path + filename;
- img.Load(loc);
+ img.Load(loc.c_str());
total_rows = img.H() / tile_h;
total_cols = img.W() / tile_w;
}
@@ -79,6 +80,9 @@ void TileSetGroup::Load(const std::string &path, rapidxml::xml_node<char> *node)
}
void TileSet::Draw(const Vector2i &pos, const TileInfo &tile) {
+ warning("STUB: TileSet::Draw()");
+
+#if 0
if (tile.gid != 0) {
clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
@@ -88,6 +92,7 @@ void TileSet::Draw(const Vector2i &pos, const TileInfo &tile) {
/*if(tile.flip != FLIP_NONE && GameDebug)
pyrodactyl::text::gTextManager.Draw(pos.x,pos.y,NumberToString(tile.flip),0);*/
}
+#endif
}
void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos) {
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 8fbb6afd4b7..eb6982905c0 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -33,6 +33,8 @@ MODULE_OBJS = \
stat/StatTemplate.o \
text/color.o \
text/TextManager.o \
+ TMX/TMXLayer.o \
+ TMX/TMXTileSet.o \
timer.o \
app.o \
splash.o \
Commit: 146c1a8ca8ec0c468e517d39d45043326be9da15
https://github.com/scummvm/scummvm/commit/146c1a8ca8ec0c468e517d39d45043326be9da15
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make some UI classes compilable
Changed paths:
engines/crab/module.mk
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/HealthIndicator.h
engines/crab/ui/ImageData.cpp
engines/crab/ui/ProgressBar.h
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/element.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index eb6982905c0..7deef8c3361 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -35,6 +35,24 @@ MODULE_OBJS = \
text/TextManager.o \
TMX/TMXLayer.o \
TMX/TMXTileSet.o \
+ ui/button.o \
+ ui/ClipButton.o \
+ ui/CreditScreen.o \
+ ui/Caption.o \
+ ui/element.o \
+ ui/HealthIndicator.o \
+ ui/HoverInfo.o \
+ ui/ImageData.o \
+ ui/MapData.o \
+ ui/ParagraphData.o \
+ ui/SectionHeader.o \
+ ui/slider.o \
+ ui/SlideShow.o \
+ ui/StateButton.o \
+ ui/textarea.o \
+ ui/textdata.o \
+ ui/ToggleButton.o \
+ ui/TraitButton.o \
timer.o \
app.o \
splash.o \
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 5183c2d3b58..85e56e1c021 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -29,7 +29,7 @@
*/
#include "crab/ui/CreditScreen.h"
-#include "crab/url.h"
+//#include "crab/url.h"
namespace Crab {
@@ -44,7 +44,7 @@ void CreditScreen::Reset() {
}
void CreditScreen::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("credits");
@@ -104,6 +104,7 @@ void CreditScreen::Load(const std::string &filename) {
}
}
+#if 0
bool CreditScreen::HandleEvents(SDL_Event &Event) {
if (slow.HandleEvents(Event) == BUAC_LCLICK)
speed.cur = speed.slow;
@@ -121,6 +122,7 @@ bool CreditScreen::HandleEvents(SDL_Event &Event) {
return (back.HandleEvents(Event) == BUAC_LCLICK);
}
+#endif
void CreditScreen::Draw() {
bg.Draw();
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 03fa2d9bdd9..3971bb15beb 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -114,7 +114,9 @@ public:
void Load(const std::string &filename);
void Reset();
+#if 0
bool HandleEvents(SDL_Event &Event);
+#endif
void Draw();
void SetUI();
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 42f92147604..5a858a36354 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
void DebugConsole::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("debug");
if (NodeValid(node)) {
@@ -78,7 +78,7 @@ void DebugConsole::Draw(pyrodactyl::event::Info &info) {
{
int temp = 0;
if (info.VarGet(var_name, temp))
- value.Draw(NumberToString(temp));
+ value.Draw(NumberToString(temp).c_str());
else
value.Draw("Does not exist.");
}
@@ -89,6 +89,7 @@ void DebugConsole::Draw(pyrodactyl::event::Info &info) {
}
}
+#if 0
void DebugConsole::HandleEvents(const SDL_Event &Event) {
switch (state) {
case STATE_NORMAL: {
@@ -119,6 +120,7 @@ void DebugConsole::HandleEvents(const SDL_Event &Event) {
break;
}
}
+#endif
void DebugConsole::InternalEvents() {
}
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index f58b05b91ba..d4ab3a18020 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -66,7 +66,9 @@ public:
void Load(const std::string &filename);
void Draw(pyrodactyl::event::Info &info);
+#if 0
void HandleEvents(const SDL_Event &Event);
+#endif
void InternalEvents();
};
} // End of namespace ui
diff --git a/engines/crab/ui/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
index 08df7bbcbd0..7d7559672bb 100644
--- a/engines/crab/ui/HealthIndicator.h
+++ b/engines/crab/ui/HealthIndicator.h
@@ -48,7 +48,7 @@ class HealthIndicator {
std::vector<HealthImage> img;
// Related to the pulse effect
- Uint8 alpha;
+ uint8 alpha;
bool inc;
public:
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 72877fe486a..0c4938e4d19 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -46,10 +46,14 @@ void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo) {
}
void ImageData::Draw(const int &XOffset, const int &YOffset) {
+ warning("ImaageData::Draw()");
+
+#if 0
if (crop)
gImageManager.Draw(x + XOffset, y + YOffset, key, &clip);
else
gImageManager.Draw(x + XOffset, y + YOffset, key);
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index f23d7239e44..4931614c4b9 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -44,7 +44,7 @@ class ProgressBar : public ClipButton {
Timer timer;
// The total time for which the change effect must be shown
- Uint32 notify_rate;
+ uint32 notify_rate;
// Are we currently displaying the effect?
bool changed;
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 03891374858..a5166fedfbb 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -37,6 +37,9 @@ using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
void SectionHeader::Load(rapidxml::xml_node<char> *node) {
+ warning("STUB: SectionHeader::Load()");
+
+#if 0
if (TextData::Load(node, NULL, false)) {
LoadStr(text, "text", node);
text.insert(0, " ");
@@ -71,6 +74,8 @@ void SectionHeader::Load(rapidxml::xml_node<char> *node) {
SDL_FreeSurface(surf);
}
+#endif
+
}
void SectionHeader::Draw(const int &XOffset, const int &YOffset) {
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 2318df3f2a0..7193853384f 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -27,7 +27,7 @@
* Licensed under MIT
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/SlideShow.h"
namespace Crab {
@@ -52,12 +52,12 @@ void SlideShow::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("prev", node)) {
prev.Load(node->first_node("prev"));
- prev.hotkey.Set(IU_PREV);
+ //prev.hotkey.Set(IU_PREV);
}
if (NodeValid("next", node)) {
next.Load(node->first_node("next"));
- next.hotkey.Set(IU_NEXT);
+ //next.hotkey.Set(IU_NEXT);
}
path.clear();
@@ -84,6 +84,7 @@ void SlideShow::Draw() {
next.Draw();
}
+#if 0
void SlideShow::HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
@@ -99,12 +100,17 @@ void SlideShow::HandleEvents(const SDL_Event &Event) {
Refresh();
}
}
+#endif
void SlideShow::Refresh() {
+ warning("SlideShow::Refresh()");
+
+#if 0
img.Delete();
if (index >= 0 && index < path.size())
img.Load(path.at(index));
+#endif
}
void SlideShow::SetUI() {
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 75bb2000908..4c4aaaa0724 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -70,7 +70,9 @@ public:
void Clear() { img.Delete(); }
void Load(rapidxml::xml_node<char> *node);
+#if 0
void HandleEvents(const SDL_Event &Event);
+#endif
void Draw();
void SetUI();
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index cc5af5a33a4..cfd2c6b968c 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -53,6 +53,7 @@ void ToggleButton::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
gImageManager.Draw(x + offset.x, y + offset.y, off);
}
+#if 0
ButtonAction ToggleButton::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
ButtonAction action = Button::HandleEvents(Event, XOffset, YOffset);
@@ -61,5 +62,6 @@ ButtonAction ToggleButton::HandleEvents(const SDL_Event &Event, const int &XOffs
return action;
}
+#endif
} // End of namespace Crab
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index 38c682141c1..dc175897739 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -60,7 +60,10 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+
+#if 0
ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+#endif
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index e8674cf7808..9870c7fb780 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -63,8 +63,8 @@ void Button::Load(rapidxml::xml_node<char> *node, const bool &echo) {
LoadNum(se_click, "click", node, echo);
LoadNum(se_hover, "hover", node, echo);
- if (NodeValid("hotkey", node, false))
- hotkey.Load(node->first_node("hotkey"));
+ //if (NodeValid("hotkey", node, false))
+ // hotkey.Load(node->first_node("hotkey"));
tooltip.Load(node->first_node("tooltip"), this);
caption.Load(node->first_node("caption"), this);
@@ -101,6 +101,9 @@ void Button::Reset() {
// Purpose: Draw
//------------------------------------------------------------------------
void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
+ warning("STUB: Button::Draw()");
+
+#if 0
if (visible) {
if (mousepressed) {
gImageManager.Draw(x + XOffset, y + YOffset, img.select, clip);
@@ -117,9 +120,13 @@ void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
caption.Draw(false, XOffset, YOffset);
}
}
+#endif
}
void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
+ warning("STUB: Button::ImageCaptionOnly()");
+
+#if 0
if (visible) {
if (mousepressed) {
gImageManager.Draw(x + XOffset, y + YOffset, img.select, clip);
@@ -132,6 +139,7 @@ void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *
caption.Draw(false, XOffset, YOffset);
}
}
+#endif
}
void Button::HoverInfoOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
@@ -141,6 +149,7 @@ void Button::HoverInfoOnlyDraw(const int &XOffset, const int &YOffset, Rect *cli
}
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle input and stuff
//------------------------------------------------------------------------
@@ -190,6 +199,7 @@ ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, co
return BUAC_IGNORE;
}
+#endif
void Button::SetUI(Rect *parent) {
Element::SetUI(parent);
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index 6ab8244df67..b8aa89e7ebd 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -42,7 +42,7 @@
#include "crab/text/TextManager.h"
#include "crab/common_header.h"
#include "crab/ui/element.h"
-#include "crab/input/hotkey.h"
+//#include "crab/input/hotkey.h"
namespace Crab {
@@ -102,7 +102,7 @@ public:
Caption caption;
// A hotkey is a keyboard key(s) that are equivalent to pressing a button
- pyrodactyl::input::HotKey hotkey;
+ //pyrodactyl::input::HotKey hotkey;
Button();
~Button() {}
@@ -117,7 +117,10 @@ public:
ButtonImage Img() { return img; }
void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+
+#if 0
ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+#endif
// Special functions to only draw parts of a button (used in special situations like world map)
void ImageCaptionOnlyDraw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index 7f30fefcb8d..a13ff5ccb7e 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -35,6 +35,7 @@
#include "crab/ScreenSettings.h"
#include "crab/common_header.h"
#include "crab/vectors.h"
+#include "crab/Rectangle.h"
namespace Crab {
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index e4aee95c942..ce88b9da2f9 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -56,6 +56,7 @@ void Slider::Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
CreateBackup();
}
+#if 0
bool Slider::HandleEvents(const SDL_Event &Event) {
// A person is moving the knob
if (knob.HandleEvents(Event) == BUAC_GRABBED) {
@@ -84,6 +85,7 @@ bool Slider::HandleEvents(const SDL_Event &Event) {
return false;
}
+#endif
void Slider::Draw() {
bar.Draw();
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index f710fce8a07..2c8827aafb2 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -68,8 +68,10 @@ public:
void Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val);
+#if 0
// Return true if volume changed
bool HandleEvents(const SDL_Event &Event);
+#endif
void Draw();
int Value() { return value; }
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 5347391cef7..0346fcb0210 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -54,6 +54,7 @@ void TextArea::Load(rapidxml::xml_node<char> *node) {
}
}
+#if 0
bool TextArea::HandleEvents(const SDL_Event &Event, bool numbers_only) {
// If a key was pressed
if (Event.type == SDL_TEXTINPUT) {
@@ -84,6 +85,8 @@ bool TextArea::HandleEvents(const SDL_Event &Event, bool numbers_only) {
return false;
}
+#endif
+
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index d35b370d4d2..647d569ab6b 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -39,7 +39,7 @@
#include "crab/music/MusicManager.h"
#include "crab/text/TextManager.h"
#include "crab/common_header.h"
-#include "crab/input/input.h"
+//#include "crab/input/input.h"
namespace Crab {
@@ -67,7 +67,11 @@ public:
~TextArea(void) {}
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
bool HandleEvents(const SDL_Event &Event, bool numbers_only = false);
+#endif
+
void Draw();
void SetUI() {
Commit: 973b34cb67868e901eb9d3567801d7dd6ffd6686
https://github.com/scummvm/scummvm/commit/973b34cb67868e901eb9d3567801d7dd6ffd6686
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make all classes in input component compilable
Changed paths:
engines/crab/input/fightinput.cpp
engines/crab/input/fightinput.h
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/input/inputval.cpp
engines/crab/input/inputval.h
engines/crab/module.mk
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index b5169d93930..55e32d90c5f 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -39,6 +39,7 @@ void FightInput::Load(rapidxml::xml_node<char> *node) {
LoadNum(state, "state", node);
}
+#if 0
FightAnimationType FightInput::HandleEvents(const SDL_Event &Event) {
if (gInput.State(IG_ATTACK))
return FA_ATTACK;
@@ -47,5 +48,6 @@ FightAnimationType FightInput::HandleEvents(const SDL_Event &Event) {
return FA_IDLE;
}
+#endif
} // End of namespace Crab
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 07bcc652ab1..cfb6e42cba9 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -74,7 +74,10 @@ struct FightInput {
bool Idle() { return type == FA_IDLE; }
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
FightAnimationType HandleEvents(const SDL_Event &Event);
+#endif
};
} // End of namespace input
} // End of namespace pyrodactyl
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index 583cee92fe7..fdaf33e05a7 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -38,6 +38,7 @@ void HotKey::Load(rapidxml::xml_node<char> *node) {
LoadEnum(input, "input", node);
}
+#if 0
bool HotKey::HandleEvents(const SDL_Event &Event) {
if (input > IT_NONE && input < IT_TOTAL) {
int result = gInput.Equals(input, Event);
@@ -52,10 +53,15 @@ bool HotKey::HandleEvents(const SDL_Event &Event) {
return false;
}
+#endif
const char *HotKey::Name() {
+ warning("STUB: HotKey::Name()");
+
+#if 0
if (input > IT_NONE && input < IT_TOTAL)
return SDL_GetScancodeName(gInput.iv[input].key);
+#endif
return "";
}
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 7a7bb2ff650..120241d3360 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -56,7 +56,10 @@ public:
const char *Name();
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
bool HandleEvents(const SDL_Event &Event);
+#endif
};
} // End of namespace input
} // End of namespace pyrodactyl
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 895c9426a59..dc93f136825 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -39,12 +39,15 @@ InputManager gInput;
} // End of namespace pyrodactyl
using namespace pyrodactyl::input;
-using namespace boost::filesystem;
+//using namespace boost::filesystem;
//------------------------------------------------------------------------
// Purpose: Return pressed/depressed state of key
//------------------------------------------------------------------------
const bool InputManager::State(const InputType &val) {
+ warning("STUB: InputManager::State()");
+
+#if 0
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
if (keystate[iv[val].key] || keystate[iv[val].alt])
return true;
@@ -57,10 +60,12 @@ const bool InputManager::State(const InputType &val) {
return (iv[val].c_ax.greater && av > iv[val].c_ax.val) || (!iv[val].c_ax.greater && av < iv[val].c_ax.val);
}
}
+#endif
return false;
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Check for controller and keyboard input simultaneously
// Return value 2 is a special case used for analog stick hotkey input
@@ -100,14 +105,18 @@ const int InputManager::Equals(const InputType &val, const SDL_Event &Event) {
return -1;
}
+#endif
//------------------------------------------------------------------------
// Purpose: Load from file
//------------------------------------------------------------------------
void InputManager::Init() {
+ warning("STUB: InputManager::Init()");
+
+#if 0
const std::string DEFAULT_FILENAME = "res/controls.xml";
- std::string filename = gFilePath.appdata;
+ std::string filename = gFilePath.appdata.c_str();
filename += "controls.xml";
if (!is_regular_file(filename)) {
@@ -125,13 +134,14 @@ void InputManager::Init() {
}
CreateBackup();
+#endif
}
//------------------------------------------------------------------------
// Purpose: Load key & controller binding settings from file
//------------------------------------------------------------------------
void InputManager::Load(const std::string &filename) {
- XMLDoc control_list(filename);
+ XMLDoc control_list(filename.c_str());
if (control_list.ready()) {
rapidxml::xml_node<char> *node = control_list.Doc()->first_node("controls");
if (NodeValid(node)) {
@@ -148,14 +158,19 @@ void InputManager::Load(const std::string &filename) {
// Purpose: Initialize the controller if it is plugged in
//------------------------------------------------------------------------
void InputManager::AddController() {
+ warning("STUB: InputManager::AddController()");
+
+#if 0
if (SDL_NumJoysticks() > 0) {
if (SDL_IsGameController(0))
controller = SDL_GameControllerOpen(0);
else
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Controller not recognized", "Unsupported device", NULL);
}
+#endif
}
+#if 0
void InputManager::HandleController(const SDL_Event &Event) {
if (Event.type == SDL_CONTROLLERDEVICEREMOVED && controller != nullptr) {
SDL_GameControllerClose(controller);
@@ -163,6 +178,7 @@ void InputManager::HandleController(const SDL_Event &Event) {
} else if (Event.type == SDL_CONTROLLERDEVICEADDED && controller == nullptr)
AddController();
}
+#endif
//------------------------------------------------------------------------
// Purpose: Create and restore backup
@@ -181,6 +197,9 @@ void InputManager::RestoreBackup() {
// Purpose: Save to file
//------------------------------------------------------------------------
void InputManager::Save() {
+ warning("STUB: InputManager::Save()");
+
+#if 0
rapidxml::xml_document<char> doc;
std::string filename = gFilePath.appdata;
@@ -210,6 +229,7 @@ void InputManager::Save() {
doc.clear();
CreateBackup();
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index aefd2a9570a..32bb3ef54d6 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -96,13 +96,17 @@ class InputManager {
public:
InputManager() {
- controller = nullptr;
+ //controller = nullptr;
version = 0;
}
~InputManager() {}
void Quit() {
+ warning("STUB: InputManager::Quit()");
+
+#if 0
if (controller != nullptr)
SDL_GameControllerClose(controller);
+#endif
}
// NOTE: The lower level arrays can have buttons in common, but buttons cannot be common within these arrays
@@ -112,11 +116,13 @@ public:
InputVal iv[IT_TOTAL];
// Our controller object
- SDL_GameController *controller;
+ //SDL_GameController *controller;
// These functions check if the value of a key matches the input values
// Returns SDL_PRESSED for pressing a button, SDL_RELEASED for releasing a button and -1 if no input
+#if 0
const int Equals(const InputType &val, const SDL_Event &Event);
+#endif
// These functions return true if key is pressed, false otherwise
const bool State(const InputType &val);
@@ -127,8 +133,10 @@ public:
// Initialize the controller if it is plugged in
void AddController();
+#if 0
// Handle plugging and unplugging of controllers on the fly
void HandleController(const SDL_Event &Event);
+#endif
// Initialize the input system
void Init();
diff --git a/engines/crab/input/inputval.cpp b/engines/crab/input/inputval.cpp
index 102dba49426..7bfa99a1ce3 100644
--- a/engines/crab/input/inputval.cpp
+++ b/engines/crab/input/inputval.cpp
@@ -35,15 +35,23 @@ namespace Crab {
using namespace pyrodactyl::input;
InputVal::InputVal() {
+ warning("STUB: InputVal::InputVal()");
+
+#if 0
key = SDL_SCANCODE_UNKNOWN;
alt = SDL_SCANCODE_UNKNOWN;
c_bu = SDL_CONTROLLER_BUTTON_INVALID;
+#endif
+
}
//------------------------------------------------------------------------
// Purpose: Load input values
//------------------------------------------------------------------------
void InputVal::LoadState(rapidxml::xml_node<char> *node) {
+ warning("STUB: InputVal::LoadState()");
+
+#if 0
LoadStr(name, "name", node);
LoadEnum(key, "key", node);
LoadEnum(alt, "alt", node);
@@ -51,12 +59,16 @@ void InputVal::LoadState(rapidxml::xml_node<char> *node) {
if (NodeValid("axis", node, false))
c_ax.LoadState(node->first_node("axis"));
+#endif
}
//------------------------------------------------------------------------
// Purpose: Save them
//------------------------------------------------------------------------
void InputVal::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title) {
+ warning("STUB: InputVal::SaveState()");
+
+#if 0
rapidxml::xml_node<char> *child;
child = doc.allocate_node(rapidxml::node_element, title);
@@ -69,8 +81,10 @@ void InputVal::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
c_ax.SaveState(doc, child);
root->append_node(child);
+#endif
}
+#if 0
//------------------------------------------------------------------------
// Purpose: See if we have been using the analog sticks
//------------------------------------------------------------------------
@@ -102,5 +116,6 @@ const bool InputVal::Equals(const SDL_ControllerButtonEvent &Event) {
const bool InputVal::Equals(const SDL_KeyboardEvent &Event) {
return (key == Event.keysym.scancode || alt == Event.keysym.scancode);
}
+#endif
} // End of namespace Crab
diff --git a/engines/crab/input/inputval.h b/engines/crab/input/inputval.h
index 135178255e6..e3ab9d70f44 100644
--- a/engines/crab/input/inputval.h
+++ b/engines/crab/input/inputval.h
@@ -46,15 +46,15 @@ public:
std::string name;
// Keyboard keys
- SDL_Scancode key, alt;
+ //SDL_Scancode key, alt;
// Controller button
- SDL_GameControllerButton c_bu;
+ //SDL_GameControllerButton c_bu;
// The controller axis
struct AxisData {
// The axis
- SDL_GameControllerAxis id;
+ //SDL_GameControllerAxis id;
// Value of controller axis - because controller axes have a range of values
int val;
@@ -68,14 +68,18 @@ public:
bool toggle;
AxisData() {
+ warning("STUB: AxisData::AxisDAta()");
+
+#if 0
id = SDL_CONTROLLER_AXIS_INVALID;
val = 0;
toggle = false;
greater = false;
+#endif
}
void LoadState(rapidxml::xml_node<char> *node) {
- LoadEnum(id, "id", node);
+ //LoadEnum(id, "id", node);
LoadNum(val, "val", node);
LoadBool(greater, "greater", node);
}
@@ -84,7 +88,7 @@ public:
rapidxml::xml_node<char> *child;
child = doc.allocate_node(rapidxml::node_element, "axis");
- child->append_attribute(doc.allocate_attribute("id", gStrPool.Get(id)));
+ //child->append_attribute(doc.allocate_attribute("id", gStrPool.Get(id)));
child->append_attribute(doc.allocate_attribute("val", gStrPool.Get(val)));
SaveBool(greater, "greater", doc, child);
@@ -95,9 +99,11 @@ public:
InputVal();
+#if 0
const bool Equals(const SDL_KeyboardEvent &val);
const bool Equals(const SDL_ControllerButtonEvent &Event);
const bool Equals(const SDL_ControllerAxisEvent &Event);
+#endif
void LoadState(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title);
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 7deef8c3361..bf5f8eb380a 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -22,6 +22,10 @@ MODULE_OBJS = \
image/Image.o \
image/ImageManager.o \
input/cursor.o \
+ input/fightinput.o \
+ input/hotkey.o \
+ input/input.o \
+ input/inputval.o \
item/Item.o \
music/MusicManager.o \
people/opinion.o \
Commit: e104f0c7d8402734a0b0dd8497bc3e09c79dffff
https://github.com/scummvm/scummvm/commit/e104f0c7d8402734a0b0dd8497bc3e09c79dffff
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable hotkey usage in ui components
Changed paths:
engines/crab/ui/SlideShow.cpp
engines/crab/ui/button.h
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 7193853384f..73b017278f7 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -52,12 +52,12 @@ void SlideShow::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("prev", node)) {
prev.Load(node->first_node("prev"));
- //prev.hotkey.Set(IU_PREV);
+ prev.hotkey.Set(IU_PREV);
}
if (NodeValid("next", node)) {
next.Load(node->first_node("next"));
- //next.hotkey.Set(IU_NEXT);
+ next.hotkey.Set(IU_NEXT);
}
path.clear();
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index b8aa89e7ebd..cd089c23b25 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -42,7 +42,7 @@
#include "crab/text/TextManager.h"
#include "crab/common_header.h"
#include "crab/ui/element.h"
-//#include "crab/input/hotkey.h"
+#include "crab/input/hotkey.h"
namespace Crab {
@@ -102,7 +102,7 @@ public:
Caption caption;
// A hotkey is a keyboard key(s) that are equivalent to pressing a button
- //pyrodactyl::input::HotKey hotkey;
+ pyrodactyl::input::HotKey hotkey;
Button();
~Button() {}
Commit: 3706cb2e1b379b0477a4b75050b4043fa3278081
https://github.com/scummvm/scummvm/commit/3706cb2e1b379b0477a4b75050b4043fa3278081
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix compilation error due to missing include
Changed paths:
engines/crab/common_header.h
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index c93911d1b04..500784312ed 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -36,7 +36,7 @@
//#include <ctime>
#include <deque>
//#include <fstream>
-#include <limits.h>
+#include <limits>
#include <map>
//#include <random>
//#include <sstream>
Commit: 611a097bc73787c88965af7dd78f1230b9e19737
https://github.com/scummvm/scummvm/commit/611a097bc73787c88965af7dd78f1230b9e19737
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make some classes in animation component compilable
Changed paths:
engines/crab/animation/AnimationEffect.h
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/AnimationFrame.h
engines/crab/animation/animation.cpp
engines/crab/animation/animation.h
engines/crab/animation/animframe.cpp
engines/crab/animation/animframe.h
engines/crab/module.mk
diff --git a/engines/crab/animation/AnimationEffect.h b/engines/crab/animation/AnimationEffect.h
index 850c091276d..5ab9dba40a6 100644
--- a/engines/crab/animation/AnimationEffect.h
+++ b/engines/crab/animation/AnimationEffect.h
@@ -54,7 +54,7 @@ struct AnimationEffect {
FadeType type;
// The duration of the effect relative to the start of this animation
- Uint32 start, finish;
+ uint32 start, finish;
// Warning: the only way to start drawing the game again is having another animation event with DRAW_START
DrawType draw_game;
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index 5bc5f5dcb47..b758f67338c 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -40,7 +40,7 @@ AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : eff(node) {
LoadImgKey(img, "img", node);
LoadNum(start, "start", node);
LoadNum(finish, "finish", node);
- LoadColor(col, node);
+ //LoadColor(col, node);
if (NodeValid("text", node, false))
text.Load(node->first_node("text"));
@@ -62,7 +62,10 @@ void AnimationFrame::Reset() {
}
}
-void AnimationFrame::Draw(const Uint32 ×tamp) {
+void AnimationFrame::Draw(const uint32 ×tamp) {
+ warning("STUB: AnimationFrame::Draw()");
+
+#if 0
// Only draw the frame in the specified duration
if (timestamp >= start && timestamp <= finish) {
// Fill the screen with the color indicated
@@ -73,9 +76,11 @@ void AnimationFrame::Draw(const Uint32 ×tamp) {
gImageManager.Draw(x, y, img);
text.Draw();
}
+#endif
}
-DrawType AnimationFrame::InternalEvents(const Uint32 ×tamp) {
+DrawType AnimationFrame::InternalEvents(const uint32 ×tamp) {
+
// Vary alpha according to the effect values in the variation time frame
if (timestamp >= eff.start && timestamp <= eff.finish) {
// These equations courtesy of linear algebra
diff --git a/engines/crab/animation/AnimationFrame.h b/engines/crab/animation/AnimationFrame.h
index a921c68ea82..081be4245ee 100644
--- a/engines/crab/animation/AnimationFrame.h
+++ b/engines/crab/animation/AnimationFrame.h
@@ -41,12 +41,21 @@ namespace Crab {
namespace pyrodactyl {
namespace anim {
+
+// Make linker happy by temporarily defining SDL_COLOR
+struct SDL_Color {
+ uint32 r;
+ uint32 g;
+ uint32 b;
+ uint32 a;
+};
+
struct AnimationFrame : public Vector2i {
// The image drawn in this frame
ImageKey img;
// This is the time in we draw the frame milliseconds relative to the start of the entire animation
- Uint32 start, finish;
+ uint32 start, finish;
// The effect applied to the image
AnimationEffect eff;
@@ -69,8 +78,8 @@ struct AnimationFrame : public Vector2i {
AnimationFrame(rapidxml::xml_node<char> *node);
void Reset();
- void Draw(const Uint32 ×tamp);
- DrawType InternalEvents(const Uint32 ×tamp);
+ void Draw(const uint32 ×tamp);
+ DrawType InternalEvents(const uint32 ×tamp);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index bae600503c4..23805047bc1 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -42,13 +42,13 @@ Animation::Animation(rapidxml::xml_node<char> *node) {
}
void Animation::Draw() {
- Uint32 timestamp = timer.Ticks();
+ uint32 timestamp = timer.Ticks();
for (auto i = frame.begin(); i != frame.end(); ++i)
i->Draw(timestamp);
}
bool Animation::InternalEvents(DrawType &game_draw) {
- Uint32 timestamp = timer.Ticks();
+ uint32 timestamp = timer.Ticks();
for (auto i = frame.begin(); i != frame.end(); ++i) {
DrawType result = i->InternalEvents(timestamp);
// if (result != DRAW_SAME)
diff --git a/engines/crab/animation/animation.h b/engines/crab/animation/animation.h
index ecfb2eea70c..ed840f84d2c 100644
--- a/engines/crab/animation/animation.h
+++ b/engines/crab/animation/animation.h
@@ -45,7 +45,7 @@ class Animation {
std::vector<AnimationFrame> frame;
// Length of the entire animation in milliseconds
- Uint32 length;
+ uint32 length;
// Keep track of the time
Timer timer;
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index 97c0fd65626..7fd4844bf45 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::anim;
-void AnimFrame::Load(rapidxml::xml_node<char> *node, const Rect &VBOX, const Uint32 &rep, const int &AX, const int &AY) {
+void AnimFrame::Load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
clip.Load(node);
if (rep == 0)
@@ -86,10 +86,13 @@ void AnimationFrames::Load(rapidxml::xml_node<char> *node) {
}
}
+#if 0
if (random)
current_clip = gRandom.Num() % frame.size();
else
current_clip = 0;
+#endif
+ current_clip = 0;
}
bool AnimationFrames::UpdateClip() {
diff --git a/engines/crab/animation/animframe.h b/engines/crab/animation/animframe.h
index b611a016d8c..6310992f788 100644
--- a/engines/crab/animation/animframe.h
+++ b/engines/crab/animation/animframe.h
@@ -45,7 +45,7 @@ struct AnimFrame {
Rect clip;
// The duration for which the frame must be repeated on screen
- Uint32 repeat;
+ uint32 repeat;
// The anchor point of the frame
Vector2i anchor;
@@ -56,7 +56,7 @@ struct AnimFrame {
AnimFrame() { repeat = 0; }
void Load(rapidxml::xml_node<char> *node, const Rect &VBOX,
- const Uint32 &REP = 0, const int &AX = 0, const int &AY = 0);
+ const uint32 &REP = 0, const int &AX = 0, const int &AY = 0);
};
class AnimationFrames {
@@ -76,7 +76,7 @@ public:
// The global repeat value for all the frames
// If this is 0, then use individual frame values
- Uint32 repeat;
+ uint32 repeat;
// The global anchor value for all the frames
// If this is 0, then use individual frame values
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index bf5f8eb380a..fb1b36e044a 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -9,6 +9,10 @@ MODULE_OBJS = \
loaders.o \
ScreenSettings.o \
GameParam.o \
+ animation/animation.o \
+ animation/AnimationFrame.o \
+ animation/animframe.o \
+ animation/imageeffect.o \
event/conversationdata.o \
event/effect.o \
event/EventSeqGroup.o \
@@ -49,6 +53,8 @@ MODULE_OBJS = \
ui/ImageData.o \
ui/MapData.o \
ui/ParagraphData.o \
+ ui/ProgressBar.o \
+ ui/QuestText.o \
ui/SectionHeader.o \
ui/slider.o \
ui/SlideShow.o \
Commit: 3fa3e30806b573e0b5d94abc01110a19c9fc7f52
https://github.com/scummvm/scummvm/commit/3fa3e30806b573e0b5d94abc01110a19c9fc7f52
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make various Pathfinding classes compilable
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/common_header.h
engines/crab/module.mk
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 3b49dd6d068..c29aa9c915a 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/PathfindingAgent.h"
namespace Crab {
@@ -103,6 +104,9 @@ void PathfindingAgent::SetDestination(Vector2f d, bool r) {
}
void PathfindingAgent::Update(long timeslice) {
+ warning("STUB: PathfindingAgent::Update()");
+
+#if 0
long prevTime = SDL_GetTicks();
long time = timeslice;
@@ -218,6 +222,7 @@ void PathfindingAgent::Update(long timeslice) {
} while (!isDone() && (time >= 0 || timeslice == 0));
noSolution = true; // You can't get there from here (SZ)
+#endif
}
bool PathfindingAgent::isDone() const {
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index fd54ed3e75d..0d771e3b7bb 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/PathfindingGrid.h"
#include "crab/TMX/TMXMap.h"
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 637c32b63a4..107b2173411 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -31,13 +31,12 @@
#ifndef CRAB_PATHFINDINGGRID_H
#define CRAB_PATHFINDINGGRID_H
+#include <math.h>
#include "crab/PathfindingGraphNode.h"
#include "crab/common_header.h"
namespace Crab {
-include <math.h>
-
namespace TMX {
class TMXMap;
}
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 500784312ed..33d4bb0b4ea 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -40,6 +40,7 @@
#include <map>
//#include <random>
//#include <sstream>
+#include <list>
#include <string>
#include <unordered_map>
#include <vector>
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index fb1b36e044a..12ba8e95905 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -67,6 +67,9 @@ MODULE_OBJS = \
app.o \
splash.o \
Line.o \
+ PathfindingAgent.o \
+ PathfindingGraphNode.o \
+ PathfindingGrid.o \
Polygon.o \
Rectangle.o \
Shape.o
Commit: 438db4e4aa97e0f15b1300229857866ce3c32f5e
https://github.com/scummvm/scummvm/commit/438db4e4aa97e0f15b1300229857866ce3c32f5e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make some ai classes compilable
Changed paths:
engines/crab/ai/SpriteConstant.h
engines/crab/ai/movement.h
engines/crab/ai/spriteai.cpp
engines/crab/module.mk
diff --git a/engines/crab/ai/SpriteConstant.h b/engines/crab/ai/SpriteConstant.h
index 7cbae61efa2..154068b1d53 100644
--- a/engines/crab/ai/SpriteConstant.h
+++ b/engines/crab/ai/SpriteConstant.h
@@ -44,7 +44,7 @@ struct FlyerConstant {
Vector2i start;
// The value of the delay for fliers
- Uint32 delay_min, delay_max;
+ uint32 delay_min, delay_max;
// The velocity of fliers
Vector2f vel;
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index c179c469e7f..aa3b1c208ae 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -46,7 +46,7 @@ struct MovementSet {
Rect target;
// The time the sprite waits before it starts moving to pos
- Uint32 delay;
+ uint32 delay;
Movement(rapidxml::xml_node<char> *node) {
target.Load(node);
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 3d88972c8f3..d58dd8e8fa1 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -207,6 +207,9 @@ void Sprite::Flee(pyrodactyl::event::Info &info, std::vector<pyrodactyl::level::
// Purpose: AI routine for fighting the player
//------------------------------------------------------------------------
void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const SpriteConstant &sc) {
+ warning("STUB: Sprite::Attack()");
+
+#if 0
switch (ai_data.fight.state) {
case FIGHTSTATE_GETNEXTMOVE: {
ai_data.fight.state = FIGHTSTATE_GETINRANGE;
@@ -245,9 +248,13 @@ void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const Spri
default:
break;
}
+#endif
}
void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
+ warning("STUB: Sprite::FlyAround()");
+
+#if 0
// Is this sprite flying right now?
if (ai_data.walk.enabled) {
// We're flying towards the left edge
@@ -308,6 +315,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
ai_data.walk.enabled = true;
}
}
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 12ba8e95905..9170135efce 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -9,6 +9,9 @@ MODULE_OBJS = \
loaders.o \
ScreenSettings.o \
GameParam.o \
+ ai/moveeffect.o \
+ ai/movement.o \
+ ai/SpriteConstant.o \
animation/animation.o \
animation/AnimationFrame.o \
animation/animframe.o \
Commit: e863443161ed219f0b8301cf70cead2c1f0779ab
https://github.com/scummvm/scummvm/commit/e863443161ed219f0b8301cf70cead2c1f0779ab
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make all of animation component compilable
Changed paths:
engines/crab/animation/PopUp.h
engines/crab/animation/fightanim.cpp
engines/crab/animation/fightanim.h
engines/crab/animation/fightmoves.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/module.mk
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index 70b8d872133..56b59629f97 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -37,6 +37,7 @@
#include "crab/common_header.h"
#include "crab/event/effect.h"
#include "crab/event/triggerset.h"
+#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index 002c9858f12..f36ef2f4cb3 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::anim;
//------------------------------------------------------------------------
// Purpose: Load a single frame of a fighting move
//------------------------------------------------------------------------
-void FightAnimFrame::Load(rapidxml::xml_node<char> *node, const Rect &VBOX, const Uint32 &rep, const int &AX, const int &AY) {
+void FightAnimFrame::Load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
AnimFrame::Load(node, VBOX, rep, AX, AY);
if (NodeValid("box_d", node, false))
diff --git a/engines/crab/animation/fightanim.h b/engines/crab/animation/fightanim.h
index e3df9d81401..76f4a8f240e 100644
--- a/engines/crab/animation/fightanim.h
+++ b/engines/crab/animation/fightanim.h
@@ -64,7 +64,7 @@ struct FightAnimFrame : public AnimFrame {
}
void Load(rapidxml::xml_node<char> *node, const Rect &VBOX,
- const Uint32 &REP = 0, const int &AX = 0, const int &AY = 0);
+ const uint32 &REP = 0, const int &AX = 0, const int &AY = 0);
};
// All data related to a single fighting move in a single direction
@@ -85,7 +85,7 @@ public:
// The amount of time in milliseconds each animation frame needs to be on screen
// If this is zero then use the value in each individual frame
- Uint32 repeat;
+ uint32 repeat;
// The global anchor value for all the frames
// If this is 0, then use individual frame values
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index cbca0617ef4..e997d443032 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -34,6 +34,7 @@
#include "crab/music/MusicManager.h"
#include "crab/common_header.h"
#include "crab/animation/fightmove.h"
+#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 0ee885a2042..90cb265d8f4 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/animation/sprite.h"
namespace Crab {
@@ -240,6 +241,9 @@ Vector2i Sprite::CamFocus() {
// Purpose: Draw the sprite
//------------------------------------------------------------------------
void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
+ warning("STUB: Sprite::Draw()");
+
+#if 0
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
@@ -321,6 +325,7 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
10);
destinationRect.Draw(-camera.x, -camera.y, 0, 200, 0, 254);
}
+#endif
}
void Sprite::DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
@@ -330,6 +335,8 @@ void Sprite::DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
popup.Draw(x, y, pop, camera);
}
+
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle the movement in a level for the player only
//------------------------------------------------------------------------
@@ -393,6 +400,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is to prevent one frame of drawing with incorrect parameters
Animate(info);
}
+#endif
//------------------------------------------------------------------------
// Purpose: Set destination for sprite movement
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 2da5c4f4792..381ffe10904 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -207,8 +207,10 @@ public:
// Set sprite destination
void SetDestPathfinding(const Vector2i &dest, bool reachable = true);
+#if 0
// Used for sprite movement controlled by player input (usually the player sprite)
void HandleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const SDL_Event &Event);
+#endif
// This is for sprites with valid object ids
void Animate(pyrodactyl::event::Info &info);
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 9170135efce..8eed59572b4 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -15,7 +15,13 @@ MODULE_OBJS = \
animation/animation.o \
animation/AnimationFrame.o \
animation/animframe.o \
+ animation/fightanim.o \
+ animation/fightmove.o \
+ animation/fightmoves.o \
animation/imageeffect.o \
+ animation/PopUp.o \
+ animation/sprite.o \
+ animation/walkframes.o \
event/conversationdata.o \
event/effect.o \
event/EventSeqGroup.o \
Commit: 857108c3e33e54fa15a6d109e146dfd3436e1e7b
https://github.com/scummvm/scummvm/commit/857108c3e33e54fa15a6d109e146dfd3436e1e7b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: spriteAI class should be compilable now
Changed paths:
engines/crab/ai/spriteai.cpp
engines/crab/module.mk
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index d58dd8e8fa1..c21f8287851 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 8eed59572b4..47d495674ee 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -11,6 +11,7 @@ MODULE_OBJS = \
GameParam.o \
ai/moveeffect.o \
ai/movement.o \
+ ai/spriteai.o \
ai/SpriteConstant.o \
animation/animation.o \
animation/AnimationFrame.o \
Commit: e49e2cbbd861f6399261a1799caf48eb43f4769b
https://github.com/scummvm/scummvm/commit/e49e2cbbd861f6399261a1799caf48eb43f4769b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix compilation due to missing includes
Changed paths:
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index bde2980deb5..6918ee40dd6 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -104,7 +104,7 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
total_page = page_count + 1;
// Update the text
- status.text = NumberToString(current_page + 1) + " of " + NumberToString(total_page);
+ status.text = (NumberToString(current_page + 1) + " of " + NumberToString(total_page)).c_str();
// Now, start drawing the quest
status.Draw();
@@ -135,6 +135,7 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
}
}
+#if 0
void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event) {
if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
current_page--;
@@ -150,6 +151,7 @@ void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event
current_page = total_page - 1;
}
}
+#endif
void QuestText::SetUI() {
ParagraphData::SetUI();
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index ed03d2e9119..a6f58161abe 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -81,8 +81,9 @@ public:
// Reset the value of current page
void Reset() { current_page = 0; }
-
+#if 0
void HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event);
+#endif
void Draw(pyrodactyl::event::Quest &q);
void SetUI();
Commit: cf9be95a4a7e3b0cfffee585dc520a3eee9d67e9
https://github.com/scummvm/scummvm/commit/cf9be95a4a7e3b0cfffee585dc520a3eee9d67e9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make some more UI classes compilable
Changed paths:
engines/crab/module.mk
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/FileData.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 47d495674ee..eb3ab1ff5ab 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -54,17 +54,37 @@ MODULE_OBJS = \
TMX/TMXLayer.o \
TMX/TMXTileSet.o \
ui/button.o \
+ ui/Caption.o \
+ ui/ChapterIntro.o \
ui/ClipButton.o \
ui/CreditScreen.o \
- ui/Caption.o \
+ ui/dialogbox.o \
ui/element.o \
+ ui/emotion.o \
+ ui/FileMenu.o \
+ ui/GameOverMenu.o \
+ ui/GeneralSettingMenu.o \
+ ui/GfxSettingMenu.o \
ui/HealthIndicator.o \
ui/HoverInfo.o \
ui/ImageData.o \
+ ui/Inventory.o \
+ ui/journal.o \
+ ui/KeyBindMenu.o \
+ ui/map.o \
ui/MapData.o \
+ ui/MapMarkerMenu.o \
+ ui/ModMenu.o \
+ ui/OptionMenu.o \
+ ui/OptionSelect.o \
ui/ParagraphData.o \
+ ui/PauseMenu.o \
ui/ProgressBar.o \
+ ui/questmenu.o \
ui/QuestText.o \
+ ui/ReplyButton.o \
+ ui/ResolutionMenu.o \
+ ui/SaveGameMenu.o \
ui/SectionHeader.o \
ui/slider.o \
ui/SlideShow.o \
@@ -73,6 +93,7 @@ MODULE_OBJS = \
ui/textdata.o \
ui/ToggleButton.o \
ui/TraitButton.o \
+ ui/TraitMenu.o \
timer.o \
app.o \
splash.o \
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 39e75cf5721..7fda2fc2251 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -27,7 +27,7 @@
* Licensed under MIT
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/ChapterIntro.h"
namespace Crab {
@@ -46,15 +46,19 @@ void ChapterIntro::Load(rapidxml::xml_node<char> *node) {
traits.Load(node->first_node("trait"));
}
+#if 0
bool ChapterIntro::HandleEvents(SDL_Event &Event) {
if (traits.HandleEvents(Event))
show_traits = true;
return dialog.HandleEvents(Event);
}
+#endif
void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state) {
+ warning("STUB: ChapterIntro::Draw()");
+#if 0
dialog.Draw(false);
dialog.Draw(info, text);
@@ -64,6 +68,7 @@ void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
Rect clip = cur_sp->DialogClip(state);
gImageManager.Draw(pos.x, pos.y, cur_sp->Img(), &clip);
}
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index 3ef54dd596f..0ecda146328 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -57,7 +57,11 @@ public:
ChapterIntro() { show_traits = false; }
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
bool HandleEvents(SDL_Event &Event);
+#endif
+
void Draw(pyrodactyl::event::Info &info, std::string &text,
pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state);
};
diff --git a/engines/crab/ui/FileData.h b/engines/crab/ui/FileData.h
index 72486f14029..282d0eea626 100644
--- a/engines/crab/ui/FileData.h
+++ b/engines/crab/ui/FileData.h
@@ -42,7 +42,7 @@ namespace ui {
class FileData {
public:
std::string name, path, last_modified;
- FileData(const boost::filesystem::path &filepath);
+ //FileData(const boost::filesystem::path &filepath);
};
class SaveFileData : public FileData {
@@ -52,14 +52,14 @@ public:
// This is to account for the first save slot, called "New Save", which doesn't actually have a file
bool blank;
- SaveFileData(const boost::filesystem::path &filepath);
+ //SaveFileData(const boost::filesystem::path &filepath);
SaveFileData(const bool empty);
};
class ModFileData : public FileData {
public:
std::string author, version, info, website, preview;
- ModFileData(boost::filesystem::path filepath);
+ //ModFileData(boost::filesystem::path filepath);
};
// The types of data shown about the save file
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 046f03a618e..3d30c4a9ffd 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -109,6 +109,9 @@ public:
void SelectedPath(const std::string &val) { selected = val; }
void ScanDir() {
+ warning("STUB: FileMenu::ScanDir()");
+
+#if 0
using namespace boost::filesystem;
slot_info.clear();
@@ -133,6 +136,7 @@ public:
create_directories(filedir);
menu.AssignPaths();
+#endif
}
void Load(rapidxml::xml_node<char> *node) {
@@ -168,11 +172,12 @@ public:
hov[DATA_PLAYERNAME].Load(offnode->first_node("player_name_title"));
}
- extension = gFilePath.save_ext;
- directory = gFilePath.appdata + gFilePath.save_dir;
+ extension = gFilePath.save_ext.c_str();
+ directory = (gFilePath.appdata + gFilePath.save_dir).c_str();
ScanDir();
}
+#if 0
bool HandleEvents(const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
if (choice >= 0) {
@@ -184,6 +189,7 @@ public:
return false;
}
+#endif
void Draw() {
bg.Draw();
@@ -204,8 +210,8 @@ public:
if (!img.loaded || prev_hover != i) {
img.loaded = true;
prev_hover = i;
- if (!img.preview.Load(slot_info[i].preview))
- img.preview.Load(img.no_preview_path);
+ if (!img.preview.Load(slot_info[i].preview.c_str()))
+ img.preview.Load(img.no_preview_path.c_str());
}
hover = true;
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index 49db78ef479..f8b32f4d714 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -56,9 +56,11 @@ void GameOverMenu::Load(rapidxml::xml_node<char> *node) {
}
}
+#if 0
int GameOverMenu::HandleEvents(const SDL_Event &Event) {
return menu.HandleEvents(Event);
}
+#endif
void GameOverMenu::Draw() {
bg.Draw();
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index e0a6676b651..2b632af3923 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -60,10 +60,17 @@ public:
GameOverMenu(void) { cur = 0; }
~GameOverMenu(void) {}
- void Reset() { cur = gRandom.Num() % quote.size(); }
+ void Reset() {
+ warning("STUB: GameOverMenu::Reset()");
+#if 0
+ cur = gRandom.Num() % quote.size();
+#endif
+ }
void Load(rapidxml::xml_node<char> *node);
+#if 0
int HandleEvents(const SDL_Event &Event);
+#endif
void Draw();
void SetUI();
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 6f014a82031..3256acc1a26 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -45,11 +45,11 @@ void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("desc", musnode))
notice_volume.Load(musnode->first_node("desc"));
- if (NodeValid("music", musnode))
- vol_music.Load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, gMusicManager.VolMusic());
+ // if (NodeValid("music", musnode))
+ // vol_music.Load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, gMusicManager.VolMusic());
- if (NodeValid("effects", musnode))
- vol_effects.Load(musnode->first_node("effects"), 0, MIX_MAX_VOLUME, gMusicManager.VolEffects());
+ // if (NodeValid("effects", musnode))
+ // vol_effects.Load(musnode->first_node("effects"), 0, MIX_MAX_VOLUME, gMusicManager.VolEffects());
}
if (NodeValid("mouse_trap", node))
@@ -66,6 +66,7 @@ void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
i.state = (i.val == gScreenSettings.text_speed);
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
@@ -89,6 +90,7 @@ void GeneralSettingMenu::HandleEvents(const SDL_Event &Event) {
if (result >= 0)
gScreenSettings.text_speed = text_speed.element.at(result).val;
}
+#endif
//------------------------------------------------------------------------
// Purpose: Sync our buttons with screen settings
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 8a037c5bf73..1b547da7727 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -56,7 +56,11 @@ public:
~GeneralSettingMenu() {}
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
void HandleEvents(const SDL_Event &Event);
+#endif
+
void InternalEvents();
void Draw();
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 341c3af2404..2357628a3c1 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -86,6 +86,7 @@ void GfxSettingMenu::Draw() {
resolution.Draw();
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
@@ -121,6 +122,7 @@ int GfxSettingMenu::HandleEvents(const SDL_Event &Event) {
return resolution.HandleEvents(Event);
}
+#endif
//------------------------------------------------------------------------
// Purpose: Keep button settings synced with our screen settings
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 12b6d5789ee..6b151f62246 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -60,7 +60,10 @@ public:
~GfxSettingMenu() {}
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
int HandleEvents(const SDL_Event &Event);
+#endif
void InternalEvents();
void Draw();
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 0ca8340505a..c1255488b74 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::people;
// Purpose: Load layout
//------------------------------------------------------------------------
void Inventory::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("inventory");
if (NodeValid(node)) {
@@ -61,7 +61,7 @@ void Inventory::Load(const std::string &filename) {
void Inventory::LoadItem(const std::string &char_id, const std::string &id) {
Item i;
- XMLDoc item_list(itemfile);
+ XMLDoc item_list(itemfile.c_str());
if (item_list.ready()) {
rapidxml::xml_node<char> *node = item_list.Doc()->first_node("items");
for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item")) {
@@ -95,10 +95,11 @@ void Inventory::Draw(Person &obj, const int &money_val) {
// helper.DrawInfo(obj);
collection.Draw(obj.id /*, helper*/);
- money.caption.text = NumberToString(money_val);
+ money.caption.text = NumberToString(money_val).c_str();
money.Draw();
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
@@ -106,6 +107,7 @@ void Inventory::HandleEvents(const std::string &char_id, const SDL_Event &Event)
collection.HandleEvents(char_id, Event);
money.HandleEvents(Event);
}
+#endif
//------------------------------------------------------------------------
// Purpose: Load and save items
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index 0f113f117ab..0a6dbc647a2 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -71,7 +71,10 @@ public:
void Load(const std::string &filename);
void Draw(pyrodactyl::people::Person &obj, const int &money_val);
+
+#if 0
void HandleEvents(const std::string &char_id, const SDL_Event &Event);
+#endif
void LoadState(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index 9b604f2c215..b110ae1cfcb 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -89,6 +89,9 @@ void KeyBindMenu::StartAndSize(const int &type, int &start, int &size) {
}
void KeyBindMenu::InitMenu(const int &type) {
+ warning("STUB: KeyBindMenu::InitMenu()");
+
+#if 0
int start = 0, size = 0;
StartAndSize(type, start, size);
@@ -104,6 +107,7 @@ void KeyBindMenu::InitMenu(const int &type) {
menu[type].element.at(i + 1).Init(alt, xoffset, yoffset);
menu[type].element.at(i + 1).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].alt);
}
+#endif
}
void KeyBindMenu::DrawDesc(const int &type) {
@@ -126,6 +130,9 @@ void KeyBindMenu::Draw() {
}
void KeyBindMenu::SetCaption() {
+ warning("STUB: KeyBindMenu::SetCaption()");
+
+#if 0
int start = 0, size = 0;
StartAndSize(sel_controls.cur, start, size);
@@ -133,8 +140,10 @@ void KeyBindMenu::SetCaption() {
menu[sel_controls.cur].element.at(i).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].key);
menu[sel_controls.cur].element.at(i + 1).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].alt);
}
+#endif
}
+#if 0
void KeyBindMenu::HandleEvents(const SDL_Event &Event) {
if (sel_controls.HandleEvents(Event))
SetCaption();
@@ -182,6 +191,7 @@ void KeyBindMenu::SwapKey(const SDL_Scancode &find) {
else
gInput.iv[pos].alt = find;
}
+#endif
void KeyBindMenu::SetUI() {
menu[CON_GAME].Clear();
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index d3538e052e3..8b6b279675f 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -108,11 +108,16 @@ public:
~KeyBindMenu() {}
void Reset() { state = STATE_NORMAL; }
+
+#if 0
void SwapKey(const SDL_Scancode &find);
+#endif
bool DisableHotkeys() { return state != STATE_NORMAL; }
void Load(rapidxml::xml_node<char> *node);
+#if 0
void HandleEvents(const SDL_Event &Event);
+#endif
void SetCaption();
void Draw();
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 3c0197a14eb..e20609d6009 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -78,6 +78,7 @@ void MapMarkerMenu::Draw(const Element &pos, const Vector2i &player_pos, const R
i.HoverInfoOnlyDraw(offset_m.x, offset_m.y);
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
@@ -98,6 +99,7 @@ void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos,
}
}
}
+#endif
//------------------------------------------------------------------------
// Purpose: Internal Events
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 53ead0b93c2..2f176cc160a 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -86,7 +86,9 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
+#if 0
void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
+#endif
void InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
void SetUI();
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 41068525cf2..8a135550b69 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
void ModMenu::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("mod_menu");
@@ -71,12 +71,13 @@ void ModMenu::Load(const std::string &filename) {
hov[DATA_WEBSITE].Load(offnode->first_node("website_title"));
}
- extension = gFilePath.mod_ext;
- directory = gFilePath.mod_path;
+ extension = gFilePath.mod_ext.c_str();
+ directory = gFilePath.mod_path.c_str();
ScanDir();
}
}
+#if 0
bool ModMenu::HandleEvents(const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
if (choice >= 0) {
@@ -86,6 +87,7 @@ bool ModMenu::HandleEvents(const SDL_Event &Event) {
return false;
}
+#endif
void ModMenu::Draw() {
bg.Draw();
@@ -102,8 +104,8 @@ void ModMenu::Draw() {
if (!img.loaded || prev_hover != i) {
img.loaded = true;
prev_hover = i;
- if (!img.preview.Load(slot_info[i].preview))
- img.preview.Load(img.no_preview_path);
+ if (!img.preview.Load(slot_info[i].preview.c_str()))
+ img.preview.Load(img.no_preview_path.c_str());
}
hover = true;
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index 14d2cab7d28..2bd848a9f38 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -44,7 +44,10 @@ public:
~ModMenu() {}
void Load(const std::string &filename);
+
+#if 0
bool HandleEvents(const SDL_Event &Event);
+#endif
void Draw();
};
} // End of namespace ui
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 7595c6b60c9..cb305bae97d 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -43,7 +43,7 @@ OptionMenu gOptionMenu;
} // End of namespace pyrodactyl
void OptionMenu::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("option");
if (NodeValid(node)) {
@@ -143,7 +143,7 @@ void OptionMenu::Draw(Button &back) {
break;
case STATE_CONFIRM:
notice_res.Draw();
- countdown.Draw(NumberToString(timer.RemainingTicks() / 1000));
+ countdown.Draw(NumberToString(timer.RemainingTicks() / 1000).c_str());
break;
default:
break;
@@ -154,6 +154,7 @@ void OptionMenu::Draw(Button &back) {
}
}
+#if 0
bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
if (state < STATE_ENTER_W) {
bg.Draw();
@@ -230,6 +231,7 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
return false;
}
+
bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
if (back.HandleEvents(Event) == BUAC_LCLICK) {
Reset();
@@ -286,6 +288,7 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
return false;
}
+#endif
void OptionMenu::InternalEvents() {
// Since these states can be changed at any time, we just update it regularly
@@ -301,6 +304,9 @@ void OptionMenu::InternalEvents() {
}
void OptionMenu::SaveState() {
+ warning("STUB: OptionMenu::SaveState()");
+
+#if 0
rapidxml::xml_document<char> doc;
// xml declaration
@@ -328,6 +334,7 @@ void OptionMenu::SaveState() {
}
doc.clear();
+#endif
}
void OptionMenu::SetUI() {
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 08d5912caaf..a0ed51935c1 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -39,6 +39,7 @@
#include "crab/ui/ToggleButton.h"
#include "crab/common_header.h"
#include "crab/ui/slider.h"
+#include "crab/timer.h"
namespace Crab {
@@ -85,8 +86,10 @@ class OptionMenu {
TextData countdown;
Timer timer;
+#if 0
// Function to draw the main menu (controls, settings, save, cancel)
bool HandleTabs(Button &back, const SDL_Event &Event);
+#endif
public:
bool loaded;
@@ -103,7 +106,9 @@ public:
void Load(const std::string &filename);
void Draw(Button &back);
+#if 0
bool HandleEvents(Button &back, const SDL_Event &Event);
+#endif
void InternalEvents();
void SetUI();
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index ba11985be82..f27a984efb3 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -64,6 +64,7 @@ void OptionSelect::Draw() {
next.Draw();
}
+#if 0
bool OptionSelect::HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
@@ -83,6 +84,7 @@ bool OptionSelect::HandleEvents(const SDL_Event &Event) {
return false;
}
+#endif
void OptionSelect::SetUI() {
option.data.SetUI();
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index 3257bba1e09..c2d4f574093 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -64,7 +64,10 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw();
+
+#if 0
bool HandleEvents(const SDL_Event &Event);
+#endif
void SetUI();
};
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 2ee22204185..f9054dfdd8a 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -133,7 +133,11 @@ public:
m->SetUI();
}
- void UpdateInfo() { info = NumberToString(current_page + 1) + " of " + NumberToString(menu.size()); }
+ void UpdateInfo() {
+ info = NumberToString(current_page + 1).c_str();
+ info += " of ";
+ info += NumberToString(menu.size()).c_str();
+ }
void Load(rapidxml::xml_node<char> *node) {
using namespace pyrodactyl::input;
@@ -196,6 +200,7 @@ public:
UpdateInfo();
}
+#if 0
int HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
@@ -217,6 +222,7 @@ public:
return menu.at(current_page).HandleEvents(Event);
}
+#endif
void Draw() {
status.Draw(info);
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 60eb2e34544..4769a9a51d5 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -67,6 +67,7 @@ bool PauseMenu::Draw(Button &back) {
return false;
}
+#if 0
PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
switch (state) {
case STATE_NORMAL:
@@ -126,6 +127,7 @@ PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
return PS_NONE;
}
+#endif
bool PauseMenu::DisableHotkeys() {
return (state == STATE_SAVE && save.DisableHotkeys()) || (state == STATE_OPTION && gOptionMenu.DisableHotkeys());
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 4201fe2f9ff..b4d6e7a9086 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -84,7 +84,10 @@ public:
}
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
PauseSignal HandleEvents(const SDL_Event &Event, Button &back);
+#endif
// Returns true if inside options menu, false otherwise
bool Draw(Button &back);
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index 1ed55c16e71..efa12f0158b 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -62,6 +62,7 @@ public:
Menu::Draw(XOffset, YOffset);
}
+#if 0
int HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
int result = Menu::HandleEvents(Event, XOffset, YOffset);
@@ -74,6 +75,7 @@ public:
return result;
}
+#endif
void SetUI() {
Menu::SetUI();
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 24bb91587f4..149062131c5 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -43,9 +43,9 @@ void ReplyButton::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("text", node)) {
rapidxml::xml_node<char> *tenode = node->first_node("text");
- LoadColor(col_b, tenode->first_node("col_b"));
- LoadColor(col_s, tenode->first_node("col_s"));
- LoadColor(col_h, tenode->first_node("col_h"));
+ //LoadColor(col_b, tenode->first_node("col_b"));
+ //LoadColor(col_s, tenode->first_node("col_s"));
+ //LoadColor(col_h, tenode->first_node("col_h"));
LoadNum(font, "font", tenode);
LoadAlign(align, tenode);
@@ -66,6 +66,9 @@ void ReplyButton::Draw(const int &XOffset, const int &YOffset) {
}
void ReplyButton::Cache(const std::string &val, const int &spacing, const int &bottom_edge, Rect *parent) {
+ warning("STUB: ReplyButton::Cache()");
+
+#if 0
text = val;
// Find out about the font
@@ -83,6 +86,7 @@ void ReplyButton::Cache(const std::string &val, const int &spacing, const int &b
if (orig.y < bottom_edge)
y = bottom_edge + spacing;
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 501d2c17df5..31bb3d0ac40 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -65,7 +65,9 @@ void ResolutionMenu::Load(rapidxml::xml_node<char> *node) {
dim.push_back(d);
Button b;
b.Init(ref, inc.x * (count_slot % columns), inc.y * (count_slot / columns));
- b.caption.text = NumberToString(d.w) + " x " + NumberToString(d.h);
+ b.caption.text = NumberToString(d.w).c_str();
+ b.caption.text += " x ";
+ b.caption.text += NumberToString(d.h).c_str();
element.push_back(b);
}
}
@@ -94,6 +96,7 @@ void ResolutionMenu::Draw() {
}
}
+#if 0
int ResolutionMenu::HandleEvents(const SDL_Event &Event) {
switch (state) {
case STATE_NORMAL:
@@ -122,6 +125,7 @@ int ResolutionMenu::HandleEvents(const SDL_Event &Event) {
return 0;
}
+#endif
void ResolutionMenu::SetUI() {
cancel.SetUI();
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index e4d66d0144e..e2581a42622 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -71,10 +71,18 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw();
+#if 0
// Return 1 if one of resolution buttons is pressed, 2 if custom button is pressed, 0 otherwise
int HandleEvents(const SDL_Event &Event);
+#endif
+
+ void SetInfo() {
+ info.text = def_info;
+ info.text += NumberToString(gScreenSettings.cur.w).c_str();
+ info.text += " x ";
+ info.text += NumberToString(gScreenSettings.cur.h).c_str();
+ }
- void SetInfo() { info.text = def_info + NumberToString(gScreenSettings.cur.w) + " x " + NumberToString(gScreenSettings.cur.h); }
void SetUI();
};
} // End of namespace ui
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 2c22b99065a..bff6671ccc8 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -42,6 +42,7 @@ void GameSaveMenu::Load(rapidxml::xml_node<char> *node) {
FileMenu<SaveFileData>::Load(node);
}
+#if 0
void GameSaveMenu::AddButton(boost::filesystem::path p, unsigned int &slot_index, unsigned int &menu_index) {
slot_info.push_back(SaveFileData(p));
menu.Add(slot_index, menu_index);
@@ -119,6 +120,7 @@ bool GameSaveMenu::HandleEvents(const SDL_Event &Event) {
return false;
}
+#endif
void GameSaveMenu::Draw() {
bg.Draw();
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index ece98d0c7d9..306c649d574 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -51,7 +51,9 @@ class GameSaveMenu : public FileMenu<SaveFileData> {
// The index of the selected button
int index;
+#if 0
void AddButton(boost::filesystem::path p, unsigned int &slot_index, unsigned int &menu_index);
+#endif
public:
GameSaveMenu() {
@@ -64,7 +66,10 @@ public:
bool DisableHotkeys() { return state == STATE_NAME; }
void Load(rapidxml::xml_node<char> *node);
+
+#if 0
bool HandleEvents(const SDL_Event &Event);
+#endif
void Draw();
void SetUI();
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 25a12e3542f..74ce438e45a 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -83,6 +83,7 @@ void TraitMenu::Draw(const pyrodactyl::people::Person *obj) {
i.Draw();
}
+#if 0
void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
if (choice >= 0) {
@@ -98,6 +99,7 @@ void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const SDL_Event &E
}
}
}
+#endif
void TraitMenu::Cache(const pyrodactyl::people::Person &obj) {
auto e = menu.element.begin();
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index 6420636fa58..c96bfd79997 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -74,7 +74,10 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(const pyrodactyl::people::Person *obj);
+
+#if 0
void HandleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event);
+#endif
void Cache(const pyrodactyl::people::Person &obj);
void SetUI();
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index b208d8378c1..b7658912aee 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -77,12 +77,15 @@ void GameDialogBox::Draw(pyrodactyl::event::Info &info, std::string &message) {
text.Draw(message);
button.Draw();
}
+
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
bool GameDialogBox::HandleEvents(const SDL_Event &Event) {
return (button.HandleEvents(Event) == BUAC_LCLICK);
}
+#endif
void GameDialogBox::SetUI() {
pos.SetUI();
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index 32dd2434538..9906dc370b2 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -72,7 +72,9 @@ public:
void Draw(pyrodactyl::event::Info &info, std::string &message);
void Draw(const bool &player);
+#if 0
bool HandleEvents(const SDL_Event &Event);
+#endif
void SetUI();
};
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 8c2f8dcd332..236b1b7fb35 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::ui;
// Purpose: Load game
//------------------------------------------------------------------------
void Journal::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("objectives");
if (NodeValid(node)) {
@@ -124,6 +124,7 @@ void Journal::Draw(const std::string &id) {
}
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
@@ -142,6 +143,7 @@ bool Journal::HandleEvents(const std::string &id, const SDL_Event &Event) {
return false;
}
+#endif
//------------------------------------------------------------------------
// Purpose: Add an entry to journal
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 15cbd910e0a..1f4ec88c48a 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -98,7 +98,9 @@ public:
void Draw(const std::string &id);
// Return true if "go to map" is selected
+#if 0
bool HandleEvents(const std::string &id, const SDL_Event &Event);
+#endif
void Add(const std::string &id, const std::string &Category, const std::string &Title, const std::string &Text);
void Move(const std::string &id, const std::string &Title, const bool &completed);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index dfa0543a101..1298415242a 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::input;
// Purpose: Load stuff that can't be modified by the user
//------------------------------------------------------------------------
void Map::Load(const std::string &filename, pyrodactyl::event::Info &info) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("map");
if (NodeValid(node)) {
@@ -89,6 +89,9 @@ void Map::Load(const std::string &filename, pyrodactyl::event::Info &info) {
// Purpose: Draw
//------------------------------------------------------------------------
void Map::Draw(pyrodactyl::event::Info &info) {
+ warning("STUB: Map::Draw()");
+
+#if 0
// The map graphic is clipped to fit inside the UI
img_bg.Draw(pos.x, pos.y, &camera);
@@ -140,6 +143,7 @@ void Map::Draw(pyrodactyl::event::Info &info) {
marker.Draw(pos, player_pos, camera);
scroll.Draw();
+#endif
}
//------------------------------------------------------------------------
@@ -176,6 +180,7 @@ void Map::Validate() {
scroll.element.at(DIRECTION_UP).visible = !(camera.y == 0);
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Move
//------------------------------------------------------------------------
@@ -243,6 +248,7 @@ void Map::Move(const SDL_Event &Event) {
}
}
}
+#endif
//------------------------------------------------------------------------
// Purpose: Internal Events
@@ -261,6 +267,7 @@ void Map::InternalEvents(pyrodactyl::event::Info &info) {
marker.InternalEvents(pos, player_pos, camera, bounds);
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
@@ -280,6 +287,7 @@ bool Map::HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
return false;
}
+#endif
void Map::SetImage(const unsigned int &val, const bool &force) {
if (force || (cur != val && val < map.size())) {
@@ -288,8 +296,8 @@ void Map::SetImage(const unsigned int &val, const bool &force) {
img_bg.Delete();
img_overlay.Delete();
- img_bg.Load(map.at(cur).path_bg);
- img_overlay.Load(map.at(cur).path_overlay);
+ img_bg.Load(map.at(cur).path_bg.c_str());
+ img_overlay.Load(map.at(cur).path_overlay.c_str());
size.x = img_bg.W();
size.y = img_bg.H();
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 052888b607d..24e87beef66 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -118,11 +118,15 @@ public:
void Load(const std::string &filename, pyrodactyl::event::Info &info);
void Draw(pyrodactyl::event::Info &info);
+#if 0
bool HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
+#endif
void InternalEvents(pyrodactyl::event::Info &info);
void Center(const Vector2i &pos);
+#if 0
void Move(const SDL_Event &Event);
+#endif
void Validate();
void RevealAdd(const int &id, const Rect &area);
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 3bd1d017519..6b2f704dd41 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -119,6 +119,7 @@ protected:
}
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle keyboard input
//------------------------------------------------------------------------
@@ -160,6 +161,7 @@ protected:
return -1;
}
+#endif
public:
// The collection of buttons in the menu
@@ -201,6 +203,7 @@ public:
}
}
+ #if 0
//------------------------------------------------------------------------
// Purpose: Event Handling
// The reason this function doesn't declare its own Event object is because
@@ -255,6 +258,7 @@ public:
return -1;
}
+ #endif
//------------------------------------------------------------------------
// Purpose: Draw the menu
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 1d1f05a4698..42fbc7633b5 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -64,13 +64,13 @@ void QuestMenu::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("normal", tabnode)) {
rapidxml::xml_node<char> *nornode = tabnode->first_node("normal");
img_n.Load(nornode);
- LoadColor(col_n, nornode);
+ //LoadColor(col_n, nornode);
}
if (NodeValid("select", tabnode)) {
rapidxml::xml_node<char> *selnode = tabnode->first_node("select");
img_s.Load(selnode);
- LoadColor(col_s, selnode);
+ //LoadColor(col_s, selnode);
}
}
@@ -148,6 +148,7 @@ void QuestMenu::Draw(Button &bu_map) {
}
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
@@ -180,6 +181,7 @@ bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const SDL_E
return false;
}
+#endif
//------------------------------------------------------------------------
// Purpose: Select an entry
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 74c62c5c69b..9ba5e01746c 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -76,7 +76,10 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(Button &bu_map);
+
+#if 0
bool HandleEvents(Button &bu_map, std::string &map_title, const SDL_Event &Event);
+#endif
void UseKeyboard(const bool &val) { menu.UseKeyboard(val); }
void AssignPaths() { menu.AssignPaths(); }
Commit: 81242375f8e5380ac1607c720ce62045924eb67c
https://github.com/scummvm/scummvm/commit/81242375f8e5380ac1607c720ce62045924eb67c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make some more UI cmponents compilable
Changed paths:
engines/crab/module.mk
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index eb3ab1ff5ab..f615acdd775 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -53,6 +53,7 @@ MODULE_OBJS = \
text/TextManager.o \
TMX/TMXLayer.o \
TMX/TMXTileSet.o \
+ ui/AlphaImage.o \
ui/button.o \
ui/Caption.o \
ui/ChapterIntro.o \
@@ -67,6 +68,7 @@ MODULE_OBJS = \
ui/GfxSettingMenu.o \
ui/HealthIndicator.o \
ui/HoverInfo.o \
+ ui/hud.o \
ui/ImageData.o \
ui/Inventory.o \
ui/journal.o \
@@ -79,10 +81,12 @@ MODULE_OBJS = \
ui/OptionSelect.o \
ui/ParagraphData.o \
ui/PauseMenu.o \
+ ui/PersonHandler.o \
ui/ProgressBar.o \
ui/questmenu.o \
ui/QuestText.o \
ui/ReplyButton.o \
+ ui/ReplyMenu.o \
ui/ResolutionMenu.o \
ui/SaveGameMenu.o \
ui/SectionHeader.o \
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 37b00551e54..943144528f3 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -44,7 +44,7 @@ void AlphaImage::Load(rapidxml::xml_node<char> *node, const bool &echo) {
LoadNum(alpha.max, "max", node);
LoadNum(alpha.change, "inc", node);
- alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
+ alpha.cur = alpha.max; //alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
}
void AlphaImage::InternalEvents() {
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 1c60f260045..a1332ccf05b 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/PersonHandler.h"
namespace Crab {
@@ -71,6 +72,9 @@ void PersonHandler::Load(rapidxml::xml_node<char> *node) {
void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const std::string &person_id,
const bool &player, pyrodactyl::anim::Sprite *s) {
+ warning("STUB: PersonHandler::Draw()");
+
+#if 0
// Draw the dialog box background
dlbox.Draw(player);
@@ -106,8 +110,10 @@ void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
// Draw the dialog box text
dlbox.Draw(info, Event->dialog);
+#endif
}
+#if 0
bool PersonHandler::HandleCommonEvents(const SDL_Event &Event) {
opinion[OPI_LIKE].HandleEvents(Event);
opinion[OPI_RESPECT].HandleEvents(Event);
@@ -125,6 +131,7 @@ bool PersonHandler::HandleCommonEvents(const SDL_Event &Event) {
bool PersonHandler::HandleDlboxEvents(const SDL_Event &Event) {
return dlbox.HandleEvents(Event);
}
+#endif
void PersonHandler::InternalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s) {
if (s != NULL)
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index c79fc1a5855..864b046c26f 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -89,11 +89,13 @@ public:
void Load(rapidxml::xml_node<char> *node);
+#if 0
// Handle events for the three opinion bars and journal - used in both dialog box and reply events
bool HandleCommonEvents(const SDL_Event &Event);
// Handle events for the dialog box
bool HandleDlboxEvents(const SDL_Event &Event);
+#endif
void InternalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s);
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index e0487d1776a..68a4c750699 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/ReplyMenu.h"
namespace Crab {
@@ -41,7 +42,7 @@ using namespace pyrodactyl::event;
using namespace pyrodactyl::people;
void ReplyMenu::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("conversation");
if (NodeValid(node)) {
@@ -60,6 +61,7 @@ void ReplyMenu::Load(const std::string &filename) {
}
}
+#if 0
int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string &cur_id, PersonHandler &oh, const SDL_Event &Event) {
// After that, check if the user has clicked on any reply option
int choice = Menu<ReplyButton>::HandleEvents(Event);
@@ -95,6 +97,7 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string
return -1;
}
+#endif
void ReplyMenu::Draw() {
bg.Draw();
@@ -105,6 +108,9 @@ void ReplyMenu::Draw() {
}
void ReplyMenu::Cache(Info &info, ConversationData &dat) {
+ warning("STUB: ReplyMenu::Cache()");
+
+#if 0
// Some replies are locked, which means the other replies move up and take their place -
// which is why we need two count variables
unsigned int reply_count = 0, element_count = 0;
@@ -135,6 +141,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
// Unused element buttons are hidden
for (; element_count < element.size(); element_count++)
element.at(element_count).visible = false;
+ #endif
}
void ReplyMenu::SetUI() {
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index 33b5d34c83c..868e1e3098e 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -60,8 +60,11 @@ public:
~ReplyMenu() {}
void Load(const std::string &filename);
+
+#if 0
int HandleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
const std::string &cur_id, PersonHandler &oh, const SDL_Event &Event);
+#endif
void Draw();
void Cache(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat);
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 7e9fb63db74..2e7b59b5dc1 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -32,6 +32,7 @@
// Author: Arvind
// Purpose: The tray where you have inventory, map and GameObjectives icons
//=============================================================================
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/hud.h"
namespace Crab {
@@ -41,7 +42,7 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
void HUD::Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("hud");
if (NodeValid(node)) {
@@ -83,6 +84,9 @@ void HUD::Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, p
}
void HUD::Draw(pyrodactyl::event::Info &info, const std::string &id) {
+ warning("STUB: HUD::Draw()");
+
+#if 0
bg.Draw();
menu.Draw();
@@ -105,6 +109,7 @@ void HUD::Draw(pyrodactyl::event::Info &info, const std::string &id) {
gImageManager.Draw(menu.element.at(HS_MAP).x + menu.element.at(HS_MAP).w - clip.w / 2,
menu.element.at(HS_MAP).y - clip.h / 2, notify_anim, &clip);
}
+#endif
}
void HUD::InternalEvents(bool ShowMap) {
@@ -120,6 +125,7 @@ void HUD::InternalEvents(bool ShowMap) {
}
}
+#if 0
HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
gMouse.inside_hud = bg.Contains(gMouse.motion.x, gMouse.motion.y);
@@ -136,6 +142,7 @@ HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Even
return static_cast<HUDSignal>(choice);
}
+#endif
void HUD::State(const int &val) {
int count = 0;
@@ -144,11 +151,15 @@ void HUD::State(const int &val) {
}
void HUD::SetTooltip() {
+ warning("STUB: HUD::SetTooltip()");
+
+#if 0
int count = 0;
for (auto i = menu.element.begin(); i != menu.element.end() && count < tooltip.size(); ++i, ++count)
i->tooltip.text = tooltip.at(count) + " (" + i->hotkey.Name() + ")";
menu.element.at(HS_PAUSE).tooltip.text = tooltip.at(HS_PAUSE) + " (" + SDL_GetScancodeName(gInput.iv[IG_PAUSE].key) + ")";
+#endif
}
void HUD::SetUI() {
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index f630c35cedc..7406cecbb0c 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -99,7 +99,10 @@ public:
void State(const int &val);
void Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
+
+#if 0
HUDSignal HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
+#endif
void Draw(pyrodactyl::event::Info &info, const std::string &id);
Commit: c5735cc1e0f4802c2053fa3cf101d6ae11678a15
https://github.com/scummvm/scummvm/commit/c5735cc1e0f4802c2053fa3cf101d6ae11678a15
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make all classes in item component compilable
Changed paths:
engines/crab/module.mk
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index f615acdd775..01d4fc85369 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -41,6 +41,10 @@ MODULE_OBJS = \
input/input.o \
input/inputval.o \
item/Item.o \
+ item/ItemCollection.o \
+ item/ItemMenu.o \
+ item/ItemSlot.o \
+ item/StatPreview.o \
music/MusicManager.o \
people/opinion.o \
people/person.o \
Commit: f24339e1488e403d2fa469b5d6d4f0fea62fef69
https://github.com/scummvm/scummvm/commit/f24339e1488e403d2fa469b5d6d4f0fea62fef69
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make animation component fully compilable
Changed paths:
engines/crab/animation/animset.cpp
engines/crab/module.mk
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 5190cfd90ec..d9de0b1e277 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::anim;
void AnimSet::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node();
if (NodeValid(node)) {
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 01d4fc85369..19d7d74b181 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -16,6 +16,7 @@ MODULE_OBJS = \
animation/animation.o \
animation/AnimationFrame.o \
animation/animframe.o \
+ animation/animset.o \
animation/fightanim.o \
animation/fightmove.o \
animation/fightmoves.o \
Commit: 625084122c5802617995aa5d70deaccdddd1e9e5
https://github.com/scummvm/scummvm/commit/625084122c5802617995aa5d70deaccdddd1e9e5
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make most of level component compilable
Changed paths:
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_load.cpp
engines/crab/level/level_objects.h
engines/crab/level/talknotify.cpp
engines/crab/module.mk
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 8b799f7496c..8d27706089a 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
@@ -86,6 +87,7 @@ void Level::CalcProperties(Info &info) {
i->CalcProperties(info);
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle the level movement
//------------------------------------------------------------------------
@@ -112,6 +114,7 @@ void Level::HandleEvents(Info &info, const SDL_Event &Event) {
objects[player_index].HandleEvents(info, camera, sc_default, Event);
}
+#endif
//------------------------------------------------------------------------
// Purpose: Swap the player sprites
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 973ada7385f..08b300c195d 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -177,13 +177,17 @@ public:
// Used to see if a sprite collides with a rectangle
void CalcTrigCollide(pyrodactyl::event::Info &info);
+#if 0
// See if a player clicked on the sprite in contact
bool ContainsClick(const std::string &id, const SDL_Event &Event);
+#endif
// Get index of a sprite in the object array
pyrodactyl::anim::Sprite *GetSprite(const std::string &id);
+#if 0
void HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
+#endif
LevelResult InternalEvents(pyrodactyl::event::Info &info, std::vector<pyrodactyl::event::EventResult> &result,
std::vector<pyrodactyl::event::EventSeqInfo> &end_seq, bool EventInProgress);
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 8f421d21783..fca70038357 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 8de530d2cf1..98eabfbe91f 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
@@ -42,6 +43,7 @@ using namespace pyrodactyl::input;
using namespace pyrodactyl::event;
using namespace pyrodactyl::music;
+#if 0
//------------------------------------------------------------------------
// Purpose: See if player clicked on a sprite they are colliding with
//------------------------------------------------------------------------
@@ -77,7 +79,7 @@ bool Level::ContainsClick(const std::string &id, const SDL_Event &Event) {
return false;
}
-
+#endif
//------------------------------------------------------------------------
// Purpose: Find if a layer is visible (used only for objects with layers associated with them)
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index d74a645b1e6..c2ae1a7580b 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
@@ -53,7 +54,7 @@ bool CompSpriteLayer(const Sprite &a, const Sprite &b) {
void Level::Load(const std::string &filename, pyrodactyl::event::Info &info,
pyrodactyl::event::TriggerSet &game_over, const int &player_x, const int &player_y) {
Reset();
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("level");
if (NodeValid(node)) {
@@ -133,7 +134,8 @@ void Level::Load(const std::string &filename, pyrodactyl::event::Info &info,
s.Load(n, anim_set);
// Set the timer target for the first time
- s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
+ //s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
+ s.ai_data.walk.timer.Target(sc_default.fly.delay_max);
fly.push_back(s);
}
@@ -174,7 +176,7 @@ void Level::Load(const std::string &filename, pyrodactyl::event::Info &info,
// Purpose: Build an index of all animation files, called once at start
//------------------------------------------------------------------------
void Level::LoadMoves(const std::string &filename) {
- XMLDoc mov_list(filename);
+ XMLDoc mov_list(filename.c_str());
if (mov_list.ready()) {
rapidxml::xml_node<char> *node = mov_list.Doc()->first_node("movelist");
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set")) {
@@ -199,7 +201,7 @@ void Level::LoadMoves(const std::string &filename) {
// Purpose: Load the default sprite constant parameters
//------------------------------------------------------------------------
void Level::LoadConst(const std::string &filename) {
- XMLDoc doc(filename);
+ XMLDoc doc(filename.c_str());
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.Doc()->first_node("constant");
if (NodeValid(node))
diff --git a/engines/crab/level/level_objects.h b/engines/crab/level/level_objects.h
index 29d569de533..ccf583d7958 100644
--- a/engines/crab/level/level_objects.h
+++ b/engines/crab/level/level_objects.h
@@ -33,6 +33,7 @@
#include "crab/image/ImageManager.h"
#include "crab/common_header.h"
+#include "crab/Rectangle.h"
namespace Crab {
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index 7464df714f1..62733dc871c 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/talknotify.h"
namespace Crab {
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 19d7d74b181..a458be4f19f 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -46,6 +46,15 @@ MODULE_OBJS = \
item/ItemMenu.o \
item/ItemSlot.o \
item/StatPreview.o \
+ level/level_ai.o \
+ level/level_collide.o \
+ level/level_load.o \
+ level/level_objects.o \
+ level/level.o \
+ level/LevelExit.o \
+ level/MusicArea.o \
+ level/Stairs.o \
+ level/talknotify.o \
music/MusicManager.o \
people/opinion.o \
people/person.o \
Commit: 28e1544781ba1cffe3c476aabbca39365dd5b8ce
https://github.com/scummvm/scummvm/commit/28e1544781ba1cffe3c476aabbca39365dd5b8ce
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make all UI components compilable
Changed paths:
engines/crab/module.mk
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index a458be4f19f..60cbc22afae 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -73,6 +73,7 @@ MODULE_OBJS = \
ui/ChapterIntro.o \
ui/ClipButton.o \
ui/CreditScreen.o \
+ ui/DevConsole.o \
ui/dialogbox.o \
ui/element.o \
ui/emotion.o \
@@ -96,6 +97,7 @@ MODULE_OBJS = \
ui/ParagraphData.o \
ui/PauseMenu.o \
ui/PersonHandler.o \
+ ui/PersonScreen.o \
ui/ProgressBar.o \
ui/questmenu.o \
ui/QuestText.o \
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index fa7be7554cb..6ffe7da8d99 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/PersonScreen.h"
namespace Crab {
@@ -38,7 +39,7 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
void PersonScreen::Load(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("character");
if (NodeValid(node)) {
@@ -57,12 +58,14 @@ void PersonScreen::Load(const std::string &filename) {
}
}
+#if 0
void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const SDL_Event &Event) {
if (info.PersonValid(id))
menu.HandleEvents(&info.PersonGet(id), Event);
else
menu.HandleEvents(nullptr, Event);
}
+#endif
void PersonScreen::InternalEvents() {
if (cur_sp != nullptr)
@@ -70,6 +73,9 @@ void PersonScreen::InternalEvents() {
}
void PersonScreen::Draw(pyrodactyl::event::Info &info, const std::string &id) {
+ warning("STUB: PersonScreen::Draw()");
+
+#if 0
bg.Draw();
if (info.PersonValid(id)) {
@@ -82,6 +88,7 @@ void PersonScreen::Draw(pyrodactyl::event::Info &info, const std::string &id) {
Rect clip = cur_sp->DialogClip(PST_NORMAL);
gImageManager.Draw(img.x, img.y, cur_sp->Img(), &clip);
}
+#endif
}
void PersonScreen::Cache(Info &info, const std::string &id, pyrodactyl::level::Level &level) {
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 7c6f851683b..deb659ade61 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -67,7 +67,10 @@ public:
void Load(const std::string &filename);
void Cache(pyrodactyl::event::Info &info, const std::string &id, pyrodactyl::level::Level &level);
+#if 0
void HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const SDL_Event &Event);
+#endif
+
void InternalEvents();
void Draw(pyrodactyl::event::Info &info, const std::string &id);
Commit: b844b8adcbcb018f0ff348a1aa955b81b6cd58f9
https://github.com/scummvm/scummvm/commit/b844b8adcbcb018f0ff348a1aa955b81b6cd58f9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make GameEventManager class compilable
Changed paths:
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/module.mk
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index a14413df736..56f7073746f 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -49,9 +49,6 @@ using namespace pyrodactyl::event;
// Purpose: Load from xml
//------------------------------------------------------------------------
void Info::Load(rapidxml::xml_node<char> *node) {
- warning("STUB: Info::Load()");
-
-#if 0
if (NodeValid("people", node)) {
rapidxml::xml_node<char> *pnode = node->first_node("people");
@@ -80,14 +77,10 @@ void Info::Load(rapidxml::xml_node<char> *node) {
CurLocID(node->first_node("level")->first_attribute("start")->value());
inv.ItemFile(node->first_node("item")->first_attribute("list")->value());
-#endif
}
void Info::LoadPeople(const std::string &filename) {
- warning("STUB: Info::LoadPeople()");
-
-#if 0
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("people");
if (NodeValid(node)) {
@@ -98,7 +91,6 @@ void Info::LoadPeople(const std::string &filename) {
}
}
}
-#endif
}
//------------------------------------------------------------------------
@@ -374,9 +366,6 @@ void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
}
void Info::LoadState(rapidxml::xml_node<char> *node) {
- warning("STUB: Info::LoadState()");
-
-#if 0
for (rapidxml::xml_node<char> *v = node->first_node("var"); v != NULL; v = v->next_sibling("var"))
var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
@@ -402,19 +391,14 @@ void Info::LoadState(rapidxml::xml_node<char> *node) {
journal.LoadState(node);
inv.LoadState(node);
-#endif
}
//------------------------------------------------------------------------
// Purpose: Calculate UI positions after change in screen size
//------------------------------------------------------------------------
void Info::SetUI() {
- warning("STUB: Info::SetUI()");
-
-#if 0
journal.SetUI();
inv.SetUI();
-#endif
}
} // End of namespace Crab
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 3225d2065de..5378b13b60c 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -31,10 +31,10 @@
#ifndef CRAB_GAMEEVENTINFO_H
#define CRAB_GAMEEVENTINFO_H
-//#include "crab/ui/Inventory.h"
+#include "crab/ui/Inventory.h"
#include "crab/stat/StatTemplate.h"
#include "crab/common_header.h"
-//#include "crab/ui/journal.h"
+#include "crab/ui/journal.h"
#include "crab/people/person.h"
namespace Crab {
@@ -79,10 +79,10 @@ class Info {
public:
// The player's one stop shop for objectives and lore
- //pyrodactyl::ui::Journal journal;
+ pyrodactyl::ui::Journal journal;
// The current player inventory
- //pyrodactyl::ui::Inventory inv;
+ pyrodactyl::ui::Inventory inv;
// This structure keeps track of unread indicators
struct UnreadData {
@@ -184,12 +184,10 @@ public:
// Draw the inventory
void InvDraw(const std::string &id) {
-#if 0
if (var.count(money_var) > 0)
inv.Draw(people.at(id), var.at(money_var));
else
inv.Draw(people.at(id), 0);
-#endif
}
// Get whether game is iron man or not
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 6bb3e9a0a68..9db3e1f789c 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -50,16 +50,14 @@ void GameEventStore::AddConv(rapidxml::xml_node<char> *node, unsigned int &index
}
void GameEventStore::Load(const std::string &filename) {
- warning("STUB: GameEventStore::Load()");
-#if 0
// Request current user stats from Steam
// m_pSteamUserStats = SteamUserStats();
// if (m_pSteamUserStats != nullptr)
// m_pSteamUserStats->RequestCurrentStats();
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("store");
@@ -90,7 +88,6 @@ void GameEventStore::Load(const std::string &filename) {
trait.push_back(n);
}
}
-#endif
}
void GameEventStore::SetAchievement(const int &id) {
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index ac40ff51613..11e3131372e 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -31,8 +31,8 @@
#ifndef CRAB_EVENTSTORE_H
#define CRAB_EVENTSTORE_H
-//#include "crab/ui/StateButton.h"
-//#include "crab/animation/animation.h"
+#include "crab/ui/StateButton.h"
+#include "crab/animation/animation.h"
#include "crab/common_header.h"
#include "crab/event/conversationdata.h"
@@ -46,7 +46,7 @@ struct GameEventStore {
std::vector<ConversationData> con;
// Data related to animations
- //std::vector<pyrodactyl::anim::Animation> anim;
+ std::vector<pyrodactyl::anim::Animation> anim;
// Data related to the tones of a character
struct ToneData {
@@ -57,7 +57,7 @@ struct GameEventStore {
std::vector<ToneData> tone;
// We need to change player character images when switching between characters
- //std::vector<pyrodactyl::ui::StateButtonImage> img;
+ std::vector<pyrodactyl::ui::StateButtonImage> img;
// The set of traits for various characters
std::vector<pyrodactyl::people::Trait> trait;
@@ -75,7 +75,7 @@ struct GameEventStore {
void Clear() {
con.clear();
- // anim.clear();
+ anim.clear();
}
void Load(const std::string &filename);
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 23c1a55ed8d..561c8be5dd6 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/event/gameeventmanager.h"
namespace Crab {
@@ -92,6 +93,7 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
}
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
@@ -177,6 +179,8 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
EndSequence(info.CurLocID());
}
}
+#endif
+
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index e505dbd1fd5..3c2fdc5c3ac 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -95,8 +95,10 @@ public:
// cur_per is also updated here
void InternalEvents(Info &info, pyrodactyl::level::Level &level, std::vector<EventResult> &result);
+#if 0
void HandleEvents(Info &info, const std::string &player_id, SDL_Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, std::vector<EventResult> &result);
+#endif
void CalcActiveSeq(Info &info, pyrodactyl::level::Level &level, const Rect &camera);
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 60cbc22afae..09f0b31c9fb 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -31,6 +31,7 @@ MODULE_OBJS = \
event/eventstore.o \
event/gameevent.o \
event/GameEventInfo.o \
+ event/gameeventmanager.o \
event/quest.o \
event/trigger.o \
event/triggerset.o \
Commit: 121f99b6e5fe08ae104c47992a2e963490a8c573
https://github.com/scummvm/scummvm/commit/121f99b6e5fe08ae104c47992a2e963490a8c573
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable tilesets and make misc files compilable
Changed paths:
engines/crab/TMX/TMXMap.cpp
engines/crab/image/ImageManager.h
engines/crab/level/level_draw.cpp
engines/crab/module.mk
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index e1f74f70be5..a6f1bedc991 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/TMX/TMXMap.h"
#include "crab/text/TextManager.h"
#include "crab/collision.h"
@@ -62,7 +63,7 @@ TMXMap::TMXMap() {
//------------------------------------------------------------------------
void TMXMap::Load(const std::string &path, std::string filename) {
- XMLDoc conf(path + filename);
+ XMLDoc conf((path + filename).c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("map");
if (NodeValid(node)) {
@@ -249,6 +250,7 @@ void TMXMap::Reset() {
// Purpose: Draw functions
//------------------------------------------------------------------------
void TMXMap::DrawDebug(const Rect &camera) {
+#if 0
using namespace pyrodactyl::text;
for (auto i = area_trig.begin(); i != area_trig.end(); ++i)
@@ -311,6 +313,7 @@ void TMXMap::DrawDebug(const Rect &camera) {
prev = *j;
}
}*/
+#endif
}
//------------------------------------------------------------------------
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index d090ad33274..556c7f57f80 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -38,7 +38,7 @@
#include "crab/GameParam.h"
#include "crab/image/Image.h"
//#include "crab/LoadingScreen.h"
-//#include "crab/TMX/TMXTileSet.h"
+#include "crab/TMX/TMXTileSet.h"
#include "crab/common_header.h"
#include "crab/input/cursor.h"
#include "crab/loaders.h"
@@ -73,7 +73,7 @@ class ImageManager {
public:
// The tile sets used in the level
- //TMX::TileSetGroup tileset;
+ TMX::TileSetGroup tileset;
// This image is used to notify player about changes to quests and inventory
ImageKey notify;
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 77faab8cac6..d89a58063cc 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 09f0b31c9fb..53e0f5b706e 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -49,6 +49,7 @@ MODULE_OBJS = \
item/StatPreview.o \
level/level_ai.o \
level/level_collide.o \
+ level/level_draw.o \
level/level_load.o \
level/level_objects.o \
level/level.o \
@@ -68,6 +69,7 @@ MODULE_OBJS = \
text/TextManager.o \
TMX/TMXLayer.o \
TMX/TMXTileSet.o \
+ TMX/TMXMap.o \
ui/AlphaImage.o \
ui/button.o \
ui/Caption.o \
Commit: 0b3da1d2b44b8994cd63367bfaaf31902ee67606
https://github.com/scummvm/scummvm/commit/0b3da1d2b44b8994cd63367bfaaf31902ee67606
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make base game classes compilable
Changed paths:
engines/crab/GameClock.h
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/module.mk
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index aa60dd74b9b..d131b6da7bf 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -38,33 +38,33 @@ namespace Crab {
class GameClock {
Timer timer;
- Uint32 start;
+ uint32 start;
std::string seperator;
public:
GameClock() : seperator(" : ") { start = 0; }
- void Start(Uint32 initial_time = 0) {
+ void Start(uint32 initial_time = 0) {
start = initial_time;
timer.Start();
}
void Start(const std::string &str) {
- Uint32 ms = 0, hr = 0, min = 0, sec = 0;
+ uint32 ms = 0, hr = 0, min = 0, sec = 0;
std::string str_hrs, str_min, str_sec;
std::size_t found_1 = str.find_first_of(seperator);
if (found_1 > 0 && found_1 != std::string::npos) {
str_hrs = str.substr(0, found_1);
- hr = StringToNumber<Uint32>(str_hrs);
+ hr = StringToNumber<uint32>(str_hrs);
std::size_t found_2 = str.find_last_of(seperator);
if (found_2 > 0 && found_2 != std::string::npos) {
str_sec = str.substr(found_2 + 1, std::string::npos);
- sec = StringToNumber<Uint32>(str_sec);
+ sec = StringToNumber<uint32>(str_sec);
str_min = str.substr(found_1 + seperator.length(), found_2 - (2 * seperator.length()));
- min = StringToNumber<Uint32>(str_min);
+ min = StringToNumber<uint32>(str_min);
}
}
@@ -73,15 +73,21 @@ public:
}
std::string GetTime() {
- Uint32 ms = start + timer.Ticks();
+ uint32 ms = start + timer.Ticks();
- Uint32 x = ms / 1000;
- Uint32 seconds = x % 60;
+ uint32 x = ms / 1000;
+ uint32 seconds = x % 60;
x /= 60;
- Uint32 minutes = x % 60;
- Uint32 hours = x / 60;
+ uint32 minutes = x % 60;
+ uint32 hours = x / 60;
- return NumberToString(hours) + seperator + NumberToString(minutes) + seperator + NumberToString(seconds);
+ std::string time_str = NumberToString(hours).c_str();
+ time_str += seperator;
+ time_str += NumberToString(minutes).c_str();
+ time_str += seperator;
+ time_str += NumberToString(seconds).c_str();
+
+ return time_str;
}
};
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 7d3933a5f8a..fd66deb0768 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -27,7 +27,7 @@
* Licensed under MIT
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/LoadingScreen.h"
#include "crab/XMLDoc.h"
@@ -35,7 +35,7 @@ namespace Crab {
void LoadingScreen::Load() {
const std::string &filename = "res/layout/loading.xml";
- XMLDoc doc(filename);
+ XMLDoc doc(filename.c_str());
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.Doc()->first_node("loading");
if (NodeValid(node)) {
@@ -63,10 +63,11 @@ void LoadingScreen::Draw() {
text.Draw((gScreenSettings.cur.w - text.W()) / 2, (gScreenSettings.cur.h - text.H()) / 2);
// Update the screen
- SDL_RenderPresent(gRenderer);
+ //SDL_RenderPresent(gRenderer);
}
void LoadingScreen::Dim() {
+#if 0
// This is used when starting or loading a game from the main menu in order to dim the screen
// until an actual loading screen is drawn
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
@@ -75,6 +76,7 @@ void LoadingScreen::Dim() {
// Update the screen
SDL_RenderPresent(gRenderer);
+#endif
}
void LoadingScreen::Quit() {
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index af349d890c9..93c63d9837b 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -61,7 +61,9 @@ public:
LoadingScreen() { cur = 0; };
~LoadingScreen(){};
- void Change() { cur = gRandom.Num() % screen.size(); }
+ void Change() {
+ // cur = gRandom.Num() % screen.size();
+ }
void Load();
void Draw();
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 2e968dc7094..03ca8de9ef2 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/game.h"
namespace Crab {
@@ -40,10 +41,10 @@ using namespace pyrodactyl::input;
// Purpose: Loading stuff
//------------------------------------------------------------------------
void Game::StartNewGame() {
- Init(gFilePath.mod_cur);
+ Init(gFilePath.mod_cur.c_str());
LoadLevel(info.CurLocID());
info.IronMan(gTemp.ironman);
- savefile.ironman = gTemp.filename;
+ savefile.ironman = gTemp.filename.c_str();
clock.Start();
hud.pause.UpdateMode(info.IronMan());
@@ -51,7 +52,7 @@ void Game::StartNewGame() {
}
void Game::LoadGame(const std::string &filename) {
- Init(gFilePath.mod_cur);
+ Init(gFilePath.mod_cur.c_str());
LoadState(filename);
}
@@ -64,7 +65,7 @@ void Game::Init(const std::string &filename) {
gem.Init();
info.Init();
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("config");
@@ -73,7 +74,7 @@ void Game::Init(const std::string &filename) {
std::string path;
if (NodeValid("level", node)) {
LoadStr(path, "list", node->first_node("level"));
- gFilePath.LoadLevel(path);
+ gFilePath.LoadLevel(path.c_str());
}
if (NodeValid("hud", node)) {
@@ -112,6 +113,9 @@ void Game::Init(const std::string &filename) {
}
bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
+ warning("STUB: Game::LoadLevel()");
+
+#if 0
if (gFilePath.level.count(id) > 0) {
gLoadScreen.Draw();
@@ -145,10 +149,12 @@ bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
info.journal.Init(level.PlayerID());
return true;
}
+#endif
return false;
}
+#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
@@ -301,6 +307,7 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
}
}
}
+#endif
//------------------------------------------------------------------------
// Purpose: InternalEvents
@@ -504,7 +511,7 @@ void Game::ApplyResult(LevelResult result) {
// Purpose: Save/load game
//------------------------------------------------------------------------
void Game::LoadState(const std::string &filename) {
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
if (NodeValid(node)) {
@@ -542,6 +549,9 @@ void Game::LoadState(const std::string &filename) {
// Purpose: Write game state to file
//------------------------------------------------------------------------
void Game::SaveState(const std::string &filename, const bool &overwrite) {
+ warning("STUB: Game::SaveState()");
+
+#if 0
rapidxml::xml_document<char> doc;
// xml declaration
@@ -633,6 +643,7 @@ void Game::SaveState(const std::string &filename, const bool &overwrite) {
doc.clear();
hud.pause.ScanDir();
+#endif
}
//------------------------------------------------------------------------
// Purpose: Quit the game
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 03eaf785c8e..a7b29981b5d 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -114,7 +114,14 @@ private:
// A nice simple function for saving games
void CreateSaveGame(const SaveGameType &savetype);
- std::string FullPath(const std::string &filename) { return gFilePath.appdata + gFilePath.save_dir + filename + gFilePath.save_ext; }
+ std::string FullPath(const std::string &filename) {
+ std::string res = gFilePath.appdata.c_str();
+ res += gFilePath.save_dir.c_str();
+ res += filename;
+ res += gFilePath.save_ext.c_str();
+
+ return res;
+ }
// Load the current player image
void PlayerImg() { hud.PlayerImg(pyrodactyl::event::gEventStore.img.at(info.PlayerImg())); }
@@ -126,7 +133,9 @@ public:
void Init(const std::string &filename);
+#if 0
void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
+#endif
void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void Draw();
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 621ae1e3d63..d69f0be08e2 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -150,6 +150,8 @@ MainMenu::MainMenu() {
gTemp.credits = false;
gFilePath.current_r = gFilePath.mainmenu_r;
}
+
+#if 0
//------------------------------------------------------------------------
// Purpose: Event/input handling Events
//------------------------------------------------------------------------
@@ -280,6 +282,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
break;
}
}
+#endif
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
@@ -356,7 +359,7 @@ void MainMenu::Draw() {
// Draw the game name and mod path if a mod is loaded
if (gFilePath.mod_cur != "res/default.xml") {
gTextManager.Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
- gTextManager.Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2 + 50, gFilePath.mod_cur, 5, 1, ALIGN_CENTER);
+ //gTextManager.Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2 + 50, gFilePath.mod_cur, 5, 1, ALIGN_CENTER);
}
me_main.Draw();
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 5f15ea0c818..cd4ccd100b5 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -123,7 +123,10 @@ class MainMenu : public GameState {
public:
MainMenu();
~MainMenu() {}
+
+#if 0
void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
+#endif
void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void Draw();
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 53e0f5b706e..65659e7da29 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -8,6 +8,8 @@ MODULE_OBJS = \
XMLDoc.o \
loaders.o \
ScreenSettings.o \
+ collision.o \
+ game.o \
GameParam.o \
ai/moveeffect.o \
ai/movement.o \
@@ -120,7 +122,9 @@ MODULE_OBJS = \
timer.o \
app.o \
splash.o \
+ LoadingScreen.o \
Line.o \
+ mainmenu.o \
PathfindingAgent.o \
PathfindingGraphNode.o \
PathfindingGrid.o \
Commit: fff85231cb62bfaa29f58d010dc23b30a1526f4d
https://github.com/scummvm/scummvm/commit/fff85231cb62bfaa29f58d010dc23b30a1526f4d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix warnings in animation component due to extra consts
Changed paths:
engines/crab/animation/animset.cpp
engines/crab/animation/animset.h
engines/crab/animation/sprite.h
engines/crab/animation/walkframes.h
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index d9de0b1e277..9ebf3cc9f5e 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -69,7 +69,7 @@ const ShadowOffset &AnimSet::Shadow(const Direction &dir) {
return walk.Shadow(dir);
}
-const int AnimSet::AnchorX(const Direction &dir) {
+int AnimSet::AnchorX(const Direction &dir) {
FightAnimFrame faf;
if (fight.CurFrame(faf, dir))
return faf.anchor.x;
@@ -77,7 +77,7 @@ const int AnimSet::AnchorX(const Direction &dir) {
return walk.AnchorX(dir);
}
-const int AnimSet::AnchorY(const Direction &dir) {
+int AnimSet::AnchorY(const Direction &dir) {
FightAnimFrame faf;
if (fight.CurFrame(faf, dir))
return faf.anchor.y;
diff --git a/engines/crab/animation/animset.h b/engines/crab/animation/animset.h
index 439e82f5f73..db024033cf6 100644
--- a/engines/crab/animation/animset.h
+++ b/engines/crab/animation/animset.h
@@ -64,8 +64,8 @@ struct AnimSet {
TextureFlipType Flip(const Direction &dir);
const ShadowOffset &Shadow(const Direction &dir);
- const int AnchorX(const Direction &dir);
- const int AnchorY(const Direction &dir);
+ int AnchorX(const Direction &dir);
+ int AnchorY(const Direction &dir);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 381ffe10904..de5ddcbbb3b 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -161,8 +161,8 @@ public:
const std::string &ID() { return id; }
- const int W() { return clip.w; }
- const int H() { return clip.h; }
+ int W() { return clip.w; }
+ int H() { return clip.h; }
const ImageKey &Img() { return image; }
Rect DialogClip(const pyrodactyl::people::PersonState &state) { return anim_set.walk.DialogClip(state); }
@@ -178,7 +178,7 @@ public:
Vector2i CamFocus();
double DistSq(const Sprite &s);
- void EffectImg(bool visible) { img_eff.visible = visible; }
+ void EffectImg(bool vis) { img_eff.visible = vis; }
bool LastFrame() { return anim_set.fight.LastFrame(); }
bool TakingDamage(Sprite &sp, const pyrodactyl::ai::SpriteConstant &sc);
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index 9a6fc2bbad5..0b4d4eb9ec2 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -93,8 +93,8 @@ public:
const ShadowOffset &Shadow(Direction d) { return set[cur].frames[d].shadow; }
- const int AnchorX(Direction d) { return set[cur].frames[d].CurrentFrame().anchor.x; }
- const int AnchorY(Direction d) { return set[cur].frames[d].CurrentFrame().anchor.y; }
+ int AnchorX(Direction d) { return set[cur].frames[d].CurrentFrame().anchor.x; }
+ int AnchorY(Direction d) { return set[cur].frames[d].CurrentFrame().anchor.y; }
// Dialog box related
Rect DialogClip(const pyrodactyl::people::PersonState &state);
Commit: 8d367daa579e36fe28814ec9a1ca66c5be4fc760
https://github.com/scummvm/scummvm/commit/8d367daa579e36fe28814ec9a1ca66c5be4fc760
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix warnings by removing extra const specifiers
Changed paths:
engines/crab/PathfindingAgent.h
engines/crab/event/GameEventInfo.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/ui/PageMenu.h
engines/crab/ui/button.h
engines/crab/ui/menu.h
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 715a2b6728f..992fe8be9e2 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -71,8 +71,8 @@ public:
void SetParent(PlannerNode *p) { parent = p; }
void SetChild(PlannerNode *c) { child = c; }
void SetHCost(double c) { cost = c; }
- void SetFinalCost(double cost) { finalCost = cost; }
- void SetGivenCost(double cost) { givenCost = cost; }
+ void SetFinalCost(double c) { finalCost = c; }
+ void SetGivenCost(double c) { givenCost = c; }
};
class PathfindingAgent {
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 5378b13b60c..8684f63370f 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -191,7 +191,7 @@ public:
}
// Get whether game is iron man or not
- const bool IronMan() { return ironman; }
+ bool IronMan() { return ironman; }
void IronMan(const bool &val) { ironman = val; }
void LoadIronMan(rapidxml::xml_node<char> *node) {
std::string str;
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index dc93f136825..7ecd77a88dc 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -44,7 +44,7 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
// Purpose: Return pressed/depressed state of key
//------------------------------------------------------------------------
-const bool InputManager::State(const InputType &val) {
+bool InputManager::State(const InputType &val) {
warning("STUB: InputManager::State()");
#if 0
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 32bb3ef54d6..2a74d69c0a4 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -125,7 +125,7 @@ public:
#endif
// These functions return true if key is pressed, false otherwise
- const bool State(const InputType &val);
+ bool State(const InputType &val);
void CreateBackup();
void RestoreBackup();
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index f9054dfdd8a..bbf0e0fc936 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -96,7 +96,7 @@ public:
void CurrentPage(int &val) { current_page = val; }
// Get the index of the hovered element in the menu
- const int HoverIndex() {
+ int HoverIndex() {
if (menu.at(current_page).HoverIndex() >= 0)
return (current_page * elements_per_page) + menu.at(current_page).HoverIndex();
@@ -104,8 +104,8 @@ public:
}
// Get the base position of the elements
- const int BaseX(const int &count) { return ref.x + inc.x * (count % cols); }
- const int BaseY(const int &count) { return ref.y + inc.y * (count / cols); }
+ int BaseX(const int &count) { return ref.x + inc.x * (count % cols); }
+ int BaseY(const int &count) { return ref.y + inc.y * (count / cols); }
// This is used to get the coordinates of a button
const int &CurX(const int &count) { return menu[current_page].element[count].x; }
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index cd089c23b25..8f649d72339 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -113,7 +113,7 @@ public:
void Init(const Button &ref, const int &XOffset = 0, const int &YOffset = 0);
void Img(Button &b) { img = b.img; }
- void Img(ButtonImage &img) { this->img = img; }
+ void Img(ButtonImage &image) { img = image; }
ButtonImage Img() { return img; }
void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 6b2f704dd41..4afcff87130 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -273,7 +273,7 @@ public:
//------------------------------------------------------------------------
void UseKeyboard(const bool &val) { use_keyboard = val; }
void Clear() { element.clear(); }
- const int HoverIndex() { return hover_index; }
+ int HoverIndex() { return hover_index; }
//------------------------------------------------------------------------
// Purpose: Assign traversal paths
Commit: 25b4de653141f0b9f796dde1efbe3df94ac1a23e
https://github.com/scummvm/scummvm/commit/25b4de653141f0b9f796dde1efbe3df94ac1a23e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix noisy warning due to missing return
Changed paths:
engines/crab/loaders.cpp
engines/crab/loaders.h
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 77148883c5f..f599042dbaf 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -78,6 +78,21 @@ bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node
return true;
}
+bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo) {
+ if (node->first_attribute(name.c_str()) != NULL)
+ val = node->first_attribute(name.c_str())->value();
+ else {
+ /*if (echo)
+ {
+ std::string error_msg = "string " + name + " not found in " + node->name() + "\n";
+ SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
+ }*/
+ return false;
+ }
+
+ return true;
+}
+
#if 0
bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index ce61ce0bce9..314fd3fb00d 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -46,7 +46,7 @@ bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node
// Functions to load attributes from xml files
// return true on success, false on failure
bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
-static inline bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true) {}
+bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true);
// Used for loading numerical types
template<typename T>
Commit: 4e178d844e67ce7ac181e9a83ee82f3702a60d18
https://github.com/scummvm/scummvm/commit/4e178d844e67ce7ac181e9a83ee82f3702a60d18
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable linking of mainmenu from app and handle events correctly
Changed paths:
engines/crab/app.cpp
engines/crab/app.h
engines/crab/gamestate_container.h
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 67c69af3860..b9e5cd5675b 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -111,9 +111,6 @@ bool App::Init() {
return false;
}
- // Initialize and load input
- pyrodactyl::input::gInput.Init();
-
// Disable the SDL stock cursor and screen-saver
SDL_ShowCursor(SDL_DISABLE);
SDL_DisableScreenSaver();
@@ -121,6 +118,9 @@ bool App::Init() {
// Initial check for controllers on the system
pyrodactyl::input::gInput.AddController();
#endif
+ // Initialize and load input
+ pyrodactyl::input::gInput.Init();
+
LoadSettings("res/settings.xml");
gScreenSettings.cur.w = 1920;
gScreenSettings.cur.h = 1080;
@@ -141,7 +141,7 @@ void App::Run() {
int fpscount = 0, fpsval = 1, lasts = 0;
// While the user hasn't quit - This is the main game loop
- while (CurrentStateID != GAMESTATE_EXIT) {
+ while (CurrentStateID != GAMESTATE_EXIT && !SHOULD_QUIT) {
// Start the frame timer
fps.Start();
@@ -168,7 +168,7 @@ void App::Run() {
break;
case GAMESTATE_MAIN_MENU:
- //CurrentState = new MainMenu();
+ CurrentState = new MainMenu();
gScreenSettings.in_game = false;
break;
@@ -228,6 +228,11 @@ void App::Run() {
pyrodactyl::input::gInput.HandleController(Event);
}
#endif
+ Common::Event e;
+ while (g_system->getEventManager()->pollEvent(e)) {
+
+ }
+
// Do we have to reposition our interface?
if (gScreenSettings.change_interface) {
@@ -266,7 +271,7 @@ void App::Run() {
SDL_Delay((1000u / gScreenSettings.fps) - fps.Ticks());
#endif
uint32 delay = (1000u / gScreenSettings.fps) - fps.Ticks();
- warning("Delay by %d ms", delay);
+ //warning("Delay by %d ms", delay);
g_system->delayMillis(delay);
}
}
diff --git a/engines/crab/app.h b/engines/crab/app.h
index a7e31a0dff3..0e403585bfb 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -32,14 +32,14 @@
#define CRAB_APP_H
#include "crab/crab.h"
-//#include "crab/image/ImageManager.h"
-//#include "crab/music/MusicManager.h"
+#include "crab/image/ImageManager.h"
+#include "crab/music/MusicManager.h"
#include "crab/common_header.h"
-//#include "crab/game.h"
+#include "crab/game.h"
#include "crab/gamestates.h"
#include "crab/gamestate_container.h"
#include "crab/ScreenSettings.h"
-//#include "crab/mainmenu.h"
+#include "crab/mainmenu.h"
#include "crab/splash.h"
#include "crab/timer.h"
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index c67328582fe..47df0bf7824 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -45,7 +45,7 @@ namespace Crab {
//------------------------------------------------------------------------
class GameState {
public:
- virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
+ //virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void Draw() = 0;
virtual void SetUI() = 0;
Commit: 339e5b8f1654ab6d7fe928d97dcb2e261219274d
https://github.com/scummvm/scummvm/commit/339e5b8f1654ab6d7fe928d97dcb2e261219274d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Init TextManager and LoadScreen in Splash
Changed paths:
engines/crab/splash.cpp
engines/crab/splash.h
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 90fd3a9b154..4a41ace5e69 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -62,11 +62,9 @@ Splash::~Splash() {
//------------------------------------------------------------------------
void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
- // gLoadScreen.Load();
+ gLoadScreen.Load();
pyrodactyl::image::gImageManager.Init();
-#if 0
pyrodactyl::text::gTextManager.Init();
-#endif
load_complete = true;
}
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index beb813c9322..3ac7a9cf276 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -37,11 +37,10 @@
#include "crab/crab.h"
#include "crab/image/ImageManager.h"
-//#include "crab/LoadingScreen.h"
-//#include "crab/music/MusicManager.h"
-//#include "crab/image/Image.h"
+#include "crab/LoadingScreen.h"
+#include "crab/music/MusicManager.h"
#include "crab/ScreenSettings.h"
-//#include "crab/text/TextManager.h"
+#include "crab/text/TextManager.h"
#include "crab/common_header.h"
#include "crab/gamestate_container.h"
#include "crab/gamestates.h"
Commit: f7aab0489bca5428b9ce9889bb8ae8e85877ddd0
https://github.com/scummvm/scummvm/commit/f7aab0489bca5428b9ce9889bb8ae8e85877ddd0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Create a Crab::Rect clip overload for drawing calls
Changed paths:
engines/crab/image/Image.cpp
engines/crab/image/Image.h
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
engines/crab/ui/SectionHeader.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index b5c25b08d29..81aaf9ac618 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -178,6 +178,10 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
}
+void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip) {
+ g_engine->_renderSurface->blitFrom(*texture, Common::Point(x, y));
+}
+
//------------------------------------------------------------------------
// Purpose: Delete texture data
//------------------------------------------------------------------------
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 026afd2c675..ce72053c999 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -34,6 +34,7 @@
#include "image/png.h"
#include "crab/ScreenSettings.h"
#include "crab/filesystem.h"
+#include "crab/Rectangle.h"
#include "crab/common_header.h"
namespace Crab {
@@ -91,6 +92,7 @@ public:
// Draw the openGL texture
void Draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+ void Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE);
// Delete the openGL texture
void Delete();
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 015096057ca..6b27af8dbf8 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -155,6 +155,14 @@ void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Common::
GetTexture(id).Draw(x, y, clip, flip);
}
+//------------------------------------------------------------------------
+// Purpose: Draw
+//------------------------------------------------------------------------
+void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Rect *clip,
+ const TextureFlipType &flip) {
+ GetTexture(id).Draw(x, y, clip, flip);
+}
+
//------------------------------------------------------------------------
// Purpose: Dim the screen by drawing a 128 alpha black rectangle over it
//------------------------------------------------------------------------
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index 556c7f57f80..4fe7057ef15 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -99,6 +99,8 @@ public:
void Draw(const int &x, const int &y, const ImageKey &id,
Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+ void Draw(const int &x, const int &y, const ImageKey &id,
+ Rect *clip, const TextureFlipType &flip = FLIP_NONE);
void DimScreen();
void BlackScreen();
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index a5166fedfbb..8941d2aa9b9 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -87,7 +87,7 @@ void SectionHeader::Draw(const std::string &str, const int &XOffset, const int &
gImageManager.Draw(left.x + XOffset, left.y + YOffset, img);
if (draw_r)
- gImageManager.Draw(right.x + XOffset, right.y + YOffset, img, NULL, FLIP_X);
+ gImageManager.Draw(right.x + XOffset, right.y + YOffset, img, (Rect*)NULL, FLIP_X);
TextData::Draw(str, XOffset, YOffset);
}
Commit: 0eb75982b389938088bab3f7bcfc2e453bdd7858
https://github.com/scummvm/scummvm/commit/0eb75982b389938088bab3f7bcfc2e453bdd7858
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub button and ImageData drawing routines
Changed paths:
engines/crab/ui/ImageData.cpp
engines/crab/ui/button.cpp
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 0c4938e4d19..03d5c3ab4b2 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -47,13 +47,10 @@ void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo) {
void ImageData::Draw(const int &XOffset, const int &YOffset) {
warning("ImaageData::Draw()");
-
-#if 0
if (crop)
gImageManager.Draw(x + XOffset, y + YOffset, key, &clip);
else
gImageManager.Draw(x + XOffset, y + YOffset, key);
-#endif
}
} // End of namespace Crab
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 9870c7fb780..a1245a77642 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -103,7 +103,6 @@ void Button::Reset() {
void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
warning("STUB: Button::Draw()");
-#if 0
if (visible) {
if (mousepressed) {
gImageManager.Draw(x + XOffset, y + YOffset, img.select, clip);
@@ -120,7 +119,6 @@ void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
caption.Draw(false, XOffset, YOffset);
}
}
-#endif
}
void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
Commit: 27c62f5e36e030ca19624ea2392fdc15db571790
https://github.com/scummvm/scummvm/commit/27c62f5e36e030ca19624ea2392fdc15db571790
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Start enabling HandleEvents routine
Changed paths:
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/input/input.cpp
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index fdaf33e05a7..bb9334dc17c 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -55,6 +55,12 @@ bool HotKey::HandleEvents(const SDL_Event &Event) {
}
#endif
+bool HotKey::HandleEvents(const Common::Event &Event) {
+ warning("STUB: HotKey::HandleEvents()");
+
+ return false;
+}
+
const char *HotKey::Name() {
warning("STUB: HotKey::Name()");
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 120241d3360..28fd3c8f16e 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -57,6 +57,8 @@ public:
void Load(rapidxml::xml_node<char> *node);
+ bool HandleEvents(const Common::Event &Event);
+
#if 0
bool HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 7ecd77a88dc..4e6bf1eaac3 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -111,7 +111,9 @@ const int InputManager::Equals(const InputType &val, const SDL_Event &Event) {
// Purpose: Load from file
//------------------------------------------------------------------------
void InputManager::Init() {
- warning("STUB: InputManager::Init()");
+
+ const std::string DEFAULT_FILENAME = "res/controls.xml";
+ Load(DEFAULT_FILENAME);
#if 0
const std::string DEFAULT_FILENAME = "res/controls.xml";
Commit: 7828c1f85303996523fad2b87443262c821d8269
https://github.com/scummvm/scummvm/commit/7828c1f85303996523fad2b87443262c821d8269
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents routine for diffrent types of buttons
Changed paths:
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index cfd2c6b968c..52935248fab 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -53,6 +53,15 @@ void ToggleButton::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
gImageManager.Draw(x + offset.x, y + offset.y, off);
}
+ButtonAction ToggleButton::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ ButtonAction action = Button::HandleEvents(Event, XOffset, YOffset);
+
+ if (action == BUAC_LCLICK)
+ state = !state;
+
+ return action;
+}
+
#if 0
ButtonAction ToggleButton::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
ButtonAction action = Button::HandleEvents(Event, XOffset, YOffset);
@@ -64,4 +73,6 @@ ButtonAction ToggleButton::HandleEvents(const SDL_Event &Event, const int &XOffs
}
#endif
+
+
} // End of namespace Crab
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index dc175897739..bf2f3092996 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -64,6 +64,7 @@ public:
#if 0
ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
+ ButtonAction HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index a1245a77642..8a5c6382dff 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -147,6 +147,56 @@ void Button::HoverInfoOnlyDraw(const int &XOffset, const int &YOffset, Rect *cli
}
}
+//------------------------------------------------------------------------
+// Purpose: Handle input and stuff
+//------------------------------------------------------------------------
+ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ Rect dim = *this;
+ dim.x += XOffset;
+ dim.y += YOffset;
+
+ if (visible) {
+ if (dim.Contains(gMouse.motion.x, gMouse.motion.y)) {
+ hover_mouse = true;
+
+ if (!hover_prev) {
+ hover_prev = true;
+ gMusicManager.PlayEffect(se_hover, 0);
+ }
+ } else {
+ hover_prev = false;
+ hover_mouse = false;
+ }
+
+ if (Event.type == Common::EVENT_MOUSEMOVE) {
+ if (canmove && mousepressed) {
+ x += gMouse.rel.x;
+ y += gMouse.rel.y;
+ return BUAC_GRABBED;
+ }
+ } else if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
+ // The gMouse button pressed, then released, comprises of a click action
+ if (dim.Contains(gMouse.button.x, gMouse.button.y))
+ mousepressed = true;
+ } else if ((Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP) && mousepressed) {
+ Reset();
+ if (dim.Contains(gMouse.button.x, gMouse.button.y)) {
+ mousepressed = false;
+ if (Event.type == Common::EVENT_LBUTTONUP) {
+ gMusicManager.PlayEffect(se_click, 0);
+ return BUAC_LCLICK;
+ } else if (Event.type == Common::EVENT_RBUTTONUP)
+ return BUAC_RCLICK;
+ }
+ } else if (hotkey.HandleEvents(Event)) {
+ gMusicManager.PlayEffect(se_click, 0);
+ return BUAC_LCLICK;
+ }
+ }
+
+ return BUAC_IGNORE;
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle input and stuff
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index 8f649d72339..1e65ff4be9e 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -118,6 +118,7 @@ public:
void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+ ButtonAction HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
Commit: 4e6e782c1cfdec81b3316a08623c0d0afbe57e28
https://github.com/scummvm/scummvm/commit/4e6e782c1cfdec81b3316a08623c0d0afbe57e28
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents() rotine for some more UI classes
Changed paths:
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/menu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 7fda2fc2251..440f115bd6e 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -46,6 +46,13 @@ void ChapterIntro::Load(rapidxml::xml_node<char> *node) {
traits.Load(node->first_node("trait"));
}
+bool ChapterIntro::HandleEvents(Common::Event &Event) {
+ if (traits.HandleEvents(Event))
+ show_traits = true;
+
+ return dialog.HandleEvents(Event);
+}
+
#if 0
bool ChapterIntro::HandleEvents(SDL_Event &Event) {
if (traits.HandleEvents(Event))
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index 0ecda146328..650364ee74d 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -58,6 +58,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
+ bool HandleEvents(Common::Event &Event);
#if 0
bool HandleEvents(SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 85e56e1c021..ff00e8d0f6f 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -104,6 +104,19 @@ void CreditScreen::Load(const std::string &filename) {
}
}
+bool CreditScreen::HandleEvents(Common::Event &Event) {
+ if (slow.HandleEvents(Event) == BUAC_LCLICK)
+ speed.cur = speed.slow;
+ else if (fast.HandleEvents(Event) == BUAC_LCLICK)
+ speed.cur = speed.fast;
+ else if (pause.HandleEvents(Event) == BUAC_LCLICK)
+ speed.cur = 0.0f;
+ else if (reverse.HandleEvents(Event) == BUAC_LCLICK)
+ speed.cur = speed.reverse;
+
+ return (back.HandleEvents(Event) == BUAC_LCLICK);
+}
+
#if 0
bool CreditScreen::HandleEvents(SDL_Event &Event) {
if (slow.HandleEvents(Event) == BUAC_LCLICK)
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 3971bb15beb..23fac197f3c 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -114,6 +114,7 @@ public:
void Load(const std::string &filename);
void Reset();
+ bool HandleEvents(Common::Event &Event);
#if 0
bool HandleEvents(SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 3d30c4a9ffd..4eb113a8daa 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -177,6 +177,18 @@ public:
ScanDir();
}
+ bool HandleEvents(const Common::Event &Event) {
+ int choice = menu.HandleEvents(Event);
+ if (choice >= 0) {
+ menu.Reset();
+ selected = slot_info[menu.Index() + choice].path;
+ Reset();
+ return true;
+ }
+
+ return false;
+ }
+
#if 0
bool HandleEvents(const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index f8b32f4d714..6142ccaa508 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -56,6 +56,10 @@ void GameOverMenu::Load(rapidxml::xml_node<char> *node) {
}
}
+int GameOverMenu::HandleEvents(const Common::Event &Event) {
+ return menu.HandleEvents(Event);
+}
+
#if 0
int GameOverMenu::HandleEvents(const SDL_Event &Event) {
return menu.HandleEvents(Event);
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 2b632af3923..366354d75f3 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -68,6 +68,8 @@ public:
}
void Load(rapidxml::xml_node<char> *node);
+
+ int HandleEvents(const Common::Event &Event);
#if 0
int HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 3256acc1a26..dffe83a4a46 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -66,6 +66,30 @@ void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
i.state = (i.val == gScreenSettings.text_speed);
}
+//------------------------------------------------------------------------
+// Purpose: Handle user input
+//------------------------------------------------------------------------
+void GeneralSettingMenu::HandleEvents(const Common::Event &Event) {
+ if (vol_music.HandleEvents(Event))
+ gMusicManager.VolMusic(vol_music.Value());
+
+ if (vol_effects.HandleEvents(Event))
+ gMusicManager.VolEffects(vol_effects.Value());
+
+ // No need to change screen here
+ if (save_on_exit.HandleEvents(Event))
+ gScreenSettings.save_on_exit = !gScreenSettings.save_on_exit;
+
+ if (mouse_trap.HandleEvents(Event)) {
+ gScreenSettings.mouse_trap = !gScreenSettings.mouse_trap;
+ gScreenSettings.SetMouseTrap();
+ }
+
+ int result = text_speed.HandleEvents(Event);
+ if (result >= 0)
+ gScreenSettings.text_speed = text_speed.element.at(result).val;
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle user input
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 1b547da7727..a62f638d08c 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -57,6 +57,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
+ void HandleEvents(const Common::Event &Event);
#if 0
void HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index c1255488b74..0bad17a07cc 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -99,6 +99,16 @@ void Inventory::Draw(Person &obj, const int &money_val) {
money.Draw();
}
+//------------------------------------------------------------------------
+// Purpose: Handle events
+//------------------------------------------------------------------------
+void Inventory::HandleEvents(const std::string &char_id, const Common::Event &Event) {
+ warning("STUB: Inventory::HandleEvents()");
+
+ //collection.HandleEvents(char_id, Event);
+ //money.HandleEvents(Event);
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index 0a6dbc647a2..b7692125336 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -72,6 +72,7 @@ public:
void Load(const std::string &filename);
void Draw(pyrodactyl::people::Person &obj, const int &money_val);
+ void HandleEvents(const std::string &char_id, const Common::Event &Event);
#if 0
void HandleEvents(const std::string &char_id, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 8a135550b69..17ad5dcb816 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -77,6 +77,16 @@ void ModMenu::Load(const std::string &filename) {
}
}
+bool ModMenu::HandleEvents(const Common::Event &Event) {
+ int choice = menu.HandleEvents(Event);
+ if (choice >= 0) {
+ gFilePath.mod_cur = slot_info[menu.Index() + choice].path.c_str();
+ return true;
+ }
+
+ return false;
+}
+
#if 0
bool ModMenu::HandleEvents(const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index 2bd848a9f38..1285368aa21 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -45,6 +45,7 @@ public:
void Load(const std::string &filename);
+ bool HandleEvents(const Common::Event &Event);
#if 0
bool HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index f27a984efb3..ce9047dab59 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -64,6 +64,29 @@ void OptionSelect::Draw() {
next.Draw();
}
+bool OptionSelect::HandleEvents(const Common::Event &Event) {
+ using namespace pyrodactyl::input;
+
+ if (cur > 0) {
+ // Don't check for keyboard inputs for now
+ if (prev.HandleEvents(Event) == BUAC_LCLICK) {
+ cur--;
+ return true;
+ }
+ }
+
+ if (cur < option.text.size() - 1) {
+
+ // Don't check for keyboard inputs for now
+ if (next.HandleEvents(Event) == BUAC_LCLICK) {
+ cur++;
+ return true;
+ }
+ }
+
+ return false;
+}
+
#if 0
bool OptionSelect::HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index c2d4f574093..941d8bad0cb 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -65,6 +65,7 @@ public:
void Draw();
+ bool HandleEvents(const Common::Event &Event);
#if 0
bool HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index bbf0e0fc936..c48ffa1a103 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -200,6 +200,28 @@ public:
UpdateInfo();
}
+ int HandleEvents(const Common::Event &Event) {
+ using namespace pyrodactyl::input;
+
+ if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
+ current_page--;
+ UpdateInfo();
+
+ if (current_page < 0)
+ current_page = 0;
+ }
+
+ if (current_page < menu.size() - 1 && next.HandleEvents(Event) == BUAC_LCLICK) {
+ current_page++;
+ UpdateInfo();
+
+ if (current_page >= menu.size())
+ current_page = menu.size() - 1;
+ }
+
+ return menu.at(current_page).HandleEvents(Event);
+ }
+
#if 0
int HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 6918ee40dd6..5992497af31 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -135,6 +135,22 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
}
}
+void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event) {
+ if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
+ current_page--;
+
+ if (current_page < 0)
+ current_page = 0;
+ }
+
+ if (current_page < total_page - 1 && next.HandleEvents(Event) == BUAC_LCLICK) {
+ current_page++;
+
+ if (current_page >= total_page)
+ current_page = total_page - 1;
+ }
+}
+
#if 0
void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event) {
if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index a6f58161abe..d60c822f0a7 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -81,6 +81,8 @@ public:
// Reset the value of current page
void Reset() { current_page = 0; }
+
+ void HandleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event);
#if 0
void HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index efa12f0158b..21e6b24babe 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -62,6 +62,19 @@ public:
Menu::Draw(XOffset, YOffset);
}
+ int HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
+ int result = Menu::HandleEvents(Event, XOffset, YOffset);
+
+ if (result >= 0) {
+ select = result;
+
+ for (int i = 0; i < element.size(); ++i)
+ element.at(i).state = (i == result);
+ }
+
+ return result;
+ }
+
#if 0
int HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
int result = Menu::HandleEvents(Event, XOffset, YOffset);
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 73b017278f7..b079c40289d 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -84,6 +84,22 @@ void SlideShow::Draw() {
next.Draw();
}
+void SlideShow::HandleEvents(const Common::Event &Event) {
+ using namespace pyrodactyl::input;
+
+ if (index > 0)
+ if (prev.HandleEvents(Event) == BUAC_LCLICK) {
+ index--;
+ Refresh();
+ }
+
+ if (index < path.size() - 1)
+ if (next.HandleEvents(Event) == BUAC_LCLICK) {
+ index++;
+ Refresh();
+ }
+}
+
#if 0
void SlideShow::HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 4c4aaaa0724..5c350ca6f12 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -70,6 +70,8 @@ public:
void Clear() { img.Delete(); }
void Load(rapidxml::xml_node<char> *node);
+
+ void HandleEvents(const Common::Event &Event);
#if 0
void HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index b7658912aee..5db4cd06671 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -78,6 +78,13 @@ void GameDialogBox::Draw(pyrodactyl::event::Info &info, std::string &message) {
button.Draw();
}
+//------------------------------------------------------------------------
+// Purpose: Handle input
+//------------------------------------------------------------------------
+bool GameDialogBox::HandleEvents(const Common::Event &Event) {
+ return (button.HandleEvents(Event) == BUAC_LCLICK);
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle input
@@ -87,6 +94,8 @@ bool GameDialogBox::HandleEvents(const SDL_Event &Event) {
}
#endif
+
+
void GameDialogBox::SetUI() {
pos.SetUI();
text.SetUI(&pos);
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index 9906dc370b2..d26a9858c66 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -72,6 +72,8 @@ public:
void Draw(pyrodactyl::event::Info &info, std::string &message);
void Draw(const bool &player);
+ bool HandleEvents(const Common::Event &Event);
+
#if 0
bool HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 2e7b59b5dc1..3c2d2ac3f3e 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -125,6 +125,23 @@ void HUD::InternalEvents(bool ShowMap) {
}
}
+HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
+ gMouse.inside_hud = bg.Contains(gMouse.motion.x, gMouse.motion.y);
+
+ int choice = menu.HandleEvents(Event);
+
+ if (choice == HS_JOURNAL)
+ info.unread.journal = false;
+ else if (choice == HS_INV)
+ info.unread.inventory = false;
+ else if (choice == HS_CHAR)
+ info.unread.trait = false;
+ else if (choice == HS_MAP)
+ info.unread.map = false;
+
+ return static_cast<HUDSignal>(choice);
+}
+
#if 0
HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
gMouse.inside_hud = bg.Contains(gMouse.motion.x, gMouse.motion.y);
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 7406cecbb0c..ba81e70000c 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -100,6 +100,7 @@ public:
void Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
+ HUDSignal HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
HUDSignal HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 4afcff87130..8237cbd8bc7 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -203,6 +203,64 @@ public:
}
}
+ //------------------------------------------------------------------------
+ // Purpose: Event Handling
+ // The reason this function doesn't declare its own Event object is because
+ // a menu might not be the only object in a game state
+ //------------------------------------------------------------------------
+ int HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
+ // The keyboard/joystick event handling bit
+ /*
+ if (use_keyboard) {
+ int result = HandleKeyboard(Event);
+
+ // We have accepted a menu option using the keyboard
+ if (result != -1) {
+ // Reset the menu state
+ Reset();
+ return result;
+ }
+ }
+ */
+
+ // Check if we have moved or clicked the mouse
+ if (Common::isMouseEvent(Event)) {
+ // Since the player is moving the mouse, we have to recalculate hover index at every opportunity
+ hover_index = -1;
+ latest_input = MOUSE;
+ }
+
+ // The mouse and hotkey event handling bit
+ int i = 0;
+ for (auto it = element.begin(); it != element.end(); ++it, ++i) {
+ // We clicked on a button using the mouse
+ if (it->HandleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
+ // Reset the menu state
+ Reset();
+ return i;
+ }
+
+ // We did not click a button, however we did hover over the button
+ // However if we are use keyboard to browse through the menu, hovering is forgotten until we move the mouse again
+ if (it->hover_mouse && latest_input == MOUSE) {
+ hover_index = i;
+
+ // The latest input is the mouse, which means we have to forget the keyboard hover states
+ for (auto e = element.begin(); e != element.end(); ++e)
+ e->hover_key = false;
+ }
+ }
+
+ /*
+ if (latest_input == KEYBOARD) {
+ // The latest input is the keyboard, which means we have to forget the mouse hover states
+ for (auto it = element.begin(); it != element.end(); ++it)
+ it->hover_mouse = false;
+ }
+ */
+ return -1;
+ }
+
#if 0
//------------------------------------------------------------------------
// Purpose: Event Handling
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index ce88b9da2f9..caed874b6a9 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -56,6 +56,35 @@ void Slider::Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
CreateBackup();
}
+bool Slider::HandleEvents(const Common::Event &Event) {
+ // A person is moving the knob
+ if (knob.HandleEvents(Event) == BUAC_GRABBED) {
+ int dx = gMouse.motion.x - bar.x;
+
+ if (dx < 0)
+ dx = 0;
+ else if (dx > (bar.w - knob.w))
+ dx = (bar.w - knob.w);
+
+ knob.x = bar.x + dx;
+ knob.y = bar.y;
+
+ value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
+ return true;
+ }
+
+ // If a person clicks on the slider bar, the knob needs to travel there
+ if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && bar.Contains(gMouse.button.x, gMouse.button.y)) {
+ knob.x = gMouse.button.x;
+ knob.y = bar.y;
+
+ value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
+ return true;
+ }
+
+ return false;
+}
+
#if 0
bool Slider::HandleEvents(const SDL_Event &Event) {
// A person is moving the knob
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 2c8827aafb2..625be5e00c7 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -68,10 +68,12 @@ public:
void Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val);
+ bool HandleEvents(const Common::Event &Event);
#if 0
// Return true if volume changed
bool HandleEvents(const SDL_Event &Event);
#endif
+
void Draw();
int Value() { return value; }
Commit: 37dbcce972189fe2f57b0b31cbf8191a0b851348
https://github.com/scummvm/scummvm/commit/37dbcce972189fe2f57b0b31cbf8191a0b851348
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents() for FightInput class
Changed paths:
engines/crab/input/fightinput.cpp
engines/crab/input/fightinput.h
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index 55e32d90c5f..a079ab7e094 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -39,6 +39,15 @@ void FightInput::Load(rapidxml::xml_node<char> *node) {
LoadNum(state, "state", node);
}
+FightAnimationType FightInput::HandleEvents(const Common::Event &Event) {
+ if (gInput.State(IG_ATTACK))
+ return FA_ATTACK;
+ else if (gInput.State(IG_BLOCK))
+ return FA_BLOCK;
+
+ return FA_IDLE;
+}
+
#if 0
FightAnimationType FightInput::HandleEvents(const SDL_Event &Event) {
if (gInput.State(IG_ATTACK))
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index cfb6e42cba9..89c2e96978e 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -75,6 +75,7 @@ struct FightInput {
void Load(rapidxml::xml_node<char> *node);
+ FightAnimationType HandleEvents(const Common::Event &Event);
#if 0
FightAnimationType HandleEvents(const SDL_Event &Event);
#endif
Commit: 6ae92431bd25723e048391b60e06b5d9cf0589ff
https://github.com/scummvm/scummvm/commit/6ae92431bd25723e048391b60e06b5d9cf0589ff
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents() for Sprite Class
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 90cb265d8f4..33e49fff011 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -336,6 +336,70 @@ void Sprite::DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
popup.Draw(x, y, pop, camera);
}
+//------------------------------------------------------------------------
+// Purpose: Handle the movement in a level for the player only
+//------------------------------------------------------------------------
+void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const Common::Event &Event) {
+ int num = 0;
+ info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
+ ++num;
+ float player_speed = static_cast<float>(num);
+
+ // This is for Diablo style hold-mouse-button-in-direction-of-movement
+ // This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
+ if (!ai_data.dest.active && !gMouse.inside_hud && !gMouse.hover && gMouse.Pressed()) {
+ // To find where the click is w.r.t sprite, we need to see where it is being drawn
+ int x = pos.x - camera.x - anim_set.AnchorX(dir), y = pos.y - camera.y - anim_set.AnchorY(dir);
+
+ // Just use the bound rectangle dimensions
+ Rect b = BoundRect();
+ int w = b.w, h = b.h;
+
+ // X axis
+ if (gMouse.motion.x > x + w)
+ XVel(player_speed * sc.walk_vel_mod.x);
+ else if (gMouse.motion.x < x)
+ XVel(-player_speed * sc.walk_vel_mod.x);
+ else
+ XVel(0.0f);
+
+ // Y axis
+ if (gMouse.motion.y > y + h)
+ YVel(player_speed * sc.walk_vel_mod.y);
+ else if (gMouse.motion.y < y)
+ YVel(-player_speed * sc.walk_vel_mod.y);
+ else
+ YVel(0.0f);
+ } else // Keyboard movement
+ {
+ // Disable destination as soon as player presses a direction key
+ // X axis
+ if (gInput.State(IG_LEFT)) {
+ ai_data.dest.active = false;
+ XVel(-player_speed * sc.walk_vel_mod.x);
+ } else if (gInput.State(IG_RIGHT)) {
+ ai_data.dest.active = false;
+ XVel(player_speed * sc.walk_vel_mod.x);
+ } else if (!ai_data.dest.active)
+ XVel(0.0f);
+
+ // Y axis
+ if (gInput.State(IG_UP)) {
+ ai_data.dest.active = false;
+ YVel(-player_speed * sc.walk_vel_mod.y);
+ } else if (gInput.State(IG_DOWN)) {
+ ai_data.dest.active = false;
+ YVel(player_speed * sc.walk_vel_mod.y);
+ } else if (!ai_data.dest.active)
+ YVel(0.0f);
+ }
+
+ UpdateMove(input.HandleEvents(Event));
+
+ // This is to prevent one frame of drawing with incorrect parameters
+ Animate(info);
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle the movement in a level for the player only
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index de5ddcbbb3b..bf9ba21f5aa 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -207,8 +207,9 @@ public:
// Set sprite destination
void SetDestPathfinding(const Vector2i &dest, bool reachable = true);
-#if 0
// Used for sprite movement controlled by player input (usually the player sprite)
+ void HandleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const Common::Event &Event);
+#if 0
void HandleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const SDL_Event &Event);
#endif
Commit: 0c10a65c176c03791aa57214389a57fab6c54e5d
https://github.com/scummvm/scummvm/commit/0c10a65c176c03791aa57214389a57fab6c54e5d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents() for classes inside Level component
Changed paths:
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_collide.cpp
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 8d27706089a..4040f87f838 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -87,6 +87,33 @@ void Level::CalcProperties(Info &info) {
i->CalcProperties(info);
}
+//------------------------------------------------------------------------
+// Purpose: Handle the level movement
+//------------------------------------------------------------------------
+void Level::HandleEvents(Info &info, const Common::Event &Event) {
+ if (!gMouse.inside_hud) {
+ if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
+ // Only go to path if our mouse is a normal walking cursor
+ if (!gMouse.hover) {
+ // The destination coordinate is set by adding camera position to click position
+ Vector2i dest = gMouse.button;
+ dest.x += camera.x;
+ dest.y += camera.y;
+
+ Rect b = objects[player_index].BoundRect();
+ b.w /= 2;
+ b.h /= 2;
+ b.x = dest.x - b.w / 2;
+ b.y = dest.y - b.h / 2;
+
+ objects[player_index].SetDestPathfinding(dest, !terrain.InsideNoWalk(dest));
+ }
+ }
+ }
+
+ objects[player_index].HandleEvents(info, camera, sc_default, Event);
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle the level movement
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 08b300c195d..465ef8d11b3 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -177,14 +177,16 @@ public:
// Used to see if a sprite collides with a rectangle
void CalcTrigCollide(pyrodactyl::event::Info &info);
-#if 0
// See if a player clicked on the sprite in contact
+ bool ContainsClick(const std::string &id, const Common::Event &Event);
+#if 0
bool ContainsClick(const std::string &id, const SDL_Event &Event);
#endif
// Get index of a sprite in the object array
pyrodactyl::anim::Sprite *GetSprite(const std::string &id);
+ void HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
void HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 98eabfbe91f..911d3df0b41 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -43,6 +43,42 @@ using namespace pyrodactyl::input;
using namespace pyrodactyl::event;
using namespace pyrodactyl::music;
+//------------------------------------------------------------------------
+// Purpose: See if player clicked on a sprite they are colliding with
+//------------------------------------------------------------------------
+bool Level::ContainsClick(const std::string &id, const Common::Event &Event) {
+ // If mouse is moved and is hovering on the specified sprite (id), set hover = true
+ if (Event.type == Common::EVENT_MOUSEMOVE) {
+ for (auto &i : objects) {
+ Rect r = i.PosRect();
+
+ if (r.Contains(gMouse.motion.x + camera.x, gMouse.motion.y + camera.y)) {
+ // This is to show the sprite's name on top of their head
+ i.hover = true;
+
+ // This is to update the mouse cursor only if we're in talking range of a sprite
+ if (i.ID() == id)
+ gMouse.hover = true;
+ } else
+ i.hover = false;
+ }
+
+ return false;
+ } else if (gMouse.Pressed()) {
+ for (auto &i : objects) {
+ if (i.ID() == id) {
+ Rect r = i.PosRect();
+ if (r.Contains(gMouse.button.x + camera.x, gMouse.button.y + camera.y)) {
+ gMouse.hover = true;
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: See if player clicked on a sprite they are colliding with
Commit: 1ec4c9f29af1bc87363c3599798becf00d0347f8
https://github.com/scummvm/scummvm/commit/1ec4c9f29af1bc87363c3599798becf00d0347f8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents() for the whole Item Component
Changed paths:
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 6feec3b65c6..cc494287997 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -66,6 +66,14 @@ void ItemCollection::Init(const std::string &char_id) {
item[char_id].Init(ref, inc, rows, cols, usekeyboard);
}
+//------------------------------------------------------------------------
+// Purpose: Handle events
+//------------------------------------------------------------------------
+void ItemCollection::HandleEvents(const std::string &char_id, const Common::Event &Event) {
+ if (item.count(char_id) > 0)
+ item[char_id].HandleEvents(Event);
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 29fe0163ed0..1afebc0902d 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -71,6 +71,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
+ void HandleEvents(const std::string &char_id, const Common::Event &Event);
#if 0
void HandleEvents(const std::string &char_id, const SDL_Event &Event);
#endif
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 80af6b975e8..aa0b61b0db8 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -69,6 +69,18 @@ void ItemMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
i->SaveState(doc, root);
}
+//------------------------------------------------------------------------
+// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
+//------------------------------------------------------------------------
+void ItemMenu::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ int result = Menu<ItemSlot>::HandleEvents(Event);
+ if (result != -1) {
+ select_index = result;
+ for (unsigned int i = 0; i < element.size(); ++i)
+ element.at(i).State(i == select_index);
+ }
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index c13bda07137..c431d01955c 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -70,6 +70,7 @@ public:
void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
const unsigned int &cols, const bool &keyboard);
+ void HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
void HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 920055870b9..3c04e99dfad 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -116,6 +116,17 @@ void ItemSlot::Draw() {
#endif
}
+//------------------------------------------------------------------------
+// Purpose: Handle user input
+//------------------------------------------------------------------------
+ButtonAction ItemSlot::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ ButtonAction ac = StateButton::HandleEvents(Event, XOffset, YOffset);
+ if (ac == BUAC_LCLICK || ac == BUAC_RCLICK)
+ unread = false;
+
+ return ac;
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle user input
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index effde4bc014..8f739684dcc 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -80,6 +80,7 @@ public:
void Draw();
+ pyrodactyl::ui::ButtonAction HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
pyrodactyl::ui::ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
Commit: 7c946e9f4aef94e616d8f64553fec06f9289a98a
https://github.com/scummvm/scummvm/commit/7c946e9f4aef94e616d8f64553fec06f9289a98a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents() for rest of the UI component
Changed paths:
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 2357628a3c1..df250075bf1 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -86,6 +86,42 @@ void GfxSettingMenu::Draw() {
resolution.Draw();
}
+//------------------------------------------------------------------------
+// Purpose: Handle input
+//------------------------------------------------------------------------
+int GfxSettingMenu::HandleEvents(const Common::Event &Event) {
+ if (fullscreen.HandleEvents(Event)) {
+ // Setting video flags is necessary when toggling fullscreen
+ gScreenSettings.fullscreen = !gScreenSettings.fullscreen;
+ gScreenSettings.SetFullscreen();
+ }
+
+ // Vsync doesn't need to set the change value
+ if (vsync.HandleEvents(Event)) {
+ gScreenSettings.vsync = !gScreenSettings.vsync;
+ gScreenSettings.SetVsync();
+ }
+
+ // Quality and resolution can only be changed in the main menu
+ if (!gScreenSettings.in_game) {
+ if (quality.HandleEvents(Event))
+ gScreenSettings.quality = !gScreenSettings.quality;
+ }
+
+ // Window border doesn't matter if you are in fullscreen
+ if (border.HandleEvents(Event) && !gScreenSettings.fullscreen) {
+ gScreenSettings.border = !gScreenSettings.border;
+ gScreenSettings.SetWindowBorder();
+ }
+
+ if (brightness.HandleEvents(Event)) {
+ gScreenSettings.gamma = static_cast<float>(brightness.Value()) / 100.0f;
+ gScreenSettings.SetGamma();
+ }
+
+ return resolution.HandleEvents(Event);
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle input
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 6b151f62246..c215bc283f5 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -61,6 +61,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
+ int HandleEvents(const Common::Event &Event);
#if 0
int HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 0bad17a07cc..87558759fa0 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -103,10 +103,8 @@ void Inventory::Draw(Person &obj, const int &money_val) {
// Purpose: Handle events
//------------------------------------------------------------------------
void Inventory::HandleEvents(const std::string &char_id, const Common::Event &Event) {
- warning("STUB: Inventory::HandleEvents()");
-
- //collection.HandleEvents(char_id, Event);
- //money.HandleEvents(Event);
+ collection.HandleEvents(char_id, Event);
+ money.HandleEvents(Event);
}
#if 0
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index b110ae1cfcb..17d9080d728 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -143,6 +143,37 @@ void KeyBindMenu::SetCaption() {
#endif
}
+void KeyBindMenu::HandleEvents(const Common::Event &Event) {
+ warning("STUB: KeyBindMenu::HandleEvents()");
+
+ /*
+ if (sel_controls.HandleEvents(Event))
+ SetCaption();
+
+ switch (state) {
+ case STATE_NORMAL:
+ choice = menu[sel_controls.cur].HandleEvents(Event);
+ if (choice >= 0) {
+ prompt.Swap(menu[sel_controls.cur].element.at(choice).caption);
+ state = STATE_KEY;
+ break;
+ }
+
+ break;
+ case STATE_KEY:
+ if (Event.type == SDL_KEYDOWN) {
+ SwapKey(Event.key.keysym.scancode);
+ SetCaption();
+ menu[sel_controls.cur].element.at(choice).caption.col = prompt.col_prev;
+ state = STATE_NORMAL;
+ }
+ break;
+ default:
+ break;
+ }
+ */
+}
+
#if 0
void KeyBindMenu::HandleEvents(const SDL_Event &Event) {
if (sel_controls.HandleEvents(Event))
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 8b6b279675f..8d77696684e 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -115,6 +115,8 @@ public:
bool DisableHotkeys() { return state != STATE_NORMAL; }
void Load(rapidxml::xml_node<char> *node);
+
+ void HandleEvents(const Common::Event &Event);
#if 0
void HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index e20609d6009..0a29d214eb2 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -78,6 +78,27 @@ void MapMarkerMenu::Draw(const Element &pos, const Vector2i &player_pos, const R
i.HoverInfoOnlyDraw(offset_m.x, offset_m.y);
}
+//------------------------------------------------------------------------
+// Purpose: Handle Events
+//------------------------------------------------------------------------
+void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event) {
+ if (player_pos.x >= camera.x && player_pos.y >= camera.y)
+ player.HandleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
+
+ int choice = menu.HandleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+ if (choice != -1) {
+ int c = 0;
+ for (auto &i : menu.element) {
+ if (c == choice) // For an already selected marker, clicking it toggles the selection state
+ i.State(!i.State());
+ else
+ i.State(false);
+
+ ++c;
+ }
+ }
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle Events
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 2f176cc160a..dc21ceea2d6 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -86,6 +86,8 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
+
+ void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event);
#if 0
void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index cb305bae97d..6a4fa91a883 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -154,6 +154,88 @@ void OptionMenu::Draw(Button &back) {
}
}
+bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
+ if (state < STATE_ENTER_W) {
+ bg.Draw();
+
+ switch (state) {
+ case STATE_GENERAL:
+ general.HandleEvents(Event);
+ break;
+ case STATE_KEYBOARD:
+ keybind.HandleEvents(Event);
+ break;
+ case STATE_GRAPHICS: {
+ int result = gfx.HandleEvents(Event);
+ if (result == 1) {
+ state = STATE_CONFIRM;
+ timer.Start();
+ gScreenSettings.SetResolution();
+ gfx.SetInfo();
+ } else if (result == 2)
+ state = STATE_ENTER_W;
+ } break;
+ default:
+ break;
+ }
+
+ return HandleTabs(back, Event);
+ } else {
+ questionbox.Draw();
+
+ switch (state) {
+ case STATE_ENTER_W:
+ if (prompt_w.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
+ gScreenSettings.cur.w = StringToNumber<int>(prompt_w.text);
+ state = STATE_ENTER_H;
+ } else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
+ gScreenSettings.RestoreBackup();
+ gfx.SetInfo();
+ state = STATE_GRAPHICS;
+ }
+ break;
+ case STATE_ENTER_H:
+ if (prompt_h.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
+ gScreenSettings.cur.h = StringToNumber<int>(prompt_h.text);
+ state = STATE_CONFIRM;
+ timer.Start();
+ gScreenSettings.SetResolution();
+ gfx.SetInfo();
+ } else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
+ gScreenSettings.RestoreBackup();
+ gfx.SetInfo();
+ state = STATE_GRAPHICS;
+ }
+
+ break;
+ case STATE_CONFIRM:
+ if (accept.HandleEvents(Event)) {
+ state = STATE_GRAPHICS;
+ timer.Stop();
+ } else if (cancel.HandleEvents(Event)) {
+ gScreenSettings.RestoreBackup();
+ gScreenSettings.SetResolution();
+ gfx.SetInfo();
+ state = STATE_GRAPHICS;
+ }
+ break;
+ default:
+ break;
+ }
+
+ accept.Draw();
+ cancel.Draw();
+ }
+
+ return false;
+}
+
+bool OptionMenu::HandleTabs(Button &back, const Common::Event &Event) {
+ warning("STUB: OptionMenu::HandleTabs()");
+
+ return false;
+}
+
#if 0
bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
if (state < STATE_ENTER_W) {
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index a0ed51935c1..ccac578d3c2 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -86,8 +86,9 @@ class OptionMenu {
TextData countdown;
Timer timer;
-#if 0
// Function to draw the main menu (controls, settings, save, cancel)
+ bool HandleTabs(Button &back, const Common::Event &Event);
+#if 0
bool HandleTabs(Button &back, const SDL_Event &Event);
#endif
@@ -106,6 +107,7 @@ public:
void Load(const std::string &filename);
void Draw(Button &back);
+ bool HandleEvents(Button &back, const Common::Event &Event);
#if 0
bool HandleEvents(Button &back, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 4769a9a51d5..fcc86e8a157 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -67,6 +67,66 @@ bool PauseMenu::Draw(Button &back) {
return false;
}
+PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
+ switch (state) {
+ case STATE_NORMAL:
+ choice = menu.HandleEvents(Event);
+ if (choice == -1) {
+ if (back.hotkey.HandleEvents(Event))
+ return PS_RESUME;
+ } else {
+ switch (choice) {
+ case 0:
+ state = STATE_NORMAL;
+ return PS_RESUME;
+ case 1:
+ state = STATE_SAVE;
+ save.ScanDir();
+ break;
+ case 2:
+ state = STATE_LOAD;
+ gLoadMenu.ScanDir();
+ break;
+ case 3:
+ state = STATE_OPTION;
+ break;
+ case 4:
+ return PS_HELP;
+ case 5:
+ return PS_QUIT_MENU;
+ case 6:
+ return PS_QUIT_GAME;
+ default:
+ break;
+ }
+ }
+ break;
+ case STATE_SAVE:
+ if (save.HandleEvents(Event)) {
+ state = STATE_NORMAL;
+ return PS_SAVE;
+ } else if (back.HandleEvents(Event) == BUAC_LCLICK && !save.DisableHotkeys())
+ state = STATE_NORMAL;
+ break;
+ case STATE_OPTION:
+ if (gOptionMenu.HandleEvents(back, Event)) {
+ gOptionMenu.Reset();
+ state = STATE_NORMAL;
+ }
+ break;
+ case STATE_LOAD:
+ if (gLoadMenu.HandleEvents(Event))
+ return PS_LOAD;
+ else if (back.HandleEvents(Event) == BUAC_LCLICK)
+ state = STATE_NORMAL;
+ break;
+ default:
+ break;
+ }
+
+ return PS_NONE;
+}
+
#if 0
PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
switch (state) {
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index b4d6e7a9086..403755f5e72 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -85,6 +85,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
+ PauseSignal HandleEvents(const Common::Event &Event, Button &back);
#if 0
PauseSignal HandleEvents(const SDL_Event &Event, Button &back);
#endif
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index a1332ccf05b..4df10c9f3eb 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -113,6 +113,24 @@ void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
#endif
}
+bool PersonHandler::HandleCommonEvents(const Common::Event &Event) {
+ opinion[OPI_LIKE].HandleEvents(Event);
+ opinion[OPI_RESPECT].HandleEvents(Event);
+ opinion[OPI_FEAR].HandleEvents(Event);
+
+ if (jb.HandleEvents(Event) == BUAC_LCLICK) {
+ // User wants to open their journal
+ show_journal = true;
+ return true;
+ }
+
+ return false;
+}
+
+bool PersonHandler::HandleDlboxEvents(const Common::Event &Event) {
+ return dlbox.HandleEvents(Event);
+}
+
#if 0
bool PersonHandler::HandleCommonEvents(const SDL_Event &Event) {
opinion[OPI_LIKE].HandleEvents(Event);
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index 864b046c26f..b111ec557ec 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -89,11 +89,14 @@ public:
void Load(rapidxml::xml_node<char> *node);
-#if 0
// Handle events for the three opinion bars and journal - used in both dialog box and reply events
- bool HandleCommonEvents(const SDL_Event &Event);
+ bool HandleCommonEvents(const Common::Event &Event);
// Handle events for the dialog box
+ bool HandleDlboxEvents(const Common::Event &Event);
+
+#if 0
+ bool HandleCommonEvents(const SDL_Event &Event);
bool HandleDlboxEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 6ffe7da8d99..33c4cf3c0df 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -58,6 +58,13 @@ void PersonScreen::Load(const std::string &filename) {
}
}
+void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const Common::Event &Event) {
+ if (info.PersonValid(id))
+ menu.HandleEvents(&info.PersonGet(id), Event);
+ else
+ menu.HandleEvents(nullptr, Event);
+}
+
#if 0
void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const SDL_Event &Event) {
if (info.PersonValid(id))
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index deb659ade61..2a4caed89d7 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -67,6 +67,7 @@ public:
void Load(const std::string &filename);
void Cache(pyrodactyl::event::Info &info, const std::string &id, pyrodactyl::level::Level &level);
+ void HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const Common::Event &Event);
#if 0
void HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 68a4c750699..09a8079d880 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -61,6 +61,44 @@ void ReplyMenu::Load(const std::string &filename) {
}
}
+int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string &cur_id, PersonHandler &oh, const Common::Event &Event) {
+ // After that, check if the user has clicked on any reply option
+ int choice = Menu<ReplyButton>::HandleEvents(Event);
+ if (choice >= 0 && choice < dat.reply.size()) {
+ bool play_sound = false;
+
+ // Loop through any opinion changes required
+ for (auto &i : dat.reply[element.at(choice).index].change) {
+ if (i.id == cur_id) {
+ // This is a special case because we also need to update the opinion bars
+ oh.OpinionChange(info, i.id, OPI_LIKE, i.val[OPI_LIKE]);
+ oh.OpinionChange(info, i.id, OPI_RESPECT, i.val[OPI_RESPECT]);
+ oh.OpinionChange(info, i.id, OPI_FEAR, i.val[OPI_FEAR]);
+ play_sound = true;
+ } else {
+ info.OpinionChange(i.id, OPI_LIKE, i.val[OPI_LIKE]);
+ info.OpinionChange(i.id, OPI_RESPECT, i.val[OPI_RESPECT]);
+ info.OpinionChange(i.id, OPI_FEAR, i.val[OPI_FEAR]);
+ play_sound = true;
+ }
+ }
+
+#if 0
+ // Right now we play sound randomly
+ if (play_sound) {
+ if (gRandom.Num() % 2 == 1)
+ info.sound.rep_dec = true;
+ else
+ info.sound.rep_inc = true;
+ }
+#endif
+
+ return dat.reply[element.at(choice).index].nextid;
+ }
+
+ return -1;
+}
+
#if 0
int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string &cur_id, PersonHandler &oh, const SDL_Event &Event) {
// After that, check if the user has clicked on any reply option
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index 868e1e3098e..b75b99e247e 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -61,6 +61,8 @@ public:
void Load(const std::string &filename);
+ int HandleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
+ const std::string &cur_id, PersonHandler &oh, const Common::Event &Event);
#if 0
int HandleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
const std::string &cur_id, PersonHandler &oh, const SDL_Event &Event);
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 31bb3d0ac40..f4541b7e173 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -96,6 +96,35 @@ void ResolutionMenu::Draw() {
}
}
+int ResolutionMenu::HandleEvents(const Common::Event &Event) {
+ switch (state) {
+ case STATE_NORMAL:
+ if (change.HandleEvents(Event) == BUAC_LCLICK)
+ state = STATE_CHANGE;
+ break;
+ case STATE_CHANGE: {
+ int choice = Menu::HandleEvents(Event);
+ if (choice >= 0) {
+ gScreenSettings.cur = dim[choice];
+ state = STATE_NORMAL;
+ return 1;
+ }
+
+ if (custom.HandleEvents(Event) == BUAC_LCLICK) {
+ state = STATE_NORMAL;
+ return 2;
+ }
+
+ if (cancel.HandleEvents(Event) == BUAC_LCLICK)
+ state = STATE_NORMAL;
+ } break;
+ default:
+ break;
+ }
+
+ return 0;
+}
+
#if 0
int ResolutionMenu::HandleEvents(const SDL_Event &Event) {
switch (state) {
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index e2581a42622..d5ba8dc3e71 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -71,8 +71,9 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw();
-#if 0
// Return 1 if one of resolution buttons is pressed, 2 if custom button is pressed, 0 otherwise
+ int HandleEvents(const Common::Event &Event);
+#if 0
int HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index bff6671ccc8..33f74161c99 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -122,6 +122,11 @@ bool GameSaveMenu::HandleEvents(const SDL_Event &Event) {
}
#endif
+bool GameSaveMenu::HandleEvents(const Common::Event &Event) {
+ warning("STUB: GameSaveMenu::HandleEvents()");
+ return false;
+}
+
void GameSaveMenu::Draw() {
bg.Draw();
menu.Draw();
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 306c649d574..9305a289b59 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -67,6 +67,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
+ bool HandleEvents(const Common::Event &Event);
#if 0
bool HandleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 74ce438e45a..26a725e5bab 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -83,6 +83,22 @@ void TraitMenu::Draw(const pyrodactyl::people::Person *obj) {
i.Draw();
}
+void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event) {
+ int choice = menu.HandleEvents(Event);
+ if (choice >= 0) {
+ for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
+ i->State(false);
+
+ menu.element.at(choice).State(true);
+ select = choice;
+
+ if (obj != nullptr) {
+ if (select > -1 && select < obj->trait.size())
+ obj->trait.at(select).unread = false;
+ }
+ }
+}
+
#if 0
void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index c96bfd79997..a98e1876aef 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -75,6 +75,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(const pyrodactyl::people::Person *obj);
+ void HandleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event);
#if 0
void HandleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 236b1b7fb35..345c7e5a542 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -124,6 +124,25 @@ void Journal::Draw(const std::string &id) {
}
}
+//------------------------------------------------------------------------
+// Purpose: Handle user input
+//------------------------------------------------------------------------
+bool Journal::HandleEvents(const std::string &id, const Common::Event &Event) {
+ int choice = category.HandleEvents(Event);
+ if (choice >= 0 && choice < category.element.size())
+ Select(id, choice);
+
+ // Check if select is valid
+ if (select >= 0 && select < JE_TOTAL) {
+ // Always find valid journal group first
+ for (auto &jo : journal)
+ if (jo.id == id)
+ return jo.menu[select].HandleEvents(bu_map, marker_title, Event);
+ }
+
+ return false;
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle user input
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 1f4ec88c48a..cedfac2be37 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -98,6 +98,7 @@ public:
void Draw(const std::string &id);
// Return true if "go to map" is selected
+ bool HandleEvents(const std::string &id, const Common::Event &Event);
#if 0
bool HandleEvents(const std::string &id, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 1298415242a..b8d5523f1a3 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -180,6 +180,81 @@ void Map::Validate() {
scroll.element.at(DIRECTION_UP).visible = !(camera.y == 0);
}
+//------------------------------------------------------------------------
+// Purpose: Move
+//------------------------------------------------------------------------
+void Map::Move(const Common::Event &Event) {
+ // Reset the velocity to avoid weirdness
+ vel.x = 0;
+ vel.y = 0;
+
+ // We don't use the result, but this keeps the button states up to date
+ scroll.HandleEvents(Event);
+
+ switch (Event.type) {
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_RBUTTONDOWN: {
+ bool click = false;
+ int count = 0;
+ for (auto &i : scroll.element) {
+ if (i.Contains(gMouse.button)) {
+ if (count == DIRECTION_UP)
+ vel.y = -1 * speed;
+ else if (count == DIRECTION_DOWN)
+ vel.y = speed;
+ else if (count == DIRECTION_RIGHT)
+ vel.x = speed;
+ else if (count == DIRECTION_LEFT)
+ vel.x = -1 * speed;
+
+ click = true;
+ }
+ count++;
+ }
+
+ if (!click) {
+ pan = true;
+ vel.x = 0;
+ vel.y = 0;
+ } else
+ pan = false;
+ } break;
+
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONUP:
+ pan = false;
+ break;
+
+ case Common::EVENT_MOUSEMOVE:
+ if (pan) {
+ camera.x -= gMouse.rel.x;
+ camera.y -= gMouse.rel.y;
+ Validate();
+ }
+ break;
+ default:
+ warning("STUB: Map keyboard processing");
+#if 0
+ // Move the map camera if player presses the direction keys
+ if (gInput.Equals(IU_UP, Event) == SDL_PRESSED)
+ vel.y = -1 * speed;
+ else if (gInput.Equals(IU_DOWN, Event) == SDL_PRESSED)
+ vel.y = speed;
+ else if (gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED)
+ vel.x = speed;
+ else if (gInput.Equals(IU_LEFT, Event) == SDL_PRESSED)
+ vel.x = -1 * speed;
+ // Stop moving when we release a key (but only in that direction)
+ else if (gInput.Equals(IU_UP, Event) == SDL_RELEASED || gInput.Equals(IU_DOWN, Event) == SDL_RELEASED)
+ vel.y = 0;
+ else if (gInput.Equals(IU_LEFT, Event) == SDL_RELEASED || gInput.Equals(IU_RIGHT, Event) == SDL_RELEASED)
+ vel.x = 0;
+ break;
+ }
+#endif
+ }
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Move
@@ -267,6 +342,26 @@ void Map::InternalEvents(pyrodactyl::event::Info &info) {
marker.InternalEvents(pos, player_pos, camera, bounds);
}
+//------------------------------------------------------------------------
+// Purpose: Handle Events
+//------------------------------------------------------------------------
+bool Map::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
+ int choice = travel.HandleEvents(Event, -1 * camera.x, -1 * camera.y);
+ if (choice >= 0) {
+ cur_loc = travel.element.at(choice).loc;
+ pan = false;
+ return true;
+ }
+
+ marker.HandleEvents(pos, player_pos, camera, Event);
+
+ Move(Event);
+ if (bu_overlay.HandleEvents(Event) == BUAC_LCLICK)
+ overlay = bu_overlay.state;
+
+ return false;
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle Events
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 24e87beef66..99e6d62c8b8 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -118,12 +118,14 @@ public:
void Load(const std::string &filename, pyrodactyl::event::Info &info);
void Draw(pyrodactyl::event::Info &info);
+ bool HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
bool HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
void InternalEvents(pyrodactyl::event::Info &info);
void Center(const Vector2i &pos);
+ void Move(const Common::Event &Event);
#if 0
void Move(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 42fbc7633b5..8ebdb1e1029 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -148,6 +148,39 @@ void QuestMenu::Draw(Button &bu_map) {
}
}
+//------------------------------------------------------------------------
+// Purpose: Handle user input
+//------------------------------------------------------------------------
+bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const Common::Event &Event) {
+ int res = menu.HandleEvents(Event);
+ if (res != -1) {
+ if (sel_bu >= 0 && sel_page >= 0)
+ menu.Image(sel_bu, sel_page, img_n);
+
+ sel_bu = res;
+ sel_page = menu.CurrentPage();
+ sel_quest = menu.Index() + sel_bu;
+
+ quest.at(sel_quest).unread = false;
+ text.Reset();
+
+ menu.Image(sel_bu, sel_page, img_s);
+ }
+
+ if (sel_quest >= 0 && sel_quest < quest.size()) {
+ if (quest.at(sel_quest).marker)
+ if (bu_map.HandleEvents(Event) == BUAC_LCLICK) {
+ // The title of the quest selected by the "show in map" button
+ map_title = quest.at(sel_quest).title;
+ return true;
+ }
+
+ text.HandleEvents(quest.at(sel_quest), Event);
+ }
+
+ return false;
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle user input
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 9ba5e01746c..a53db8f8e0e 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -77,6 +77,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(Button &bu_map);
+ bool HandleEvents(Button &bu_map, std::string &map_title, const Common::Event &Event);
#if 0
bool HandleEvents(Button &bu_map, std::string &map_title, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 0346fcb0210..53a0e3342ba 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -54,6 +54,12 @@ void TextArea::Load(rapidxml::xml_node<char> *node) {
}
}
+bool TextArea::HandleEvents(const Common::Event &Event, bool numbers_only) {
+ warning("STUB: TextArea::HandleEvents()");
+ return false;
+}
+
+
#if 0
bool TextArea::HandleEvents(const SDL_Event &Event, bool numbers_only) {
// If a key was pressed
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 647d569ab6b..9646977bcb7 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -68,6 +68,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
+ bool HandleEvents(const Common::Event &Event, bool numbers_only = false);
#if 0
bool HandleEvents(const SDL_Event &Event, bool numbers_only = false);
#endif
Commit: 4bcfcba976fdb53f8f1d2862c20f174f5e6e9c25
https://github.com/scummvm/scummvm/commit/4bcfcba976fdb53f8f1d2862c20f174f5e6e9c25
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix some shadow declarations in spriteAI
Changed paths:
engines/crab/ai/spriteai.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index c21f8287851..886aebda834 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -91,23 +91,23 @@ void Sprite::MoveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteCo
//------------------------------------------------------------------------
// Purpose: Move towards a location without any path finding
//------------------------------------------------------------------------
-bool Sprite::MoveToLoc(Vector2i &dest, const float &vel, const SpriteConstant &sc) {
+bool Sprite::MoveToLoc(Vector2i &dest, const float &velocity, const SpriteConstant &sc) {
// Use the bound rectangle dimensions
Rect b = BoundRect();
// X axis
if (b.x + b.w < dest.x)
- XVel(vel * sc.walk_vel_mod.x);
+ XVel(velocity * sc.walk_vel_mod.x);
else if (b.x > dest.x)
- XVel(-vel * sc.walk_vel_mod.x);
+ XVel(-velocity * sc.walk_vel_mod.x);
else
XVel(0.0f);
// Y axis
if (b.y + b.h < dest.y)
- YVel(vel * sc.walk_vel_mod.y);
+ YVel(velocity * sc.walk_vel_mod.y);
else if (b.y > dest.y)
- YVel(-vel * sc.walk_vel_mod.y);
+ YVel(-velocity * sc.walk_vel_mod.y);
else
YVel(0.0f);
@@ -115,7 +115,7 @@ bool Sprite::MoveToLoc(Vector2i &dest, const float &vel, const SpriteConstant &s
}
// Move toward the location using pathfinding.
-bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &vel, const SpriteConstant &sc) {
+bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &velocity, const SpriteConstant &sc) {
// Rect b = BoundRect();
Vector2i immediateDest = pathing.GetImmediateDest();
@@ -128,20 +128,20 @@ bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &vel, const Sprite
float deltaTime = 1.0f / (float)gScreenSettings.fps;
// Project how far we will travel next frame.
- Vector2f velVec = Vector2f(sc.walk_vel_mod.x * vel * deltaTime, sc.walk_vel_mod.y * vel * deltaTime);
+ Vector2f velVec = Vector2f(sc.walk_vel_mod.x * velocity * deltaTime, sc.walk_vel_mod.y * velocity * deltaTime);
if (vecTo.Magnitude() > velVec.Magnitude()) {
vecTo.Normalize();
- XVel(vecTo.x * sc.walk_vel_mod.x * vel);
- YVel(vecTo.y * sc.walk_vel_mod.y * vel);
+ XVel(vecTo.x * sc.walk_vel_mod.x * velocity);
+ YVel(vecTo.y * sc.walk_vel_mod.y * velocity);
} else {
XVel(0.0f);
YVel(0.0f);
}
} else {
Vector2i loc = pathing.GetImmediateDest();
- MoveToLoc(loc, vel, sc);
+ MoveToLoc(loc, velocity, sc);
}
// return(MoveToLoc(pathing.GetImmediateDest(), vel, sc) || (XVel() == 0.0f && YVel() == 0.0f));
@@ -190,10 +190,10 @@ void Sprite::Flee(pyrodactyl::event::Info &info, std::vector<pyrodactyl::level::
int num = 0;
info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
++num;
- float vel = static_cast<float>(num);
+ float velocity = static_cast<float>(num);
// MoveToLoc(ai_data.dest, vel, sc);
- MoveToLocPathfinding(ai_data.dest, vel, sc);
+ MoveToLocPathfinding(ai_data.dest, velocity, sc);
}
} break;
case FLEESTATE_DISAPPEAR:
Commit: 1805db93d980914741d25dcf9080da087f31b0a9
https://github.com/scummvm/scummvm/commit/1805db93d980914741d25dcf9080da087f31b0a9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents() of GameEventManager
Changed paths:
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 561c8be5dd6..29c6190313b 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -93,6 +93,92 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
}
}
+//------------------------------------------------------------------------
+// Purpose: Handle events
+//------------------------------------------------------------------------
+void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Event &Event, HUD &hud, Level &level, std::vector<EventResult> &result) {
+ // If an event is already being performed
+ if (event_map.count(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ switch (cur_event->type) {
+ case EVENT_DIALOG:
+ if (oh.show_journal) {
+ info.journal.HandleEvents(player_id, Event);
+
+ if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ oh.show_journal = false;
+ } else {
+ // If journal button is select from within an event, go to the entry corresponding to that person's name
+ if (oh.HandleCommonEvents(Event)) {
+ if (info.PersonValid(cur_event->title)) {
+ Person &p = info.PersonGet(cur_event->title);
+ if (p.alt_journal_name)
+ info.journal.Open(player_id, JE_PEOPLE, p.journal_name);
+ else
+ info.journal.Open(player_id, JE_PEOPLE, p.name);
+ }
+ }
+
+ if (oh.HandleDlboxEvents(Event)) {
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ oh.show_journal = false;
+ }
+ }
+ break;
+ case EVENT_ANIM:
+ // Skip animation if key pressed or mouse pressed
+ if (Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP)
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ break;
+ case EVENT_REPLY:
+ if (oh.show_journal) {
+ info.journal.HandleEvents(player_id, Event);
+
+ if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ oh.show_journal = false;
+ } else {
+ // If journal button is select from within an event, go to the entry corresponding to that person's name
+ if (oh.HandleCommonEvents(Event))
+ if (info.PersonValid(cur_event->title))
+ info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
+
+ int choice = reply.HandleEvents(info, gEventStore.con.at(cur_event->special), cur_event->title, oh, Event);
+ if (choice >= 0) {
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
+ oh.show_journal = false;
+ }
+ }
+ break;
+ case EVENT_TEXT:
+ // If journal button is select from within an event, go to the entry corresponding to that person's name
+ if (oh.HandleCommonEvents(Event))
+ if (info.PersonValid(cur_event->title))
+ info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
+
+ if (textin.HandleEvents(Event))
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ break;
+ case EVENT_SPLASH:
+ if (intro.show_traits) {
+ per.HandleEvents(info, cur_event->title, Event);
+
+ if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ intro.show_traits = false;
+ } else {
+ if (intro.HandleEvents(Event))
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+
+ if (intro.show_traits)
+ per.Cache(info, level.PlayerID(), level);
+ }
+ break;
+ default:
+ break;
+ }
+
+ EndSequence(info.CurLocID());
+ }
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 3c2fdc5c3ac..c214887c189 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -95,6 +95,8 @@ public:
// cur_per is also updated here
void InternalEvents(Info &info, pyrodactyl::level::Level &level, std::vector<EventResult> &result);
+ void HandleEvents(Info &info, const std::string &player_id, Common::Event &Event,
+ pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, std::vector<EventResult> &result);
#if 0
void HandleEvents(Info &info, const std::string &player_id, SDL_Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, std::vector<EventResult> &result);
Commit: 3230845177b6915562af6bcd0625f7cc422fe4c5
https://github.com/scummvm/scummvm/commit/3230845177b6915562af6bcd0625f7cc422fe4c5
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unneeded warnings
Changed paths:
engines/crab/ui/ImageData.cpp
engines/crab/ui/button.cpp
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 03d5c3ab4b2..72877fe486a 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -46,7 +46,6 @@ void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo) {
}
void ImageData::Draw(const int &XOffset, const int &YOffset) {
- warning("ImaageData::Draw()");
if (crop)
gImageManager.Draw(x + XOffset, y + YOffset, key, &clip);
else
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 8a5c6382dff..b212a682659 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -101,8 +101,6 @@ void Button::Reset() {
// Purpose: Draw
//------------------------------------------------------------------------
void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
- warning("STUB: Button::Draw()");
-
if (visible) {
if (mousepressed) {
gImageManager.Draw(x + XOffset, y + YOffset, img.select, clip);
Commit: 12fe5ecd72d94b3ca6f4b020a2d9cbc1a4f1f379
https://github.com/scummvm/scummvm/commit/12fe5ecd72d94b3ca6f4b020a2d9cbc1a4f1f379
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable HandleEvents() for rest of the classes
Changed paths:
engines/crab/app.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gamestate_container.h
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/ui/PauseMenu.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index b9e5cd5675b..ec90c4d830b 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -173,7 +173,7 @@ void App::Run() {
break;
case GAMESTATE_NEW_GAME:
- // CurrentState = new Game();
+ CurrentState = new Game();
gScreenSettings.in_game = true;
break;
@@ -228,9 +228,10 @@ void App::Run() {
pyrodactyl::input::gInput.HandleController(Event);
}
#endif
- Common::Event e;
while (g_system->getEventManager()->pollEvent(e)) {
+ // Do state Event handling
+ CurrentState->HandleEvents(e, ShouldChangeState, NextStateID);
}
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 03ca8de9ef2..ee2c1259946 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -154,6 +154,161 @@ bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
return false;
}
+//------------------------------------------------------------------------
+// Purpose: Handle events
+//------------------------------------------------------------------------
+void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
+ gMouse.HandleEvents(Event);
+
+// if (GameDebug)
+// debug_console.HandleEvents(Event);
+
+ if (!debug_console.RestrictInput()) {
+ if (state == STATE_LOSE_MENU) {
+ switch (hud.gom.HandleEvents(Event)) {
+ case 0:
+ state = STATE_LOSE_LOAD;
+ break;
+ case 1:
+ Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
+ break;
+ default:
+ break;
+ }
+ } else if (state == STATE_LOSE_LOAD) {
+ if (gLoadMenu.HandleEvents(Event)) {
+ ShouldChangeState = true;
+ NewStateID = GAMESTATE_LOAD_GAME;
+ return;
+ }
+
+ if (hud.pausekey.HandleEvents(Event) || hud.back.HandleEvents(Event) == BUAC_LCLICK)
+ state = STATE_LOSE_MENU;
+ } else {
+ if (!gem.EventInProgress() && !hud.pause.DisableHotkeys()) {
+ switch (hud.HandleEvents(info, Event)) {
+ case HS_MAP:
+ ToggleState(STATE_MAP);
+ break;
+ case HS_PAUSE:
+ ToggleState(STATE_PAUSE);
+ break;
+ case HS_CHAR:
+ ToggleState(STATE_CHARACTER);
+ gem.per.Cache(info, level.PlayerID(), level);
+ break;
+ case HS_JOURNAL:
+ ToggleState(STATE_JOURNAL);
+ break;
+ case HS_INV:
+ ToggleState(STATE_INVENTORY);
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (state == STATE_GAME) {
+ if (gem.EventInProgress()) {
+ gem.HandleEvents(info, level.PlayerID(), Event, hud, level, event_res);
+ if (ApplyResult())
+ Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
+ } else {
+ // Update the talk key state
+ info.TalkKeyDown = gInput.State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
+
+ level.HandleEvents(info, Event);
+
+ if (!game_over.Empty() && game_over.Evaluate(info)) {
+ state = STATE_LOSE_MENU;
+ hud.gom.Reset();
+ return;
+ }
+
+#if 0
+ if (gInput.Equals(IG_QUICKSAVE, Event) == SDL_RELEASED) {
+ CreateSaveGame(SAVEGAME_QUICK);
+ return;
+ } else if (gInput.Equals(IG_QUICKLOAD, Event) == SDL_RELEASED && !info.IronMan()) {
+ ShouldChangeState = true;
+ NewStateID = GAMESTATE_LOAD_GAME;
+ gLoadMenu.SelectedPath(FullPath(savefile.quick));
+ return;
+ }
+#endif
+
+ if (hud.pausekey.HandleEvents(Event))
+ ToggleState(STATE_PAUSE);
+ }
+ } else if (state == STATE_PAUSE) {
+ switch (hud.pause.HandleEvents(Event, hud.back)) {
+ case PS_RESUME:
+ ToggleState(STATE_GAME);
+ hud.SetTooltip();
+ break;
+
+ case PS_SAVE:
+ CreateSaveGame(SAVEGAME_NORMAL);
+ ToggleState(STATE_GAME);
+ hud.SetTooltip();
+ break;
+ case PS_LOAD:
+ ShouldChangeState = true;
+ NewStateID = GAMESTATE_LOAD_GAME;
+ return;
+
+ case PS_HELP:
+ ToggleState(STATE_HELP);
+ break;
+
+ case PS_QUIT_MENU:
+ CreateSaveGame(SAVEGAME_EXIT);
+ Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
+ break;
+
+ case PS_QUIT_GAME:
+ CreateSaveGame(SAVEGAME_EXIT);
+ Quit(ShouldChangeState, NewStateID, GAMESTATE_EXIT);
+ break;
+ default:
+ break;
+ }
+ } else {
+ if (hud.back.HandleEvents(Event) == BUAC_LCLICK)
+ ToggleState(STATE_GAME);
+
+ switch (state) {
+ case STATE_MAP:
+ if (map.HandleEvents(info, Event)) {
+ // We need to load the new level
+ LoadLevel(map.cur_loc);
+ ToggleState(STATE_GAME);
+ }
+ break;
+ case STATE_JOURNAL:
+ if (info.journal.HandleEvents(level.PlayerID(), Event)) {
+ // This means we selected the "find on map" button, so we need to:
+ // switch to the world map, and highlight the appropriate quest marker
+ map.SelectDest(info.journal.marker_title);
+ ToggleState(STATE_MAP);
+ }
+ break;
+ case STATE_CHARACTER:
+ gem.per.HandleEvents(info, level.PlayerID(), Event);
+ break;
+ case STATE_INVENTORY:
+ info.inv.HandleEvents(level.PlayerID(), Event);
+ break;
+ case STATE_HELP:
+ gHelpScreen.HandleEvents(Event);
+ default:
+ break;
+ }
+ }
+ }
+ }
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
diff --git a/engines/crab/game.h b/engines/crab/game.h
index a7b29981b5d..78f2cd9fe39 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -133,6 +133,7 @@ public:
void Init(const std::string &filename);
+ void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#if 0
void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index 47df0bf7824..c67328582fe 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -45,7 +45,7 @@ namespace Crab {
//------------------------------------------------------------------------
class GameState {
public:
- //virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
+ virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void Draw() = 0;
virtual void SetUI() = 0;
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index d69f0be08e2..8f72345b8e4 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -151,6 +151,139 @@ MainMenu::MainMenu() {
gFilePath.current_r = gFilePath.mainmenu_r;
}
+//------------------------------------------------------------------------
+// Purpose: Event/input handling Events
+//------------------------------------------------------------------------
+void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
+ gMouse.HandleEvents(Event);
+
+ if (state != STATE_CREDITS) {
+ int choice = me_main.HandleEvents(Event);
+ if (choice >= 0) {
+ for (unsigned i = 0; i < me_main.element.size(); ++i)
+ me_main.element.at(i).State(i == choice);
+
+ switch (choice) {
+ case 0:
+ if (gLoadMenu.SelectNewestFile()) {
+ ChangeState(STATE_NORMAL);
+ ShouldChangeState = true;
+ NewStateID = GAMESTATE_LOAD_GAME;
+ }
+ break;
+ case 1:
+ ChangeState(STATE_DIFF);
+ break;
+ case 2:
+ ChangeState(STATE_LOAD);
+ gLoadMenu.ScanDir();
+ break;
+ case 3:
+ ChangeState(STATE_OPTIONS);
+ break;
+ case 4:
+ ChangeState(STATE_MOD);
+ break;
+ case 5:
+ ChangeState(STATE_HELP);
+ break;
+ case 6:
+ ChangeState(STATE_CREDITS);
+ credits.Reset();
+ break;
+ case 7:
+ ShouldChangeState = true;
+ NewStateID = GAMESTATE_EXIT;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+#if 0
+ if (gInput.Equals(IU_BACK, Event) == SDL_PRESSED || (back.HandleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
+ if (state == STATE_SAVENAME)
+ ChangeState(STATE_DIFF);
+ else if (state != STATE_NORMAL)
+ ChangeState(STATE_NORMAL);
+ }
+#endif
+
+ switch (state) {
+#ifdef UNREST_DEMO
+ case STATE_NORMAL:
+ if (steam.HandleEvents(Event) == BUAC_LCLICK) {
+ // Open steam in browser window
+ OpenURL("https://store.steampowered.com/app/292400/");
+ }
+
+ if (direct.HandleEvents(Event) == BUAC_LCLICK) {
+ // Open humble widget in browser window
+ OpenURL("https://www.humblebundle.com/store/unrest/Udg6Ytd8Dfw");
+ }
+ break;
+#endif
+ case STATE_OPTIONS:
+ if (gOptionMenu.HandleEvents(back, Event))
+ ChangeState(STATE_NORMAL);
+ break;
+
+ case STATE_CREDITS:
+ if (credits.HandleEvents(Event))
+ ChangeState(STATE_NORMAL);
+ break;
+
+ case STATE_LOAD:
+ if (gLoadMenu.HandleEvents(Event)) {
+ ChangeState(STATE_NORMAL);
+ ShouldChangeState = true;
+ NewStateID = GAMESTATE_LOAD_GAME;
+ return;
+ }
+ break;
+
+ case STATE_DIFF: {
+ int choice = diff.menu.HandleEvents(Event);
+
+ // First menu option is Non-iron man, second is iron man
+ // For the second choice, we must display a prompt to choose the name of the save game
+ if (choice == 0) {
+ gTemp.ironman = false;
+ ShouldChangeState = true;
+ NewStateID = GAMESTATE_NEW_GAME;
+ } else if (choice == 1)
+ ChangeState(STATE_SAVENAME);
+ } break;
+
+ case STATE_SAVENAME:
+ if (save.HandleEvents(Event) || accept.HandleEvents(Event)) {
+ if (save.text != "") {
+ gTemp.filename = save.text.c_str();
+ gTemp.ironman = true;
+ ShouldChangeState = true;
+ NewStateID = GAMESTATE_NEW_GAME;
+ } else
+ debug("Please enter a valid filename for the iron man save.");
+ } else if (cancel.HandleEvents(Event))
+ ChangeState(STATE_DIFF);
+
+ break;
+
+ case STATE_MOD:
+ if (mod.HandleEvents(Event))
+ ChangeState(STATE_NORMAL);
+ break;
+
+ case STATE_HELP:
+ gHelpScreen.HandleEvents(Event);
+ break;
+
+ default:
+ break;
+ }
+}
+
#if 0
//------------------------------------------------------------------------
// Purpose: Event/input handling Events
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index cd4ccd100b5..0f768701628 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -124,6 +124,7 @@ public:
MainMenu();
~MainMenu() {}
+ void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#if 0
void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index fcc86e8a157..7d5ea098a58 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -81,11 +81,11 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
return PS_RESUME;
case 1:
state = STATE_SAVE;
- save.ScanDir();
+ //save.ScanDir();
break;
case 2:
state = STATE_LOAD;
- gLoadMenu.ScanDir();
+ //gLoadMenu.ScanDir();
break;
case 3:
state = STATE_OPTION;
Commit: 97a8356a6449844af3fdbb587e174c769cd9fc1b
https://github.com/scummvm/scummvm/commit/97a8356a6449844af3fdbb587e174c769cd9fc1b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub ChapterIntro and HUD drawing funcs
Changed paths:
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/hud.cpp
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 440f115bd6e..32e5ae3e784 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -64,8 +64,6 @@ bool ChapterIntro::HandleEvents(SDL_Event &Event) {
void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state) {
- warning("STUB: ChapterIntro::Draw()");
-#if 0
dialog.Draw(false);
dialog.Draw(info, text);
@@ -75,7 +73,6 @@ void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
Rect clip = cur_sp->DialogClip(state);
gImageManager.Draw(pos.x, pos.y, cur_sp->Img(), &clip);
}
-#endif
}
} // End of namespace Crab
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 3c2d2ac3f3e..dbc62ec287c 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -86,7 +86,6 @@ void HUD::Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, p
void HUD::Draw(pyrodactyl::event::Info &info, const std::string &id) {
warning("STUB: HUD::Draw()");
-#if 0
bg.Draw();
menu.Draw();
@@ -109,7 +108,7 @@ void HUD::Draw(pyrodactyl::event::Info &info, const std::string &id) {
gImageManager.Draw(menu.element.at(HS_MAP).x + menu.element.at(HS_MAP).w - clip.w / 2,
menu.element.at(HS_MAP).y - clip.h / 2, notify_anim, &clip);
}
-#endif
+//#endif
}
void HUD::InternalEvents(bool ShowMap) {
Commit: ebef8bd49c77410f2185260dffab103de33d7209
https://github.com/scummvm/scummvm/commit/ebef8bd49c77410f2185260dffab103de33d7209
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add warnings for stubs in ImageManager
Changed paths:
engines/crab/image/ImageManager.cpp
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 6b27af8dbf8..ed067c17a6c 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -167,6 +167,8 @@ void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Rect *cl
// Purpose: Dim the screen by drawing a 128 alpha black rectangle over it
//------------------------------------------------------------------------
void ImageManager::DimScreen() {
+ warning("STUB: ImageManger::DimScreen()");
+
#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 128);
@@ -175,6 +177,8 @@ void ImageManager::DimScreen() {
}
void ImageManager::BlackScreen() {
+ warning("STUB: ImageManger::BlackScreen()");
+
#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 255);
Commit: b0e2512578f003d2f9e3275026637158f81e76fe
https://github.com/scummvm/scummvm/commit/b0e2512578f003d2f9e3275026637158f81e76fe
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add clipping and flipping of textures
This is needed for the proper rendering of the game's first screen
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 81aaf9ac618..972a7e6fa7c 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -122,6 +122,19 @@ bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
//------------------------------------------------------------------------
void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFlipType &flip) {
+ Common::Rect srcRect;
+ if (clip != NULL) {
+ srcRect = *clip;
+ } else {
+ srcRect = Common::Rect{x, y, w + x, h + y};
+ }
+
+ Common::Rect destRect {x, y, w + x, h + y};
+ if (clip != NULL) {
+ destRect.right = clip->right;
+ destRect.bottom = clip->bottom;
+ }
+
g_engine->_renderSurface->blitFrom(*texture, Common::Point(x, y));
//g_engine->_renderSurface->copyRectToSurface(texture->getPixels(), texture->pitch, x, y, texture->w, texture->h);
#if 0
@@ -179,7 +192,31 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
}
void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip) {
- g_engine->_renderSurface->blitFrom(*texture, Common::Point(x, y));
+ Common::Rect srcRect {0, 0, w + 0, h + 0};
+ Common::Rect destRect {x, y, w + x, h + y};
+
+ if (clip) {
+ srcRect = {clip->x, clip->y, clip->x + clip->w, clip->y + clip->h};
+ destRect.right = clip->w + x;
+ destRect.bottom = clip->h + y;
+ }
+
+ Graphics::Surface *s = new Graphics::Surface();
+ s->copyFrom(texture->getSubArea(srcRect));
+
+ switch(flip) {
+ case FLIP_NONE:
+ break;
+
+ case FLIP_X:
+ s->flipHorizontal(Common::Rect(s->w, s->h));
+ break;
+
+ default:
+ warning("Flipped texture: %d", flip);
+ }
+
+ g_engine->_renderSurface->blitFrom(s, Common::Rect(s->w, s->h), destRect);
}
//------------------------------------------------------------------------
Commit: fb05da3c39c8a04e3b1b23a4c5412a074219ebf3
https://github.com/scummvm/scummvm/commit/fb05da3c39c8a04e3b1b23a4c5412a074219ebf3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Graphics::Screen instead of renderBuffer
Changed paths:
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/image/Image.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index ec90c4d830b..7eefb7da96f 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -257,9 +257,9 @@ void App::Run() {
pyrodactyl::text::gTextManager.Draw(0, 0, NumberToString(fpsval), 0);
}
#endif
- const Graphics::ManagedSurface *s = g_engine->_renderSurface;
- g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
- g_system->updateScreen();
+ //const Graphics::ManagedSurface *s = g_engine->_renderSurface;
+ //g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
+ g_engine->_screen->update();
#if 0
// Update the screen
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 86022a7e393..cc333580d73 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -89,6 +89,7 @@ Common::Error CrabEngine::run() {
Graphics::PixelFormat *format = new Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
initGraphics(1920, 1080, format);
_renderSurface = new Graphics::ManagedSurface(1920, 1080, *format);
+ _screen = new Graphics::Screen(1920, 1080, *format);
// Set the engine's debugger console
setDebugger(new Console());
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 972a7e6fa7c..6ea66deab6b 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -135,7 +135,9 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
destRect.bottom = clip->bottom;
}
- g_engine->_renderSurface->blitFrom(*texture, Common::Point(x, y));
+ // TODO: Do proper clipping
+ g_engine->_screen->blitFrom(*texture, Common::Point(x, y));
+ //g_engine->_renderSurface->blitFrom(*texture, Common::Point(x, y));
//g_engine->_renderSurface->copyRectToSurface(texture->getPixels(), texture->pitch, x, y, texture->w, texture->h);
#if 0
// Set rendering space and render to screen
@@ -216,7 +218,8 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
warning("Flipped texture: %d", flip);
}
- g_engine->_renderSurface->blitFrom(s, Common::Rect(s->w, s->h), destRect);
+ g_engine->_screen->blitFrom(s, Common::Rect(s->w, s->h), destRect);
+ //g_engine->_renderSurface->blitFrom(s, Common::Rect(s->w, s->h), destRect);
}
//------------------------------------------------------------------------
Commit: 1b24558cefbb94a8eef9431b0f76fdf3e427169e
https://github.com/scummvm/scummvm/commit/1b24558cefbb94a8eef9431b0f76fdf3e427169e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub Game::LoadLevel function
Changed paths:
engines/crab/game.cpp
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index ee2c1259946..f4e3f3f0cb1 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -113,26 +113,23 @@ void Game::Init(const std::string &filename) {
}
bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
- warning("STUB: Game::LoadLevel()");
-
-#if 0
- if (gFilePath.level.count(id) > 0) {
+ if (gFilePath.level.contains(id.c_str())) {
gLoadScreen.Draw();
// Load the assets local to this level
// If the filename is same as the previous one, skip loading
- if (gFilePath.current_r != gFilePath.level[id].asset) {
- gFilePath.current_r = gFilePath.level[id].asset;
- gImageManager.LoadMap(gFilePath.level[id].asset);
+ if (gFilePath.current_r != gFilePath.level[id.c_str()].asset) {
+ gFilePath.current_r = gFilePath.level[id.c_str()].asset;
+ gImageManager.LoadMap(gFilePath.level[id.c_str()].asset);
}
// Load the level itself
level.pop = pop_default;
- level.Load(gFilePath.level[id].layout, info, game_over, player_x, player_y);
+ level.Load(gFilePath.level[id.c_str()].layout.c_str(), info, game_over, player_x, player_y);
// Set the current location
info.CurLocID(id);
- info.CurLocName(gFilePath.level[id].name);
+ info.CurLocName(gFilePath.level[id.c_str()].name.c_str());
map.player_pos = level.map_loc;
// Update and center the world map to the player current position
@@ -149,7 +146,6 @@ bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
info.journal.Init(level.PlayerID());
return true;
}
-#endif
return false;
}
@@ -505,7 +501,6 @@ void Game::Draw() {
level.Draw(info);
else
gImageManager.BlackScreen();
-
switch (state) {
case STATE_GAME:
if (gem.EventInProgress())
@@ -561,7 +556,6 @@ void Game::Draw() {
if (GameDebug)
debug_console.Draw(info);
-
gMouse.Draw();
}
Commit: 32024f73c23cbe146d045d04a47f4752cc62ba95
https://github.com/scummvm/scummvm/commit/32024f73c23cbe146d045d04a47f4752cc62ba95
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub ItemSlot::Draw()
Changed paths:
engines/crab/item/ItemSlot.cpp
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 3c04e99dfad..82bbb46ebe8 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -103,9 +103,6 @@ void ItemSlot::LoadState(rapidxml::xml_node<char> *node) {
// Purpose: Draw
//------------------------------------------------------------------------
void ItemSlot::Draw() {
-
- warning("STUB: ItemSlot::Draw()");
-#if 0
StateButton::Draw();
if (!empty)
@@ -113,7 +110,6 @@ void ItemSlot::Draw() {
if (unread)
pyrodactyl::image::gImageManager.NotifyDraw(x + w, y);
-#endif
}
//------------------------------------------------------------------------
Commit: 1b7a7c6502910dedec3cd2df5e997776120d3b68
https://github.com/scummvm/scummvm/commit/1b7a7c6502910dedec3cd2df5e997776120d3b68
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub misc funcs in TMX
Changed paths:
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 8becdee1e86..0ce74e009a0 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -43,16 +43,13 @@ bool Layer::Load(rapidxml::xml_node<char> *node) {
}
bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
- warning("STUB: MapLayer::Load()");
-
-#if 0
if (Layer::Load(node)) {
if (NodeValid("image", node, false)) {
type = LAYER_IMAGE;
rapidxml::xml_node<char> *imgnode = node->first_node("image");
if (imgnode->first_attribute("source") != NULL)
- img.Load(path + imgnode->first_attribute("source")->value());
+ img.Load((path + imgnode->first_attribute("source")->value()).c_str());
} else {
type = LAYER_NORMAL;
int i = 0;
@@ -104,7 +101,6 @@ bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
return true;
}
-#endif
return false;
}
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index a6f1bedc991..1ccc8a76b2b 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -250,7 +250,6 @@ void TMXMap::Reset() {
// Purpose: Draw functions
//------------------------------------------------------------------------
void TMXMap::DrawDebug(const Rect &camera) {
-#if 0
using namespace pyrodactyl::text;
for (auto i = area_trig.begin(); i != area_trig.end(); ++i)
@@ -270,8 +269,8 @@ void TMXMap::DrawDebug(const Rect &camera) {
for (auto i = area_stairs.begin(); i != area_stairs.end(); ++i) {
i->Draw(-camera.x, -camera.y, 0, 254, 0, 254);
- gTextManager.Draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x), 0);
- gTextManager.Draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y), 0);
+ //gTextManager.Draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x).c_str(), 0);
+ //gTextManager.Draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y).c_str(), 0);
}
// Draw the pathfinding grid (SZ)
@@ -313,7 +312,6 @@ void TMXMap::DrawDebug(const Rect &camera) {
prev = *j;
}
}*/
-#endif
}
//------------------------------------------------------------------------
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index c085101e1c7..0d5b0bfee2d 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -80,9 +80,6 @@ void TileSetGroup::Load(const std::string &path, rapidxml::xml_node<char> *node)
}
void TileSet::Draw(const Vector2i &pos, const TileInfo &tile) {
- warning("STUB: TileSet::Draw()");
-
-#if 0
if (tile.gid != 0) {
clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
@@ -92,7 +89,6 @@ void TileSet::Draw(const Vector2i &pos, const TileInfo &tile) {
/*if(tile.flip != FLIP_NONE && GameDebug)
pyrodactyl::text::gTextManager.Draw(pos.x,pos.y,NumberToString(tile.flip),0);*/
}
-#endif
}
void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos) {
Commit: 49fcc5f4e210cefa5c014de1e155bcadf96ce8f2
https://github.com/scummvm/scummvm/commit/49fcc5f4e210cefa5c014de1e155bcadf96ce8f2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub Sprite drawing function
Changed paths:
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 33e49fff011..f0231ae64fc 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -241,9 +241,6 @@ Vector2i Sprite::CamFocus() {
// Purpose: Draw the sprite
//------------------------------------------------------------------------
void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
- warning("STUB: Sprite::Draw()");
-
-#if 0
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
@@ -325,7 +322,6 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
10);
destinationRect.Draw(-camera.x, -camera.y, 0, 200, 0, 254);
}
-#endif
}
void Sprite::DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
@@ -340,6 +336,7 @@ void Sprite::DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
// Purpose: Handle the movement in a level for the player only
//------------------------------------------------------------------------
void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const Common::Event &Event) {
+
int num = 0;
info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
++num;
@@ -372,6 +369,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
YVel(0.0f);
} else // Keyboard movement
{
+ #if 0
// Disable destination as soon as player presses a direction key
// X axis
if (gInput.State(IG_LEFT)) {
@@ -392,6 +390,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
YVel(player_speed * sc.walk_vel_mod.y);
} else if (!ai_data.dest.active)
YVel(0.0f);
+ #endif
}
UpdateMove(input.HandleEvents(Event));
Commit: cd14fb46e9e3c34691d309c6135dfd13c2eae253
https://github.com/scummvm/scummvm/commit/cd14fb46e9e3c34691d309c6135dfd13c2eae253
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub misc functions in event component
Changed paths:
engines/crab/event/EventSequence.cpp
engines/crab/event/effect.cpp
engines/crab/event/trigger.cpp
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index fccc2c3a0ad..fa41bac3d12 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -39,10 +39,7 @@ using namespace pyrodactyl::event;
// Purpose: Load
//------------------------------------------------------------------------
void EventSequence::Load(const std::string &filename) {
- warning("STUB: EventSequence::Load()");
-
-#if 0
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("events");
for (auto n = node->first_node("event"); n != NULL; n = n->next_sibling("event")) {
@@ -50,7 +47,6 @@ void EventSequence::Load(const std::string &filename) {
events.push_back(e);
}
}
-#endif
}
//------------------------------------------------------------------------
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index ec872d2eca7..3bdf79eda1c 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -129,10 +129,6 @@ void Effect::ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::Op
bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id,
std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
-
- warning("STUB: Effect::Execute()");
-
-#if 0
if (type < EFF_MOVE) {
switch (type) {
case EFF_VAR:
@@ -287,8 +283,6 @@ bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id
result.push_back(r);
}
-#endif
-
return false;
}
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 8a0b92a8a1b..c3b0cebef4c 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -103,10 +103,6 @@ bool Trigger::Evaluate(int lhs, int rhs) {
}
bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
-
- warning("STUB: Trigger::Evaluate()");
-
-#if 0
using namespace pyrodactyl::people;
using namespace pyrodactyl::stat;
@@ -199,8 +195,6 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
break;
}
-#endif
-
return false;
}
Commit: c30b37f1dbe87df9b4a554a0c7a137408efea969
https://github.com/scummvm/scummvm/commit/c30b37f1dbe87df9b4a554a0c7a137408efea969
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use stringstream to convert string to number for now
The past implementation was bugged out incase of floating points
Changed paths:
engines/crab/common_header.h
engines/crab/numstr.h
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 33d4bb0b4ea..2e555f38ee8 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -44,6 +44,7 @@
#include <string>
#include <unordered_map>
#include <vector>
+#include <sstream>
#if 0
#include <SDL2/SDL.h>
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 15505368028..366bdb2bbb4 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -65,16 +65,9 @@ Common::String NumberToString(T Number) {
template<typename T>
T StringToNumber(char *Text) {
- T result = 0;
- char *num = Text;
-
- if (Text[0] == '-')
- num++;
-
- for (int i = 0; num[i]; i++)
- result = (result * 10) + (num[i] - '0');
-
- return Text[0] == '-' ? -result : result;
+ std::stringstream ss(Text);
+ T result;
+ return (ss >> result) ? result : 0;
}
template<typename T>
Commit: a5e52ed9a327affcf1db06427f560a045a2d4372
https://github.com/scummvm/scummvm/commit/a5e52ed9a327affcf1db06427f560a045a2d4372
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub PersonScreen::Draw and PersonHandler::Draw
Changed paths:
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 4df10c9f3eb..fd6750f1382 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -72,9 +72,6 @@ void PersonHandler::Load(rapidxml::xml_node<char> *node) {
void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const std::string &person_id,
const bool &player, pyrodactyl::anim::Sprite *s) {
- warning("STUB: PersonHandler::Draw()");
-
-#if 0
// Draw the dialog box background
dlbox.Draw(player);
@@ -110,7 +107,6 @@ void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
// Draw the dialog box text
dlbox.Draw(info, Event->dialog);
-#endif
}
bool PersonHandler::HandleCommonEvents(const Common::Event &Event) {
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 33c4cf3c0df..0c48c7e2595 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -80,9 +80,6 @@ void PersonScreen::InternalEvents() {
}
void PersonScreen::Draw(pyrodactyl::event::Info &info, const std::string &id) {
- warning("STUB: PersonScreen::Draw()");
-
-#if 0
bg.Draw();
if (info.PersonValid(id)) {
@@ -95,7 +92,6 @@ void PersonScreen::Draw(pyrodactyl::event::Info &info, const std::string &id) {
Rect clip = cur_sp->DialogClip(PST_NORMAL);
gImageManager.Draw(img.x, img.y, cur_sp->Img(), &clip);
}
-#endif
}
void PersonScreen::Cache(Info &info, const std::string &id, pyrodactyl::level::Level &level) {
Commit: 58548c7ad7e2fdc6a6ecc89cc9f4237c37f40c1b
https://github.com/scummvm/scummvm/commit/58548c7ad7e2fdc6a6ecc89cc9f4237c37f40c1b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port and unstub DrawLine() function
Changed paths:
engines/crab/Line.cpp
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index c56546c5014..cd2bfaaf759 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/Line.h"
namespace Crab {
@@ -37,7 +39,7 @@ namespace Crab {
//------------------------------------------------------------------------
void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
- warning("STUB: DrawLine()");
+ g_engine->_screen->drawLine(x1, y1, x2, y2, g_engine->_format->ARGBToColor(a, r, g, b));
#if 0
SDL_SetRenderDrawColor(gRenderer, r, g, b, a);
Commit: 268bf022c3ca8ccf629ed5a0071f6997f0f612d7
https://github.com/scummvm/scummvm/commit/268bf022c3ca8ccf629ed5a0071f6997f0f612d7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Change default resolution to 1280x720
Changed paths:
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 7eefb7da96f..17ad6b198dd 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -122,8 +122,6 @@ bool App::Init() {
pyrodactyl::input::gInput.Init();
LoadSettings("res/settings.xml");
- gScreenSettings.cur.w = 1920;
- gScreenSettings.cur.h = 1080;
gScreenSettings.in_game = false;
return true;
}
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index cc333580d73..25b8ecbee2b 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -86,10 +86,10 @@ Common::String CrabEngine::getGameId() const {
Common::Error CrabEngine::run() {
// Initialize 320x200 paletted graphics mode
- Graphics::PixelFormat *format = new Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
- initGraphics(1920, 1080, format);
- _renderSurface = new Graphics::ManagedSurface(1920, 1080, *format);
- _screen = new Graphics::Screen(1920, 1080, *format);
+ _format = new Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
+ initGraphics(1280, 720, _format);
+ _renderSurface = new Graphics::ManagedSurface(1920, 1080, *_format);
+ _screen = new Graphics::Screen(1280, 720, *_format);
// Set the engine's debugger console
setDebugger(new Console());
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 648904f3424..c83aaead2f2 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -83,6 +83,7 @@ protected:
public:
Graphics::Screen *_screen = nullptr;
+ Graphics::PixelFormat *_format = nullptr;
Graphics::ManagedSurface *_renderSurface = nullptr;
Common::FSNode _gameDataDir;
Commit: e9e78480e3911cb490b34240620f136b2bc1ba94
https://github.com/scummvm/scummvm/commit/e9e78480e3911cb490b34240620f136b2bc1ba94
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Create an overload for ManagedSurface
Changed paths:
engines/crab/image/Image.cpp
engines/crab/image/Image.h
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 6ea66deab6b..229fbf0c7bc 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -64,6 +64,27 @@ bool Image::Load(Graphics::Surface *surface) {
#endif
}
+bool Image::Load(Graphics::ManagedSurface *surface) {
+ Delete();
+ texture = new Graphics::ManagedSurface(*surface);
+ w = surface->w;
+ h = surface->h;
+ return true;
+#if 0
+ // Create texture from surface pixels
+ texture = SDL_CreateTextureFromSurface(gRenderer, surface);
+ if (texture == NULL) {
+ fprintf(stderr, "Unable to create texture from SDL_Surface! SDL Error: %s\n", SDL_GetError());
+ return false;
+ }
+
+ // Get image dimensions
+ w = surface->w;
+ h = surface->h;
+ return true;
+#endif
+}
+
bool Image::Load(const Common::String &path) {
// Get rid of preexisting texture
Delete();
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index ce72053c999..ceaece8d571 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -89,6 +89,7 @@ public:
bool Load(const Common::String &path);
bool Load(rapidxml::xml_node<char> *node, const char *name);
bool Load(Graphics::Surface *surface);
+ bool Load(Graphics::ManagedSurface *surface);
// Draw the openGL texture
void Draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
Commit: f67cd91a3f7651158acb680578b473f13f7f8c4d
https://github.com/scummvm/scummvm/commit/f67cd91a3f7651158acb680578b473f13f7f8c4d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub ColorPool::load()
Changed paths:
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/text/color.cpp
engines/crab/text/color.h
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index f599042dbaf..c5d111d6adf 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -103,6 +103,7 @@ bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
return true;
return false;
}
+#endif
bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo,
const Common::String &r_name, const Common::String &g_name, const Common::String &b_name)
@@ -120,8 +121,6 @@ bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo,
return false;
}
-#endif
-
bool LoadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo) {
return LoadNum(col, "color", node, echo);
}
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 314fd3fb00d..6a10382bed7 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -88,6 +88,15 @@ bool LoadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node
bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo = true,
const Common::String &x_name = "x", const Common::String &y_name = "y", const Common::String &w_name = "w", const Common::String &h_name = "h");
+#endif
+
+// Make linker happy by temporarily defining SDL_COLOR
+struct SDL_Color {
+ uint32 r;
+ uint32 g;
+ uint32 b;
+};
+
//Load Color
bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo = true,
const Common::String &r_name = "r", const Common::String &g_name = "g", const Common::String &b_name = "b");
@@ -95,8 +104,6 @@ bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo
//Shortcut to load integer color index to a number
bool LoadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo = true);
-#endif
-
// Load two dimensional coordinates
template<typename T>
bool LoadXY(T &x, T &y, rapidxml::xml_node<char> *node, const bool &echo = true) {
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index 76198ab94f2..8b74347cace 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -35,10 +35,8 @@ namespace Crab {
using namespace pyrodactyl::text;
void ColorPool::Load(const std::string &filename) {
- warning("STUB: ColorPool::Load()");
-#if 0
pool.clear();
- XMLDoc col_list(filename);
+ XMLDoc col_list(filename.c_str());
if (col_list.ready()) {
rapidxml::xml_node<char> *node = col_list.Doc()->first_node("colors");
for (rapidxml::xml_node<char> *n = node->first_node("color"); n != NULL; n = n->next_sibling("color")) {
@@ -47,7 +45,6 @@ void ColorPool::Load(const std::string &filename) {
pool.push_back(c);
}
}
-#endif
}
SDL_Color &ColorPool::Get(const int &num) {
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index 82a5b491c0e..0e89c9cc7c8 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -41,13 +41,6 @@ namespace pyrodactyl {
namespace text {
// Storage pool for saving colors from one file, then using them
-// Make linker happy by temporarily defining SDL_COLOR
-struct SDL_Color {
- uint32 r;
- uint32 g;
- uint32 b;
-};
-
class ColorPool {
std::vector<SDL_Color> pool;
Commit: 8d3760482c6b257c6213b589d9a73155d6531811
https://github.com/scummvm/scummvm/commit/8d3760482c6b257c6213b589d9a73155d6531811
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port and unstub PathFindingAgent::Update
Changed paths:
engines/crab/PathfindingAgent.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index c29aa9c915a..3ddca9e6635 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -29,6 +29,7 @@
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/PathfindingAgent.h"
namespace Crab {
@@ -104,10 +105,8 @@ void PathfindingAgent::SetDestination(Vector2f d, bool r) {
}
void PathfindingAgent::Update(long timeslice) {
- warning("STUB: PathfindingAgent::Update()");
-#if 0
- long prevTime = SDL_GetTicks();
+ long prevTime = g_system->getMillis();
long time = timeslice;
double dTempCost;
@@ -216,13 +215,12 @@ void PathfindingAgent::Update(long timeslice) {
// Update the time
if (timeslice != 0) {
- time -= (SDL_GetTicks() - prevTime);
- prevTime = SDL_GetTicks();
+ time -= (g_system->getMillis() - prevTime);
+ prevTime = g_system->getMillis();
}
- } while (!isDone() && (time >= 0 || timeslice == 0));
+ } while (!isDone() && (time >= 0 || timeslice == 0));
noSolution = true; // You can't get there from here (SZ)
-#endif
}
bool PathfindingAgent::isDone() const {
Commit: bd6b56b6336359242ed5c663350ee17906223b87
https://github.com/scummvm/scummvm/commit/bd6b56b6336359242ed5c663350ee17906223b87
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port most of TextManager
Changed paths:
engines/crab/common_header.h
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 2e555f38ee8..63ac0cf5f32 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -64,6 +64,8 @@
#include "graphics/surface.h"
#include "graphics/managed_surface.h"
+#include "graphics/font.h"
+#include "graphics/fonts/ttf.h"
#define RAPIDXML_NO_EXCEPTIONS
#include "crab/rapidxml/rapidxml.hpp"
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 84bb8dc6897..eae4822cedc 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/text/TextManager.h"
#include "crab/XMLDoc.h"
@@ -45,9 +47,6 @@ TextManager gTextManager;
// Purpose: Initialize, set cache etc
//------------------------------------------------------------------------
void TextManager::Init() {
- warning("STUB: TextManager::Init()");
-
-#if 0
// First, delete everything that exists
Quit();
@@ -73,14 +72,18 @@ void TextManager::Init() {
unsigned int pos = StringToNumber<unsigned int>(id->value());
if (font.size() <= pos)
font.resize(pos + 1);
+#if 0
font.at(pos) = TTF_OpenFont(path->value(), StringToNumber<int>(size->value()));
TTF_SetFontHinting(font.at(pos), TTF_HINTING_LIGHT);
+#endif
+ Common::File file;
+ FileOpen(path->value(), &file);
+ font.at(pos) = Graphics::loadTTFFont(file, StringToNumber<int>(size->value()));
}
}
}
- colpool.Load(gFilePath.colors);
-#endif
+ colpool.Load(gFilePath.colors.c_str());
}
void TextManager::Reset() {
@@ -123,54 +126,93 @@ SDL_Surface *TextManager::RenderTextBlended(const FontKey &font, const std::stri
}
#endif
+Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &font, const std::string &text, const int &color) {
+ SDL_Color sdlcolor = colpool.Get(color);
+ uint32 col = g_engine->_format->ARGBToColor(255, sdlcolor.r, sdlcolor.g, sdlcolor.b);
+
+ Graphics::ManagedSurface *surf = nullptr;
+
+ if (text.empty()) {
+ Common::Rect rec = GetFont(font)->getBoundingBox(" ");
+ int h = rec.height();
+ surf = new Graphics::ManagedSurface(rec.width(), h + (h / 2), *g_engine->_format);
+ GetFont(font)->drawString(surf, " ", 0, 0, rec.width(), col);
+ } else {
+ Common::Rect rec = GetFont(font)->getBoundingBox(text.c_str());
+ int h = rec.height();
+ surf = new Graphics::ManagedSurface(rec.width(), h + (h / 2), *g_engine->_format);
+ GetFont(font)->drawString(surf, text.c_str(), 0, 0, rec.width(), col);
+ }
+
+ return surf;
+}
+
//------------------------------------------------------------------------
// Purpose: Draw text
//------------------------------------------------------------------------
void TextManager::Draw(const int &x, const int &y, const std::string &text, const int &color,
- const FontKey &font, const Align &align, const bool &background) {
- warning("STUB: TextManager::Draw()");
+ const FontKey &fontk, const Align &align, const bool &background) {
+ //warning("STUB: TextManager::Draw()");
-#if 0
- int pos = Search(text, color, font);
+ int pos = Search(text, color, fontk);
if (pos == -1) {
pos = FindFreeSlot();
+#if 0
SDL_Surface *surf = RenderTextBlended(font, text, color);
-
+#endif
+ Graphics::ManagedSurface *surf = RenderTextBlended(fontk, text, color);
cache[pos].img.Delete();
cache[pos].empty = false;
cache[pos].text = text;
cache[pos].col = color;
- cache[pos].font = font;
+ cache[pos].font = fontk;
cache[pos].img.Load(surf);
+
+ delete surf;
+#if 0
SDL_FreeSurface(surf);
+#endif
}
if (background) {
rect.w = cache[pos].img.W() + (2 * pad_bg.x);
rect.h = cache[pos].img.H() + (2 * pad_bg.y);
-
+#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 128);
+#endif
if (align == ALIGN_LEFT) {
rect.x = x - pad_bg.x;
rect.y = y - pad_bg.y;
+#if 0
SDL_RenderFillRect(gRenderer, &rect);
+#endif
+ uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
+ g_engine->_screen->fillRect(Common::Rect(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h), col);
cache[pos].img.Draw(x, y);
} else if (align == ALIGN_CENTER) {
rect.x = x - cache[pos].img.W() / 2 - pad_bg.x;
rect.y = y - cache[pos].img.H() / 2 - pad_bg.y;
+#if 0
SDL_RenderFillRect(gRenderer, &rect);
+#endif
+ uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
+ g_engine->_screen->fillRect(Common::Rect(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h), col);
cache[pos].img.Draw(x - cache[pos].img.W() / 2, y - cache[pos].img.H() / 2);
} else {
rect.x = x - cache[pos].img.W() - pad_bg.x;
rect.y = y - pad_bg.y;
+#if 0
SDL_RenderFillRect(gRenderer, &rect);
+#endif
+ uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
+ g_engine->_screen->fillRect(Common::Rect(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h), col);
cache[pos].img.Draw(x - cache[pos].img.W(), y);
}
} else {
@@ -181,7 +223,6 @@ void TextManager::Draw(const int &x, const int &y, const std::string &text, cons
else
cache[pos].img.Draw(x - cache[pos].img.W(), y);
}
-#endif
}
void TextManager::Draw(const int &x, int y, const std::string &text, const int &color, const FontKey &font, const Align &align,
@@ -224,7 +265,7 @@ void TextManager::Draw(const int &x, int y, const std::string &text, const int &
// Purpose: Quit
//------------------------------------------------------------------------
void TextManager::Quit() {
- warning("TextManager::Quit()");
+ warning("STUB: TextManager::Quit()");
#if 0
for (auto i = font.begin(); i != font.end(); ++i)
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 51afc0fb685..83c8a85aa5f 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -49,7 +49,7 @@ namespace pyrodactyl {
namespace text {
class TextManager {
// The collection of stored fonts
- // std::vector<TTF_Font *> font;
+ std::vector<Graphics::Font *> font;
// The size of the cache
int cache_size;
@@ -86,7 +86,7 @@ class TextManager {
ColorPool colpool;
// The rectangle used to store the darkened rectangle coordinates
- //SDL_Rect rect;
+ SDL_Rect rect;
int Search(const std::string &text, int col, FontKey fontid);
int FindFreeSlot();
@@ -102,8 +102,10 @@ public:
void Quit();
void Reset();
+
+ Graphics::Font *GetFont(const FontKey &fontid) { return font[fontid]; }
+ Graphics::ManagedSurface *RenderTextBlended(const FontKey &font, const std::string &text, const int &color);
#if 0
- TTF_Font *GetFont(const FontKey &fontid) { return font[fontid]; }
SDL_Surface *RenderTextBlended(const FontKey &font, const std::string &text, const int &color);
#endif
Commit: 8ffc3c475e58982bed259039c7dd54f833224bb3
https://github.com/scummvm/scummvm/commit/8ffc3c475e58982bed259039c7dd54f833224bb3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix/Unstub misc functions for ReplyMenu and ReplyButton
Changed paths:
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyMenu.cpp
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 149062131c5..941d331d9b6 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -43,9 +43,9 @@ void ReplyButton::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("text", node)) {
rapidxml::xml_node<char> *tenode = node->first_node("text");
- //LoadColor(col_b, tenode->first_node("col_b"));
- //LoadColor(col_s, tenode->first_node("col_s"));
- //LoadColor(col_h, tenode->first_node("col_h"));
+ LoadColor(col_b, tenode->first_node("col_b"));
+ LoadColor(col_s, tenode->first_node("col_s"));
+ LoadColor(col_h, tenode->first_node("col_h"));
LoadNum(font, "font", tenode);
LoadAlign(align, tenode);
@@ -66,14 +66,15 @@ void ReplyButton::Draw(const int &XOffset, const int &YOffset) {
}
void ReplyButton::Cache(const std::string &val, const int &spacing, const int &bottom_edge, Rect *parent) {
- warning("STUB: ReplyButton::Cache()");
-
-#if 0
text = val;
// Find out about the font
int width = 0, height = 0;
+#if 0
TTF_SizeText(gTextManager.GetFont(font), val.c_str(), &width, &height);
+#endif
+ width = gTextManager.GetFont(font)->getStringWidth(val.c_str());
+ height = gTextManager.GetFont(font)->getFontHeight();
// Find out how many line sizes will the text take
int lines = ((text.length() - 1) / line_size.x) + 1;
@@ -86,7 +87,6 @@ void ReplyButton::Cache(const std::string &val, const int &spacing, const int &b
if (orig.y < bottom_edge)
y = bottom_edge + spacing;
-#endif
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 09a8079d880..9c8aaa17886 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -146,9 +146,6 @@ void ReplyMenu::Draw() {
}
void ReplyMenu::Cache(Info &info, ConversationData &dat) {
- warning("STUB: ReplyMenu::Cache()");
-
-#if 0
// Some replies are locked, which means the other replies move up and take their place -
// which is why we need two count variables
unsigned int reply_count = 0, element_count = 0;
@@ -160,8 +157,9 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
tone.value.at(element_count) = dat.reply.at(reply_count).tone;
- std::string text = SDL_GetScancodeName(gInput.iv[IU_REPLY_0 + element_count].key);
- text += ". " + i->text;
+ //std::string text = SDL_GetScancodeName(gInput.iv[IU_REPLY_0 + element_count].key);
+ //text += ". " + i->text;
+ std::string text = i->text;
info.InsertName(text);
if (element_count == 0)
@@ -179,7 +177,6 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
// Unused element buttons are hidden
for (; element_count < element.size(); element_count++)
element.at(element_count).visible = false;
- #endif
}
void ReplyMenu::SetUI() {
Commit: d5958a818224746be2ccfdf50c948f24546b9437
https://github.com/scummvm/scummvm/commit/d5958a818224746be2ccfdf50c948f24546b9437
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix warnings due to narrowing in image.cpp
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 229fbf0c7bc..b5d997a1461 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -147,17 +147,17 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
if (clip != NULL) {
srcRect = *clip;
} else {
- srcRect = Common::Rect{x, y, w + x, h + y};
+ srcRect = Common::Rect{static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
}
- Common::Rect destRect {x, y, w + x, h + y};
+ Common::Rect destRect {static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
if (clip != NULL) {
destRect.right = clip->right;
destRect.bottom = clip->bottom;
}
// TODO: Do proper clipping
- g_engine->_screen->blitFrom(*texture, Common::Point(x, y));
+ g_engine->_screen->blitFrom(*texture, Common::Point(static_cast<int16>(x), static_cast<int16>(y)));
//g_engine->_renderSurface->blitFrom(*texture, Common::Point(x, y));
//g_engine->_renderSurface->copyRectToSurface(texture->getPixels(), texture->pitch, x, y, texture->w, texture->h);
#if 0
@@ -215,13 +215,13 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
}
void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip) {
- Common::Rect srcRect {0, 0, w + 0, h + 0};
- Common::Rect destRect {x, y, w + x, h + y};
+ Common::Rect srcRect {0, 0, static_cast<int16>(w + 0), static_cast<int16>(h + 0)};
+ Common::Rect destRect {static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
if (clip) {
- srcRect = {clip->x, clip->y, clip->x + clip->w, clip->y + clip->h};
- destRect.right = clip->w + x;
- destRect.bottom = clip->h + y;
+ srcRect = {static_cast<int16>(clip->x), static_cast<int16>(clip->y), static_cast<int16>(clip->x + clip->w), static_cast<int16>(clip->y + clip->h)};
+ destRect.right = static_cast<int16>(clip->w + x);
+ destRect.bottom = static_cast<int16>(clip->h + y);
}
Graphics::Surface *s = new Graphics::Surface();
Commit: dfccfc5e6647e1111efc5bf3f890a67dd1bebebe
https://github.com/scummvm/scummvm/commit/dfccfc5e6647e1111efc5bf3f890a67dd1bebebe
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Display fps on top left corner
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 17ad6b198dd..7e3a8ee898d 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -255,6 +255,15 @@ void App::Run() {
pyrodactyl::text::gTextManager.Draw(0, 0, NumberToString(fpsval), 0);
}
#endif
+ if (g_system->getMillis() - lasts > 1000) {
+ lasts = g_system->getMillis();
+ fpsval = fpscount;
+ fpscount = 1;
+ } else
+ ++fpscount;
+
+ if (CurrentStateID >= 0)
+ pyrodactyl::text::gTextManager.Draw(0, 0, NumberToString(fpsval).c_str(), 0);
//const Graphics::ManagedSurface *s = g_engine->_renderSurface;
//g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
g_engine->_screen->update();
Commit: a64187ae1c091ed4b4ecee9ac7dc61f149be1124
https://github.com/scummvm/scummvm/commit/a64187ae1c091ed4b4ecee9ac7dc61f149be1124
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cache tilesets and blit them using a faster method
Changed paths:
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/TMX/TileInfo.h
engines/crab/image/Image.cpp
engines/crab/image/Image.h
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 0d5b0bfee2d..3ebca079d59 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -55,6 +55,8 @@ void TileSet::Load(const std::string &path, rapidxml::xml_node<char> *node) {
img.Load(loc.c_str());
total_rows = img.H() / tile_h;
total_cols = img.W() / tile_w;
+ warning("Total rows : %d Total cols: %d gid: %d", total_rows, total_cols, first_gid);
+
}
}
@@ -84,7 +86,17 @@ void TileSet::Draw(const Vector2i &pos, const TileInfo &tile) {
clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
- img.Draw(pos.x, pos.y, &clip, tile.flip);
+ // Try to cache tiles
+ if (tiles.count(tile) > 0) {
+ tiles[tile].FastDraw(pos.x, pos.y);
+ } else if (tiles.count(tile) < 1) {
+ pyrodactyl::image::Image im;
+ im.Load(img, &clip, tile.flip);
+ im.FastDraw(pos.x, pos.y);
+ tiles[tile] = im;
+ }
+
+ //img.FastDraw(pos.x, pos.y, &clip, tile.flip);
/*if(tile.flip != FLIP_NONE && GameDebug)
pyrodactyl::text::gTextManager.Draw(pos.x,pos.y,NumberToString(tile.flip),0);*/
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 25a9e81482f..a6c71ebbeae 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -57,6 +57,17 @@ struct TileSet {
// The image used by the tileset
pyrodactyl::image::Image img;
+ struct MyHash {
+ std::size_t operator()(const TileInfo& s) const {
+ std::size_t h1 = std::hash<int>{}(s.gid);
+ std::size_t h2 = std::hash<int>{}(s.flip);
+ return h1 ^ (h2 << 1);
+ }
+ };
+
+ // Vector to hold textures for individual tiles in the tileset
+ std::unordered_map<TileInfo, pyrodactyl::image::Image, MyHash> tiles;
+
// Stuff used to store temporary data
// The rectangle used to store clip info
@@ -68,6 +79,7 @@ struct TileSet {
tile_h = 1;
total_rows = 1;
total_cols = 1;
+ tiles.clear();
}
TileSet() { Init(); }
diff --git a/engines/crab/TMX/TileInfo.h b/engines/crab/TMX/TileInfo.h
index 92df34933ce..cb573ab00d5 100644
--- a/engines/crab/TMX/TileInfo.h
+++ b/engines/crab/TMX/TileInfo.h
@@ -55,6 +55,7 @@ struct TileInfo {
gid = 0;
flip = FLIP_NONE;
}
+
TileInfo(rapidxml::xml_node<char> *node) {
// Load the gid of the tile
if (!LoadNum(gid, "gid", node))
@@ -88,6 +89,10 @@ struct TileInfo {
// Clear the flags
gid &= ~(FlippedHorizontallyFlag | FlippedVerticallyFlag | FlippedAntiDiagonallyFlag);
}
+
+ bool operator==(const TileInfo& other) const {
+ return (gid == other.gid) && (flip == other.flip);
+ }
};
} // End of namespace TMX
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index b5d997a1461..218e7af8461 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -29,6 +29,7 @@
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "graphics/blit.h"
#include "crab/crab.h"
#include "crab/image/Image.h"
#include "image/png.h"
@@ -94,7 +95,8 @@ bool Image::Load(const Common::String &path) {
ImageDecoder decoder;
if (FileOpen(path, &file) && decoder.loadStream(file)) {
- texture = new Graphics::ManagedSurface(decoder.getSurface());
+ texture = new Graphics::ManagedSurface(decoder.getSurface()->w, decoder.getSurface()->h, *g_engine->_format);
+ texture->blitFrom(decoder.getSurface());
w = texture->w;
h = texture->h;
@@ -138,6 +140,35 @@ bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
return false;
}
+bool Image::Load(const Image &image, Rect *clip, const TextureFlipType &flip) {
+ Delete();
+
+ Common::Rect srcRect {0, 0, static_cast<int16>(w + 0), static_cast<int16>(h + 0)};
+
+ if (clip)
+ srcRect = {static_cast<int16>(clip->x), static_cast<int16>(clip->y), static_cast<int16>(clip->x + clip->w), static_cast<int16>(clip->y + clip->h)};
+
+ texture = new Graphics::ManagedSurface();
+ texture->copyFrom(image.texture->getSubArea(srcRect));
+
+ switch(flip) {
+ case FLIP_NONE:
+ break;
+
+ case FLIP_X:
+ texture->surfacePtr()->flipHorizontal(Common::Rect(texture->w, texture->h));
+ break;
+
+ default:
+ warning("Flipped texture: %d", flip);
+ }
+
+ w = texture->w;
+ h = texture->h;
+
+ return true;
+}
+
//------------------------------------------------------------------------
// Purpose: Draw a texture to the screen without cropping
//------------------------------------------------------------------------
@@ -243,6 +274,64 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
//g_engine->_renderSurface->blitFrom(s, Common::Rect(s->w, s->h), destRect);
}
+void Image::FastDraw(const int &x, const int &y) {
+ Common::Rect destRect {static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
+ int in_y = 0, in_x = 0;
+
+ // Handle off-screen clipping
+ if (destRect.top < 0) {
+ destRect.top = 0;
+ in_y += -y;
+ }
+
+ if (destRect.left < 0) {
+ destRect.left = 0;
+ in_x += -x;
+ }
+
+ if (destRect.bottom > 720) {
+ //in_y += destRect.bottom - 720;
+ destRect.bottom = 720;
+ }
+
+ if (destRect.right > 1280) {
+ //in_x += destRect.right - 1280;
+ destRect.right = 1280;
+ }
+
+
+ uint8 a, g, b, r;
+
+ const int he = destRect.height();
+ const int destW = destRect.width();
+ uint32 *out = (uint32*)g_engine->_screen->getBasePtr(destRect.left, destRect.top);
+ uint32 *in = (uint32*)texture->getBasePtr(in_x, in_y);
+
+ const uint32 outPitch = g_engine->_screen->pitch / sizeof(uint32);
+ const uint32 inPitch = texture->pitch / sizeof(uint32);
+
+ //if (*in & 0xff == 0) {
+ // return;
+ //}
+
+ for (int y = 0; y < he; y++) {
+ uint32 *out1 = out;
+ uint32 *in1 = in;
+ for (int x = 0; x < destW; x++, out1++, in1++) {
+ if (*in1 & 0xff) {
+ *(out1) = *(in1);
+ }
+ }
+ out += outPitch;
+ in += inPitch;
+ //memcpy(out, in, destRect.width() * 4);
+ }
+
+ //g_engine->_screen->blitFrom(*texture, Common::Rect(in_x, in_y, in_x + destRect.width(), he + in_y), destRect);
+ g_engine->_screen->addDirtyRect(destRect);
+}
+
+
//------------------------------------------------------------------------
// Purpose: Delete texture data
//------------------------------------------------------------------------
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index ceaece8d571..0256bceba20 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -45,6 +45,8 @@ namespace image {
class Image {
// The dimensions of the image
int w, h;
+ int id;
+ TextureFlipType _flip;
// The actual hardware texture
//SDL_Texture *texture;
@@ -90,10 +92,13 @@ public:
bool Load(rapidxml::xml_node<char> *node, const char *name);
bool Load(Graphics::Surface *surface);
bool Load(Graphics::ManagedSurface *surface);
+ bool Load(const Image &image, Rect *clip, const TextureFlipType &flip);
+
// Draw the openGL texture
void Draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
void Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE);
+ void FastDraw(const int &x, const int &y);
// Delete the openGL texture
void Delete();
Commit: 80853afd903c84bb8adde2c9699f262abbcd545a
https://github.com/scummvm/scummvm/commit/80853afd903c84bb8adde2c9699f262abbcd545a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add const to operator overloads
Changed paths:
engines/crab/vectors.h
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index 4af5ce3c66a..93a4bd8b72b 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -81,8 +81,8 @@ public:
x -= v.x;
y -= v.y;
}
- bool operator==(const Vector2D &v) { return x == v.x && y == v.y; }
- bool operator!=(const Vector2D &v) { return x != v.x || y != v.y; }
+ bool operator==(const Vector2D &v) const { return x == v.x && y == v.y; }
+ bool operator!=(const Vector2D &v) const { return x != v.x || y != v.y; }
friend Vector2D operator-(const Vector2D &v1, const Vector2D &v2) {
return Vector2D(v1.x - v2.x, v1.y - v2.y);
}
Commit: 3191745328ab6b7cb96e48ff7ec95525f9c0ac6f
https://github.com/scummvm/scummvm/commit/3191745328ab6b7cb96e48ff7ec95525f9c0ac6f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove stub warning in HUD::Draw()
Changed paths:
engines/crab/ui/hud.cpp
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index dbc62ec287c..eb67fa01393 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -84,8 +84,6 @@ void HUD::Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, p
}
void HUD::Draw(pyrodactyl::event::Info &info, const std::string &id) {
- warning("STUB: HUD::Draw()");
-
bg.Draw();
menu.Draw();
Commit: 2b64108f562651b236ca8901fb1a3832fa913657
https://github.com/scummvm/scummvm/commit/2b64108f562651b236ca8901fb1a3832fa913657
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use CursorManager
Changed paths:
engines/crab/common_header.h
engines/crab/crab.cpp
engines/crab/input/cursor.cpp
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 63ac0cf5f32..e51558dc3b8 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -64,6 +64,9 @@
#include "graphics/surface.h"
#include "graphics/managed_surface.h"
+#include "graphics/cursor.h"
+#include "graphics/wincursor.h"
+#include "graphics/cursorman.h"
#include "graphics/font.h"
#include "graphics/fonts/ttf.h"
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 25b8ecbee2b..97ef50e1993 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -91,6 +91,12 @@ Common::Error CrabEngine::run() {
_renderSurface = new Graphics::ManagedSurface(1920, 1080, *_format);
_screen = new Graphics::Screen(1280, 720, *_format);
+ Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
+ CursorMan.replaceCursor(cursor);
+ delete cursor;
+
+ CursorMan.showMouse(true);
+
// Set the engine's debugger console
setDebugger(new Console());
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 8f2630e80d5..d042a396498 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -125,6 +125,7 @@ void Cursor::HandleEvents(const Common::Event &event) {
// Purpose: Draw
//------------------------------------------------------------------------
void Cursor::Draw() {
+/*
//warning("Drawing cursor: %d %d", motion.x, motion.y);
if (hover) {
if (pressed)
@@ -137,6 +138,7 @@ void Cursor::Draw() {
else
img.Draw(motion.x, motion.y);
}
+*/
}
} // End of namespace Crab
Commit: 194c5bb646be933b44ccea5c34ad00da69ebc923
https://github.com/scummvm/scummvm/commit/194c5bb646be933b44ccea5c34ad00da69ebc923
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add a extend method to Rectangle class
Changed paths:
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 1edef77d737..2e4993e4a0e 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -50,6 +50,28 @@ bool Rect::Collide(Rect box) {
return true; // bounding boxes intersect
}
+void Rect::Extend(Rect box) {
+ int left1 = x;
+ int right1 = x + w;
+ int top1 = y;
+ int bottom1 = y + h;
+
+ const int left2 = box.x;
+ const int right2 = box.x + box.w;
+ const int top2 = box.y;
+ const int bottom2 = box.y + box.h;
+
+ left1 = MIN(left1, left2);
+ right1 = MAX(right1, right2);
+ top1 = MIN(top1, top2);
+ bottom1 = MAX(bottom1, bottom2);
+
+ x = left1;
+ y = top1;
+ w = right1 - left1;
+ h = bottom1 - top1;
+}
+
Direction Rect::ResolveX(Rect collider) {
// Check left edge of collider
if (x < collider.x && collider.x < x + w)
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index 8938560f101..c8659534814 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -62,6 +62,9 @@ public:
// Is this rectangle colliding with another rectangle?
bool Collide(Rect box);
+ // Extend this rectangle to fully contain another rectangle
+ void Extend(Rect box);
+
// Resolving a collision means we need to correct the position of the target rectangle to just outside of the reference rectangle
// To do this, first we need to determine which edges of the rectangles are colliding
Commit: 3093ffa55235912174c2b29df4c6cd4b4c6fb20e
https://github.com/scummvm/scummvm/commit/3093ffa55235912174c2b29df4c6cd4b4c6fb20e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Pre-render level and certain objects
Changed paths:
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/game.cpp
engines/crab/image/Image.cpp
engines/crab/image/Image.h
engines/crab/level/level.h
engines/crab/level/level_draw.cpp
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index 6b92564b104..1e8884774a8 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -93,6 +93,8 @@ public:
// This is also the collision rectangle of the prop and auto hide layer
Rect pos;
+ Common::List<Rect> boundRect;
+
// The rate of scrolling of image, used for parallax
Vector2f rate;
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 3ebca079d59..b58139656f0 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -29,6 +29,7 @@
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/TMX/TMXTileSet.h"
#include "crab/text/TextManager.h"
@@ -86,24 +87,97 @@ void TileSet::Draw(const Vector2i &pos, const TileInfo &tile) {
clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
- // Try to cache tiles
- if (tiles.count(tile) > 0) {
- tiles[tile].FastDraw(pos.x, pos.y);
- } else if (tiles.count(tile) < 1) {
- pyrodactyl::image::Image im;
- im.Load(img, &clip, tile.flip);
- im.FastDraw(pos.x, pos.y);
- tiles[tile] = im;
+ img.Draw(pos.x, pos.y, &clip, tile.flip);
+ }
+}
+
+void TileSet::PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf) {
+ if (tile.gid != 0) {
+ clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
+ clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
+
+ img.Draw(pos.x, pos.y, &clip, tile.flip, surf);
+ }
+}
+
+void TileSetGroup::PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf) {
+ start.x = 0;
+ start.y = 0;
+
+ finish.x = layer.tile.size() - 1;
+ finish.y = layer.tile.at(0).size() - 1;
+
+ v.x = start.y * tile_size.x;
+ v.y = start.x * tile_size.y;
+
+ for (int x = start.x; x < finish.x; ++x) {
+ for (int y = start.y; y < finish.y; ++y) {
+ for (int i = tileset.size() - 1; i >= 0; --i)
+ if (layer.tile[x][y].gid >= tileset[i].first_gid) {
+ tileset[i].PreDraw(v, layer.tile[x][y], surf);
+ layer.boundRect.push_back(Rect(v.x, v.y, tile_size.x, tile_size.y));
+ break;
+ }
+
+ v.x += tile_size.x;
+ }
+
+ v.x = start.y * tile_size.x;
+ v.y += tile_size.y;
+ }
+
+ Common::List<Rect>::iterator rOuter, rInner;
+
+ // Process the bound rect list to find any rects to merge
+ for (rOuter = layer.boundRect.begin(); rOuter != layer.boundRect.end(); ++rOuter) {
+ rInner = rOuter;
+ while (++rInner != layer.boundRect.end()) {
+ if ((*rOuter).Collide(*rInner)) {
+ rOuter->Extend(*rInner);
+ layer.boundRect.erase(rInner);
+ rInner = rOuter;
+ }
}
+ }
+}
+
+void TileSetGroup::ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos) {
+ layer.collide = layer.pos.Collide(player_pos);
+
+ // Normal and prop layers are drawn this way
+ // The row and column we start drawing at
+ start.x = player_pos.y / tile_size.y;
+ start.y = player_pos.x / tile_size.x;
- //img.FastDraw(pos.x, pos.y, &clip, tile.flip);
+ // The row and column we end drawing at
+ finish.x = (player_pos.y + player_pos.h) / tile_size.y + 1;
+ finish.y = (player_pos.x + player_pos.w) / tile_size.x + 1;
- /*if(tile.flip != FLIP_NONE && GameDebug)
- pyrodactyl::text::gTextManager.Draw(pos.x,pos.y,NumberToString(tile.flip),0);*/
+ if (finish.x > layer.tile.size())
+ finish.x = layer.tile.size();
+ if (finish.y > layer.tile[0].size())
+ finish.y = layer.tile.at(0).size();
+
+ v.x = start.y * tile_size.x - camera.x;
+ v.y = start.x * tile_size.y - camera.y;
+
+ for (int x = start.x; x < finish.x; ++x) {
+ for (int y = start.y; y < finish.y; ++y) {
+ for (int i = tileset.size() - 1; i >= 0; --i)
+ if (layer.tile[x][y].gid >= tileset[i].first_gid) {
+ tileset[i].Draw(v, layer.tile[x][y]);
+ break;
+ }
+
+ v.x += tile_size.x;
+ }
+
+ v.x = start.y * tile_size.x - camera.x;
+ v.y += tile_size.y;
}
}
-void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos) {
+void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img) {
if (layer.type == LAYER_IMAGE)
layer.img.Draw(-1.0f * camera.x * layer.rate.x, -1.0f * camera.y * layer.rate.y);
else if (layer.type == LAYER_PARALLAX) {
@@ -158,23 +232,16 @@ void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &til
if (finish.y > layer.tile[0].size())
finish.y = layer.tile.at(0).size();
- v.x = start.y * tile_size.x - camera.x;
- v.y = start.x * tile_size.y - camera.y;
+ v.x = camera.x;
+ v.y = camera.y;
- for (int x = start.x; x < finish.x; ++x) {
- for (int y = start.y; y < finish.y; ++y) {
- for (int i = tileset.size() - 1; i >= 0; --i)
- if (layer.tile[x][y].gid >= tileset[i].first_gid) {
- tileset[i].Draw(v, layer.tile[x][y]);
- break;
- }
+ Vector2i end;
- v.x += tile_size.x;
- }
+ end.x = camera.x + g_engine->_screen->w;
+ end.y = camera.y + g_engine->_screen->h;
- v.x = start.y * tile_size.x - camera.x;
- v.y += tile_size.y;
- }
+ Rect clip(v.x, v.y, end.x - v.x, end.y - v.y);
+ img.FastDraw(0, 0, &clip);
}
}
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index a6c71ebbeae..693dcca2624 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -90,6 +90,7 @@ struct TileSet {
void Load(const std::string &path, rapidxml::xml_node<char> *node);
void Draw(const Vector2i &pos, const TileInfo &tile);
+ void PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf);
};
class TileSetGroup {
@@ -107,7 +108,9 @@ public:
void Reset();
void Load(const std::string &path, rapidxml::xml_node<char> *node);
- void Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
+ void Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img);
+ void PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf);
+ void ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
};
}; // End of namespace TMX
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index f4e3f3f0cb1..82ec9b997d3 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -144,6 +144,8 @@ bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
// Initialize journal
info.journal.Init(level.PlayerID());
+
+ level.PreDraw();
return true;
}
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 218e7af8461..73f4f7cdabd 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -245,7 +245,10 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
}
-void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip) {
+void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip, Graphics::ManagedSurface *surf) {
+ if (surf == NULL)
+ surf = g_engine->_screen;
+
Common::Rect srcRect {0, 0, static_cast<int16>(w + 0), static_cast<int16>(h + 0)};
Common::Rect destRect {static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
@@ -270,38 +273,21 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
warning("Flipped texture: %d", flip);
}
- g_engine->_screen->blitFrom(s, Common::Rect(s->w, s->h), destRect);
+ surf->blitFrom(s, Common::Rect(s->w, s->h), destRect);
//g_engine->_renderSurface->blitFrom(s, Common::Rect(s->w, s->h), destRect);
}
-void Image::FastDraw(const int &x, const int &y) {
+void Image::FastDraw(const int &x, const int &y, Rect *clip) {
Common::Rect destRect {static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
int in_y = 0, in_x = 0;
- // Handle off-screen clipping
- if (destRect.top < 0) {
- destRect.top = 0;
- in_y += -y;
- }
-
- if (destRect.left < 0) {
- destRect.left = 0;
- in_x += -x;
- }
-
- if (destRect.bottom > 720) {
- //in_y += destRect.bottom - 720;
- destRect.bottom = 720;
- }
-
- if (destRect.right > 1280) {
- //in_x += destRect.right - 1280;
- destRect.right = 1280;
+ if (clip) {
+ destRect.setWidth(clip->w);
+ destRect.setHeight(clip->h);
+ in_x = clip->x;
+ in_y = clip->y;
}
-
- uint8 a, g, b, r;
-
const int he = destRect.height();
const int destW = destRect.width();
uint32 *out = (uint32*)g_engine->_screen->getBasePtr(destRect.left, destRect.top);
@@ -310,24 +296,12 @@ void Image::FastDraw(const int &x, const int &y) {
const uint32 outPitch = g_engine->_screen->pitch / sizeof(uint32);
const uint32 inPitch = texture->pitch / sizeof(uint32);
- //if (*in & 0xff == 0) {
- // return;
- //}
-
for (int y = 0; y < he; y++) {
- uint32 *out1 = out;
- uint32 *in1 = in;
- for (int x = 0; x < destW; x++, out1++, in1++) {
- if (*in1 & 0xff) {
- *(out1) = *(in1);
- }
- }
+ memcpy(out, in, destW * 4);
out += outPitch;
in += inPitch;
- //memcpy(out, in, destRect.width() * 4);
}
- //g_engine->_screen->blitFrom(*texture, Common::Rect(in_x, in_y, in_x + destRect.width(), he + in_y), destRect);
g_engine->_screen->addDirtyRect(destRect);
}
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 0256bceba20..13e86cd14c3 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -50,9 +50,10 @@ class Image {
// The actual hardware texture
//SDL_Texture *texture;
- Graphics::ManagedSurface *texture;
public:
+ Graphics::ManagedSurface *texture;
+
Image() : texture(nullptr), w(0), h(0) {}
~Image() {}
@@ -97,8 +98,8 @@ public:
// Draw the openGL texture
void Draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
- void Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE);
- void FastDraw(const int &x, const int &y);
+ void Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE, Graphics::ManagedSurface *surf = NULL);
+ void FastDraw(const int &x, const int &y, Rect *clip = NULL);
// Delete the openGL texture
void Delete();
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 465ef8d11b3..0a7fb2bad7f 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -140,6 +140,9 @@ public:
// The path of the preview image
std::string preview_path;
+ // A full rendered image of the level
+ pyrodactyl::image::Image img;
+
Level() { Reset(); }
~Level() {}
@@ -193,6 +196,8 @@ public:
LevelResult InternalEvents(pyrodactyl::event::Info &info, std::vector<pyrodactyl::event::EventResult> &result,
std::vector<pyrodactyl::event::EventSeqInfo> &end_seq, bool EventInProgress);
+ void PreDraw();
+ void PreDrawObjects(Graphics::ManagedSurface *surf);
void Draw(pyrodactyl::event::Info &info);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index d89a58063cc..da34224a1eb 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -41,6 +41,26 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
using namespace pyrodactyl::input;
+
+// Purpose: Pre render the terrain layer
+void Level::PreDraw() {
+ Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(terrain.W(), terrain.H(), *g_engine->_format);
+ unsigned int layer_count = 0u;
+ for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
+ gImageManager.tileset.PreDraw(*l, terrain.tile_size, surf);
+
+ // Draw the normal sprites if this is the layer for it
+ if (layer_count == terrain.sprite_layer)
+ PreDrawObjects(surf);
+ }
+
+ // This is to ensure we don't miss out on drawing sprites
+ if (layer_count <= terrain.sprite_layer)
+ PreDrawObjects(surf);
+
+ img.Load(surf);
+}
+
//------------------------------------------------------------------------
// Purpose: Draw the level
//------------------------------------------------------------------------
@@ -52,7 +72,15 @@ void Level::Draw(pyrodactyl::event::Info &info) {
auto b = background.begin();
unsigned int layer_count = 0u;
+
+ // Draw the terrain layer
+ gImageManager.tileset.Draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].PosRect(), img);
+
+ Vector2i pos = objects[player_index].ai_data.dest;
+ Rect newpos(pos.x - (dest_marker.size.x/2), pos.y - (dest_marker.size.y/2), dest_marker.size.x, dest_marker.size.y);
+
for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
+
// Draw the background sprites
for (; b != background.end(); ++b) {
if (b->layer > layer_count) // We don't have any sprites to draw at this layer
@@ -66,7 +94,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
DrawObjects(info);
// Draw the terrain layer
- gImageManager.tileset.Draw(*l, camera, terrain.tile_size, objects[player_index].PosRect());
+ gImageManager.tileset.ForceDraw(*l, camera, terrain.tile_size, objects[player_index].PosRect());
}
// Draw the background sprites
@@ -116,6 +144,9 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
if (objects[player_index].ai_data.dest.active)
dest_marker.Draw(objects[player_index].ai_data.dest, camera);
+ Vector2i pos = objects[player_index].ai_data.dest;
+ Rect newpos(pos.x - (dest_marker.size.x/2), pos.y - (dest_marker.size.y/2), dest_marker.size.x, dest_marker.size.y);
+
if (terrain.prop.empty()) {
for (auto &entry : obj_seq) {
if (entry.second->Visible() && LayerVisible(entry.second))
@@ -128,7 +159,16 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
while (a != terrain.prop.end() && b != obj_seq.end()) {
auto obj = b->second;
if (a->pos.y + a->pos.h < obj->Y() + obj->H()) {
- gImageManager.tileset.Draw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
+ for (auto &i : a->boundRect) {
+ i.Draw(-camera.x, -camera.y, 128, 128, 0, 256);
+ if (i.Collide(objects[player_index].PosRect())) {
+ gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
+ }
+
+ if (i.Contains(objects[player_index].ai_data.dest)) {
+ gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
+ }
+ }
++a;
} else {
if (obj->Visible() && LayerVisible(obj))
@@ -143,9 +183,44 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
if (obj->Visible() && LayerVisible(obj))
obj->Draw(info, camera);
}
+ } else if (b == obj_seq.end()) {
+ for (; a != terrain.prop.end(); ++a) {
+ for (auto &i : a->boundRect) {
+ i.Draw(-camera.x, -camera.y, 128, 128, 0, 256);
+ if (i.Collide(objects[player_index].PosRect())) {
+ gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
+ }
+
+ if (i.Contains(objects[player_index].ai_data.dest)) {
+ gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
+ }
+ }
+ }
+ }
+ }
+}
+
+void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
+ if (terrain.prop.empty()) {
+ return;
+ } else {
+ auto a = terrain.prop.begin();
+ auto b = obj_seq.begin();
+
+ while (a != terrain.prop.end() && b != obj_seq.end()) {
+ auto obj = b->second;
+ if (a->pos.y + a->pos.h < obj->Y() + obj->H()) {
+ gImageManager.tileset.PreDraw(*a, terrain.tile_size, surf);
+ ++a;
+ } else {
+ ++b;
+ }
+ }
+
+ if (a == terrain.prop.end()) {
} else if (b == obj_seq.end()) {
for (; a != terrain.prop.end(); ++a)
- gImageManager.tileset.Draw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
+ gImageManager.tileset.PreDraw(*a, terrain.tile_size, surf);
}
}
}
Commit: 5610a0cf7940c2bdc0e3d963658d80c85ef93c3a
https://github.com/scummvm/scummvm/commit/5610a0cf7940c2bdc0e3d963658d80c85ef93c3a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the animation component
Changed paths:
engines/crab/animation/PopUp.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fightmoves.h
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 87eeb6e7e5c..dd460dbf5ed 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -93,9 +93,9 @@ bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const std::string &pla
void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
- if (cur >= 0 && cur < element.size()) {
+ if (cur >= 0 && (unsigned int)cur < element.size()) {
if (element.at(cur).InternalEvents(info, player_id, result, end_seq)) {
- if (element.at(cur).next <= 0 || element.at(cur).next >= element.size()) {
+ if (element.at(cur).next <= 0 || (unsigned int)element.at(cur).next >= element.size()) {
// This means that this popup is the "end" node, we must loop back to start or end this
if (loop) {
cur = 0;
@@ -125,7 +125,7 @@ void PopUp::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop,
}
void PopUpCollection::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
- if (cur >= 0 && cur < element.size())
+ if (cur >= 0 && (unsigned int)cur < element.size())
element.at(cur).Draw(x, y, pop, camera);
}
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 5896a318913..519fc514603 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -64,7 +64,7 @@ void FightMoves::Load(rapidxml::xml_node<char> *node) {
// Purpose: Return current or next move
//------------------------------------------------------------------------
bool FightMoves::CurMove(FightMove &fm) {
- if (cur >= 0 && cur < move.size()) {
+ if (cur >= 0 && (unsigned int)cur < move.size()) {
fm = move.at(cur);
return true;
}
@@ -73,7 +73,7 @@ bool FightMoves::CurMove(FightMove &fm) {
}
bool FightMoves::NextMove(FightMove &fm) {
- if (next >= 0 && next < move.size()) {
+ if (next >= 0 && (unsigned int)next < move.size()) {
fm = move.at(next);
return true;
}
@@ -86,7 +86,7 @@ bool FightMoves::NextMove(FightMove &fm) {
//------------------------------------------------------------------------
bool FightMoves::CurFrame(FightAnimFrame &faf, const Direction &d) {
// Check validity of current move
- if (cur >= 0 && cur < move.size()) {
+ if (cur >= 0 && (unsigned int)cur < move.size()) {
// Check validity of current frame
if (frame_cur < frame_total && frame_cur < move.at(cur).frames[d].frame.size()) {
faf = move.at(cur).frames[d].frame.at(frame_cur);
@@ -102,7 +102,7 @@ bool FightMoves::CurFrame(FightAnimFrame &faf, const Direction &d) {
//------------------------------------------------------------------------
FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
// Check validity of current move
- if (cur >= 0 && cur < move.size()) {
+ if (cur >= 0 && (unsigned int)cur < move.size()) {
// Check validity of current frame
if (frame_cur < frame_total && frame_cur < move.at(cur).frames[d].frame.size()) {
// Has the current frame finished playing?
@@ -127,7 +127,7 @@ FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
unsigned int FightMoves::FindMove(const pyrodactyl::input::FightAnimationType &type, const int &state) {
unsigned int pos = 0;
for (auto i = move.begin(); i != move.end(); ++i, ++pos)
- if (i->input.type == type && i->input.state == state)
+ if (i->input.type == type && i->input.state == (unsigned int)state)
return pos;
pos = 0;
@@ -156,7 +156,7 @@ bool FightMoves::ForceUpdate(const unsigned int &index, pyrodactyl::input::Fight
frame_cur = 0;
cur = index;
- if (cur < move.size()) {
+ if ((unsigned int)cur < move.size()) {
if (move[cur].unlock.Result()) {
frame_total = move[cur].frames[d].frame.size();
if (frame_total > 0) {
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index e997d443032..7326501432f 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -90,7 +90,7 @@ public:
void CurCombo(pyrodactyl::input::FightInput &input) { input = move[cur].input; }
- bool ValidMove() { return cur >= 0 && cur < move.size(); }
+ bool ValidMove() { return cur >= 0 && (unsigned int)cur < move.size(); }
bool Empty() { return move.empty(); }
bool Flip(TextureFlipType &flip, Direction d);
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index f0231ae64fc..8b0ad63f4b6 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -265,9 +265,9 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
if (GameDebug) {
// Nice boxes for the frames and box_v, box_d
- Rect bounds = BoundRect(), vul = BoxV(), dmg = BoxD(), pos = PosRect();
+ Rect bounds = BoundRect(), vul = BoxV(), dmg = BoxD(), debugpos = PosRect();
bounds.Draw(-camera.x, -camera.y);
- pos.Draw(-camera.x, -camera.y, 255, 255, 255);
+ debugpos.Draw(-camera.x, -camera.y, 255, 255, 255);
dmg.Draw(-camera.x, -camera.y, 255, 0, 0);
vul.Draw(-camera.x, -camera.y, 0, 0, 255);
Commit: ff87d6818f9ad6c1e46d98af4f3e158b03595e3b
https://github.com/scummvm/scummvm/commit/ff87d6818f9ad6c1e46d98af4f3e158b03595e3b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the event component
Changed paths:
engines/crab/event/GameEventInfo.cpp
engines/crab/event/effect.cpp
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 56f7073746f..49b1e0ce3ec 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -184,7 +184,7 @@ void Info::VarDel(const std::string &name) {
void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
if (PersonValid(per_id)) // Valid person id
{
- if (trait_id >= 0 && trait_id < gEventStore.trait.size()) // Valid trait id
+ if (trait_id >= 0 && (unsigned int)trait_id < gEventStore.trait.size()) // Valid trait id
{
// Check for duplicate traits, DONT award anything if duplicate found
Person *p = &PersonGet(per_id);
@@ -203,7 +203,7 @@ void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
void Info::TraitDel(const std::string &per_id, const int &trait_id) {
if (PersonValid(per_id)) // Valid person id
{
- if (trait_id > 0 && trait_id < gEventStore.trait.size()) // Valid trait id
+ if (trait_id > 0 && (unsigned int)trait_id < gEventStore.trait.size()) // Valid trait id
{
Person *p = &PersonGet(per_id);
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 3bdf79eda1c..e5ce2d5f695 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -105,20 +105,20 @@ void Effect::Load(rapidxml::xml_node<char> *node) {
LoadStr(val, "val", node, echo_val);
}
-void Effect::ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType type) {
+void Effect::ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType opType) {
int old_op = 0;
// Only bother if the person exists and has a valid opinion
- if (info.OpinionGet(subject, type, old_op)) {
+ if (info.OpinionGet(subject, opType, old_op)) {
if (operation == "=")
- info.OpinionSet(subject, type, StringToNumber<int>(val));
+ info.OpinionSet(subject, opType, StringToNumber<int>(val));
else if (operation == "+")
- info.OpinionChange(subject, type, StringToNumber<int>(val));
+ info.OpinionChange(subject, opType, StringToNumber<int>(val));
else if (operation == "-")
- info.OpinionChange(subject, type, -1 * StringToNumber<int>(val));
+ info.OpinionChange(subject, opType, -1 * StringToNumber<int>(val));
int new_op = 0;
- info.OpinionGet(subject, type, new_op);
+ info.OpinionGet(subject, opType, new_op);
if (new_op > old_op)
info.sound.rep_inc = true;
Commit: 12ae56bac414d9f49097e7d06435f959befeb6f2
https://github.com/scummvm/scummvm/commit/12ae56bac414d9f49097e7d06435f959befeb6f2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the image component
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 73f4f7cdabd..261fdec6d15 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -296,7 +296,7 @@ void Image::FastDraw(const int &x, const int &y, Rect *clip) {
const uint32 outPitch = g_engine->_screen->pitch / sizeof(uint32);
const uint32 inPitch = texture->pitch / sizeof(uint32);
- for (int y = 0; y < he; y++) {
+ for (int y_ = 0; y_ < he; y_++) {
memcpy(out, in, destW * 4);
out += outPitch;
in += inPitch;
Commit: 3314b58a05c450b4eff1bec3abdc641d61bf7513
https://github.com/scummvm/scummvm/commit/3314b58a05c450b4eff1bec3abdc641d61bf7513
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the item component
Changed paths:
engines/crab/item/ItemMenu.cpp
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index aa0b61b0db8..89930626b35 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -77,7 +77,7 @@ void ItemMenu::HandleEvents(const Common::Event &Event, const int &XOffset, cons
if (result != -1) {
select_index = result;
for (unsigned int i = 0; i < element.size(); ++i)
- element.at(i).State(i == select_index);
+ element.at(i).State(i == (unsigned int)select_index);
}
}
Commit: dc0b649049c28d56f97c79af28dd070b54e54dc9
https://github.com/scummvm/scummvm/commit/dc0b649049c28d56f97c79af28dd070b54e54dc9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the level component
Changed paths:
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index fca70038357..618bc78d8ae 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -87,7 +87,7 @@ LevelResult Level::InternalEvents(Info &info, std::vector<EventResult> &result,
//------------------------------------------------------------------------
void Level::Think(Info &info, std::vector<EventResult> &result,
std::vector<EventSeqInfo> &end_seq, std::string &id) {
- int index = 0;
+ unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
// Only bother if the sprite is visible
if (i->Visible()) {
@@ -139,7 +139,7 @@ void Level::Think(Info &info, std::vector<EventResult> &result,
objects[player_index].ExchangeDamage(info, *i, sc_default);
} else {
// For the player sprite
- Rect boundRect = i->BoundRect();
+ boundRect = i->BoundRect();
i->pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
i->pathing.Update(0);
@@ -171,7 +171,7 @@ void Level::Think(Info &info, std::vector<EventResult> &result,
// Purpose: Once a player provokes any sprite, call this function
//------------------------------------------------------------------------
void Level::BattleAlert(Info &info) {
- int index = 0;
+ unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
if (index != player_index && i->Visible() && info.State(i->ID()) != PST_KO) {
switch (info.Type(i->ID())) {
@@ -209,7 +209,7 @@ void Level::MoveObject(Info &info, pyrodactyl::anim::Sprite &s) {
// Purpose: If any other object is trying to kill you, you are in combat
//------------------------------------------------------------------------
bool Level::PlayerInCombat(Info &info) {
- int index = 0;
+ unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index)
if (index != player_index && info.State(i->ID()) == PST_FIGHT && i->Visible())
return true;
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 911d3df0b41..a6181bcbacf 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -123,7 +123,7 @@ bool Level::LayerVisible(Sprite *obj) {
if (obj->layer < 0)
return true;
- if (obj->layer < terrain.layer.size())
+ if ((unsigned int)obj->layer < terrain.layer.size())
return terrain.layer.at(obj->layer).collide;
return false;
@@ -147,7 +147,7 @@ bool Level::CollidingWithObject(Info &info, std::string &id) {
// Clip and Bounding rectangle of player
Rect p_pos = objects[player_index].PosRect(), p_bound = objects[player_index].BoundRect();
- int index = 0;
+ unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
if (i->Visible() && player_index != index && info.State(i->ID()) == PST_NORMAL) {
// Clip and bounding rectangles for the NPC sprite
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index da34224a1eb..af4296dc4c3 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -83,9 +83,9 @@ void Level::Draw(pyrodactyl::event::Info &info) {
// Draw the background sprites
for (; b != background.end(); ++b) {
- if (b->layer > layer_count) // We don't have any sprites to draw at this layer
+ if ((unsigned int)b->layer > layer_count) // We don't have any sprites to draw at this layer
break;
- else if (b->layer == layer_count && b->Visible())
+ else if ((unsigned int)b->layer == layer_count && b->Visible())
b->Draw(info, camera);
}
@@ -99,9 +99,9 @@ void Level::Draw(pyrodactyl::event::Info &info) {
// Draw the background sprites
for (; b != background.end(); ++b) {
- if (b->layer > layer_count) // We don't have any sprites to draw at this layer
+ if ((unsigned int)b->layer > layer_count) // We don't have any sprites to draw at this layer
break;
- else if (b->layer >= layer_count && b->Visible())
+ else if ((unsigned int)b->layer >= layer_count && b->Visible())
b->Draw(info, camera);
}
@@ -160,7 +160,7 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
auto obj = b->second;
if (a->pos.y + a->pos.h < obj->Y() + obj->H()) {
for (auto &i : a->boundRect) {
- i.Draw(-camera.x, -camera.y, 128, 128, 0, 256);
+ i.Draw(-camera.x, -camera.y, 128, 128, 0, 255);
if (i.Collide(objects[player_index].PosRect())) {
gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
}
@@ -186,7 +186,7 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
} else if (b == obj_seq.end()) {
for (; a != terrain.prop.end(); ++a) {
for (auto &i : a->boundRect) {
- i.Draw(-camera.x, -camera.y, 128, 128, 0, 256);
+ i.Draw(-camera.x, -camera.y, 128, 128, 0, 255);
if (i.Collide(objects[player_index].PosRect())) {
gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
}
Commit: 41670695744087346ed9973e6ed58a197bc1a4a1
https://github.com/scummvm/scummvm/commit/41670695744087346ed9973e6ed58a197bc1a4a1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the people component
Changed paths:
engines/crab/people/person.cpp
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 83a938eaff8..23d4810ee1e 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -76,9 +76,9 @@ void Person::Load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
if (statnode->first_attribute("template") == NULL) {
stat.Load(statnode);
} else {
- unsigned int index = 0;
+ int index = 0;
LoadNum(index, "template", statnode);
- if (index < stem.collection.size() && index >= 0)
+ if (index >= 0 && (unsigned int)index < stem.collection.size())
for (int i = 0; i < STAT_TOTAL; i++)
stat.val[i] = stem.collection[index].val[i];
}
Commit: afd30a0e8ec8799c2b195a9b7891109da6499685
https://github.com/scummvm/scummvm/commit/afd30a0e8ec8799c2b195a9b7891109da6499685
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the text component
Changed paths:
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index eae4822cedc..42f02d21b2b 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -126,22 +126,22 @@ SDL_Surface *TextManager::RenderTextBlended(const FontKey &font, const std::stri
}
#endif
-Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &font, const std::string &text, const int &color) {
+Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &fKey, const std::string &text, const int &color) {
SDL_Color sdlcolor = colpool.Get(color);
uint32 col = g_engine->_format->ARGBToColor(255, sdlcolor.r, sdlcolor.g, sdlcolor.b);
Graphics::ManagedSurface *surf = nullptr;
if (text.empty()) {
- Common::Rect rec = GetFont(font)->getBoundingBox(" ");
+ Common::Rect rec = GetFont(fKey)->getBoundingBox(" ");
int h = rec.height();
surf = new Graphics::ManagedSurface(rec.width(), h + (h / 2), *g_engine->_format);
- GetFont(font)->drawString(surf, " ", 0, 0, rec.width(), col);
+ GetFont(fKey)->drawString(surf, " ", 0, 0, rec.width(), col);
} else {
- Common::Rect rec = GetFont(font)->getBoundingBox(text.c_str());
+ Common::Rect rec = GetFont(fKey)->getBoundingBox(text.c_str());
int h = rec.height();
surf = new Graphics::ManagedSurface(rec.width(), h + (h / 2), *g_engine->_format);
- GetFont(font)->drawString(surf, text.c_str(), 0, 0, rec.width(), col);
+ GetFont(fKey)->drawString(surf, text.c_str(), 0, 0, rec.width(), col);
}
return surf;
@@ -225,10 +225,11 @@ void TextManager::Draw(const int &x, const int &y, const std::string &text, cons
}
}
-void TextManager::Draw(const int &x, int y, const std::string &text, const int &color, const FontKey &font, const Align &align,
+void TextManager::Draw(const int &x, int y, const std::string &text, const int &color, const FontKey &fKey, const Align &align,
const unsigned int &line_width, const unsigned int &line_height, const bool &background) {
- for (int start_pos = 0, len = text.length(); start_pos < len; y += line_height) {
- int end_pos = start_pos + 1, last_interrupt = -1;
+ for (unsigned int start_pos = 0, len = text.length(); start_pos < len; y += line_height) {
+ unsigned int end_pos = start_pos + 1;
+ int last_interrupt = -1;
std::string word;
while (end_pos - start_pos <= line_width) {
@@ -245,19 +246,19 @@ void TextManager::Draw(const int &x, int y, const std::string &text, const int &
if (last_interrupt >= 0) // wrap a word around
{
- for (int i = 0; i < last_interrupt - start_pos; i++)
+ for (unsigned int i = 0; i < last_interrupt - start_pos; i++)
word += text[start_pos + i];
start_pos = last_interrupt + 1;
} else // word bigger than line, just thunk
{
- for (int i = 0; i < end_pos - start_pos; i++)
+ for (unsigned int i = 0; i < end_pos - start_pos; i++)
word += text[start_pos + i];
start_pos += line_width;
}
- Draw(x, y, word, color, font, align, background);
+ Draw(x, y, word, color, fKey, align, background);
}
}
Commit: ea86cf4e628d2a5ee4b627ea650ef9b69ed8fdc1
https://github.com/scummvm/scummvm/commit/ea86cf4e628d2a5ee4b627ea650ef9b69ed8fdc1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the TMX component
Changed paths:
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 1ccc8a76b2b..1814b2c6ccd 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -349,7 +349,7 @@ bool TMXMap::InsideWalk(const Vector2i &pos) {
}
bool TMXMap::CollideWithTrigger(const Rect rect, int index) {
- if (area_trig.size() > index)
+ if (area_trig.size() > (unsigned int)index)
return area_trig.at(index).Collide(rect).intersect;
return false;
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index b58139656f0..1ca11c6f8a3 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -153,9 +153,9 @@ void TileSetGroup::ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i
finish.x = (player_pos.y + player_pos.h) / tile_size.y + 1;
finish.y = (player_pos.x + player_pos.w) / tile_size.x + 1;
- if (finish.x > layer.tile.size())
+ if (finish.x > (int)layer.tile.size())
finish.x = layer.tile.size();
- if (finish.y > layer.tile[0].size())
+ if (finish.y > (int)layer.tile[0].size())
finish.y = layer.tile.at(0).size();
v.x = start.y * tile_size.x - camera.x;
@@ -187,7 +187,7 @@ void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &til
// The row and column we end drawing at
finish.x = layer.tile.size() - 1;
- finish.y = finish.y = layer.tile.at(0).size() - 1;
+ finish.y = layer.tile.at(0).size() - 1;
v.x = (start.y * tile_size.x - camera.x) * layer.rate.x;
v.y = (start.x * tile_size.y - camera.y) * layer.rate.y;
@@ -227,9 +227,9 @@ void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &til
finish.x = (camera.y + camera.h) / tile_size.y + 1;
finish.y = (camera.x + camera.w) / tile_size.x + 1;
- if (finish.x > layer.tile.size())
+ if (finish.x > (int)layer.tile.size())
finish.x = layer.tile.size();
- if (finish.y > layer.tile[0].size())
+ if (finish.y > (int)layer.tile[0].size())
finish.y = layer.tile.at(0).size();
v.x = camera.x;
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 693dcca2624..f9f4fd34e90 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -46,7 +46,7 @@ struct TileSet {
std::string loc;
// The first gid of the tileset
- int first_gid;
+ GidFormat first_gid;
// Dimensions of tiles
int tile_w, tile_h;
Commit: aefa597a91115f35cdf74a44b34c87d036b9553d
https://github.com/scummvm/scummvm/commit/aefa597a91115f35cdf74a44b34c87d036b9553d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix misc. warnings in the ui component
Changed paths:
engines/crab/ui/HoverInfo.cpp
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/emotion.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
diff --git a/engines/crab/ui/HoverInfo.cpp b/engines/crab/ui/HoverInfo.cpp
index 6a43c8ae68b..9b9ab6211b5 100644
--- a/engines/crab/ui/HoverInfo.cpp
+++ b/engines/crab/ui/HoverInfo.cpp
@@ -36,8 +36,8 @@ namespace Crab {
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
-void HoverInfo::Init(const HoverInfo &h, const int &XOffset, const int &YOffset) {
- *this = h;
+void HoverInfo::Init(const HoverInfo &hInfo, const int &XOffset, const int &YOffset) {
+ *this = hInfo;
x += XOffset;
y += YOffset;
}
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index ce9047dab59..0c4b87f9d73 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -60,7 +60,7 @@ void OptionSelect::Draw() {
if (cur > 0)
prev.Draw();
- if (cur < option.text.size() - 1)
+ if ((unsigned int)cur < option.text.size() - 1)
next.Draw();
}
@@ -75,7 +75,7 @@ bool OptionSelect::HandleEvents(const Common::Event &Event) {
}
}
- if (cur < option.text.size() - 1) {
+ if ((unsigned int)cur < option.text.size() - 1) {
// Don't check for keyboard inputs for now
if (next.HandleEvents(Event) == BUAC_LCLICK) {
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index 941d8bad0cb..0417833848b 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -46,7 +46,7 @@ class OptionSelect {
TextData data;
void Draw(const int &index) {
- if (index >= 0 && index < text.size())
+ if (index >= 0 && (unsigned int)index < text.size())
data.Draw(text.at(index));
}
} option;
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index c48ffa1a103..2edf90624d2 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -207,7 +207,7 @@ public:
current_page--;
UpdateInfo();
- if (current_page < 0)
+ if ((int)current_page < 0)
current_page = 0;
}
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 5992497af31..b88e31dca1f 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -71,10 +71,10 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
stop = q.text.size();
// Keep count of lines and pages - remember a single entry can take more than one line
- int page_count = 0, page_start = 0;
+ unsigned int page_count = 0, page_start = 0;
// Start from line 0, page 0 and scan the list of entries
- for (int i = 0, line_count = 0; i < q.text.size(); ++i) {
+ for (unsigned int i = 0, line_count = 0; i < q.text.size(); ++i) {
// Increment the number of lines by one text entry
line_count += (q.text[i].size() / line.x) + 1;
@@ -120,7 +120,7 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
// Count the number of lines, because a single entry can take more than one line
int count = 0;
- for (unsigned int i = start; i < stop; ++i) {
+ for (unsigned int i = start; i < (unsigned int)stop; ++i) {
img.Draw(inc.x * count, inc.y * count);
// Draw first entry in selected color, and older quest entries in standard color
@@ -136,13 +136,9 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
}
void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event) {
- if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
+ if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK)
current_page--;
- if (current_page < 0)
- current_page = 0;
- }
-
if (current_page < total_page - 1 && next.HandleEvents(Event) == BUAC_LCLICK) {
current_page++;
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index 21e6b24babe..a65b61fe7e8 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -68,7 +68,7 @@ public:
if (result >= 0) {
select = result;
- for (int i = 0; i < element.size(); ++i)
+ for (int i = 0; i < (int)element.size(); ++i)
element.at(i).state = (i == result);
}
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 9c8aaa17886..a035532ba5f 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -64,7 +64,7 @@ void ReplyMenu::Load(const std::string &filename) {
int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string &cur_id, PersonHandler &oh, const Common::Event &Event) {
// After that, check if the user has clicked on any reply option
int choice = Menu<ReplyButton>::HandleEvents(Event);
- if (choice >= 0 && choice < dat.reply.size()) {
+ if (choice >= 0 && (unsigned int)choice < dat.reply.size()) {
bool play_sound = false;
// Loop through any opinion changes required
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 33f74161c99..9a7d31ea5a7 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -134,7 +134,7 @@ void GameSaveMenu::Draw() {
float base_x = menu.BaseX(count), base_y = menu.BaseY(count);
td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
- if (i == index && state == STATE_NAME)
+ if (i == (unsigned int)index && state == STATE_NAME)
ta_name.Draw();
else
td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 26a725e5bab..f327802118a 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -51,7 +51,7 @@ void TraitMenu::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("desc", node))
desc.Load(node->first_node("desc"));
- for (auto i = 0; i < size; ++i) {
+ for (unsigned int i = 0; i < size; ++i) {
TraitButton b;
b.Init(ref, inc.x * (i % cols), inc.y * (i / cols));
menu.element.push_back(b);
@@ -76,7 +76,7 @@ void TraitMenu::Draw(const pyrodactyl::people::Person *obj) {
for (; i != menu.element.end(); ++i)
i->Draw();
- if (select > -1 && select < obj->trait.size())
+ if (select > -1 && (unsigned int)select < obj->trait.size())
desc.Draw(obj->trait.at(select).desc);
} else
for (auto &i : menu.element)
@@ -93,7 +93,7 @@ void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const Common::Even
select = choice;
if (obj != nullptr) {
- if (select > -1 && select < obj->trait.size())
+ if (select > -1 && (unsigned int)select < obj->trait.size())
obj->trait.at(select).unread = false;
}
}
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 9677182aa6e..707ae152928 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -41,8 +41,8 @@ void EmotionIndicator::Load(rapidxml::xml_node<char> *node) {
}
void EmotionIndicator::Draw(const int &select) {
- if (select >= 0 && select < value.size())
- if (value.at(select) >= 0 && value.at(select) < gEventStore.tone.size()) {
+ if (select >= 0 && (unsigned int)select < value.size())
+ if (value.at(select) < gEventStore.tone.size()) {
text.Draw(gEventStore.tone.at(value.at(select)).text);
}
}
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 345c7e5a542..d5c2d169dfe 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -129,7 +129,7 @@ void Journal::Draw(const std::string &id) {
//------------------------------------------------------------------------
bool Journal::HandleEvents(const std::string &id, const Common::Event &Event) {
int choice = category.HandleEvents(Event);
- if (choice >= 0 && choice < category.element.size())
+ if (choice >= 0 && (unsigned int)choice < category.element.size())
Select(id, choice);
// Check if select is valid
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index b8d5523f1a3..db955ba6d05 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -426,7 +426,7 @@ void Map::Update(pyrodactyl::event::Info &info) {
// Purpose: Add a rectangle to the revealed world map data
//------------------------------------------------------------------------
void Map::RevealAdd(const int &id, const Rect &area) {
- if (id < map.size()) {
+ if ((unsigned int)id < map.size()) {
for (auto i = map.at(id).reveal.begin(); i != map.at(id).reveal.end(); ++i)
if (*i == area)
return;
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 8ebdb1e1029..a5efb8e0593 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -82,16 +82,16 @@ void QuestMenu::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Add an entry to the menu
//------------------------------------------------------------------------
-void QuestMenu::Add(const std::string &title, const std::string &text) {
+void QuestMenu::Add(const std::string &title, const std::string &txt) {
for (auto i = quest.begin(); i != quest.end(); ++i)
if (i->title == title) // We already have the quest entry
{
- i->text.push_front(text); // Just add the new string to the start of the quest messages and return
+ i->text.push_front(txt); // Just add the new string to the start of the quest messages and return
i->unread = true;
return;
}
- Quest q(title, text, true, false);
+ Quest q(title, txt, true, false);
quest.push_front(q);
menu.Add();
unread = true;
@@ -129,7 +129,7 @@ void QuestMenu::Draw(Button &bu_map) {
auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
// Only draw in _s color if we are on the same button and page
- if (sel_bu == count && sel_page == menu.CurrentPage())
+ if ((unsigned int)sel_bu == count && (unsigned int)sel_page == menu.CurrentPage())
gTextManager.Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_s, font, align);
else
gTextManager.Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_n, font, align);
@@ -140,7 +140,7 @@ void QuestMenu::Draw(Button &bu_map) {
}
}
- if (sel_quest >= 0 && sel_quest < quest.size()) {
+ if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
text.Draw(quest.at(sel_quest));
if (quest.at(sel_quest).marker)
@@ -167,7 +167,7 @@ bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const Commo
menu.Image(sel_bu, sel_page, img_s);
}
- if (sel_quest >= 0 && sel_quest < quest.size()) {
+ if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
if (quest.at(sel_quest).marker)
if (bu_map.HandleEvents(Event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
@@ -220,7 +220,7 @@ bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const SDL_E
// Purpose: Select an entry
//------------------------------------------------------------------------
void QuestMenu::Select(const int &quest_index) {
- if (quest_index >= 0 && quest_index < quest.size()) {
+ if (quest_index >= 0 && (unsigned int)quest_index < quest.size()) {
if (sel_bu >= 0 && sel_page >= 0)
menu.Image(sel_bu, sel_page, img_n);
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index a53db8f8e0e..2ec34c7b518 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -87,7 +87,7 @@ public:
void Marker(const std::string &title, const bool &val);
- void Add(const std::string &title, const std::string &text);
+ void Add(const std::string &title, const std::string &txt);
void Add(const pyrodactyl::event::Quest &q);
void Erase(const int &index);
Commit: 3f729fa953d11b84cb0b79fb9880a15ee21fee89
https://github.com/scummvm/scummvm/commit/3f729fa953d11b84cb0b79fb9880a15ee21fee89
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix warnings in misc classes
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGrid.cpp
engines/crab/Polygon.cpp
engines/crab/mainmenu.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 3ddca9e6635..075d6085f8b 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -290,9 +290,9 @@ std::vector<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSolut
std::vector<PathfindingGraphNode const *> returnVec = temp;
// Any node that is not adjacent to an obstacle or an obstacle corner can be removed.
- for (int i = 0; i < temp.size(); ++i) {
+ for (int i = 0; (unsigned int)i < temp.size(); ++i) {
if (!temp[i]->AdjacentToObstacle()) {
- if (i > 0 && i < temp.size() - 1) {
+ if (i > 0 && (unsigned int)i < temp.size() - 1) {
// This check to see if the node is a "corner" to an obstacle that should not be pruned
// to prevent hanging on corners.
std::vector<PathfindingGraphNode *> corners = grid->CornerCheck(temp[i - 1], temp[i + 1]);
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 6571c4506ed..3d099ef788a 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -55,7 +55,7 @@ void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode *node, bool ignoreDi
return;
// Make sure that the node is not already a neighbor (SZ)
- for (int i = 0; i < neighborNodes.size(); ++i) {
+ for (unsigned int i = 0; i < neighborNodes.size(); ++i) {
if (neighborNodes[i]->id == node->id) {
return;
}
@@ -83,7 +83,7 @@ bool PathfindingGraphNode::AdjacentToObstacle() const {
}
bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode *otherNode) {
- for (int i = 0; i < neighborNodes.size(); ++i) {
+ for (unsigned int i = 0; i < neighborNodes.size(); ++i) {
if (neighborNodes[i] == otherNode)
return true;
}
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 0d771e3b7bb..105f4b86998 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -240,7 +240,7 @@ PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vect
returnNode = checkNodes.front();
}
} else {
- for (int i = 0; i < checkNodes.front()->neighborNodes.size(); ++i) {
+ for (unsigned int i = 0; i < checkNodes.front()->neighborNodes.size(); ++i) {
// If the neighbor hasn't been checked yet, add it to the list to check.
if (std::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->neighborNodes[i]) == allUsedNodes.end()) {
allUsedNodes.push_back(checkNodes.front()->neighborNodes[i]);
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index e72320741c1..f96bb3af201 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -102,7 +102,7 @@ void Polygon2D::Load(rapidxml::xml_node<char> *node, Rect &bounds) {
void Polygon2D::SetEdge() {
edge.clear();
Vector2f p1, p2, res;
- for (int i = 0; i < point.size(); i++) {
+ for (unsigned int i = 0; i < point.size(); i++) {
p1 = point[i];
if (i + 1 >= point.size())
p2 = point[0];
@@ -117,7 +117,7 @@ void Polygon2D::SetEdge() {
Vector2f Polygon2D::Center() const {
Vector2f total;
- for (int i = 0; i < point.size(); i++) {
+ for (unsigned int i = 0; i < point.size(); i++) {
total.x += point[i].x;
total.y += point[i].y;
}
@@ -248,7 +248,7 @@ PolygonCollisionResult Polygon2D::Collide(const Polygon2D &polyB) {
bool Polygon2D::Contains(const float &X, const float &Y) {
bool result = false;
- for (int i = 0, j = point.size() - 1; i < point.size(); j = i++) {
+ for (unsigned int i = 0, j = point.size() - 1; i < point.size(); j = i++) {
if (((point[i].y > Y) != (point[j].y > Y)) &&
(X < (point[j].x - point[i].x) * (Y - point[i].y) / (point[j].y - point[i].y) + point[i].x))
result = !result;
@@ -259,7 +259,7 @@ bool Polygon2D::Contains(const float &X, const float &Y) {
void Polygon2D::Draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
Vector2f p1, p2;
- for (int i = 0; i < point.size(); i++) {
+ for (unsigned int i = 0; i < point.size(); i++) {
p1 = point[i];
if (i + 1 >= point.size())
p2 = point[0];
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 8f72345b8e4..68ba3348f68 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -161,7 +161,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
int choice = me_main.HandleEvents(Event);
if (choice >= 0) {
for (unsigned i = 0; i < me_main.element.size(); ++i)
- me_main.element.at(i).State(i == choice);
+ me_main.element.at(i).State(i == (unsigned int)choice);
switch (choice) {
case 0:
Commit: a2a401c8d743a98ec72f32b65afa34bfcafe98ec
https://github.com/scummvm/scummvm/commit/a2a401c8d743a98ec72f32b65afa34bfcafe98ec
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove semicolon after closing brace of a namespace
Changed paths:
engines/crab/TMX/TMXTileSet.h
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index f9f4fd34e90..1719f533470 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -112,7 +112,7 @@ public:
void PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf);
void ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
};
-}; // End of namespace TMX
+} // End of namespace TMX
} // End of namespace Crab
Commit: 54a933545d5c0640a35b1e0cda75cd7e53608d36
https://github.com/scummvm/scummvm/commit/54a933545d5c0640a35b1e0cda75cd7e53608d36
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Append end of namespace comment
Changed paths:
engines/crab/input/cursor.h
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index 648e02c27a4..9b11b6d9a98 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -88,6 +88,6 @@ extern Cursor gMouse;
} // End of namespace input
} // End of namespace pyrodactyl
-};
+} // End of namespace Crab
#endif // CRAB_CURSOR_H
Commit: d1700016a9f98142c0a66b3167cae20d19b31300
https://github.com/scummvm/scummvm/commit/d1700016a9f98142c0a66b3167cae20d19b31300
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make ImageManager a public member of Engine class
Changed paths:
engines/crab/TMX/TMXMap.cpp
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/imageeffect.cpp
engines/crab/animation/shadow.h
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/image/Image.cpp
engines/crab/item/Item.cpp
engines/crab/item/ItemSlot.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_objects.cpp
engines/crab/metaengine.cpp
engines/crab/splash.cpp
engines/crab/stat/StatDrawHelper.cpp
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ClipButton.cpp
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/ImageData.cpp
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/StateButton.cpp
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/button.cpp
engines/crab/ui/dialogbox.cpp
engines/crab/ui/element.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/questmenu.cpp
engines/crab/ui/slider.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 1814b2c6ccd..e3e96934290 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -100,7 +100,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
path_rows = (int)ceil((float)w / (float)path_size.x + .5f); // Adding .5 before casting in order to round up (SZ)
path_cols = (int)ceil((float)h / (float)path_size.y + .5f);
- gImageManager.tileset.Load(path, node);
+ g_engine->_imageManager->tileset.Load(path, node);
// Reset the layer at which sprites are drawn
sprite_layer = 0;
@@ -233,7 +233,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
// Purpose: Clear all data from the level
//------------------------------------------------------------------------
void TMXMap::Reset() {
- gImageManager.tileset.Reset();
+ g_engine->_imageManager->tileset.Reset();
layer.clear();
area_nowalk.clear();
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index b758f67338c..3447ae355a3 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/animation/AnimationFrame.h"
namespace Crab {
@@ -73,7 +75,7 @@ void AnimationFrame::Draw(const uint32 ×tamp) {
SDL_SetRenderDrawColor(gRenderer, col.r, col.g, col.b, col.a);
SDL_RenderFillRect(gRenderer, NULL);
- gImageManager.Draw(x, y, img);
+ g_engine->_imageManager->Draw(x, y, img);
text.Draw();
}
#endif
diff --git a/engines/crab/animation/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
index 7633b5c48e2..c2c50bf3325 100644
--- a/engines/crab/animation/imageeffect.cpp
+++ b/engines/crab/animation/imageeffect.cpp
@@ -28,7 +28,8 @@
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/animation/imageeffect.h"
namespace Crab {
@@ -44,7 +45,7 @@ void ImageEffect::Load(rapidxml::xml_node<char> *node) {
void ImageEffect::Draw(const int &XOffset, const int &YOffset) {
if (visible)
- pyrodactyl::image::gImageManager.Draw(x + XOffset, y + YOffset, img);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index 4724c323f90..94cd30df014 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -31,7 +31,7 @@
#ifndef CRAB_SHADOW_H
#define CRAB_SHADOW_H
-#include "crab/image/ImageManager.h"
+#include "crab/crab.h"
#include "crab/common_header.h"
#include "crab/vectors.h"
@@ -57,7 +57,7 @@ struct ShadowData {
using namespace pyrodactyl::image;
Image dat;
- gImageManager.GetTexture(img, dat);
+ g_engine->_imageManager->GetTexture(img, dat);
size.x = dat.W() / 2;
size.y = dat.H() / 2;
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 8b0ad63f4b6..2d5cfe676db 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -74,7 +74,7 @@ void Sprite::Load(rapidxml::xml_node<char> *node, std::vector<std::string> &anim
LoadNum(layer, "layer", node, false);
Image dat;
- gImageManager.GetTexture(image, dat);
+ g_engine->_imageManager->GetTexture(image, dat);
img_size.x = dat.W();
img_size.y = dat.H();
@@ -250,17 +250,17 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
ShadowOffset sh = anim_set.Shadow(dir);
if (sh.valid) {
// Draw using custom offset
- gImageManager.Draw(x + clip.w / 2 - anim_set.shadow.size.x + sh.x,
+ g_engine->_imageManager->Draw(x + clip.w / 2 - anim_set.shadow.size.x + sh.x,
y + clip.h - anim_set.shadow.size.y + sh.y,
anim_set.shadow.img);
} else {
// Draw using default offset
- gImageManager.Draw(x + clip.w / 2 - anim_set.shadow.size.x + anim_set.shadow.offset.x,
+ g_engine->_imageManager->Draw(x + clip.w / 2 - anim_set.shadow.size.x + anim_set.shadow.offset.x,
y + clip.h - anim_set.shadow.size.y + anim_set.shadow.offset.y,
anim_set.shadow.img);
}
- gImageManager.Draw(x, y, image, &clip, anim_set.Flip(dir));
+ g_engine->_imageManager->Draw(x, y, image, &clip, anim_set.Flip(dir));
img_eff.Draw(x, y);
if (GameDebug) {
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 7e3a8ee898d..2b4e2a0bc07 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -309,7 +309,7 @@ App::~App() {
#if 0
// SteamAPI_Shutdown();
- pyrodactyl::image::gImageManager.Quit();
+ g_engine->_imageManager->Quit();
pyrodactyl::music::gMusicManager.Quit();
pyrodactyl::text::gTextManager.Quit();
pyrodactyl::input::gInput.Quit();
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 97ef50e1993..83bdd999f15 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -91,6 +91,8 @@ Common::Error CrabEngine::run() {
_renderSurface = new Graphics::ManagedSurface(1920, 1080, *_format);
_screen = new Graphics::Screen(1280, 720, *_format);
+ _imageManager = new pyrodactyl::image::ImageManager();
+
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
delete cursor;
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index c83aaead2f2..4a2c2246910 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -63,6 +63,7 @@
#include "engines/engine.h"
#include "engines/savestate.h"
#include "graphics/screen.h"
+#include "crab/image/ImageManager.h"
#include "crab/detection.h"
@@ -85,9 +86,9 @@ public:
Graphics::Screen *_screen = nullptr;
Graphics::PixelFormat *_format = nullptr;
Graphics::ManagedSurface *_renderSurface = nullptr;
+ pyrodactyl::image::ImageManager *_imageManager = nullptr;
Common::FSNode _gameDataDir;
-public:
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
~CrabEngine() override;
void initializePath(const Common::FSNode &gamePath) override;
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 29c6190313b..7ebddd69928 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -323,7 +323,7 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
gEventStore.anim.at(cur_event->special).Draw();
break;
case EVENT_DIALOG:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
if (oh.show_journal) {
info.journal.Draw(level.PlayerID());
hud.back.Draw();
@@ -331,7 +331,7 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
oh.Draw(info, cur_event, cur_event->title, player, cur_sp);
break;
case EVENT_REPLY:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
if (oh.show_journal) {
info.journal.Draw(level.PlayerID());
hud.back.Draw();
@@ -345,7 +345,7 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
textin.Draw();
break;
case EVENT_SPLASH:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
if (intro.show_traits) {
per.Draw(info, cur_event->title);
hud.back.Draw();
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 82ec9b997d3..3d427e58398 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -120,7 +120,7 @@ bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
// If the filename is same as the previous one, skip loading
if (gFilePath.current_r != gFilePath.level[id.c_str()].asset) {
gFilePath.current_r = gFilePath.level[id.c_str()].asset;
- gImageManager.LoadMap(gFilePath.level[id.c_str()].asset);
+ g_engine->_imageManager->LoadMap(gFilePath.level[id.c_str()].asset);
}
// Load the level itself
@@ -502,7 +502,7 @@ void Game::Draw() {
if (gem.draw_game)
level.Draw(info);
else
- gImageManager.BlackScreen();
+ g_engine->_imageManager->BlackScreen();
switch (state) {
case STATE_GAME:
if (gem.EventInProgress())
@@ -511,36 +511,36 @@ void Game::Draw() {
hud.Draw(info, level.PlayerID());
break;
case STATE_PAUSE:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
hud.pause.Draw(hud.back);
hud.Draw(info, level.PlayerID());
break;
case STATE_MAP:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
map.Draw(info);
hud.Draw(info, level.PlayerID());
hud.back.Draw();
break;
case STATE_JOURNAL:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
info.journal.Draw(level.PlayerID());
hud.Draw(info, level.PlayerID());
hud.back.Draw();
break;
case STATE_CHARACTER:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
gem.per.Draw(info, level.PlayerID());
hud.Draw(info, level.PlayerID());
hud.back.Draw();
break;
case STATE_INVENTORY:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
info.InvDraw(level.PlayerID());
hud.Draw(info, level.PlayerID());
hud.back.Draw();
break;
case STATE_HELP:
- gImageManager.DimScreen();
+ g_engine->_imageManager->DimScreen();
gHelpScreen.Draw();
hud.back.Draw();
hud.Draw(info, level.PlayerID());
@@ -802,7 +802,7 @@ void Game::SaveState(const std::string &filename, const bool &overwrite) {
void Game::Quit(bool &ShouldChangeState, GameStateID &NewStateID, const GameStateID &NewStateVal) {
ShouldChangeState = true;
NewStateID = NewStateVal;
- gImageManager.LoadMap(gFilePath.mainmenu_r);
+ g_engine->_imageManager->LoadMap(gFilePath.mainmenu_r);
}
//------------------------------------------------------------------------
// Purpose: Change our internal state
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 261fdec6d15..fae7d267b20 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -269,6 +269,10 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
s->flipHorizontal(Common::Rect(s->w, s->h));
break;
+ case FLIP_Y:
+ s->flipVertical(Common::Rect(s->w, s->h));
+ break;
+
default:
warning("Flipped texture: %d", flip);
}
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 2430c2f0828..f73bb1efc78 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/item/Item.h"
namespace Crab {
@@ -115,7 +117,7 @@ void Item::StatChange(Person &obj, bool increase) {
}
void Item::Draw(const int &x, const int &y) {
- gImageManager.Draw(x, y, img);
+ g_engine->_imageManager->Draw(x, y, img);
}
} // End of namespace Crab
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 82bbb46ebe8..a46fdc1c5ff 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/item/ItemSlot.h"
namespace Crab {
@@ -109,7 +111,7 @@ void ItemSlot::Draw() {
item.Draw(x, y);
if (unread)
- pyrodactyl::image::gImageManager.NotifyDraw(x + w, y);
+ g_engine->_imageManager->NotifyDraw(x + w, y);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index af4296dc4c3..7f8b1e8bba6 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -47,7 +47,7 @@ void Level::PreDraw() {
Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(terrain.W(), terrain.H(), *g_engine->_format);
unsigned int layer_count = 0u;
for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
- gImageManager.tileset.PreDraw(*l, terrain.tile_size, surf);
+ g_engine->_imageManager->tileset.PreDraw(*l, terrain.tile_size, surf);
// Draw the normal sprites if this is the layer for it
if (layer_count == terrain.sprite_layer)
@@ -74,7 +74,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
unsigned int layer_count = 0u;
// Draw the terrain layer
- gImageManager.tileset.Draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].PosRect(), img);
+ g_engine->_imageManager->tileset.Draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].PosRect(), img);
Vector2i pos = objects[player_index].ai_data.dest;
Rect newpos(pos.x - (dest_marker.size.x/2), pos.y - (dest_marker.size.y/2), dest_marker.size.x, dest_marker.size.y);
@@ -94,7 +94,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
DrawObjects(info);
// Draw the terrain layer
- gImageManager.tileset.ForceDraw(*l, camera, terrain.tile_size, objects[player_index].PosRect());
+ g_engine->_imageManager->tileset.ForceDraw(*l, camera, terrain.tile_size, objects[player_index].PosRect());
}
// Draw the background sprites
@@ -162,11 +162,11 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
for (auto &i : a->boundRect) {
i.Draw(-camera.x, -camera.y, 128, 128, 0, 255);
if (i.Collide(objects[player_index].PosRect())) {
- gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
+ g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
}
if (i.Contains(objects[player_index].ai_data.dest)) {
- gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
+ g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
}
}
++a;
@@ -188,11 +188,11 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
for (auto &i : a->boundRect) {
i.Draw(-camera.x, -camera.y, 128, 128, 0, 255);
if (i.Collide(objects[player_index].PosRect())) {
- gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
+ g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
}
if (i.Contains(objects[player_index].ai_data.dest)) {
- gImageManager.tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
+ g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
}
}
}
@@ -210,7 +210,7 @@ void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
while (a != terrain.prop.end() && b != obj_seq.end()) {
auto obj = b->second;
if (a->pos.y + a->pos.h < obj->Y() + obj->H()) {
- gImageManager.tileset.PreDraw(*a, terrain.tile_size, surf);
+ g_engine->_imageManager->tileset.PreDraw(*a, terrain.tile_size, surf);
++a;
} else {
++b;
@@ -220,7 +220,7 @@ void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
if (a == terrain.prop.end()) {
} else if (b == obj_seq.end()) {
for (; a != terrain.prop.end(); ++a)
- gImageManager.tileset.PreDraw(*a, terrain.tile_size, surf);
+ g_engine->_imageManager->tileset.PreDraw(*a, terrain.tile_size, surf);
}
}
}
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index 54bdfa5486b..1d3dbb95c1d 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/level/level_objects.h"
namespace Crab {
@@ -37,12 +39,12 @@ using namespace pyrodactyl::level;
void PlayerDestMarker::Load(rapidxml::xml_node<char> *node) {
LoadImgKey(img, "dest", node);
- size.x = gImageManager.GetTexture(img).W();
- size.y = gImageManager.GetTexture(img).H();
+ size.x = g_engine->_imageManager->GetTexture(img).W();
+ size.y = g_engine->_imageManager->GetTexture(img).H();
}
void PlayerDestMarker::Draw(const Vector2i &pos, const Rect &camera) {
- gImageManager.Draw(pos.x - (size.x / 2) - camera.x, pos.y - (size.y / 2) - camera.y, img);
+ g_engine->_imageManager->Draw(pos.x - (size.x / 2) - camera.x, pos.y - (size.y / 2) - camera.y, img);
}
} // End of namespace Crab
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index 27d49354a19..ba35cec419d 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -49,6 +49,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/translation.h"
#include "crab/crab.h"
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 4a41ace5e69..2f016e1371f 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -63,7 +63,7 @@ Splash::~Splash() {
void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
gLoadScreen.Load();
- pyrodactyl::image::gImageManager.Init();
+ g_engine->_imageManager->Init();
pyrodactyl::text::gTextManager.Init();
load_complete = true;
}
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index 7fe0d7e3d3e..da3c02fab32 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -61,9 +61,9 @@ void StatInfo::Draw(const int &val, const int &max) {
int i = 0;
for (; i < val; ++i)
- gImageManager.Draw(dim.x + i * dim.w, dim.y + i * dim.h, full);
+ g_engine->_imageManager->Draw(dim.x + i * dim.w, dim.y + i * dim.h, full);
for (; i < max; ++i)
- gImageManager.Draw(dim.x + i * dim.w, dim.y + i * dim.h, empty);
+ g_engine->_imageManager->Draw(dim.x + i * dim.w, dim.y + i * dim.h, empty);
}
#endif
}
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 943144528f3..007bfd8ceb6 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/AlphaImage.h"
#include "crab/text/TextManager.h"
@@ -62,13 +64,13 @@ void AlphaImage::InternalEvents() {
}
}
- if (gImageManager.ValidTexture(img))
- gImageManager.GetTexture(img).Alpha(alpha.cur);
+ if (g_engine->_imageManager->ValidTexture(img))
+ g_engine->_imageManager->GetTexture(img).Alpha(alpha.cur);
}
void AlphaImage::Draw(const int &XOffset, const int &YOffset) {
- if (gImageManager.ValidTexture(img))
- gImageManager.GetTexture(img).Draw(pos.x + XOffset, pos.y + YOffset);
+ if (g_engine->_imageManager->ValidTexture(img))
+ g_engine->_imageManager->GetTexture(img).Draw(pos.x + XOffset, pos.y + YOffset);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 32e5ae3e784..99eb653e0c3 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -71,7 +71,7 @@ void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
if (cur_sp != nullptr) {
Rect clip = cur_sp->DialogClip(state);
- gImageManager.Draw(pos.x, pos.y, cur_sp->Img(), &clip);
+ g_engine->_imageManager->Draw(pos.x, pos.y, cur_sp->Img(), &clip);
}
}
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index a78e61272f2..4339162e521 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -28,7 +28,8 @@
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/ClipButton.h"
namespace Crab {
@@ -44,8 +45,8 @@ void ClipButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
else {
clip.x = 0;
clip.y = 0;
- clip.w = gImageManager.GetTexture(img.normal).W();
- clip.h = gImageManager.GetTexture(img.normal).H();
+ clip.w = g_engine->_imageManager->GetTexture(img.normal).W();
+ clip.h = g_engine->_imageManager->GetTexture(img.normal).H();
}
}
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 23cf27ac1b8..cd4b8d83db2 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -28,7 +28,8 @@
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/HealthIndicator.h"
namespace Crab {
@@ -54,9 +55,9 @@ void HealthIndicator::Draw(int num) {
for (auto i = img.begin(); i != img.end(); ++i)
if (num == i->val) {
using namespace pyrodactyl::image;
- gImageManager.Draw(x, y, i->normal);
- gImageManager.GetTexture(i->glow).Alpha(alpha);
- gImageManager.Draw(x, y, i->glow);
+ g_engine->_imageManager->Draw(x, y, i->normal);
+ g_engine->_imageManager->GetTexture(i->glow).Alpha(alpha);
+ g_engine->_imageManager->Draw(x, y, i->glow);
if (inc) {
alpha += 2;
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 72877fe486a..d111042ab28 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/ImageData.h"
namespace Crab {
@@ -47,9 +49,9 @@ void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo) {
void ImageData::Draw(const int &XOffset, const int &YOffset) {
if (crop)
- gImageManager.Draw(x + XOffset, y + YOffset, key, &clip);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, key, &clip);
else
- gImageManager.Draw(x + XOffset, y + YOffset, key);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, key);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index fd6750f1382..2e27fdcc46f 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -89,7 +89,7 @@ void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
else if (sprite_align.y == ALIGN_RIGHT)
y -= r.h;
- gImageManager.Draw(x, y, s->Img(), &r);
+ g_engine->_imageManager->Draw(x, y, s->Img(), &r);
}
if (info.PersonValid(person_id)) {
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 0c48c7e2595..68496527a99 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -90,7 +90,7 @@ void PersonScreen::Draw(pyrodactyl::event::Info &info, const std::string &id) {
if (cur_sp != nullptr) {
Rect clip = cur_sp->DialogClip(PST_NORMAL);
- gImageManager.Draw(img.x, img.y, cur_sp->Img(), &clip);
+ g_engine->_imageManager->Draw(img.x, img.y, cur_sp->Img(), &clip);
}
}
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index 99a70976fed..4b9f03459bc 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -67,22 +67,22 @@ void ProgressBar::Draw(const int &value, const int &max) {
// If we don't have to draw animations for changing value, just draw the bar
if (!changed) {
- clip.w = (gImageManager.GetTexture(img.normal).W() * value) / max;
+ clip.w = (g_engine->_imageManager->GetTexture(img.normal).W() * value) / max;
ClipButton::Draw();
} else {
- clip.w = (gImageManager.GetTexture(img.normal).W() * cur) / max;
+ clip.w = (g_engine->_imageManager->GetTexture(img.normal).W() * cur) / max;
ClipButton::Draw();
switch (type) {
case INCREASE:
- gImageManager.Draw(x + clip.w + offset.x, y + offset.y, inc);
+ g_engine->_imageManager->Draw(x + clip.w + offset.x, y + offset.y, inc);
if (timer.TargetReached()) {
cur++;
timer.Start();
}
break;
case DECREASE:
- gImageManager.Draw(x + clip.w + offset.x, y + offset.y, dec);
+ g_engine->_imageManager->Draw(x + clip.w + offset.x, y + offset.y, dec);
if (timer.TargetReached()) {
cur--;
timer.Start();
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 8941d2aa9b9..c299ccf8c78 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/SectionHeader.h"
namespace Crab {
@@ -53,23 +55,23 @@ void SectionHeader::Load(rapidxml::xml_node<char> *node) {
SDL_Surface *surf = gTextManager.RenderTextBlended(font, text, col);
if (align == ALIGN_CENTER) {
- left.x = x - surf->w / 2 - gImageManager.GetTexture(img).W();
- left.y = y - surf->h / 2 + gImageManager.GetTexture(img).H() / 2;
+ left.x = x - surf->w / 2 - g_engine->_imageManager->GetTexture(img).W();
+ left.y = y - surf->h / 2 + g_engine->_imageManager->GetTexture(img).H() / 2;
right.x = x + surf->w / 2;
- right.y = y - surf->h / 2 + gImageManager.GetTexture(img).H() / 2;
+ right.y = y - surf->h / 2 + g_engine->_imageManager->GetTexture(img).H() / 2;
} else if (align == ALIGN_LEFT) {
- left.x = x - gImageManager.GetTexture(img).W();
- left.y = y + surf->h / 2 - gImageManager.GetTexture(img).H() / 2;
+ left.x = x - g_engine->_imageManager->GetTexture(img).W();
+ left.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
right.x = x + surf->w;
- right.y = y + surf->h / 2 - gImageManager.GetTexture(img).H() / 2;
+ right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
} else {
- left.x = x - surf->w - gImageManager.GetTexture(img).W();
- left.y = y + surf->h / 2 - gImageManager.GetTexture(img).H() / 2;
+ left.x = x - surf->w - g_engine->_imageManager->GetTexture(img).W();
+ left.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
right.x = x;
- right.y = y + surf->h / 2 - gImageManager.GetTexture(img).H() / 2;
+ right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
}
SDL_FreeSurface(surf);
@@ -84,10 +86,10 @@ void SectionHeader::Draw(const int &XOffset, const int &YOffset) {
void SectionHeader::Draw(const std::string &str, const int &XOffset, const int &YOffset) {
if (draw_l)
- gImageManager.Draw(left.x + XOffset, left.y + YOffset, img);
+ g_engine->_imageManager->Draw(left.x + XOffset, left.y + YOffset, img);
if (draw_r)
- gImageManager.Draw(right.x + XOffset, right.y + YOffset, img, (Rect*)NULL, FLIP_X);
+ g_engine->_imageManager->Draw(right.x + XOffset, right.y + YOffset, img, (Rect*)NULL, FLIP_X);
TextData::Draw(str, XOffset, YOffset);
}
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index 5481d7c1024..5617f0f3c81 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/StateButton.h"
namespace Crab {
@@ -74,8 +76,8 @@ void StateButton::State(const bool val) {
}
// Images might be different in size
- w = gImageManager.GetTexture(img.normal).W();
- h = gImageManager.GetTexture(img.normal).H();
+ w = g_engine->_imageManager->GetTexture(img.normal).W();
+ h = g_engine->_imageManager->GetTexture(img.normal).H();
}
void StateButton::Img(const StateButtonImage &sbi) {
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 52935248fab..838986458b6 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/ToggleButton.h"
namespace Crab {
@@ -48,9 +50,9 @@ void ToggleButton::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
Button::Draw(XOffset, YOffset, clip);
if (state)
- gImageManager.Draw(x + offset.x, y + offset.y, on);
+ g_engine->_imageManager->Draw(x + offset.x, y + offset.y, on);
else
- gImageManager.Draw(x + offset.x, y + offset.y, off);
+ g_engine->_imageManager->Draw(x + offset.x, y + offset.y, off);
}
ButtonAction ToggleButton::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index 29b17e62947..c249c601ff9 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/TraitButton.h"
namespace Crab {
@@ -50,7 +52,7 @@ void TraitButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
void TraitButton::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
if (trait_img != 0)
- gImageManager.Draw(x + offset.x, y + offset.y, trait_img);
+ g_engine->_imageManager->Draw(x + offset.x, y + offset.y, trait_img);
StateButton::Draw(XOffset, YOffset, clip);
}
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index f327802118a..c833125240b 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/TraitMenu.h"
namespace Crab {
@@ -70,7 +72,7 @@ void TraitMenu::Draw(const pyrodactyl::people::Person *obj) {
for (auto t = obj->trait.begin(); t != obj->trait.end() && i != menu.element.end(); ++t, ++i) {
i->Draw();
if (t->unread)
- pyrodactyl::image::gImageManager.NotifyDraw(i->x + i->w, i->y);
+ g_engine->_imageManager->NotifyDraw(i->x + i->w, i->y);
}
for (; i != menu.element.end(); ++i)
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index b212a682659..df9e622d6ea 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -32,6 +32,8 @@
// Author: Arvind
// Purpose: Contains the button functions
//=============================================================================
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/button.h"
namespace Crab {
@@ -103,17 +105,17 @@ void Button::Reset() {
void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
if (visible) {
if (mousepressed) {
- gImageManager.Draw(x + XOffset, y + YOffset, img.select, clip);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.select, clip);
tooltip.Draw(XOffset, YOffset);
caption.Draw(true, XOffset, YOffset);
} else if (hover_mouse || hover_key) {
- gImageManager.Draw(x + XOffset, y + YOffset, img.hover, clip);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.hover, clip);
tooltip.Draw(XOffset, YOffset);
caption.Draw(true, XOffset, YOffset);
} else {
- gImageManager.Draw(x + XOffset, y + YOffset, img.normal, clip);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.normal, clip);
caption.Draw(false, XOffset, YOffset);
}
}
@@ -125,13 +127,13 @@ void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *
#if 0
if (visible) {
if (mousepressed) {
- gImageManager.Draw(x + XOffset, y + YOffset, img.select, clip);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.select, clip);
caption.Draw(true, XOffset, YOffset);
} else if (hover_mouse || hover_key) {
- gImageManager.Draw(x + XOffset, y + YOffset, img.hover, clip);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.hover, clip);
caption.Draw(true, XOffset, YOffset);
} else {
- gImageManager.Draw(x + XOffset, y + YOffset, img.normal, clip);
+ g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.normal, clip);
caption.Draw(false, XOffset, YOffset);
}
}
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index 5db4cd06671..b981c1f9723 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -32,6 +32,8 @@
// Author: Arvind
// Purpose: Dialog box!
//=============================================================================
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/dialogbox.h"
namespace Crab {
@@ -61,9 +63,9 @@ void GameDialogBox::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void GameDialogBox::Draw(const bool &player) {
if (player)
- gImageManager.Draw(pos.x, pos.y, bg_p);
+ g_engine->_imageManager->Draw(pos.x, pos.y, bg_p);
else
- gImageManager.Draw(pos.x, pos.y, bg);
+ g_engine->_imageManager->Draw(pos.x, pos.y, bg);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 3e211408808..29e45b90f2f 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -27,7 +27,8 @@
* Licensed under MIT
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/element.h"
namespace Crab {
@@ -46,7 +47,7 @@ void Element::Init(const int &X, const int &Y, const Align &align_x, const Align
w = W;
h = H;
} else {
- Image dat = gImageManager.GetTexture(img);
+ Image dat = g_engine->_imageManager->GetTexture(img);
w = dat.W();
h = dat.H();
}
@@ -62,12 +63,12 @@ void Element::Load(rapidxml::xml_node<char> *node, ImageKey img, const bool &ech
BasicLoad(node, echo);
if (node->first_attribute("w") == NULL)
- w = gImageManager.GetTexture(img).W();
+ w = g_engine->_imageManager->GetTexture(img).W();
else
LoadNum(w, "w", node);
if (node->first_attribute("h") == NULL)
- h = gImageManager.GetTexture(img).H();
+ h = g_engine->_imageManager->GetTexture(img).H();
else
LoadNum(h, "h", node);
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index eb67fa01393..a39386d0bd1 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -60,7 +60,7 @@ void HUD::Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, p
if (NodeValid("notify", node)) {
rapidxml::xml_node<char> *notifynode = node->first_node("notify");
- LoadImgKey(gImageManager.notify, "img", notifynode);
+ LoadImgKey(g_engine->_imageManager->notify, "img", notifynode);
tn.Load(notifynode);
pdm.Load(notifynode);
@@ -88,22 +88,22 @@ void HUD::Draw(pyrodactyl::event::Info &info, const std::string &id) {
menu.Draw();
if (info.unread.journal) {
- gImageManager.Draw(menu.element.at(HS_JOURNAL).x + menu.element.at(HS_JOURNAL).w - clip.w / 2,
+ g_engine->_imageManager->Draw(menu.element.at(HS_JOURNAL).x + menu.element.at(HS_JOURNAL).w - clip.w / 2,
menu.element.at(HS_JOURNAL).y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.inventory) {
- gImageManager.Draw(menu.element.at(HS_INV).x + menu.element.at(HS_INV).w - clip.w / 2,
+ g_engine->_imageManager->Draw(menu.element.at(HS_INV).x + menu.element.at(HS_INV).w - clip.w / 2,
menu.element.at(HS_INV).y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.trait) {
- gImageManager.Draw(menu.element.at(HS_CHAR).x + menu.element.at(HS_CHAR).w - clip.w / 2,
+ g_engine->_imageManager->Draw(menu.element.at(HS_CHAR).x + menu.element.at(HS_CHAR).w - clip.w / 2,
menu.element.at(HS_CHAR).y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.map) {
- gImageManager.Draw(menu.element.at(HS_MAP).x + menu.element.at(HS_MAP).w - clip.w / 2,
+ g_engine->_imageManager->Draw(menu.element.at(HS_MAP).x + menu.element.at(HS_MAP).w - clip.w / 2,
menu.element.at(HS_MAP).y - clip.h / 2, notify_anim, &clip);
}
//#endif
@@ -115,7 +115,7 @@ void HUD::InternalEvents(bool ShowMap) {
if (timer.TargetReached()) {
clip.x += clip.w;
- if (clip.x >= gImageManager.GetTexture(notify_anim).W())
+ if (clip.x >= g_engine->_imageManager->GetTexture(notify_anim).W())
clip.x = 0;
timer.Start();
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index d5c2d169dfe..adc39fe955c 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/journal.h"
namespace Crab {
@@ -115,7 +117,7 @@ void Journal::Draw(const std::string &id) {
int count = 0;
for (auto i = category.element.begin(); i != category.element.end() && count < JE_TOTAL; ++i, ++count)
if (jo.menu[count].unread)
- gImageManager.NotifyDraw(i->x + i->w, i->y);
+ g_engine->_imageManager->NotifyDraw(i->x + i->w, i->y);
if (select >= 0 && select < JE_TOTAL)
jo.menu[select].Draw(bu_map);
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index a5efb8e0593..59cd0f0477c 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/questmenu.h"
namespace Crab {
@@ -136,7 +138,7 @@ void QuestMenu::Draw(Button &bu_map) {
if (quest.at(i).unread) {
using namespace pyrodactyl::image;
- gImageManager.Draw(base_x + off_unread.x, base_y + off_unread.y, gImageManager.notify);
+ g_engine->_imageManager->Draw(base_x + off_unread.x, base_y + off_unread.y, g_engine->_imageManager->notify);
}
}
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index caed874b6a9..c6a1955ea65 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/slider.h"
namespace Crab {
@@ -42,8 +44,8 @@ void Slider::Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
bar.Load(node->first_node("bar"));
knob.y = bar.y;
- knob.w = gImageManager.GetTexture(knob.img.normal).W();
- knob.h = gImageManager.GetTexture(knob.img.normal).H();
+ knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).W();
+ knob.h = g_engine->_imageManager->GetTexture(knob.img.normal).H();
knob.canmove = true;
min = Min;
@@ -140,8 +142,8 @@ void Slider::SetUI() {
knob.x = bar.x + ((bar.w - knob.w) * value / (max - min));
knob.y = bar.y;
- knob.w = gImageManager.GetTexture(knob.img.normal).W();
- knob.h = gImageManager.GetTexture(knob.img.normal).H();
+ knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).W();
+ knob.h = g_engine->_imageManager->GetTexture(knob.img.normal).H();
}
} // End of namespace Crab
Commit: 58d38614479cd1af49b72654dd4630a3b8be3f03
https://github.com/scummvm/scummvm/commit/58d38614479cd1af49b72654dd4630a3b8be3f03
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Cursor a public member of Engine class
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/image/ImageManager.cpp
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
engines/crab/level/level.cpp
engines/crab/level/level_collide.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/button.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
engines/crab/ui/slider.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 2d5cfe676db..56403482bf7 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -344,7 +344,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!ai_data.dest.active && !gMouse.inside_hud && !gMouse.hover && gMouse.Pressed()) {
+ if (!ai_data.dest.active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
int x = pos.x - camera.x - anim_set.AnchorX(dir), y = pos.y - camera.y - anim_set.AnchorY(dir);
@@ -353,17 +353,17 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
int w = b.w, h = b.h;
// X axis
- if (gMouse.motion.x > x + w)
+ if (g_engine->_mouse->motion.x > x + w)
XVel(player_speed * sc.walk_vel_mod.x);
- else if (gMouse.motion.x < x)
+ else if (g_engine->_mouse->motion.x < x)
XVel(-player_speed * sc.walk_vel_mod.x);
else
XVel(0.0f);
// Y axis
- if (gMouse.motion.y > y + h)
+ if (g_engine->_mouse->motion.y > y + h)
YVel(player_speed * sc.walk_vel_mod.y);
- else if (gMouse.motion.y < y)
+ else if (g_engine->_mouse->motion.y < y)
YVel(-player_speed * sc.walk_vel_mod.y);
else
YVel(0.0f);
@@ -411,7 +411,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!ai_data.dest.active && !gMouse.inside_hud && !gMouse.hover && gMouse.Pressed()) {
+ if (!ai_data.dest.active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
int x = pos.x - camera.x - anim_set.AnchorX(dir), y = pos.y - camera.y - anim_set.AnchorY(dir);
@@ -420,17 +420,17 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
int w = b.w, h = b.h;
// X axis
- if (gMouse.motion.x > x + w)
+ if (g_engine->_mouse->motion.x > x + w)
XVel(player_speed * sc.walk_vel_mod.x);
- else if (gMouse.motion.x < x)
+ else if (g_engine->_mouse->motion.x < x)
XVel(-player_speed * sc.walk_vel_mod.x);
else
XVel(0.0f);
// Y axis
- if (gMouse.motion.y > y + h)
+ if (g_engine->_mouse->motion.y > y + h)
YVel(player_speed * sc.walk_vel_mod.y);
- else if (gMouse.motion.y < y)
+ else if (g_engine->_mouse->motion.y < y)
YVel(-player_speed * sc.walk_vel_mod.y);
else
YVel(0.0f);
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 83bdd999f15..2dd1d4d92c2 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -92,6 +92,7 @@ Common::Error CrabEngine::run() {
_screen = new Graphics::Screen(1280, 720, *_format);
_imageManager = new pyrodactyl::image::ImageManager();
+ _mouse = new pyrodactyl::input::Cursor();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 4a2c2246910..60c7ff5ac0e 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -64,6 +64,7 @@
#include "engines/savestate.h"
#include "graphics/screen.h"
#include "crab/image/ImageManager.h"
+#include "crab/input/cursor.h"
#include "crab/detection.h"
@@ -87,6 +88,7 @@ public:
Graphics::PixelFormat *_format = nullptr;
Graphics::ManagedSurface *_renderSurface = nullptr;
pyrodactyl::image::ImageManager *_imageManager = nullptr;
+ pyrodactyl::input::Cursor *_mouse = nullptr;
Common::FSNode _gameDataDir;
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 3d427e58398..46272768f00 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -156,7 +156,7 @@ bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
// Purpose: Handle events
//------------------------------------------------------------------------
void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- gMouse.HandleEvents(Event);
+ g_engine->_mouse->HandleEvents(Event);
// if (GameDebug)
// debug_console.HandleEvents(Event);
@@ -312,7 +312,7 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
// Purpose: Handle events
//------------------------------------------------------------------------
void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- gMouse.HandleEvents(Event);
+ g_engine->_mouse->HandleEvents(Event);
if (GameDebug)
debug_console.HandleEvents(Event);
@@ -558,7 +558,7 @@ void Game::Draw() {
if (GameDebug)
debug_console.Draw(info);
- gMouse.Draw();
+ g_engine->_mouse->Draw();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index ed067c17a6c..b04ead300f9 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -32,6 +32,8 @@
// Author: Arvind
// Purpose: Contains the image manager class - used to manage in-game images
//=============================================================================
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/image/ImageManager.h"
#include "crab/XMLDoc.h"
@@ -85,8 +87,8 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
if (NodeValid("mouse", node, false)) {
using namespace pyrodactyl::input;
- gMouse.Quit();
- gMouse.Load(node->first_node("mouse"));
+ g_engine->_mouse->Quit();
+ g_engine->_mouse->Load(node->first_node("mouse"));
}
}
}
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index d042a396498..b90f0eaa84b 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -34,15 +34,9 @@
//=============================================================================
#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/input/cursor.h"
+#include "crab/crab.h"
namespace Crab {
-
-namespace pyrodactyl {
-namespace input {
-Cursor gMouse;
-}
-} // End of namespace pyrodactyl
-
using namespace pyrodactyl::input;
//------------------------------------------------------------------------
@@ -83,7 +77,7 @@ void Cursor::Load(rapidxml::xml_node<char> *node) {
// Purpose: Handle Events
//------------------------------------------------------------------------
void Cursor::HandleEvents(const Common::Event &event) {
- gMouse.hover = false;
+ g_engine->_mouse->hover = false;
#if 0
if (event.type == SDL_MOUSEMOTION) {
motion.x = Event.motion.x;
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index 9b11b6d9a98..bd52044ed32 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -84,7 +84,6 @@ public:
bool Pressed() { return pressed; }
};
-extern Cursor gMouse;
} // End of namespace input
} // End of namespace pyrodactyl
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 4040f87f838..375361d3367 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -91,12 +91,12 @@ void Level::CalcProperties(Info &info) {
// Purpose: Handle the level movement
//------------------------------------------------------------------------
void Level::HandleEvents(Info &info, const Common::Event &Event) {
- if (!gMouse.inside_hud) {
+ if (!g_engine->_mouse->inside_hud) {
if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
// Only go to path if our mouse is a normal walking cursor
- if (!gMouse.hover) {
+ if (!g_engine->_mouse->hover) {
// The destination coordinate is set by adding camera position to click position
- Vector2i dest = gMouse.button;
+ Vector2i dest = g_engine->_mouse->button;
dest.x += camera.x;
dest.y += camera.y;
@@ -119,12 +119,12 @@ void Level::HandleEvents(Info &info, const Common::Event &Event) {
// Purpose: Handle the level movement
//------------------------------------------------------------------------
void Level::HandleEvents(Info &info, const SDL_Event &Event) {
- if (!gMouse.inside_hud) {
+ if (!g_engine->_mouse->inside_hud) {
if (Event.type == SDL_MOUSEBUTTONDOWN) {
// Only go to path if our mouse is a normal walking cursor
- if (!gMouse.hover) {
+ if (!g_engine->_mouse->hover) {
// The destination coordinate is set by adding camera position to click position
- Vector2i dest = gMouse.button;
+ Vector2i dest = g_engine->_mouse->button;
dest.x += camera.x;
dest.y += camera.y;
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index a6181bcbacf..e5fc15866b6 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -52,24 +52,24 @@ bool Level::ContainsClick(const std::string &id, const Common::Event &Event) {
for (auto &i : objects) {
Rect r = i.PosRect();
- if (r.Contains(gMouse.motion.x + camera.x, gMouse.motion.y + camera.y)) {
+ if (r.Contains(g_engine->_mouse->motion.x + camera.x, g_engine->_mouse->motion.y + camera.y)) {
// This is to show the sprite's name on top of their head
i.hover = true;
// This is to update the mouse cursor only if we're in talking range of a sprite
if (i.ID() == id)
- gMouse.hover = true;
+ g_engine->_mouse->hover = true;
} else
i.hover = false;
}
return false;
- } else if (gMouse.Pressed()) {
+ } else if (g_engine->_mouse->Pressed()) {
for (auto &i : objects) {
if (i.ID() == id) {
Rect r = i.PosRect();
- if (r.Contains(gMouse.button.x + camera.x, gMouse.button.y + camera.y)) {
- gMouse.hover = true;
+ if (r.Contains(g_engine->_mouse->button.x + camera.x, g_engine->_mouse->button.y + camera.y)) {
+ g_engine->_mouse->hover = true;
return true;
}
}
@@ -89,24 +89,24 @@ bool Level::ContainsClick(const std::string &id, const SDL_Event &Event) {
for (auto &i : objects) {
Rect r = i.PosRect();
- if (r.Contains(gMouse.motion.x + camera.x, gMouse.motion.y + camera.y)) {
+ if (r.Contains(g_engine->_mouse->motion.x + camera.x, g_engine->_mouse->motion.y + camera.y)) {
// This is to show the sprite's name on top of their head
i.hover = true;
// This is to update the mouse cursor only if we're in talking range of a sprite
if (i.ID() == id)
- gMouse.hover = true;
+ g_engine->_mouse->hover = true;
} else
i.hover = false;
}
return false;
- } else if (gMouse.Pressed()) {
+ } else if (g_engine->_mouse->Pressed()) {
for (auto &i : objects) {
if (i.ID() == id) {
Rect r = i.PosRect();
- if (r.Contains(gMouse.button.x + camera.x, gMouse.button.y + camera.y)) {
- gMouse.hover = true;
+ if (r.Contains(g_engine->_mouse->button.x + camera.x, g_engine->_mouse->button.y + camera.y)) {
+ g_engine->_mouse->hover = true;
return true;
}
}
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 68ba3348f68..aa67dfb34e7 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -155,7 +155,7 @@ MainMenu::MainMenu() {
// Purpose: Event/input handling Events
//------------------------------------------------------------------------
void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- gMouse.HandleEvents(Event);
+ g_engine->_mouse->HandleEvents(Event);
if (state != STATE_CREDITS) {
int choice = me_main.HandleEvents(Event);
@@ -289,7 +289,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
// Purpose: Event/input handling Events
//------------------------------------------------------------------------
void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- gMouse.HandleEvents(Event);
+ g_engine->_mouse->HandleEvents(Event);
if (state != STATE_CREDITS) {
int choice = me_main.HandleEvents(Event);
@@ -552,7 +552,7 @@ void MainMenu::Draw() {
break;
}
- gMouse.Draw();
+ g_engine->_mouse->Draw();
}
void MainMenu::SetUI() {
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index df9e622d6ea..e0383991999 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -156,7 +156,7 @@ ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset
dim.y += YOffset;
if (visible) {
- if (dim.Contains(gMouse.motion.x, gMouse.motion.y)) {
+ if (dim.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y)) {
hover_mouse = true;
if (!hover_prev) {
@@ -170,17 +170,17 @@ ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset
if (Event.type == Common::EVENT_MOUSEMOVE) {
if (canmove && mousepressed) {
- x += gMouse.rel.x;
- y += gMouse.rel.y;
+ x += g_engine->_mouse->rel.x;
+ y += g_engine->_mouse->rel.y;
return BUAC_GRABBED;
}
} else if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
- // The gMouse button pressed, then released, comprises of a click action
- if (dim.Contains(gMouse.button.x, gMouse.button.y))
+ // The g_engine->_mouse button pressed, then released, comprises of a click action
+ if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y))
mousepressed = true;
} else if ((Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP) && mousepressed) {
Reset();
- if (dim.Contains(gMouse.button.x, gMouse.button.y)) {
+ if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
mousepressed = false;
if (Event.type == Common::EVENT_LBUTTONUP) {
gMusicManager.PlayEffect(se_click, 0);
@@ -207,7 +207,7 @@ ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, co
dim.y += YOffset;
if (visible) {
- if (dim.Contains(gMouse.motion.x, gMouse.motion.y)) {
+ if (dim.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y)) {
hover_mouse = true;
if (!hover_prev) {
@@ -221,17 +221,17 @@ ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, co
if (Event.type == SDL_MOUSEMOTION) {
if (canmove && mousepressed) {
- x += gMouse.rel.x;
- y += gMouse.rel.y;
+ x += g_engine->_mouse->rel.x;
+ y += g_engine->_mouse->rel.y;
return BUAC_GRABBED;
}
} else if (Event.type == SDL_MOUSEBUTTONDOWN) {
- // The gMouse button pressed, then released, comprises of a click action
- if (dim.Contains(gMouse.button.x, gMouse.button.y))
+ // The g_engine->_mouse button pressed, then released, comprises of a click action
+ if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y))
mousepressed = true;
} else if (Event.type == SDL_MOUSEBUTTONUP && mousepressed) {
Reset();
- if (dim.Contains(gMouse.button.x, gMouse.button.y)) {
+ if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
mousepressed = false;
if (Event.button.button == SDL_BUTTON_LEFT) {
gMusicManager.PlayEffect(se_click, 0);
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index a39386d0bd1..5bb3e4ca8b7 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -123,7 +123,7 @@ void HUD::InternalEvents(bool ShowMap) {
}
HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
- gMouse.inside_hud = bg.Contains(gMouse.motion.x, gMouse.motion.y);
+ g_engine->_mouse->inside_hud = bg.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y);
int choice = menu.HandleEvents(Event);
@@ -141,7 +141,7 @@ HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &
#if 0
HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
- gMouse.inside_hud = bg.Contains(gMouse.motion.x, gMouse.motion.y);
+ g_engine->_mouse->inside_hud = bg.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y);
int choice = menu.HandleEvents(Event);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index db955ba6d05..11be1ba4ed0 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/map.h"
namespace Crab {
@@ -197,7 +199,7 @@ void Map::Move(const Common::Event &Event) {
bool click = false;
int count = 0;
for (auto &i : scroll.element) {
- if (i.Contains(gMouse.button)) {
+ if (i.Contains(g_engine->_mouse->button)) {
if (count == DIRECTION_UP)
vel.y = -1 * speed;
else if (count == DIRECTION_DOWN)
@@ -227,8 +229,8 @@ void Map::Move(const Common::Event &Event) {
case Common::EVENT_MOUSEMOVE:
if (pan) {
- camera.x -= gMouse.rel.x;
- camera.y -= gMouse.rel.y;
+ camera.x -= g_engine->_mouse->rel.x;
+ camera.y -= g_engine->_mouse->rel.y;
Validate();
}
break;
@@ -272,7 +274,7 @@ void Map::Move(const SDL_Event &Event) {
bool click = false;
int count = 0;
for (auto &i : scroll.element) {
- if (i.Contains(gMouse.button)) {
+ if (i.Contains(g_engine->_mouse->button)) {
if (count == DIRECTION_UP)
vel.y = -1 * speed;
else if (count == DIRECTION_DOWN)
@@ -299,8 +301,8 @@ void Map::Move(const SDL_Event &Event) {
break;
case SDL_MOUSEMOTION:
if (pan) {
- camera.x -= gMouse.rel.x;
- camera.y -= gMouse.rel.y;
+ camera.x -= g_engine->_mouse->rel.x;
+ camera.y -= g_engine->_mouse->rel.y;
Validate();
}
break;
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index c6a1955ea65..ebf35ec10e3 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -61,7 +61,7 @@ void Slider::Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
bool Slider::HandleEvents(const Common::Event &Event) {
// A person is moving the knob
if (knob.HandleEvents(Event) == BUAC_GRABBED) {
- int dx = gMouse.motion.x - bar.x;
+ int dx = g_engine->_mouse->motion.x - bar.x;
if (dx < 0)
dx = 0;
@@ -76,8 +76,8 @@ bool Slider::HandleEvents(const Common::Event &Event) {
}
// If a person clicks on the slider bar, the knob needs to travel there
- if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && bar.Contains(gMouse.button.x, gMouse.button.y)) {
- knob.x = gMouse.button.x;
+ if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && bar.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
+ knob.x = g_engine->_mouse->button.x;
knob.y = bar.y;
value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
@@ -91,7 +91,7 @@ bool Slider::HandleEvents(const Common::Event &Event) {
bool Slider::HandleEvents(const SDL_Event &Event) {
// A person is moving the knob
if (knob.HandleEvents(Event) == BUAC_GRABBED) {
- int dx = gMouse.motion.x - bar.x;
+ int dx = g_engine->_mouse->motion.x - bar.x;
if (dx < 0)
dx = 0;
@@ -106,8 +106,8 @@ bool Slider::HandleEvents(const SDL_Event &Event) {
}
// If a person clicks on the slider bar, the knob needs to travel there
- if (Event.type == SDL_MOUSEBUTTONDOWN && bar.Contains(gMouse.button.x, gMouse.button.y)) {
- knob.x = gMouse.button.x;
+ if (Event.type == SDL_MOUSEBUTTONDOWN && bar.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
+ knob.x = g_engine->_mouse->button.x;
knob.y = bar.y;
value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
Commit: 3e5795f19dd0367a11e37446fcfcfc1a06f95910
https://github.com/scummvm/scummvm/commit/3e5795f19dd0367a11e37446fcfcfc1a06f95910
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not create global object for ImageManager
Changed paths:
engines/crab/image/ImageManager.cpp
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index b04ead300f9..463d9580e01 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -41,13 +41,6 @@ namespace Crab {
using namespace pyrodactyl::image;
-// Stuff we use throughout the game
-namespace pyrodactyl {
-namespace image {
-ImageManager gImageManager;
-}
-} // End of namespace pyrodactyl
-
//------------------------------------------------------------------------
// Purpose: Load assets here.
//------------------------------------------------------------------------
Commit: 536344c42abc2bf4c56cd0015fc94941f47c8949
https://github.com/scummvm/scummvm/commit/536344c42abc2bf4c56cd0015fc94941f47c8949
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get rid of unused ZERO_VEL global object
Changed paths:
engines/crab/animation/sprite.h
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index bf9ba21f5aa..7d59cd426a8 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -51,7 +51,6 @@ class PathfindingAgent;
namespace pyrodactyl {
namespace anim {
-const Vector3f ZERO_VEL;
class Sprite {
protected:
Commit: cae078aa23524ac2d34ed306b944f09415e04b98
https://github.com/scummvm/scummvm/commit/cae078aa23524ac2d34ed306b944f09415e04b98
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make EventStore a public member of Engine class
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/gameevent.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/ui/emotion.cpp
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 2dd1d4d92c2..1c591c9343f 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -93,6 +93,7 @@ Common::Error CrabEngine::run() {
_imageManager = new pyrodactyl::image::ImageManager();
_mouse = new pyrodactyl::input::Cursor();
+ _eventStore = new pyrodactyl::event::GameEventStore();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 60c7ff5ac0e..36aca21353a 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -73,6 +73,12 @@ namespace Crab {
class App;
struct CrabGameDescription;
+namespace pyrodactyl {
+namespace event {
+ struct GameEventStore;
+} // End of namespace event
+} // End of namespace pyrodactyl
+
class CrabEngine : public Engine {
private:
const ADGameDescription *_gameDescription;
@@ -89,6 +95,7 @@ public:
Graphics::ManagedSurface *_renderSurface = nullptr;
pyrodactyl::image::ImageManager *_imageManager = nullptr;
pyrodactyl::input::Cursor *_mouse = nullptr;
+ pyrodactyl::event::GameEventStore *_eventStore = nullptr;
Common::FSNode _gameDataDir;
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 49b1e0ce3ec..98665473037 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -184,7 +184,7 @@ void Info::VarDel(const std::string &name) {
void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
if (PersonValid(per_id)) // Valid person id
{
- if (trait_id >= 0 && (unsigned int)trait_id < gEventStore.trait.size()) // Valid trait id
+ if (trait_id >= 0 && (unsigned int)trait_id < g_engine->_eventStore->trait.size()) // Valid trait id
{
// Check for duplicate traits, DONT award anything if duplicate found
Person *p = &PersonGet(per_id);
@@ -193,9 +193,9 @@ void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
if (i->id == trait_id)
return;
- p->trait.push_back(gEventStore.trait.at(trait_id));
+ p->trait.push_back(g_engine->_eventStore->trait.at(trait_id));
- gEventStore.SetAchievement(gEventStore.trait.at(trait_id).id);
+ g_engine->_eventStore->SetAchievement(g_engine->_eventStore->trait.at(trait_id).id);
}
}
}
@@ -203,7 +203,7 @@ void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
void Info::TraitDel(const std::string &per_id, const int &trait_id) {
if (PersonValid(per_id)) // Valid person id
{
- if (trait_id > 0 && (unsigned int)trait_id < gEventStore.trait.size()) // Valid trait id
+ if (trait_id > 0 && (unsigned int)trait_id < g_engine->_eventStore->trait.size()) // Valid trait id
{
Person *p = &PersonGet(per_id);
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 9db3e1f789c..e13c0483a42 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -32,12 +32,6 @@
namespace Crab {
-namespace pyrodactyl {
-namespace event {
-GameEventStore gEventStore;
-}
-} // End of namespace pyrodactyl
-
using namespace pyrodactyl::event;
void GameEventStore::AddConv(rapidxml::xml_node<char> *node, unsigned int &index) {
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 11e3131372e..3322205d879 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -83,7 +83,6 @@ struct GameEventStore {
void SetAchievement(const int &id);
};
-extern GameEventStore gEventStore;
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index b7bcf71166a..2a605b04f1f 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -58,7 +58,7 @@ void GameEvent::Load(rapidxml::xml_node<char> *node) {
special = 0;
} else if (Type == "reply") {
type = EVENT_REPLY;
- gEventStore.AddConv(node, special);
+ g_engine->_eventStore->AddConv(node, special);
} else if (Type == "animation") {
type = EVENT_ANIM;
LoadNum(special, "anim", node);
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 7ebddd69928..73a181cd627 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -141,7 +141,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- int choice = reply.HandleEvents(info, gEventStore.con.at(cur_event->special), cur_event->title, oh, Event);
+ int choice = reply.HandleEvents(info, g_engine->_eventStore->con.at(cur_event->special), cur_event->title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -228,7 +228,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- int choice = reply.HandleEvents(info, gEventStore.con.at(cur_event->special), cur_event->title, oh, Event);
+ int choice = reply.HandleEvents(info, g_engine->_eventStore->con.at(cur_event->special), cur_event->title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -281,7 +281,7 @@ void Manager::InternalEvents(Info &info, Level &level, std::vector<EventResult>
using namespace pyrodactyl::anim;
DrawType draw_val = DRAW_SAME;
- if (gEventStore.anim.at(cur_event->special).InternalEvents(draw_val))
+ if (g_engine->_eventStore->anim.at(cur_event->special).InternalEvents(draw_val))
event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
@@ -320,7 +320,7 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
if (event_map.count(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_ANIM:
- gEventStore.anim.at(cur_event->special).Draw();
+ g_engine->_eventStore->anim.at(cur_event->special).Draw();
break;
case EVENT_DIALOG:
g_engine->_imageManager->DimScreen();
@@ -374,10 +374,10 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
switch (cur_event->type) {
case EVENT_ANIM:
- gEventStore.anim.at(cur_event->special).Start();
+ g_engine->_eventStore->anim.at(cur_event->special).Start();
break;
case EVENT_REPLY:
- reply.Cache(info, gEventStore.con.at(cur_event->special));
+ reply.Cache(info, g_engine->_eventStore->con.at(cur_event->special));
break;
default:
break;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 46272768f00..6e840a9a3ca 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -58,7 +58,7 @@ void Game::LoadGame(const std::string &filename) {
void Game::Init(const std::string &filename) {
gLoadScreen.Dim();
- pyrodactyl::event::gEventStore.Clear();
+ g_engine->_eventStore->Clear();
game_over.Clear(false);
state = STATE_GAME;
savefile.auto_slot = false;
@@ -94,7 +94,7 @@ void Game::Init(const std::string &filename) {
gem.Load(node->first_node("event"), pop_default);
LoadStr(path, "store", node->first_node("event"));
- pyrodactyl::event::gEventStore.Load(path);
+ g_engine->_eventStore->Load(path);
}
if (NodeValid("map", node)) {
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 78f2cd9fe39..4c77d590129 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -124,7 +124,7 @@ private:
}
// Load the current player image
- void PlayerImg() { hud.PlayerImg(pyrodactyl::event::gEventStore.img.at(info.PlayerImg())); }
+ void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->img.at(info.PlayerImg())); }
public:
Game() { StartNewGame(); }
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 707ae152928..2b4f561da65 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -42,8 +42,8 @@ void EmotionIndicator::Load(rapidxml::xml_node<char> *node) {
void EmotionIndicator::Draw(const int &select) {
if (select >= 0 && (unsigned int)select < value.size())
- if (value.at(select) < gEventStore.tone.size()) {
- text.Draw(gEventStore.tone.at(value.at(select)).text);
+ if (value.at(select) < g_engine->_eventStore->tone.size()) {
+ text.Draw(g_engine->_eventStore->tone.at(value.at(select)).text);
}
}
Commit: 3ea2ffa4762d9f17510a3668d56711c839076f72
https://github.com/scummvm/scummvm/commit/3ea2ffa4762d9f17510a3668d56711c839076f72
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make TextManager a public member of Engine class
Changed paths:
engines/crab/TMX/TMXMap.cpp
engines/crab/animation/PopUp.cpp
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/level/talknotify.cpp
engines/crab/mainmenu.cpp
engines/crab/splash.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/QuestText.cpp
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/questmenu.cpp
engines/crab/ui/textdata.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index e3e96934290..dc34bf13acf 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -269,8 +269,8 @@ void TMXMap::DrawDebug(const Rect &camera) {
for (auto i = area_stairs.begin(); i != area_stairs.end(); ++i) {
i->Draw(-camera.x, -camera.y, 0, 254, 0, 254);
- //gTextManager.Draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x).c_str(), 0);
- //gTextManager.Draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y).c_str(), 0);
+ //g_engine->_textManager->Draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x).c_str(), 0);
+ //g_engine->_textManager->Draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y).c_str(), 0);
}
// Draw the pathfinding grid (SZ)
@@ -289,7 +289,7 @@ void TMXMap::DrawDebug(const Rect &camera) {
i->pos.Draw(-camera.x, -camera.y, 254, 216, 0);
area_walk.Draw(-camera.x, -camera.y, 254, 254, 254, 254);
- // gTextManager.Draw(0, 200, NumberToString(sprite_layer), 0);
+ // g_engine->_textManager->Draw(0, 200, NumberToString(sprite_layer), 0);
// Use this if you want to draw poly lines in debug
/*bool start = true;
@@ -306,8 +306,8 @@ void TMXMap::DrawDebug(const Rect &camera) {
DrawLine(prev.x - camera.x, prev.y - camera.y, j->x - camera.x, j->y - camera.y, 0, 0, 0, 254);
- gTextManager.Draw(j->x - camera.x + 100, j->y - camera.y, NumberToString(j->x), 0);
- gTextManager.Draw(j->x - camera.x + 200, j->y - camera.y, NumberToString(j->y), 0);
+ g_engine->_textManager->Draw(j->x - camera.x + 100, j->y - camera.y, NumberToString(j->x), 0);
+ g_engine->_textManager->Draw(j->x - camera.x + 200, j->y - camera.y, NumberToString(j->y), 0);
prev = *j;
}
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index dd460dbf5ed..cdb8fa32a7a 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -116,11 +116,11 @@ void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const std::s
void PopUp::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
if (show) {
if (x + pop.x < camera.w / 3)
- pyrodactyl::text::gTextManager.Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
else if (x + pop.x > (2 * camera.w) / 3)
- pyrodactyl::text::gTextManager.Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
else
- pyrodactyl::text::gTextManager.Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
}
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 56403482bf7..884370d5366 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -284,12 +284,12 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
/*int health = 0;
info.StatGet(id, pyrodactyl::stat::STAT_HEALTH, health);
- gTextManager.Draw(x + 60.0f, y - 100.0f, NumberToString(health), 0);
+ g_engine->_textManager->Draw(x + 60.0f, y - 100.0f, NumberToString(health), 0);
pyrodactyl::people::PersonState state = info.State(id);
- gTextManager.Draw(x, y - 60.0f, NumberToString(state), 0);
+ g_engine->_textManager->Draw(x, y - 60.0f, NumberToString(state), 0);
- gTextManager.Draw(x + 120.0f, y - 60.0f, NumberToString(ai_data.dest.y), 0);*/
+ g_engine->_textManager->Draw(x + 120.0f, y - 60.0f, NumberToString(ai_data.dest.y), 0);*/
if (pathing.m_vSolution.size() > 0) {
for (auto iter = pathing.m_vSolution.begin(); iter != pathing.m_vSolution.end(); ++iter) {
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 2b4e2a0bc07..6277a0cd42c 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -252,7 +252,7 @@ void App::Run() {
++fpscount;
if (CurrentStateID >= 0)
- pyrodactyl::text::gTextManager.Draw(0, 0, NumberToString(fpsval), 0);
+ g_engine->_textManager->Draw(0, 0, NumberToString(fpsval), 0);
}
#endif
if (g_system->getMillis() - lasts > 1000) {
@@ -263,7 +263,7 @@ void App::Run() {
++fpscount;
if (CurrentStateID >= 0)
- pyrodactyl::text::gTextManager.Draw(0, 0, NumberToString(fpsval).c_str(), 0);
+ g_engine->_textManager->Draw(0, 0, NumberToString(fpsval).c_str(), 0);
//const Graphics::ManagedSurface *s = g_engine->_renderSurface;
//g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
g_engine->_screen->update();
@@ -311,7 +311,7 @@ App::~App() {
g_engine->_imageManager->Quit();
pyrodactyl::music::gMusicManager.Quit();
- pyrodactyl::text::gTextManager.Quit();
+ g_engine->_textManager->Quit();
pyrodactyl::input::gInput.Quit();
gLoadScreen.Quit();
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 1c591c9343f..2b7f0aa6ae1 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -94,6 +94,7 @@ Common::Error CrabEngine::run() {
_imageManager = new pyrodactyl::image::ImageManager();
_mouse = new pyrodactyl::input::Cursor();
_eventStore = new pyrodactyl::event::GameEventStore();
+ _textManager = new pyrodactyl::text::TextManager();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 36aca21353a..6217006dcd9 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -65,6 +65,7 @@
#include "graphics/screen.h"
#include "crab/image/ImageManager.h"
#include "crab/input/cursor.h"
+#include "crab/text/TextManager.h"
#include "crab/detection.h"
@@ -96,6 +97,7 @@ public:
pyrodactyl::image::ImageManager *_imageManager = nullptr;
pyrodactyl::input::Cursor *_mouse = nullptr;
pyrodactyl::event::GameEventStore *_eventStore = nullptr;
+ pyrodactyl::text::TextManager *_textManager = nullptr;
Common::FSNode _gameDataDir;
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index 62733dc871c..b077e3a2978 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -55,7 +55,7 @@ void TalkNotify::Draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s
// Find the sprite name
std::string text = info.GetName(s.ID());
- gTextManager.Draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
+ g_engine->_textManager->Draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
}
} // End of namespace Crab
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index aa67dfb34e7..2d58702b818 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -491,14 +491,14 @@ void MainMenu::Draw() {
// Draw the game name and mod path if a mod is loaded
if (gFilePath.mod_cur != "res/default.xml") {
- gTextManager.Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
- //gTextManager.Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2 + 50, gFilePath.mod_cur, 5, 1, ALIGN_CENTER);
+ g_engine->_textManager->Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
+ //g_engine->_textManager->Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2 + 50, gFilePath.mod_cur, 5, 1, ALIGN_CENTER);
}
me_main.Draw();
#ifdef UNREST_DEMO
- gTextManager.Draw(logo.x + logo.w, logo.y + logo.h / 2, "Demo", 0, 0, ALIGN_CENTER);
+ g_engine->_textManager->Draw(logo.x + logo.w, logo.y + logo.h / 2, "Demo", 0, 0, ALIGN_CENTER);
steam.Draw();
direct.Draw();
#endif
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 2f016e1371f..5dcda1a4ad8 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -64,7 +64,7 @@ void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
gLoadScreen.Load();
g_engine->_imageManager->Init();
- pyrodactyl::text::gTextManager.Init();
+ g_engine->_textManager->Init();
load_complete = true;
}
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 42f02d21b2b..4a3637bc754 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -37,12 +37,6 @@ namespace Crab {
using namespace pyrodactyl::text;
-namespace pyrodactyl {
-namespace text {
-TextManager gTextManager;
-}
-} // End of namespace pyrodactyl
-
//------------------------------------------------------------------------
// Purpose: Initialize, set cache etc
//------------------------------------------------------------------------
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 83c8a85aa5f..b35a4e095ad 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -116,7 +116,6 @@ public:
const unsigned int &line_width, const unsigned int &line_height, const bool &background = false);
};
-extern TextManager gTextManager;
} // End of namespace text
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index ff00e8d0f6f..c9c7d61ae37 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -159,9 +159,9 @@ void CreditScreen::Draw() {
if (i->heading) {
cur.y += heading.inc;
if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40) // Only draw text if it is actually visible on screen
- gTextManager.Draw(cur.x, cur.y, i->text, heading.color, heading.font, heading.align);
+ g_engine->_textManager->Draw(cur.x, cur.y, i->text, heading.color, heading.font, heading.align);
} else if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40)
- gTextManager.Draw(cur.x, cur.y, i->text, paragraph.color, paragraph.font, paragraph.align);
+ g_engine->_textManager->Draw(cur.x, cur.y, i->text, paragraph.color, paragraph.font, paragraph.align);
// If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
if (cur.y > gScreenSettings.cur.h + 40)
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index 46997c66e0e..259216287ab 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/ParagraphData.h"
namespace Crab {
@@ -42,7 +44,7 @@ bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const boo
}
void ParagraphData::Draw(const std::string &val, const int &XOffset, const int &YOffset) {
- pyrodactyl::text::gTextManager.Draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
+ g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index b88e31dca1f..190e8afd064 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/QuestText.h"
namespace Crab {
@@ -125,7 +127,7 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
// Draw first entry in selected color, and older quest entries in standard color
if (i == 0)
- gTextManager.Draw(x, y, q.text[i], col_s, font, align, line.x, line.y);
+ g_engine->_textManager->Draw(x, y, q.text[i], col_s, font, align, line.x, line.y);
else
ParagraphData::Draw(q.text[i], inc.x * count, inc.y * count);
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 941d331d9b6..8eb3b6387b6 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/ReplyButton.h"
namespace Crab {
@@ -57,11 +59,11 @@ void ReplyButton::Load(rapidxml::xml_node<char> *node) {
void ReplyButton::Draw(const int &XOffset, const int &YOffset) {
if (visible) {
if (mousepressed)
- gTextManager.Draw(x + XOffset, y + YOffset, text, col_s, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->Draw(x + XOffset, y + YOffset, text, col_s, font, align, line_size.x, line_size.y);
else if (hover_mouse || hover_key)
- gTextManager.Draw(x + XOffset, y + YOffset, text, col_h, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->Draw(x + XOffset, y + YOffset, text, col_h, font, align, line_size.x, line_size.y);
else
- gTextManager.Draw(x + XOffset, y + YOffset, text, col_b, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->Draw(x + XOffset, y + YOffset, text, col_b, font, align, line_size.x, line_size.y);
}
}
@@ -71,10 +73,10 @@ void ReplyButton::Cache(const std::string &val, const int &spacing, const int &b
// Find out about the font
int width = 0, height = 0;
#if 0
- TTF_SizeText(gTextManager.GetFont(font), val.c_str(), &width, &height);
+ TTF_SizeText(g_engine->_textManager->GetFont(font), val.c_str(), &width, &height);
#endif
- width = gTextManager.GetFont(font)->getStringWidth(val.c_str());
- height = gTextManager.GetFont(font)->getFontHeight();
+ width = g_engine->_textManager->GetFont(font)->getStringWidth(val.c_str());
+ height = g_engine->_textManager->GetFont(font)->getFontHeight();
// Find out how many line sizes will the text take
int lines = ((text.length() - 1) / line_size.x) + 1;
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index c299ccf8c78..88f8b203fc5 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -52,7 +52,7 @@ void SectionHeader::Load(rapidxml::xml_node<char> *node) {
LoadBool(draw_l, "left", node);
LoadBool(draw_r, "right", node);
- SDL_Surface *surf = gTextManager.RenderTextBlended(font, text, col);
+ SDL_Surface *surf = g_engine->_textManager->RenderTextBlended(font, text, col);
if (align == ALIGN_CENTER) {
left.x = x - surf->w / 2 - g_engine->_imageManager->GetTexture(img).W();
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 59cd0f0477c..c3e801ac1a5 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -132,9 +132,9 @@ void QuestMenu::Draw(Button &bu_map) {
// Only draw in _s color if we are on the same button and page
if ((unsigned int)sel_bu == count && (unsigned int)sel_page == menu.CurrentPage())
- gTextManager.Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_s, font, align);
+ g_engine->_textManager->Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_s, font, align);
else
- gTextManager.Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_n, font, align);
+ g_engine->_textManager->Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_n, font, align);
if (quest.at(i).unread) {
using namespace pyrodactyl::image;
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index 6414ed13735..ce23df19e28 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/TextData.h"
namespace Crab {
@@ -49,11 +51,11 @@ bool TextData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &ec
}
void TextData::Draw(const std::string &val, const int &XOffset, const int &YOffset) {
- pyrodactyl::text::gTextManager.Draw(x + XOffset, y + YOffset, val, col, font, align, background);
+ g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, col, font, align, background);
}
void TextData::DrawColor(const std::string &val, const int &color, const int &XOffset, const int &YOffset) {
- pyrodactyl::text::gTextManager.Draw(x + XOffset, y + YOffset, val, color, font, align, background);
+ g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, color, font, align, background);
}
} // End of namespace Crab
Commit: a554abe6263aaec673c89856ec1614d3177f5873
https://github.com/scummvm/scummvm/commit/a554abe6263aaec673c89856ec1614d3177f5873
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make LoadingScreen a public member of Engine class
Changed paths:
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/splash.cpp
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index fd66deb0768..2987dde134a 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -86,6 +86,4 @@ void LoadingScreen::Quit() {
i->Delete();
}
-LoadingScreen gLoadScreen;
-
} // End of namespace Crab
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 93c63d9837b..9d53b37cf7c 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -71,8 +71,6 @@ public:
void Quit();
};
-extern LoadingScreen gLoadScreen;
-
} // End of namespace Crab
#endif // CRAB_LOADINGSCREEN_H
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 6277a0cd42c..575a47806b8 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -313,7 +313,7 @@ App::~App() {
pyrodactyl::music::gMusicManager.Quit();
g_engine->_textManager->Quit();
pyrodactyl::input::gInput.Quit();
- gLoadScreen.Quit();
+ g_engine->_loadingScreen->Quit();
SDL_DestroyRenderer(gRenderer);
SDL_DestroyWindow(gWindow);
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 2b7f0aa6ae1..c9bc012d50d 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -95,6 +95,7 @@ Common::Error CrabEngine::run() {
_mouse = new pyrodactyl::input::Cursor();
_eventStore = new pyrodactyl::event::GameEventStore();
_textManager = new pyrodactyl::text::TextManager();
+ _loadingScreen = new LoadingScreen();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 6217006dcd9..855b6b896b6 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -74,10 +74,13 @@ namespace Crab {
class App;
struct CrabGameDescription;
+class LoadingScreen;
+
namespace pyrodactyl {
namespace event {
struct GameEventStore;
} // End of namespace event
+
} // End of namespace pyrodactyl
class CrabEngine : public Engine {
@@ -98,6 +101,10 @@ public:
pyrodactyl::input::Cursor *_mouse = nullptr;
pyrodactyl::event::GameEventStore *_eventStore = nullptr;
pyrodactyl::text::TextManager *_textManager = nullptr;
+
+ // Should these really be inside the Engine class?
+ LoadingScreen *_loadingScreen = nullptr;
+
Common::FSNode _gameDataDir;
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 6e840a9a3ca..a313b6c5c4e 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -57,7 +57,7 @@ void Game::LoadGame(const std::string &filename) {
}
void Game::Init(const std::string &filename) {
- gLoadScreen.Dim();
+ g_engine->_loadingScreen->Dim();
g_engine->_eventStore->Clear();
game_over.Clear(false);
state = STATE_GAME;
@@ -114,7 +114,7 @@ void Game::Init(const std::string &filename) {
bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
if (gFilePath.level.contains(id.c_str())) {
- gLoadScreen.Draw();
+ g_engine->_loadingScreen->Draw();
// Load the assets local to this level
// If the filename is same as the previous one, skip loading
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 5dcda1a4ad8..4cd0aaf96f4 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -62,7 +62,7 @@ Splash::~Splash() {
//------------------------------------------------------------------------
void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
- gLoadScreen.Load();
+ g_engine->_loadingScreen->Load();
g_engine->_imageManager->Init();
g_engine->_textManager->Init();
load_complete = true;
Commit: ed2786e8eb4dfe4ed47d1552bd30815988ce25df
https://github.com/scummvm/scummvm/commit/ed2786e8eb4dfe4ed47d1552bd30815988ce25df
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make HelpScreen a public member of Engine class
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index c9bc012d50d..3436a926a2f 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -96,6 +96,7 @@ Common::Error CrabEngine::run() {
_eventStore = new pyrodactyl::event::GameEventStore();
_textManager = new pyrodactyl::text::TextManager();
_loadingScreen = new LoadingScreen();
+ _helpScreen = new pyrodactyl::ui::SlideShow();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 855b6b896b6..4acfbe1e1ac 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -81,6 +81,10 @@ namespace event {
struct GameEventStore;
} // End of namespace event
+namespace ui {
+class SlideShow;
+} // End of namespace ui
+
} // End of namespace pyrodactyl
class CrabEngine : public Engine {
@@ -104,6 +108,8 @@ public:
// Should these really be inside the Engine class?
LoadingScreen *_loadingScreen = nullptr;
+ pyrodactyl::ui::SlideShow *_helpScreen = nullptr;
+
Common::FSNode _gameDataDir;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index a313b6c5c4e..a390202710d 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -298,7 +298,7 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
info.inv.HandleEvents(level.PlayerID(), Event);
break;
case STATE_HELP:
- gHelpScreen.HandleEvents(Event);
+ g_engine->_helpScreen->HandleEvents(Event);
default:
break;
}
@@ -452,7 +452,7 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
info.inv.HandleEvents(level.PlayerID(), Event);
break;
case STATE_HELP:
- gHelpScreen.HandleEvents(Event);
+ g_engine->_helpScreen->HandleEvents(Event);
default:
break;
}
@@ -541,7 +541,7 @@ void Game::Draw() {
break;
case STATE_HELP:
g_engine->_imageManager->DimScreen();
- gHelpScreen.Draw();
+ g_engine->_helpScreen->Draw();
hud.back.Draw();
hud.Draw(info, level.PlayerID());
break;
@@ -819,9 +819,9 @@ void Game::ToggleState(const State &s) {
// Only load help screen image if we have to
if (state == STATE_HELP)
- pyrodactyl::ui::gHelpScreen.Refresh();
+ g_engine->_helpScreen->Refresh();
else
- pyrodactyl::ui::gHelpScreen.Clear();
+ g_engine->_helpScreen->Clear();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 2d58702b818..b83f4af4e3b 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -74,7 +74,7 @@ MainMenu::MainMenu() {
if (helpconf.ready()) {
rapidxml::xml_node<char> *hnode = helpconf.Doc()->first_node("help");
if (NodeValid(hnode))
- gHelpScreen.Load(hnode);
+ g_engine->_helpScreen->Load(hnode);
}
}
@@ -276,7 +276,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
case STATE_HELP:
- gHelpScreen.HandleEvents(Event);
+ g_engine->_helpScreen->HandleEvents(Event);
break;
default:
@@ -408,7 +408,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
break;
case STATE_HELP:
- gHelpScreen.HandleEvents(Event);
+ g_engine->_helpScreen->HandleEvents(Event);
break;
default:
@@ -470,9 +470,9 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
// If switching to help screen, load latest image otherwise remove it from memory
if (state == STATE_HELP)
- gHelpScreen.Refresh();
+ g_engine->_helpScreen->Refresh();
else
- gHelpScreen.Clear();
+ g_engine->_helpScreen->Clear();
}
//------------------------------------------------------------------------
@@ -543,7 +543,7 @@ void MainMenu::Draw() {
break;
case STATE_HELP:
- gHelpScreen.Draw();
+ g_engine->_helpScreen->Draw();
back.Draw();
me_main.Draw();
break;
@@ -563,7 +563,7 @@ void MainMenu::SetUI() {
gOptionMenu.SetUI();
mod.SetUI();
gLoadMenu.SetUI();
- gHelpScreen.SetUI();
+ g_engine->_helpScreen->SetUI();
credits.SetUI();
accept.SetUI();
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index b079c40289d..a8873614c81 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -32,12 +32,6 @@
namespace Crab {
-namespace pyrodactyl {
-namespace ui {
-SlideShow gHelpScreen;
-}
-} // End of namespace pyrodactyl
-
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 5c350ca6f12..70589d558fa 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -80,7 +80,6 @@ public:
void SetUI();
};
-extern SlideShow gHelpScreen;
} // End of namespace ui
} // End of namespace pyrodactyl
Commit: d8331e83d23b2f4168c06cb2a0866a79fb63eced
https://github.com/scummvm/scummvm/commit/d8331e83d23b2f4168c06cb2a0866a79fb63eced
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make OptionMenu a public member of Engine class
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/PauseMenu.cpp
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 3436a926a2f..2f12180c9f6 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -97,6 +97,7 @@ Common::Error CrabEngine::run() {
_textManager = new pyrodactyl::text::TextManager();
_loadingScreen = new LoadingScreen();
_helpScreen = new pyrodactyl::ui::SlideShow();
+ _optionMenu = new pyrodactyl::ui::OptionMenu();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 4acfbe1e1ac..e9d327e39e4 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -83,6 +83,7 @@ namespace event {
namespace ui {
class SlideShow;
+class OptionMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
@@ -109,7 +110,7 @@ public:
// Should these really be inside the Engine class?
LoadingScreen *_loadingScreen = nullptr;
pyrodactyl::ui::SlideShow *_helpScreen = nullptr;
-
+ pyrodactyl::ui::OptionMenu *_optionMenu = nullptr;
Common::FSNode _gameDataDir;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index a390202710d..8bff2d44e63 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -863,7 +863,7 @@ void Game::SetUI() {
hud.SetUI();
gLoadMenu.SetUI();
- gOptionMenu.SetUI();
+ g_engine->_optionMenu->SetUI();
gem.SetUI();
info.SetUI();
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index b83f4af4e3b..77aadd38979 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -52,9 +52,9 @@ MainMenu::MainMenu() {
back.Load(node->first_node("back"));
- if (!gOptionMenu.loaded) {
- gOptionMenu.Load(node->first_node("option")->first_attribute("path")->value());
- gOptionMenu.loaded = true;
+ if (!g_engine->_optionMenu->loaded) {
+ g_engine->_optionMenu->Load(node->first_node("option")->first_attribute("path")->value());
+ g_engine->_optionMenu->loaded = true;
}
mod.Load(node->first_node("mod")->first_attribute("path")->value());
@@ -225,7 +225,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
#endif
case STATE_OPTIONS:
- if (gOptionMenu.HandleEvents(back, Event))
+ if (g_engine->_optionMenu->HandleEvents(back, Event))
ChangeState(STATE_NORMAL);
break;
@@ -357,7 +357,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
break;
#endif
case STATE_OPTIONS:
- if (gOptionMenu.HandleEvents(back, Event))
+ if (g_engine->_optionMenu->HandleEvents(back, Event))
ChangeState(STATE_NORMAL);
break;
@@ -425,7 +425,7 @@ void MainMenu::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID)
i.InternalEvents();
if (state == STATE_OPTIONS)
- gOptionMenu.InternalEvents();
+ g_engine->_optionMenu->InternalEvents();
}
//------------------------------------------------------------------------
@@ -505,7 +505,7 @@ void MainMenu::Draw() {
break;
case STATE_OPTIONS:
- gOptionMenu.Draw(back);
+ g_engine->_optionMenu->Draw(back);
me_main.Draw();
break;
@@ -560,7 +560,7 @@ void MainMenu::SetUI() {
logo.SetUI();
back.SetUI();
- gOptionMenu.SetUI();
+ g_engine->_optionMenu->SetUI();
mod.SetUI();
gLoadMenu.SetUI();
g_engine->_helpScreen->SetUI();
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index ccac578d3c2..379b9ddd64a 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -117,7 +117,6 @@ public:
void SaveState();
};
-extern OptionMenu gOptionMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 7d5ea098a58..c65f52346e7 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -58,7 +58,7 @@ bool PauseMenu::Draw(Button &back) {
back.Draw();
break;
case STATE_OPTION:
- gOptionMenu.Draw(back);
+ g_engine->_optionMenu->Draw(back);
return true;
default:
break;
@@ -109,8 +109,8 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
state = STATE_NORMAL;
break;
case STATE_OPTION:
- if (gOptionMenu.HandleEvents(back, Event)) {
- gOptionMenu.Reset();
+ if (g_engine->_optionMenu->HandleEvents(back, Event)) {
+ g_engine->_optionMenu->Reset();
state = STATE_NORMAL;
}
break;
@@ -170,8 +170,8 @@ PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
state = STATE_NORMAL;
break;
case STATE_OPTION:
- if (gOptionMenu.HandleEvents(back, Event)) {
- gOptionMenu.Reset();
+ if (g_engine->_optionMenu->HandleEvents(back, Event)) {
+ g_engine->_optionMenu->Reset();
state = STATE_NORMAL;
}
break;
@@ -190,7 +190,7 @@ PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
#endif
bool PauseMenu::DisableHotkeys() {
- return (state == STATE_SAVE && save.DisableHotkeys()) || (state == STATE_OPTION && gOptionMenu.DisableHotkeys());
+ return (state == STATE_SAVE && save.DisableHotkeys()) || (state == STATE_OPTION && g_engine->_optionMenu->DisableHotkeys());
}
void PauseMenu::SetUI() {
Commit: 387e1116cb89f8ed951c9575b315a4375d827144
https://github.com/scummvm/scummvm/commit/387e1116cb89f8ed951c9575b315a4375d827144
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make LoadMenu a public member of Engine class
Changed paths:
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/FileMenu.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/PauseMenu.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 575a47806b8..ac68c03fa9c 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -177,8 +177,8 @@ void App::Run() {
case GAMESTATE_LOAD_GAME:
#if 0
- if (boost::filesystem::exists(pyrodactyl::ui::gLoadMenu.SelectedPath()))
- CurrentState = new Game(pyrodactyl::ui::gLoadMenu.SelectedPath());
+ if (boost::filesystem::exists(g_engine->_loadMenu->SelectedPath()))
+ CurrentState = new Game(pyrodactyl::ui::.SelectedPath());
else
CurrentState = new Game();
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 2f12180c9f6..c0b5ca745a4 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -98,6 +98,7 @@ Common::Error CrabEngine::run() {
_loadingScreen = new LoadingScreen();
_helpScreen = new pyrodactyl::ui::SlideShow();
_optionMenu = new pyrodactyl::ui::OptionMenu();
+ _loadMenu = new pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData>();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index e9d327e39e4..ec783137831 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -84,6 +84,9 @@ namespace event {
namespace ui {
class SlideShow;
class OptionMenu;
+template<typename FileType>
+class FileMenu;
+class SaveFileData;
} // End of namespace ui
} // End of namespace pyrodactyl
@@ -111,6 +114,7 @@ public:
LoadingScreen *_loadingScreen = nullptr;
pyrodactyl::ui::SlideShow *_helpScreen = nullptr;
pyrodactyl::ui::OptionMenu *_optionMenu = nullptr;
+ pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData> *_loadMenu = nullptr;
Common::FSNode _gameDataDir;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 8bff2d44e63..c433fa094ed 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -174,7 +174,7 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
break;
}
} else if (state == STATE_LOSE_LOAD) {
- if (gLoadMenu.HandleEvents(Event)) {
+ if (g_engine->_loadMenu->HandleEvents(Event)) {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
return;
@@ -230,7 +230,7 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
} else if (gInput.Equals(IG_QUICKLOAD, Event) == SDL_RELEASED && !info.IronMan()) {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
- gLoadMenu.SelectedPath(FullPath(savefile.quick));
+ g_engine->_loadMenu->SelectedPath(FullPath(savefile.quick));
return;
}
#endif
@@ -330,7 +330,7 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
break;
}
} else if (state == STATE_LOSE_LOAD) {
- if (gLoadMenu.HandleEvents(Event)) {
+ if (g_engine->_loadMenu->HandleEvents(Event)) {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
return;
@@ -385,7 +385,7 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
} else if (gInput.Equals(IG_QUICKLOAD, Event) == SDL_RELEASED && !info.IronMan()) {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
- gLoadMenu.SelectedPath(FullPath(savefile.quick));
+ g_engine->_loadMenu->SelectedPath(FullPath(savefile.quick));
return;
}
@@ -549,7 +549,7 @@ void Game::Draw() {
hud.gom.Draw();
break;
case STATE_LOSE_LOAD:
- gLoadMenu.Draw();
+ g_engine->_loadMenu->Draw();
hud.back.Draw();
break;
default:
@@ -862,7 +862,7 @@ void Game::SetUI() {
map.SetUI();
hud.SetUI();
- gLoadMenu.SetUI();
+ g_engine->_loadMenu->SetUI();
g_engine->_optionMenu->SetUI();
gem.SetUI();
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 77aadd38979..8e12e416907 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -65,7 +65,7 @@ MainMenu::MainMenu() {
if (loadconf.ready()) {
rapidxml::xml_node<char> *loadnode = loadconf.Doc()->first_node("load_menu");
if (NodeValid(loadnode))
- gLoadMenu.Load(loadnode);
+ g_engine->_loadMenu->Load(loadnode);
}
}
@@ -165,7 +165,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
switch (choice) {
case 0:
- if (gLoadMenu.SelectNewestFile()) {
+ if (g_engine->_loadMenu->SelectNewestFile()) {
ChangeState(STATE_NORMAL);
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
@@ -176,7 +176,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
case 2:
ChangeState(STATE_LOAD);
- gLoadMenu.ScanDir();
+ g_engine->_loadMenu->ScanDir();
break;
case 3:
ChangeState(STATE_OPTIONS);
@@ -235,7 +235,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
case STATE_LOAD:
- if (gLoadMenu.HandleEvents(Event)) {
+ if (g_engine->_loadMenu->HandleEvents(Event)) {
ChangeState(STATE_NORMAL);
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
@@ -299,7 +299,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
switch (choice) {
case 0:
- if (gLoadMenu.SelectNewestFile()) {
+ if (g_engine->_loadMenu->SelectNewestFile()) {
ChangeState(STATE_NORMAL);
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
@@ -310,7 +310,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
break;
case 2:
ChangeState(STATE_LOAD);
- gLoadMenu.ScanDir();
+ g_engine->_loadMenu->ScanDir();
break;
case 3:
ChangeState(STATE_OPTIONS);
@@ -367,7 +367,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
break;
case STATE_LOAD:
- if (gLoadMenu.HandleEvents(Event)) {
+ if (g_engine->_loadMenu->HandleEvents(Event)) {
ChangeState(STATE_NORMAL);
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
@@ -462,7 +462,7 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
me_main.UseKeyboard((state == STATE_NORMAL));
// Continue button is only enabled if there is a save to load
- me_main.element.at(0).visible = !gLoadMenu.Empty();
+ me_main.element.at(0).visible = !g_engine->_loadMenu->Empty();
// Enable credits and quit button if outside all menus, otherwise disable it
me_main.element.at(6).visible = (state == STATE_NORMAL);
@@ -514,7 +514,7 @@ void MainMenu::Draw() {
break;
case STATE_LOAD:
- gLoadMenu.Draw();
+ g_engine->_loadMenu->Draw();
back.Draw();
me_main.Draw();
break;
@@ -562,7 +562,7 @@ void MainMenu::SetUI() {
back.SetUI();
g_engine->_optionMenu->SetUI();
mod.SetUI();
- gLoadMenu.SetUI();
+ g_engine->_loadMenu->SetUI();
g_engine->_helpScreen->SetUI();
credits.SetUI();
diff --git a/engines/crab/ui/FileMenu.cpp b/engines/crab/ui/FileMenu.cpp
index 3cec57efef0..b76160c6241 100644
--- a/engines/crab/ui/FileMenu.cpp
+++ b/engines/crab/ui/FileMenu.cpp
@@ -34,7 +34,7 @@ namespace Crab {
namespace pyrodactyl {
namespace ui {
-FileMenu<SaveFileData> gLoadMenu;
+
}
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 4eb113a8daa..5f1a2b50b8a 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -270,7 +270,6 @@ public:
}
};
-extern FileMenu<SaveFileData> gLoadMenu;
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index c65f52346e7..03329844848 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -54,7 +54,7 @@ bool PauseMenu::Draw(Button &back) {
back.Draw();
break;
case STATE_LOAD:
- gLoadMenu.Draw();
+ g_engine->_loadMenu->Draw();
back.Draw();
break;
case STATE_OPTION:
@@ -85,7 +85,7 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
break;
case 2:
state = STATE_LOAD;
- //gLoadMenu.ScanDir();
+ //g_engine->_loadMenu->ScanDir();
break;
case 3:
state = STATE_OPTION;
@@ -115,7 +115,7 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
}
break;
case STATE_LOAD:
- if (gLoadMenu.HandleEvents(Event))
+ if (g_engine->_loadMenu->HandleEvents(Event))
return PS_LOAD;
else if (back.HandleEvents(Event) == BUAC_LCLICK)
state = STATE_NORMAL;
@@ -146,7 +146,7 @@ PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
break;
case 2:
state = STATE_LOAD;
- gLoadMenu.ScanDir();
+ g_engine->_loadMenu->ScanDir();
break;
case 3:
state = STATE_OPTION;
@@ -176,7 +176,7 @@ PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
}
break;
case STATE_LOAD:
- if (gLoadMenu.HandleEvents(Event))
+ if (g_engine->_loadMenu->HandleEvents(Event))
return PS_LOAD;
else if (back.HandleEvents(Event) == BUAC_LCLICK)
state = STATE_NORMAL;
Commit: 93ec4959d4c12f5f590e7df775de897866eed409
https://github.com/scummvm/scummvm/commit/93ec4959d4c12f5f590e7df775de897866eed409
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unused private members in Image class
Changed paths:
engines/crab/image/Image.h
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 13e86cd14c3..63180de74a1 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -45,8 +45,6 @@ namespace image {
class Image {
// The dimensions of the image
int w, h;
- int id;
- TextureFlipType _flip;
// The actual hardware texture
//SDL_Texture *texture;
Commit: ab0460d7445b039ed3571f1a5d4cf4e82825d173
https://github.com/scummvm/scummvm/commit/ab0460d7445b039ed3571f1a5d4cf4e82825d173
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup Engine class for CRAB
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index c0b5ca745a4..87150f93838 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -85,10 +85,8 @@ Common::String CrabEngine::getGameId() const {
}
Common::Error CrabEngine::run() {
- // Initialize 320x200 paletted graphics mode
_format = new Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
initGraphics(1280, 720, _format);
- _renderSurface = new Graphics::ManagedSurface(1920, 1080, *_format);
_screen = new Graphics::Screen(1280, 720, *_format);
_imageManager = new pyrodactyl::image::ImageManager();
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index ec783137831..70d3b035386 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -78,14 +78,16 @@ class LoadingScreen;
namespace pyrodactyl {
namespace event {
- struct GameEventStore;
+struct GameEventStore;
} // End of namespace event
namespace ui {
class SlideShow;
class OptionMenu;
+
template<typename FileType>
class FileMenu;
+
class SaveFileData;
} // End of namespace ui
@@ -104,7 +106,7 @@ protected:
public:
Graphics::Screen *_screen = nullptr;
Graphics::PixelFormat *_format = nullptr;
- Graphics::ManagedSurface *_renderSurface = nullptr;
+
pyrodactyl::image::ImageManager *_imageManager = nullptr;
pyrodactyl::input::Cursor *_mouse = nullptr;
pyrodactyl::event::GameEventStore *_eventStore = nullptr;
Commit: 2fe79da95ab40cdef8c421ce13ccfee5a06039af
https://github.com/scummvm/scummvm/commit/2fe79da95ab40cdef8c421ce13ccfee5a06039af
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make InputManager a public member of Engine class
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/input/fightinput.cpp
engines/crab/input/hotkey.cpp
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/mainmenu.cpp
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
engines/crab/ui/menu.h
engines/crab/ui/textarea.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 884370d5366..c90aca9b383 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -372,20 +372,20 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
#if 0
// Disable destination as soon as player presses a direction key
// X axis
- if (gInput.State(IG_LEFT)) {
+ if (g_engine->_inputManager->State(IG_LEFT)) {
ai_data.dest.active = false;
XVel(-player_speed * sc.walk_vel_mod.x);
- } else if (gInput.State(IG_RIGHT)) {
+ } else if (g_engine->_inputManager->State(IG_RIGHT)) {
ai_data.dest.active = false;
XVel(player_speed * sc.walk_vel_mod.x);
} else if (!ai_data.dest.active)
XVel(0.0f);
// Y axis
- if (gInput.State(IG_UP)) {
+ if (g_engine->_inputManager->State(IG_UP)) {
ai_data.dest.active = false;
YVel(-player_speed * sc.walk_vel_mod.y);
- } else if (gInput.State(IG_DOWN)) {
+ } else if (g_engine->_inputManager->State(IG_DOWN)) {
ai_data.dest.active = false;
YVel(player_speed * sc.walk_vel_mod.y);
} else if (!ai_data.dest.active)
@@ -438,20 +438,20 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
{
// Disable destination as soon as player presses a direction key
// X axis
- if (gInput.State(IG_LEFT)) {
+ if (g_engine->_inputManager->State(IG_LEFT)) {
ai_data.dest.active = false;
XVel(-player_speed * sc.walk_vel_mod.x);
- } else if (gInput.State(IG_RIGHT)) {
+ } else if (g_engine->_inputManager->State(IG_RIGHT)) {
ai_data.dest.active = false;
XVel(player_speed * sc.walk_vel_mod.x);
} else if (!ai_data.dest.active)
XVel(0.0f);
// Y axis
- if (gInput.State(IG_UP)) {
+ if (g_engine->_inputManager->State(IG_UP)) {
ai_data.dest.active = false;
YVel(-player_speed * sc.walk_vel_mod.y);
- } else if (gInput.State(IG_DOWN)) {
+ } else if (g_engine->_inputManager->State(IG_DOWN)) {
ai_data.dest.active = false;
YVel(player_speed * sc.walk_vel_mod.y);
} else if (!ai_data.dest.active)
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index ac68c03fa9c..bc7927cdd67 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -116,10 +116,10 @@ bool App::Init() {
SDL_DisableScreenSaver();
// Initial check for controllers on the system
- pyrodactyl::input::gInput.AddController();
+ g_engine->_inputManager->AddController();
#endif
// Initialize and load input
- pyrodactyl::input::gInput.Init();
+ g_engine->_inputManager->Init();
LoadSettings("res/settings.xml");
gScreenSettings.in_game = false;
@@ -223,7 +223,7 @@ void App::Run() {
gScreenSettings.SetFullscreen();
} else if (Event.type == SDL_KEYUP && Event.key.keysym.scancode == SDL_SCANCODE_GRAVE && Event.key.keysym.mod & KMOD_CTRL)
GameDebug = !GameDebug;
- pyrodactyl::input::gInput.HandleController(Event);
+ g_engine->_inputManager->HandleController(Event);
}
#endif
while (g_system->getEventManager()->pollEvent(e)) {
@@ -312,7 +312,7 @@ App::~App() {
g_engine->_imageManager->Quit();
pyrodactyl::music::gMusicManager.Quit();
g_engine->_textManager->Quit();
- pyrodactyl::input::gInput.Quit();
+ g_engine->_inputManager->Quit();
g_engine->_loadingScreen->Quit();
SDL_DestroyRenderer(gRenderer);
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 87150f93838..292f50596bd 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -93,6 +93,7 @@ Common::Error CrabEngine::run() {
_mouse = new pyrodactyl::input::Cursor();
_eventStore = new pyrodactyl::event::GameEventStore();
_textManager = new pyrodactyl::text::TextManager();
+ _inputManager = new pyrodactyl::input::InputManager();
_loadingScreen = new LoadingScreen();
_helpScreen = new pyrodactyl::ui::SlideShow();
_optionMenu = new pyrodactyl::ui::OptionMenu();
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 70d3b035386..bfd8edbee1e 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -65,6 +65,7 @@
#include "graphics/screen.h"
#include "crab/image/ImageManager.h"
#include "crab/input/cursor.h"
+#include "crab/input/input.h"
#include "crab/text/TextManager.h"
#include "crab/detection.h"
@@ -111,6 +112,7 @@ public:
pyrodactyl::input::Cursor *_mouse = nullptr;
pyrodactyl::event::GameEventStore *_eventStore = nullptr;
pyrodactyl::text::TextManager *_textManager = nullptr;
+ pyrodactyl::input::InputManager *_inputManager = nullptr;
// Should these really be inside the Engine class?
LoadingScreen *_loadingScreen = nullptr;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index c433fa094ed..b11f5c9ffef 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -213,7 +213,7 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
- info.TalkKeyDown = gInput.State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
+ info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
level.HandleEvents(info, Event);
@@ -224,10 +224,10 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
#if 0
- if (gInput.Equals(IG_QUICKSAVE, Event) == SDL_RELEASED) {
+ if (g_engine->_inputManager->Equals(IG_QUICKSAVE, Event) == SDL_RELEASED) {
CreateSaveGame(SAVEGAME_QUICK);
return;
- } else if (gInput.Equals(IG_QUICKLOAD, Event) == SDL_RELEASED && !info.IronMan()) {
+ } else if (g_engine->_inputManager->Equals(IG_QUICKLOAD, Event) == SDL_RELEASED && !info.IronMan()) {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
g_engine->_loadMenu->SelectedPath(FullPath(savefile.quick));
@@ -369,7 +369,7 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
- info.TalkKeyDown = gInput.State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
+ info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
level.HandleEvents(info, Event);
@@ -379,10 +379,10 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
return;
}
- if (gInput.Equals(IG_QUICKSAVE, Event) == SDL_RELEASED) {
+ if (g_engine->_inputManager->Equals(IG_QUICKSAVE, Event) == SDL_RELEASED) {
CreateSaveGame(SAVEGAME_QUICK);
return;
- } else if (gInput.Equals(IG_QUICKLOAD, Event) == SDL_RELEASED && !info.IronMan()) {
+ } else if (g_engine->_inputManager->Equals(IG_QUICKLOAD, Event) == SDL_RELEASED && !info.IronMan()) {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
g_engine->_loadMenu->SelectedPath(FullPath(savefile.quick));
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index a079ab7e094..76d0f3b3da7 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/input/fightinput.h"
namespace Crab {
@@ -40,9 +42,9 @@ void FightInput::Load(rapidxml::xml_node<char> *node) {
}
FightAnimationType FightInput::HandleEvents(const Common::Event &Event) {
- if (gInput.State(IG_ATTACK))
+ if (g_engine->_inputManager->State(IG_ATTACK))
return FA_ATTACK;
- else if (gInput.State(IG_BLOCK))
+ else if (g_engine->_inputManager->State(IG_BLOCK))
return FA_BLOCK;
return FA_IDLE;
@@ -50,9 +52,9 @@ FightAnimationType FightInput::HandleEvents(const Common::Event &Event) {
#if 0
FightAnimationType FightInput::HandleEvents(const SDL_Event &Event) {
- if (gInput.State(IG_ATTACK))
+ if (g_engine->_inputManager->State(IG_ATTACK))
return FA_ATTACK;
- else if (gInput.State(IG_BLOCK))
+ else if (g_engine->_inputManager->State(IG_BLOCK))
return FA_BLOCK;
return FA_IDLE;
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index bb9334dc17c..ba3d9da1980 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -41,7 +41,7 @@ void HotKey::Load(rapidxml::xml_node<char> *node) {
#if 0
bool HotKey::HandleEvents(const SDL_Event &Event) {
if (input > IT_NONE && input < IT_TOTAL) {
- int result = gInput.Equals(input, Event);
+ int result = g_engine->_inputManager->Equals(input, Event);
if (result == SDL_PRESSED)
keydown = true;
@@ -66,7 +66,7 @@ const char *HotKey::Name() {
#if 0
if (input > IT_NONE && input < IT_TOTAL)
- return SDL_GetScancodeName(gInput.iv[input].key);
+ return SDL_GetScancodeName(g_engine->_inputManager->iv[input].key);
#endif
return "";
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 4e6bf1eaac3..5fede291317 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -32,12 +32,6 @@
namespace Crab {
-namespace pyrodactyl {
-namespace input {
-InputManager gInput;
-}
-} // End of namespace pyrodactyl
-
using namespace pyrodactyl::input;
//using namespace boost::filesystem;
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 2a74d69c0a4..06a05f47b8e 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -144,8 +144,6 @@ public:
void Save();
};
-// The saved key values
-extern InputManager gInput;
} // End of namespace input
} // End of namespace pyrodactyl
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 8e12e416907..fcf5a132ebd 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -202,7 +202,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
}
#if 0
- if (gInput.Equals(IU_BACK, Event) == SDL_PRESSED || (back.HandleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
+ if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_PRESSED || (back.HandleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
if (state == STATE_SAVENAME)
ChangeState(STATE_DIFF);
else if (state != STATE_NORMAL)
@@ -335,7 +335,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
}
}
- if (gInput.Equals(IU_BACK, Event) == SDL_PRESSED || (back.HandleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
+ if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_PRESSED || (back.HandleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
if (state == STATE_SAVENAME)
ChangeState(STATE_DIFF);
else if (state != STATE_NORMAL)
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index 17d9080d728..ebe412bcd63 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/KeyBindMenu.h"
namespace Crab {
@@ -102,10 +104,10 @@ void KeyBindMenu::InitMenu(const int &type) {
int yoffset = inc.y * ((i / 2) % dim.x) + divide.y * ((i / 2) / dim.x);
menu[type].element.at(i).Init(prim, xoffset, yoffset);
- menu[type].element.at(i).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].key);
+ menu[type].element.at(i).caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].key);
menu[type].element.at(i + 1).Init(alt, xoffset, yoffset);
- menu[type].element.at(i + 1).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].alt);
+ menu[type].element.at(i + 1).caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].alt);
}
#endif
}
@@ -118,7 +120,7 @@ void KeyBindMenu::DrawDesc(const int &type) {
int xoffset = inc.x * i + divide.x * (i / dim.x);
int yoffset = inc.y * (i % dim.x) + divide.y * (i / dim.x);
- desc.Draw(gInput.iv[i + start].name, xoffset, yoffset);
+ desc.Draw(g_engine->_inputManager->iv[i + start].name, xoffset, yoffset);
}
}
@@ -137,8 +139,8 @@ void KeyBindMenu::SetCaption() {
StartAndSize(sel_controls.cur, start, size);
for (int i = 0; i < size * 2; i += 2) {
- menu[sel_controls.cur].element.at(i).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].key);
- menu[sel_controls.cur].element.at(i + 1).caption.text = SDL_GetScancodeName(gInput.iv[start + (i / 2)].alt);
+ menu[sel_controls.cur].element.at(i).caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].key);
+ menu[sel_controls.cur].element.at(i + 1).caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].alt);
}
#endif
}
@@ -208,19 +210,19 @@ void KeyBindMenu::SwapKey(const SDL_Scancode &find) {
int pos = start + (choice / 2);
for (int i = start; i < start + size; ++i) {
- if (gInput.iv[i].key == find) {
- gInput.iv[i].key = gInput.iv[pos].key;
+ if (g_engine->_inputManager->iv[i].key == find) {
+ g_engine->_inputManager->iv[i].key = g_engine->_inputManager->iv[pos].key;
break;
- } else if (gInput.iv[i].alt == find) {
- gInput.iv[i].alt = gInput.iv[pos].key;
+ } else if (g_engine->_inputManager->iv[i].alt == find) {
+ g_engine->_inputManager->iv[i].alt = g_engine->_inputManager->iv[pos].key;
break;
}
}
if (choice % 2 == 0)
- gInput.iv[pos].key = find;
+ g_engine->_inputManager->iv[pos].key = find;
else
- gInput.iv[pos].alt = find;
+ g_engine->_inputManager->iv[pos].alt = find;
}
#endif
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 6a4fa91a883..4be5399fdfc 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -342,7 +342,7 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
case 4:
// Save settings to file
- pyrodactyl::input::gInput.Save();
+ g_engine->_inputManager->Save();
SaveState();
general.CreateBackup();
gScreenSettings.CreateBackup();
@@ -350,7 +350,7 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
case 5:
// Revert all changes made to settings and exit
- pyrodactyl::input::gInput.RestoreBackup();
+ g_engine->_inputManager->RestoreBackup();
keybind.SetCaption();
gScreenSettings.RestoreBackup();
general.RestoreBackup();
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 0c4b87f9d73..05cdd295356 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -92,14 +92,14 @@ bool OptionSelect::HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
if (cur > 0) {
- if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_LEFT, Event) == SDL_PRESSED)) {
+ if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)) {
cur--;
return true;
}
}
if (cur < option.text.size() - 1) {
- if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
+ if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
cur++;
return true;
}
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index a035532ba5f..31e79fa187e 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -157,7 +157,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
tone.value.at(element_count) = dat.reply.at(reply_count).tone;
- //std::string text = SDL_GetScancodeName(gInput.iv[IU_REPLY_0 + element_count].key);
+ //std::string text = SDL_GetScancodeName(g_engine->_inputManager->iv[IU_REPLY_0 + element_count].key);
//text += ". " + i->text;
std::string text = i->text;
info.InsertName(text);
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 9a7d31ea5a7..fa5dfb2f285 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -110,7 +110,7 @@ bool GameSaveMenu::HandleEvents(const SDL_Event &Event) {
return true;
}
- if (gInput.Equals(IU_BACK, Event) == SDL_RELEASED) {
+ if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_RELEASED) {
ta_name.text = "New Save";
state = STATE_NORMAL;
}
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index a8873614c81..3033026d1d9 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -99,13 +99,13 @@ void SlideShow::HandleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
if (index > 0)
- if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_LEFT, Event) == SDL_PRESSED)) {
+ if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)) {
index--;
Refresh();
}
if (index < path.size() - 1)
- if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
+ if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
index++;
Refresh();
}
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 5bb3e4ca8b7..fbbf23dec06 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -172,7 +172,7 @@ void HUD::SetTooltip() {
for (auto i = menu.element.begin(); i != menu.element.end() && count < tooltip.size(); ++i, ++count)
i->tooltip.text = tooltip.at(count) + " (" + i->hotkey.Name() + ")";
- menu.element.at(HS_PAUSE).tooltip.text = tooltip.at(HS_PAUSE) + " (" + SDL_GetScancodeName(gInput.iv[IG_PAUSE].key) + ")";
+ menu.element.at(HS_PAUSE).tooltip.text = tooltip.at(HS_PAUSE) + " (" + SDL_GetScancodeName(g_engine->_inputManager->iv[IG_PAUSE].key) + ")";
#endif
}
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 11be1ba4ed0..b1b388d7eb7 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -238,18 +238,18 @@ void Map::Move(const Common::Event &Event) {
warning("STUB: Map keyboard processing");
#if 0
// Move the map camera if player presses the direction keys
- if (gInput.Equals(IU_UP, Event) == SDL_PRESSED)
+ if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_PRESSED)
vel.y = -1 * speed;
- else if (gInput.Equals(IU_DOWN, Event) == SDL_PRESSED)
+ else if (g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_PRESSED)
vel.y = speed;
- else if (gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED)
+ else if (g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)
vel.x = speed;
- else if (gInput.Equals(IU_LEFT, Event) == SDL_PRESSED)
+ else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)
vel.x = -1 * speed;
// Stop moving when we release a key (but only in that direction)
- else if (gInput.Equals(IU_UP, Event) == SDL_RELEASED || gInput.Equals(IU_DOWN, Event) == SDL_RELEASED)
+ else if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_RELEASED || g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_RELEASED)
vel.y = 0;
- else if (gInput.Equals(IU_LEFT, Event) == SDL_RELEASED || gInput.Equals(IU_RIGHT, Event) == SDL_RELEASED)
+ else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_RELEASED || g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_RELEASED)
vel.x = 0;
break;
}
@@ -308,18 +308,18 @@ void Map::Move(const SDL_Event &Event) {
break;
default: {
// Move the map camera if player presses the direction keys
- if (gInput.Equals(IU_UP, Event) == SDL_PRESSED)
+ if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_PRESSED)
vel.y = -1 * speed;
- else if (gInput.Equals(IU_DOWN, Event) == SDL_PRESSED)
+ else if (g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_PRESSED)
vel.y = speed;
- else if (gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED)
+ else if (g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)
vel.x = speed;
- else if (gInput.Equals(IU_LEFT, Event) == SDL_PRESSED)
+ else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)
vel.x = -1 * speed;
// Stop moving when we release a key (but only in that direction)
- else if (gInput.Equals(IU_UP, Event) == SDL_RELEASED || gInput.Equals(IU_DOWN, Event) == SDL_RELEASED)
+ else if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_RELEASED || g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_RELEASED)
vel.y = 0;
- else if (gInput.Equals(IU_LEFT, Event) == SDL_RELEASED || gInput.Equals(IU_RIGHT, Event) == SDL_RELEASED)
+ else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_RELEASED || g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_RELEASED)
vel.x = 0;
break;
}
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 8237cbd8bc7..416a87dfcc7 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -128,26 +128,26 @@ protected:
if (!element.empty()) {
if (path_type != PATH_HORIZONTAL) {
- if (gInput.Equals(IU_DOWN, Event) == SDL_PRESSED) {
+ if (g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_PRESSED) {
Next();
latest_input = KEYBOARD;
- } else if (gInput.Equals(IU_UP, Event) == SDL_PRESSED) {
+ } else if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_PRESSED) {
Prev();
latest_input = KEYBOARD;
}
}
if (path_type != PATH_VERTICAL) {
- if (gInput.Equals(IU_RIGHT, Event) == SDL_PRESSED) {
+ if (g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED) {
Next();
latest_input = KEYBOARD;
- } else if (gInput.Equals(IU_LEFT, Event) == SDL_PRESSED) {
+ } else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED) {
Prev();
latest_input = KEYBOARD;
}
}
- if (gInput.Equals(IU_ACCEPT, Event) == SDL_PRESSED && hover_index != -1)
+ if (g_engine->_inputManager->Equals(IU_ACCEPT, Event) == SDL_PRESSED && hover_index != -1)
return hover_index;
// We pressed a key, which means we have to update the hovering status
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 53a0e3342ba..06b9aaf5cd9 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -82,7 +82,7 @@ bool TextArea::HandleEvents(const SDL_Event &Event, bool numbers_only) {
// If backspace was pressed and the string isn't blank, remove a character from the end
text.erase(text.length() - 1);
- } else if (gInput.Equals(IU_ACCEPT, Event) == SDL_RELEASED && text.length() != 0) {
+ } else if (g_engine->_inputManager->Equals(IU_ACCEPT, Event) == SDL_RELEASED && text.length() != 0) {
// Now play the accept sound
pyrodactyl::music::gMusicManager.PlayEffect(se_accept, 0);
Commit: 3fcee45f8ba1986eeb735450a733473d6f188134
https://github.com/scummvm/scummvm/commit/3fcee45f8ba1986eeb735450a733473d6f188134
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not create a global object for OptionMenu
Changed paths:
engines/crab/ui/OptionMenu.cpp
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 4be5399fdfc..52e64812c64 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -36,12 +36,6 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::music;
-namespace pyrodactyl {
-namespace ui {
-OptionMenu gOptionMenu;
-}
-} // End of namespace pyrodactyl
-
void OptionMenu::Load(const std::string &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
Commit: b2782a05d4452f58cf67654dc2eaf6743307416e
https://github.com/scummvm/scummvm/commit/b2782a05d4452f58cf67654dc2eaf6743307416e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make ScreenSettings a public member of Engine class
Changed paths:
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/ai/spriteai.cpp
engines/crab/animation/PopUp.cpp
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/image/ImageManager.cpp
engines/crab/level/level.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/mainmenu.cpp
engines/crab/splash.cpp
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/element.cpp
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 2987dde134a..69a98613c58 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -60,7 +60,7 @@ void LoadingScreen::Draw() {
screen.at(cur).Draw();
// Draw the loading text
- text.Draw((gScreenSettings.cur.w - text.W()) / 2, (gScreenSettings.cur.h - text.H()) / 2);
+ text.Draw((g_engine->_screenSettings->cur.w - text.W()) / 2, (g_engine->_screenSettings->cur.h - text.H()) / 2);
// Update the screen
//SDL_RenderPresent(gRenderer);
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 9d53b37cf7c..c19f8c1d598 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -45,7 +45,7 @@ class LoadingScreen {
Screen(rapidxml::xml_node<char> *node) { bg.Load(node, "bg"); }
void Delete() { bg.Delete(); }
- void Draw() { bg.Draw((gScreenSettings.cur.w - bg.W()) / 2, (gScreenSettings.cur.h - bg.H()) / 2); }
+ void Draw() { bg.Draw((g_engine->_screenSettings->cur.w - bg.W()) / 2, (g_engine->_screenSettings->cur.h - bg.H()) / 2); }
};
// The different loading screens
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index 7b1b4f7bfb6..b796c529cb6 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -32,9 +32,6 @@
namespace Crab {
-// Our screen settings object
-ScreenSettings gScreenSettings;
-
// Our global renderer
//SDL_Renderer *gRenderer = nullptr;
Graphics::Surface *gRendererSurface = nullptr;
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index eb6278f1967..a3656d3cc43 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -151,8 +151,6 @@ public:
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
-extern ScreenSettings gScreenSettings;
-
}
#endif // CRAB_SCREENSETTINGS_H
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 886aebda834..632503f5aab 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -125,7 +125,7 @@ bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &velocity, const S
// If the destination is not the pathing goal, we must reach it exactly before moving on.
if (immediateDest != Vector2i(pathing.destination.x, pathing.destination.y)) {
Timer fps;
- float deltaTime = 1.0f / (float)gScreenSettings.fps;
+ float deltaTime = 1.0f / (float)g_engine->_screenSettings->fps;
// Project how far we will travel next frame.
Vector2f velVec = Vector2f(sc.walk_vel_mod.x * velocity * deltaTime, sc.walk_vel_mod.y * velocity * deltaTime);
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index cdb8fa32a7a..7ee63416ce5 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -72,7 +72,7 @@ bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const std::string &pla
std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
if (visible.Evaluate(info) || started_show) {
if (delay.TargetReached()) {
- if (duration.TargetReached(gScreenSettings.text_speed)) {
+ if (duration.TargetReached(g_engine->_screenSettings->text_speed)) {
show = false;
for (auto &i : effect)
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index bc7927cdd67..df64f831759 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -87,13 +87,13 @@ bool App::Init() {
SDL_DisplayMode d;
if (SDL_GetDesktopDisplayMode(0, &d) == 0) {
// Store the default desktop values before starting our own screen
- gScreenSettings.desktop.w = d.w;
- gScreenSettings.desktop.h = d.h;
+ g_engine->_screenSettings->desktop.w = d.w;
+ g_engine->_screenSettings->desktop.h = d.h;
}
// Set up the screen - use windowed mode at start in order to prevent loss of texture on context switching
gWindow = SDL_CreateWindow("Unrest", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
- gScreenSettings.cur.w, gScreenSettings.cur.h, SDL_WINDOW_SHOWN);
+ g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h, SDL_WINDOW_SHOWN);
if (gWindow == nullptr)
return false;
@@ -122,7 +122,7 @@ bool App::Init() {
g_engine->_inputManager->Init();
LoadSettings("res/settings.xml");
- gScreenSettings.in_game = false;
+ g_engine->_screenSettings->in_game = false;
return true;
}
@@ -155,24 +155,24 @@ void App::Run() {
switch (NextStateID) {
case GAMESTATE_TITLE:
CurrentState = new Splash();
- gScreenSettings.in_game = false;
+ g_engine->_screenSettings->in_game = false;
// Now apply all settings - except resolution because that's already set at the start
- gScreenSettings.SetFullscreen();
- gScreenSettings.SetWindowBorder();
- gScreenSettings.SetVsync();
- gScreenSettings.SetGamma();
- gScreenSettings.SetMouseTrap();
+ g_engine->_screenSettings->SetFullscreen();
+ g_engine->_screenSettings->SetWindowBorder();
+ g_engine->_screenSettings->SetVsync();
+ g_engine->_screenSettings->SetGamma();
+ g_engine->_screenSettings->SetMouseTrap();
break;
case GAMESTATE_MAIN_MENU:
CurrentState = new MainMenu();
- gScreenSettings.in_game = false;
+ g_engine->_screenSettings->in_game = false;
break;
case GAMESTATE_NEW_GAME:
CurrentState = new Game();
- gScreenSettings.in_game = true;
+ g_engine->_screenSettings->in_game = true;
break;
case GAMESTATE_LOAD_GAME:
@@ -182,7 +182,7 @@ void App::Run() {
else
CurrentState = new Game();
- gScreenSettings.in_game = true;
+ g_engine->_screenSettings->in_game = true;
break;
#endif
@@ -219,8 +219,8 @@ void App::Run() {
NextStateID = GAMESTATE_EXIT;
} else if (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_RETURN && Event.key.keysym.mod & KMOD_ALT) {
// Toggle full-screen if user presses ALT+ENTER
- gScreenSettings.fullscreen = !gScreenSettings.fullscreen;
- gScreenSettings.SetFullscreen();
+ g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
+ g_engine->_screenSettings->SetFullscreen();
} else if (Event.type == SDL_KEYUP && Event.key.keysym.scancode == SDL_SCANCODE_GRAVE && Event.key.keysym.mod & KMOD_CTRL)
GameDebug = !GameDebug;
g_engine->_inputManager->HandleController(Event);
@@ -234,9 +234,9 @@ void App::Run() {
// Do we have to reposition our interface?
- if (gScreenSettings.change_interface) {
+ if (g_engine->_screenSettings->change_interface) {
CurrentState->SetUI();
- gScreenSettings.change_interface = false;
+ g_engine->_screenSettings->change_interface = false;
}
// Do state Drawing
@@ -274,11 +274,11 @@ void App::Run() {
#endif
// Cap the frame rate
- if (fps.Ticks() < 1000u / gScreenSettings.fps) {
+ if (fps.Ticks() < 1000u / g_engine->_screenSettings->fps) {
#if 0
- SDL_Delay((1000u / gScreenSettings.fps) - fps.Ticks());
+ SDL_Delay((1000u / g_engine->_screenSettings->fps) - fps.Ticks());
#endif
- uint32 delay = (1000u / gScreenSettings.fps) - fps.Ticks();
+ uint32 delay = (1000u / g_engine->_screenSettings->fps) - fps.Ticks();
//warning("Delay by %d ms", delay);
g_system->delayMillis(delay);
}
@@ -291,11 +291,11 @@ void App::LoadSettings(const Common::String &filename) {
rapidxml::xml_node<char> *node = settings.Doc()->first_node("settings");
if (NodeValid(node)) {
// Load the version
- LoadNum(gScreenSettings.version, "version", node);
+ LoadNum(g_engine->_screenSettings->version, "version", node);
// Load screen settings
if (NodeValid("screen", node))
- gScreenSettings.Load(node->first_node("screen"));
+ g_engine->_screenSettings->Load(node->first_node("screen"));
// Start the sound subsystem
#if 0
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 292f50596bd..eb6bfd78975 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -99,6 +99,8 @@ Common::Error CrabEngine::run() {
_optionMenu = new pyrodactyl::ui::OptionMenu();
_loadMenu = new pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData>();
+ _screenSettings = new ScreenSettings();
+
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
CursorMan.replaceCursor(cursor);
delete cursor;
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index bfd8edbee1e..17b972671af 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -67,6 +67,7 @@
#include "crab/input/cursor.h"
#include "crab/input/input.h"
#include "crab/text/TextManager.h"
+#include "crab/ScreenSettings.h"
#include "crab/detection.h"
@@ -120,6 +121,8 @@ public:
pyrodactyl::ui::OptionMenu *_optionMenu = nullptr;
pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData> *_loadMenu = nullptr;
+ ScreenSettings *_screenSettings = nullptr;
+
Common::FSNode _gameDataDir;
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 463d9580e01..634a4d40e20 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -62,7 +62,7 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
bool valid = false;
Common::String path;
- if (!gScreenSettings.quality)
+ if (!g_engine->_screenSettings->quality)
valid = LoadStr(path, "path_low", n, false);
if (!valid)
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 375361d3367..2bde60b04af 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -58,7 +58,7 @@ void Level::Reset() {
background.clear();
fly.clear();
- Camera(0, 0, gScreenSettings.cur.w, gScreenSettings.cur.h);
+ Camera(0, 0, g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h);
showmap.Set(true);
inside_exit = false;
@@ -166,8 +166,8 @@ void Level::PlayerID(const std::string &ID, const int &X, const int &Y) {
// Purpose: Rearrange stuff after resolution change
//------------------------------------------------------------------------
void Level::SetUI() {
- camera.w = gScreenSettings.cur.w;
- camera.h = gScreenSettings.cur.h;
+ camera.w = g_engine->_screenSettings->cur.w;
+ camera.h = g_engine->_screenSettings->cur.h;
SetCamera();
}
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 7f8b1e8bba6..12d3e4f8e28 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -247,8 +247,8 @@ void Level::SetCamera() {
Vector2i focus = objects[player_index].CamFocus();
// Center the camera over the player
- camera.x = focus.x - (gScreenSettings.cur.w / 2);
- camera.y = focus.y - (gScreenSettings.cur.h / 2);
+ camera.x = focus.x - (g_engine->_screenSettings->cur.w / 2);
+ camera.y = focus.y - (g_engine->_screenSettings->cur.h / 2);
// Keep the camera in bounds
if (camera.x > terrain.W() - camera.w)
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index c2ae1a7580b..849c681f79f 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -188,7 +188,7 @@ void Level::LoadMoves(const std::string &filename) {
// See if there is an alternate moveset for low quality setting
// If no, just load the regular one
- if (!gScreenSettings.quality) {
+ if (!g_engine->_screenSettings->quality) {
if (!LoadStr(anim_set[pos], "path_low", n))
LoadStr(anim_set[pos], "path", n);
} else
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index fcf5a132ebd..e488594a158 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -491,8 +491,8 @@ void MainMenu::Draw() {
// Draw the game name and mod path if a mod is loaded
if (gFilePath.mod_cur != "res/default.xml") {
- g_engine->_textManager->Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
- //g_engine->_textManager->Draw(gScreenSettings.cur.w / 2, gScreenSettings.cur.h / 2 + 50, gFilePath.mod_cur, 5, 1, ALIGN_CENTER);
+ g_engine->_textManager->Draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
+ //g_engine->_textManager->Draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2 + 50, gFilePath.mod_cur, 5, 1, ALIGN_CENTER);
}
me_main.Draw();
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 4cd0aaf96f4..852a4c6af88 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -88,9 +88,9 @@ void Splash::Draw() {
// Purpose: Reset UI position
//------------------------------------------------------------------------
void Splash::SetUI() {
- warning("gScreenSettings cur w : %d h : %d", gScreenSettings.cur.w, gScreenSettings.cur.h);
- x = (gScreenSettings.cur.w - background.W()) / 2;
- y = (gScreenSettings.cur.h - background.H()) / 2;
+ warning("ScreenSettings cur w : %d h : %d", g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h);
+ x = (g_engine->_screenSettings->cur.w - background.W()) / 2;
+ y = (g_engine->_screenSettings->cur.h - background.H()) / 2;
}
}
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index c9c7d61ae37..1a4705843a0 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -37,8 +37,8 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
void CreditScreen::Reset() {
- start.x = gScreenSettings.cur.w / 2 - 150;
- start.y = gScreenSettings.cur.h + 20;
+ start.x = g_engine->_screenSettings->cur.w / 2 - 150;
+ start.y = g_engine->_screenSettings->cur.h + 20;
cur.x = start.x;
speed.cur = speed.slow;
}
@@ -158,21 +158,21 @@ void CreditScreen::Draw() {
if (i->heading) {
cur.y += heading.inc;
- if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40) // Only draw text if it is actually visible on screen
+ if (cur.y > -30 && cur.y < g_engine->_screenSettings->cur.h + 40) // Only draw text if it is actually visible on screen
g_engine->_textManager->Draw(cur.x, cur.y, i->text, heading.color, heading.font, heading.align);
- } else if (cur.y > -30 && cur.y < gScreenSettings.cur.h + 40)
+ } else if (cur.y > -30 && cur.y < g_engine->_screenSettings->cur.h + 40)
g_engine->_textManager->Draw(cur.x, cur.y, i->text, paragraph.color, paragraph.font, paragraph.align);
// If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
- if (cur.y > gScreenSettings.cur.h + 40)
+ if (cur.y > g_engine->_screenSettings->cur.h + 40)
break;
}
start.y -= speed.cur;
// Sanity check so that we don't scroll too high or low
- if (start.y > gScreenSettings.cur.h + 40)
- start.y = gScreenSettings.cur.h + 40;
+ if (start.y > g_engine->_screenSettings->cur.h + 40)
+ start.y = g_engine->_screenSettings->cur.h + 40;
else if (start.y < INT_MIN + 10)
start.y = INT_MIN + 10;
}
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index dffe83a4a46..5995863475f 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -28,6 +28,9 @@
*
*/
+
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/GeneralSettingMenu.h"
namespace Crab {
@@ -63,7 +66,7 @@ void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
// Sync popup text value with actual value
for (auto &i : text_speed.element)
- i.state = (i.val == gScreenSettings.text_speed);
+ i.state = (i.val == g_engine->_screenSettings->text_speed);
}
//------------------------------------------------------------------------
@@ -78,16 +81,16 @@ void GeneralSettingMenu::HandleEvents(const Common::Event &Event) {
// No need to change screen here
if (save_on_exit.HandleEvents(Event))
- gScreenSettings.save_on_exit = !gScreenSettings.save_on_exit;
+ g_engine->_screenSettings->save_on_exit = !g_engine->_screenSettings->save_on_exit;
if (mouse_trap.HandleEvents(Event)) {
- gScreenSettings.mouse_trap = !gScreenSettings.mouse_trap;
- gScreenSettings.SetMouseTrap();
+ g_engine->_screenSettings->mouse_trap = !g_engine->_screenSettings->mouse_trap;
+ g_engine->_screenSettings->SetMouseTrap();
}
int result = text_speed.HandleEvents(Event);
if (result >= 0)
- gScreenSettings.text_speed = text_speed.element.at(result).val;
+ g_engine->_screenSettings->text_speed = text_speed.element.at(result).val;
}
#if 0
@@ -103,16 +106,16 @@ void GeneralSettingMenu::HandleEvents(const SDL_Event &Event) {
// No need to change screen here
if (save_on_exit.HandleEvents(Event))
- gScreenSettings.save_on_exit = !gScreenSettings.save_on_exit;
+ g_engine->_screenSettings->save_on_exit = !g_engine->_screenSettings->save_on_exit;
if (mouse_trap.HandleEvents(Event)) {
- gScreenSettings.mouse_trap = !gScreenSettings.mouse_trap;
- gScreenSettings.SetMouseTrap();
+ g_engine->_screenSettings->mouse_trap = !g_engine->_screenSettings->mouse_trap;
+ g_engine->_screenSettings->SetMouseTrap();
}
int result = text_speed.HandleEvents(Event);
if (result >= 0)
- gScreenSettings.text_speed = text_speed.element.at(result).val;
+ g_engine->_screenSettings->text_speed = text_speed.element.at(result).val;
}
#endif
@@ -120,8 +123,8 @@ void GeneralSettingMenu::HandleEvents(const SDL_Event &Event) {
// Purpose: Sync our buttons with screen settings
//------------------------------------------------------------------------
void GeneralSettingMenu::InternalEvents() {
- save_on_exit.state = gScreenSettings.save_on_exit;
- mouse_trap.state = gScreenSettings.mouse_trap;
+ save_on_exit.state = g_engine->_screenSettings->save_on_exit;
+ mouse_trap.state = g_engine->_screenSettings->mouse_trap;
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index df250075bf1..64b800b847c 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/GfxSettingMenu.h"
namespace Crab {
@@ -59,7 +61,7 @@ void GfxSettingMenu::Load(rapidxml::xml_node<char> *node) {
}
if (NodeValid("brightness", node))
- brightness.Load(node->first_node("brightness"), 0, 100, gScreenSettings.gamma * 100);
+ brightness.Load(node->first_node("brightness"), 0, 100, g_engine->_screenSettings->gamma * 100);
}
//------------------------------------------------------------------------
@@ -67,7 +69,7 @@ void GfxSettingMenu::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void GfxSettingMenu::Draw() {
// Window border doesn't matter if you are in fullscreen
- if (!gScreenSettings.fullscreen)
+ if (!g_engine->_screenSettings->fullscreen)
border.Draw();
// Draw toggle buttons
@@ -76,7 +78,7 @@ void GfxSettingMenu::Draw() {
vsync.Draw();
// Quality and resolution can only be changed in the main menu
- if (!gScreenSettings.in_game) {
+ if (!g_engine->_screenSettings->in_game) {
// Tree quality button
quality.Draw();
} else
@@ -92,31 +94,31 @@ void GfxSettingMenu::Draw() {
int GfxSettingMenu::HandleEvents(const Common::Event &Event) {
if (fullscreen.HandleEvents(Event)) {
// Setting video flags is necessary when toggling fullscreen
- gScreenSettings.fullscreen = !gScreenSettings.fullscreen;
- gScreenSettings.SetFullscreen();
+ g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
+ g_engine->_screenSettings->SetFullscreen();
}
// Vsync doesn't need to set the change value
if (vsync.HandleEvents(Event)) {
- gScreenSettings.vsync = !gScreenSettings.vsync;
- gScreenSettings.SetVsync();
+ g_engine->_screenSettings->vsync = !g_engine->_screenSettings->vsync;
+ g_engine->_screenSettings->SetVsync();
}
// Quality and resolution can only be changed in the main menu
- if (!gScreenSettings.in_game) {
+ if (!g_engine->_screenSettings->in_game) {
if (quality.HandleEvents(Event))
- gScreenSettings.quality = !gScreenSettings.quality;
+ g_engine->_screenSettings->quality = !g_engine->_screenSettings->quality;
}
// Window border doesn't matter if you are in fullscreen
- if (border.HandleEvents(Event) && !gScreenSettings.fullscreen) {
- gScreenSettings.border = !gScreenSettings.border;
- gScreenSettings.SetWindowBorder();
+ if (border.HandleEvents(Event) && !g_engine->_screenSettings->fullscreen) {
+ g_engine->_screenSettings->border = !g_engine->_screenSettings->border;
+ g_engine->_screenSettings->SetWindowBorder();
}
if (brightness.HandleEvents(Event)) {
- gScreenSettings.gamma = static_cast<float>(brightness.Value()) / 100.0f;
- gScreenSettings.SetGamma();
+ g_engine->_screenSettings->gamma = static_cast<float>(brightness.Value()) / 100.0f;
+ g_engine->_screenSettings->SetGamma();
}
return resolution.HandleEvents(Event);
@@ -129,31 +131,31 @@ int GfxSettingMenu::HandleEvents(const Common::Event &Event) {
int GfxSettingMenu::HandleEvents(const SDL_Event &Event) {
if (fullscreen.HandleEvents(Event)) {
// Setting video flags is necessary when toggling fullscreen
- gScreenSettings.fullscreen = !gScreenSettings.fullscreen;
- gScreenSettings.SetFullscreen();
+ g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
+ g_engine->_screenSettings->SetFullscreen();
}
// Vsync doesn't need to set the change value
if (vsync.HandleEvents(Event)) {
- gScreenSettings.vsync = !gScreenSettings.vsync;
- gScreenSettings.SetVsync();
+ g_engine->_screenSettings->vsync = !g_engine->_screenSettings->vsync;
+ g_engine->_screenSettings->SetVsync();
}
// Quality and resolution can only be changed in the main menu
- if (!gScreenSettings.in_game) {
+ if (!g_engine->_screenSettings->in_game) {
if (quality.HandleEvents(Event))
- gScreenSettings.quality = !gScreenSettings.quality;
+ g_engine->_screenSettings->quality = !g_engine->_screenSettings->quality;
}
// Window border doesn't matter if you are in fullscreen
- if (border.HandleEvents(Event) && !gScreenSettings.fullscreen) {
- gScreenSettings.border = !gScreenSettings.border;
- gScreenSettings.SetWindowBorder();
+ if (border.HandleEvents(Event) && !g_engine->_screenSettings->fullscreen) {
+ g_engine->_screenSettings->border = !g_engine->_screenSettings->border;
+ g_engine->_screenSettings->SetWindowBorder();
}
if (brightness.HandleEvents(Event)) {
- gScreenSettings.gamma = static_cast<float>(brightness.Value()) / 100.0f;
- gScreenSettings.SetGamma();
+ g_engine->_screenSettings->gamma = static_cast<float>(brightness.Value()) / 100.0f;
+ g_engine->_screenSettings->SetGamma();
}
return resolution.HandleEvents(Event);
@@ -164,10 +166,10 @@ int GfxSettingMenu::HandleEvents(const SDL_Event &Event) {
// Purpose: Keep button settings synced with our screen settings
//------------------------------------------------------------------------
void GfxSettingMenu::InternalEvents() {
- fullscreen.state = gScreenSettings.fullscreen;
- vsync.state = gScreenSettings.vsync;
- border.state = gScreenSettings.border;
- quality.state = gScreenSettings.quality;
+ fullscreen.state = g_engine->_screenSettings->fullscreen;
+ vsync.state = g_engine->_screenSettings->vsync;
+ border.state = g_engine->_screenSettings->border;
+ quality.state = g_engine->_screenSettings->quality;
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 52e64812c64..3baeedfe971 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/OptionMenu.h"
namespace Crab {
@@ -164,7 +166,7 @@ bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
if (result == 1) {
state = STATE_CONFIRM;
timer.Start();
- gScreenSettings.SetResolution();
+ g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
} else if (result == 2)
state = STATE_ENTER_W;
@@ -180,23 +182,23 @@ bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
switch (state) {
case STATE_ENTER_W:
if (prompt_w.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
- gScreenSettings.cur.w = StringToNumber<int>(prompt_w.text);
+ g_engine->_screenSettings->cur.w = StringToNumber<int>(prompt_w.text);
state = STATE_ENTER_H;
} else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
- gScreenSettings.RestoreBackup();
+ g_engine->_screenSettings->RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
break;
case STATE_ENTER_H:
if (prompt_h.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
- gScreenSettings.cur.h = StringToNumber<int>(prompt_h.text);
+ g_engine->_screenSettings->cur.h = StringToNumber<int>(prompt_h.text);
state = STATE_CONFIRM;
timer.Start();
- gScreenSettings.SetResolution();
+ g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
} else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
- gScreenSettings.RestoreBackup();
+ g_engine->_screenSettings->RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
@@ -207,8 +209,8 @@ bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
state = STATE_GRAPHICS;
timer.Stop();
} else if (cancel.HandleEvents(Event)) {
- gScreenSettings.RestoreBackup();
- gScreenSettings.SetResolution();
+ g_engine->_screenSettings->RestoreBackup();
+ g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
@@ -247,7 +249,7 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
if (result == 1) {
state = STATE_CONFIRM;
timer.Start();
- gScreenSettings.SetResolution();
+ g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
} else if (result == 2)
state = STATE_ENTER_W;
@@ -263,23 +265,23 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
switch (state) {
case STATE_ENTER_W:
if (prompt_w.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
- gScreenSettings.cur.w = StringToNumber<int>(prompt_w.text);
+ g_engine->_screenSettings->cur.w = StringToNumber<int>(prompt_w.text);
state = STATE_ENTER_H;
} else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
- gScreenSettings.RestoreBackup();
+ g_engine->_screenSettings->RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
break;
case STATE_ENTER_H:
if (prompt_h.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
- gScreenSettings.cur.h = StringToNumber<int>(prompt_h.text);
+ g_engine->_screenSettings->cur.h = StringToNumber<int>(prompt_h.text);
state = STATE_CONFIRM;
timer.Start();
- gScreenSettings.SetResolution();
+ g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
} else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
- gScreenSettings.RestoreBackup();
+ g_engine->_screenSettings->RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
@@ -290,8 +292,8 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
state = STATE_GRAPHICS;
timer.Stop();
} else if (cancel.HandleEvents(Event)) {
- gScreenSettings.RestoreBackup();
- gScreenSettings.SetResolution();
+ g_engine->_screenSettings->RestoreBackup();
+ g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
@@ -339,23 +341,23 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
g_engine->_inputManager->Save();
SaveState();
general.CreateBackup();
- gScreenSettings.CreateBackup();
+ g_engine->_screenSettings->CreateBackup();
return true;
case 5:
// Revert all changes made to settings and exit
g_engine->_inputManager->RestoreBackup();
keybind.SetCaption();
- gScreenSettings.RestoreBackup();
+ g_engine->_screenSettings->RestoreBackup();
general.RestoreBackup();
SDL_DisplayMode current;
if (SDL_GetCurrentDisplayMode(0, ¤t) == 0) {
- if (gScreenSettings.cur.w != current.w || gScreenSettings.cur.h != current.h)
+ if (g_engine->_screenSettings->cur.w != current.w || g_engine->_screenSettings->cur.h != current.h)
gfx.SetInfo();
}
- gScreenSettings.SetResolution();
+ g_engine->_screenSettings->SetResolution();
return true;
default:
break;
@@ -372,8 +374,8 @@ void OptionMenu::InternalEvents() {
general.InternalEvents();
if (state == STATE_CONFIRM && timer.TargetReached()) {
- gScreenSettings.RestoreBackup();
- gScreenSettings.SetResolution();
+ g_engine->_screenSettings->RestoreBackup();
+ g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
@@ -393,7 +395,7 @@ void OptionMenu::SaveState() {
// root node
rapidxml::xml_node<char> *root = doc.allocate_node(rapidxml::node_element, "settings");
- gScreenSettings.SaveState(doc, root);
+ g_engine->_screenSettings->SaveState(doc, root);
gMusicManager.SaveState(doc, root);
doc.append_node(root);
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index f4541b7e173..685349317db 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -28,7 +28,8 @@
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/ui/ResolutionMenu.h"
namespace Crab {
@@ -61,7 +62,7 @@ void ResolutionMenu::Load(rapidxml::xml_node<char> *node) {
LoadNum(d.w, "x", n);
LoadNum(d.h, "y", n);
- if (gScreenSettings.ValidDimension(d)) {
+ if (g_engine->_screenSettings->ValidDimension(d)) {
dim.push_back(d);
Button b;
b.Init(ref, inc.x * (count_slot % columns), inc.y * (count_slot / columns));
@@ -105,7 +106,7 @@ int ResolutionMenu::HandleEvents(const Common::Event &Event) {
case STATE_CHANGE: {
int choice = Menu::HandleEvents(Event);
if (choice >= 0) {
- gScreenSettings.cur = dim[choice];
+ g_engine->_screenSettings->cur = dim[choice];
state = STATE_NORMAL;
return 1;
}
@@ -135,7 +136,7 @@ int ResolutionMenu::HandleEvents(const SDL_Event &Event) {
case STATE_CHANGE: {
int choice = Menu::HandleEvents(Event);
if (choice >= 0) {
- gScreenSettings.cur = dim[choice];
+ g_engine->_screenSettings->cur = dim[choice];
state = STATE_NORMAL;
return 1;
}
@@ -156,6 +157,13 @@ int ResolutionMenu::HandleEvents(const SDL_Event &Event) {
}
#endif
+void ResolutionMenu::SetInfo() {
+ info.text = def_info;
+ info.text += NumberToString(g_engine->_screenSettings->cur.w).c_str();
+ info.text += " x ";
+ info.text += NumberToString(g_engine->_screenSettings->cur.h).c_str();
+}
+
void ResolutionMenu::SetUI() {
cancel.SetUI();
change.SetUI();
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index d5ba8dc3e71..1ffae39524a 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -77,12 +77,7 @@ public:
int HandleEvents(const SDL_Event &Event);
#endif
- void SetInfo() {
- info.text = def_info;
- info.text += NumberToString(gScreenSettings.cur.w).c_str();
- info.text += " x ";
- info.text += NumberToString(gScreenSettings.cur.h).c_str();
- }
+ void SetInfo();
void SetUI();
};
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 29e45b90f2f..52b4918609e 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -86,10 +86,10 @@ void Element::SetUI(Rect *parent) {
if (parent == NULL) {
switch (align.x) {
case ALIGN_CENTER:
- x = gScreenSettings.cur.w / 2 - w / 2 + raw.x;
+ x = g_engine->_screenSettings->cur.w / 2 - w / 2 + raw.x;
break;
case ALIGN_RIGHT:
- x = gScreenSettings.cur.w - w + raw.x;
+ x = g_engine->_screenSettings->cur.w - w + raw.x;
break;
default:
x = raw.x;
@@ -98,10 +98,10 @@ void Element::SetUI(Rect *parent) {
switch (align.y) {
case ALIGN_CENTER:
- y = gScreenSettings.cur.h / 2 - h / 2 + raw.y;
+ y = g_engine->_screenSettings->cur.h / 2 - h / 2 + raw.y;
break;
case ALIGN_RIGHT:
- y = gScreenSettings.cur.h - h + raw.y;
+ y = g_engine->_screenSettings->cur.h - h + raw.y;
break;
default:
y = raw.y;
Commit: a3f6951358a70066f4a2da2058e3cd33f9d38f48
https://github.com/scummvm/scummvm/commit/a3f6951358a70066f4a2da2058e3cd33f9d38f48
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make MusicManager a public member of Engine class
Changed paths:
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/event/EventSequence.cpp
engines/crab/event/effect.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_load.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/button.cpp
engines/crab/ui/textarea.cpp
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 519fc514603..99fe2e24b24 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -167,7 +167,7 @@ bool FightMoves::ForceUpdate(const unsigned int &index, pyrodactyl::input::Fight
timer.Start();
start = true;
- pyrodactyl::music::gMusicManager.PlayEffect(move[cur].eff.activate, 0);
+ g_engine->_musicManager->PlayEffect(move[cur].eff.activate, 0);
return true;
}
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index c90aca9b383..41ddf2e3669 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -682,7 +682,7 @@ void Sprite::TakeDamage(Info &info, Sprite &s) {
else if (f.eff.hurt != -1)
ForceUpdateMove(f.eff.hurt);
- gMusicManager.PlayEffect(f.eff.hit, 0);
+ g_engine->_musicManager->PlayEffect(f.eff.hit, 0);
img_eff = f.eff.img;
}
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index df64f831759..4e3ee30baae 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -299,7 +299,7 @@ void App::LoadSettings(const Common::String &filename) {
// Start the sound subsystem
#if 0
- pyrodactyl::music::gMusicManager.Load(node);
+ g_engine->_musicManager->Load(node);
#endif
}
}
@@ -310,7 +310,7 @@ App::~App() {
// SteamAPI_Shutdown();
g_engine->_imageManager->Quit();
- pyrodactyl::music::gMusicManager.Quit();
+ g_engine->_musicManager->Quit();
g_engine->_textManager->Quit();
g_engine->_inputManager->Quit();
g_engine->_loadingScreen->Quit();
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index eb6bfd78975..d579189a4c4 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -94,6 +94,7 @@ Common::Error CrabEngine::run() {
_eventStore = new pyrodactyl::event::GameEventStore();
_textManager = new pyrodactyl::text::TextManager();
_inputManager = new pyrodactyl::input::InputManager();
+ _musicManager = new pyrodactyl::music::MusicManager();
_loadingScreen = new LoadingScreen();
_helpScreen = new pyrodactyl::ui::SlideShow();
_optionMenu = new pyrodactyl::ui::OptionMenu();
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 17b972671af..16daa6b955d 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -67,6 +67,7 @@
#include "crab/input/cursor.h"
#include "crab/input/input.h"
#include "crab/text/TextManager.h"
+#include "crab/music/MusicManager.h"
#include "crab/ScreenSettings.h"
#include "crab/detection.h"
@@ -114,6 +115,7 @@ public:
pyrodactyl::event::GameEventStore *_eventStore = nullptr;
pyrodactyl::text::TextManager *_textManager = nullptr;
pyrodactyl::input::InputManager *_inputManager = nullptr;
+ pyrodactyl::music::MusicManager *_musicManager = nullptr;
// Should these really be inside the Engine class?
LoadingScreen *_loadingScreen = nullptr;
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index fa41bac3d12..716f4140ed3 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -80,11 +80,11 @@ void EventSequence::NextEvent(pyrodactyl::event::Info &info, const std::string &
using namespace pyrodactyl::music;
if (info.sound.rep_dec)
- gMusicManager.PlayEffect(gMusicManager.rep_dec, 0);
+ g_engine->_musicManager->PlayEffect(g_engine->_musicManager->rep_dec, 0);
else if (info.sound.rep_inc)
- gMusicManager.PlayEffect(gMusicManager.rep_inc, 0);
+ g_engine->_musicManager->PlayEffect(g_engine->_musicManager->rep_inc, 0);
else if (info.sound.notify)
- gMusicManager.PlayEffect(gMusicManager.notify, 0);
+ g_engine->_musicManager->PlayEffect(g_engine->_musicManager->notify, 0);
info.sound.notify = false;
info.sound.rep_dec = false;
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index e5ce2d5f695..8f17b9bf205 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -28,6 +28,8 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/event/effect.h"
#include "crab/music/MusicManager.h"
@@ -209,15 +211,15 @@ bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id
if (subject == "music") {
if (operation == "play") {
MusicKey m = StringToNumber<MusicKey>(val);
- gMusicManager.PlayMusic(m);
+ g_engine->_musicManager->PlayMusic(m);
} else if (operation == "stop")
- gMusicManager.Stop();
+ g_engine->_musicManager->Stop();
else if (operation == "pause")
- gMusicManager.Pause();
+ g_engine->_musicManager->Pause();
else if (operation == "resume")
- gMusicManager.Resume();
+ g_engine->_musicManager->Resume();
} else
- gMusicManager.PlayEffect(StringToNumber<ChunkKey>(val), 0);
+ g_engine->_musicManager->PlayEffect(StringToNumber<ChunkKey>(val), 0);
break;
case EFF_MONEY:
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index e5fc15866b6..87597affe11 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -174,9 +174,9 @@ bool Level::CollidingWithLevel(Info &info, Sprite &s) {
if (terrain.CollideWithMusic(s.BoundRect(), music)) {
if (music.track)
- gMusicManager.PlayMusic(music.id);
+ g_engine->_musicManager->PlayMusic(music.id);
else
- gMusicManager.PlayEffect(music.id, music.loops);
+ g_engine->_musicManager->PlayEffect(music.id, music.loops);
}
// If we are colliding with something, return true
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 849c681f79f..34da9934308 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -70,7 +70,7 @@ void Level::Load(const std::string &filename, pyrodactyl::event::Info &info,
if (NodeValid("music", node)) {
LoadNum(music.id, "id", node->first_node("music"));
- pyrodactyl::music::gMusicManager.PlayMusic(music.id);
+ g_engine->_musicManager->PlayMusic(music.id);
}
if (NodeValid("map", node)) {
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index e488594a158..10ff562efb7 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -437,16 +437,16 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
// Just play the appropriate music
if (start) {
if (ms == STATE_CREDITS)
- gMusicManager.PlayMusic(music_key.credits);
+ g_engine->_musicManager->PlayMusic(music_key.credits);
else
- gMusicManager.PlayMusic(music_key.normal);
+ g_engine->_musicManager->PlayMusic(music_key.normal);
} else {
// This is not our first run, which means some music track is already playing
// Only change tracks when going from main menu->credits or credits->main menu
if (state == STATE_CREDITS && ms != STATE_CREDITS)
- gMusicManager.PlayMusic(music_key.normal);
+ g_engine->_musicManager->PlayMusic(music_key.normal);
else if (state != STATE_CREDITS && ms == STATE_CREDITS)
- gMusicManager.PlayMusic(music_key.credits);
+ g_engine->_musicManager->PlayMusic(music_key.credits);
}
// Set current state
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 5995863475f..2f8f7c9dc20 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -49,10 +49,10 @@ void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
notice_volume.Load(musnode->first_node("desc"));
// if (NodeValid("music", musnode))
- // vol_music.Load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, gMusicManager.VolMusic());
+ // vol_music.Load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolMusic());
// if (NodeValid("effects", musnode))
- // vol_effects.Load(musnode->first_node("effects"), 0, MIX_MAX_VOLUME, gMusicManager.VolEffects());
+ // vol_effects.Load(musnode->first_node("effects"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolEffects());
}
if (NodeValid("mouse_trap", node))
@@ -74,10 +74,10 @@ void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void GeneralSettingMenu::HandleEvents(const Common::Event &Event) {
if (vol_music.HandleEvents(Event))
- gMusicManager.VolMusic(vol_music.Value());
+ g_engine->_musicManager->VolMusic(vol_music.Value());
if (vol_effects.HandleEvents(Event))
- gMusicManager.VolEffects(vol_effects.Value());
+ g_engine->_musicManager->VolEffects(vol_effects.Value());
// No need to change screen here
if (save_on_exit.HandleEvents(Event))
@@ -99,10 +99,10 @@ void GeneralSettingMenu::HandleEvents(const Common::Event &Event) {
//------------------------------------------------------------------------
void GeneralSettingMenu::HandleEvents(const SDL_Event &Event) {
if (vol_music.HandleEvents(Event))
- gMusicManager.VolMusic(vol_music.Value());
+ g_engine->_musicManager->VolMusic(vol_music.Value());
if (vol_effects.HandleEvents(Event))
- gMusicManager.VolEffects(vol_effects.Value());
+ g_engine->_musicManager->VolEffects(vol_effects.Value());
// No need to change screen here
if (save_on_exit.HandleEvents(Event))
@@ -149,10 +149,10 @@ void GeneralSettingMenu::Draw() {
//------------------------------------------------------------------------
void GeneralSettingMenu::RestoreBackup() {
vol_music.RestoreBackup();
- gMusicManager.VolMusic(vol_music.Value());
+ g_engine->_musicManager->VolMusic(vol_music.Value());
vol_effects.RestoreBackup();
- gMusicManager.VolEffects(vol_effects.Value());
+ g_engine->_musicManager->VolEffects(vol_effects.Value());
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 3baeedfe971..aeca2537d67 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -396,7 +396,7 @@ void OptionMenu::SaveState() {
// root node
rapidxml::xml_node<char> *root = doc.allocate_node(rapidxml::node_element, "settings");
g_engine->_screenSettings->SaveState(doc, root);
- gMusicManager.SaveState(doc, root);
+ g_engine->_musicManager->SaveState(doc, root);
doc.append_node(root);
std::string xml_as_string;
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index e0383991999..457752550b3 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -161,7 +161,7 @@ ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset
if (!hover_prev) {
hover_prev = true;
- gMusicManager.PlayEffect(se_hover, 0);
+ g_engine->_musicManager->PlayEffect(se_hover, 0);
}
} else {
hover_prev = false;
@@ -183,13 +183,13 @@ ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset
if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
mousepressed = false;
if (Event.type == Common::EVENT_LBUTTONUP) {
- gMusicManager.PlayEffect(se_click, 0);
+ g_engine->_musicManager->PlayEffect(se_click, 0);
return BUAC_LCLICK;
} else if (Event.type == Common::EVENT_RBUTTONUP)
return BUAC_RCLICK;
}
} else if (hotkey.HandleEvents(Event)) {
- gMusicManager.PlayEffect(se_click, 0);
+ g_engine->_musicManager->PlayEffect(se_click, 0);
return BUAC_LCLICK;
}
}
@@ -212,7 +212,7 @@ ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, co
if (!hover_prev) {
hover_prev = true;
- gMusicManager.PlayEffect(se_hover, 0);
+ g_engine->_musicManager->PlayEffect(se_hover, 0);
}
} else {
hover_prev = false;
@@ -234,13 +234,13 @@ ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, co
if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
mousepressed = false;
if (Event.button.button == SDL_BUTTON_LEFT) {
- gMusicManager.PlayEffect(se_click, 0);
+ g_engine->_musicManager->PlayEffect(se_click, 0);
return BUAC_LCLICK;
} else if (Event.button.button == SDL_BUTTON_RIGHT)
return BUAC_RCLICK;
}
} else if (hotkey.HandleEvents(Event)) {
- gMusicManager.PlayEffect(se_click, 0);
+ g_engine->_musicManager->PlayEffect(se_click, 0);
return BUAC_LCLICK;
}
}
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 06b9aaf5cd9..f4283e01262 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -71,20 +71,20 @@ bool TextArea::HandleEvents(const SDL_Event &Event, bool numbers_only) {
return false;
// Now play the text input sound
- pyrodactyl::music::gMusicManager.PlayEffect(se_entry, 0);
+ g_engine->_musicManager->PlayEffect(se_entry, 0);
// Append the character to string
text += Event.text.text;
}
} else if (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_BACKSPACE && text.length() != 0) {
// Now play the text erase sound
- pyrodactyl::music::gMusicManager.PlayEffect(se_erase, 0);
+ g_engine->_musicManager->PlayEffect(se_erase, 0);
// If backspace was pressed and the string isn't blank, remove a character from the end
text.erase(text.length() - 1);
} else if (g_engine->_inputManager->Equals(IU_ACCEPT, Event) == SDL_RELEASED && text.length() != 0) {
// Now play the accept sound
- pyrodactyl::music::gMusicManager.PlayEffect(se_accept, 0);
+ g_engine->_musicManager->PlayEffect(se_accept, 0);
return true;
}
Commit: 014d6b68dee31a706358a41aa0466eb320f68dd3
https://github.com/scummvm/scummvm/commit/014d6b68dee31a706358a41aa0466eb320f68dd3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup CRAB Engine code and add some whitespaces
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index d579189a4c4..39172732eec 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -90,13 +90,16 @@ Common::Error CrabEngine::run() {
_screen = new Graphics::Screen(1280, 720, *_format);
_imageManager = new pyrodactyl::image::ImageManager();
- _mouse = new pyrodactyl::input::Cursor();
- _eventStore = new pyrodactyl::event::GameEventStore();
_textManager = new pyrodactyl::text::TextManager();
_inputManager = new pyrodactyl::input::InputManager();
_musicManager = new pyrodactyl::music::MusicManager();
+
+ _mouse = new pyrodactyl::input::Cursor();
+ _eventStore = new pyrodactyl::event::GameEventStore();
+
_loadingScreen = new LoadingScreen();
_helpScreen = new pyrodactyl::ui::SlideShow();
+
_optionMenu = new pyrodactyl::ui::OptionMenu();
_loadMenu = new pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData>();
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 16daa6b955d..250a1614127 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -111,12 +111,13 @@ public:
Graphics::PixelFormat *_format = nullptr;
pyrodactyl::image::ImageManager *_imageManager = nullptr;
- pyrodactyl::input::Cursor *_mouse = nullptr;
- pyrodactyl::event::GameEventStore *_eventStore = nullptr;
pyrodactyl::text::TextManager *_textManager = nullptr;
pyrodactyl::input::InputManager *_inputManager = nullptr;
pyrodactyl::music::MusicManager *_musicManager = nullptr;
+ pyrodactyl::input::Cursor *_mouse = nullptr;
+ pyrodactyl::event::GameEventStore *_eventStore = nullptr;
+
// Should these really be inside the Engine class?
LoadingScreen *_loadingScreen = nullptr;
pyrodactyl::ui::SlideShow *_helpScreen = nullptr;
Commit: 8eaf8235e040d8518b93ab68edc53b877ca16ca8
https://github.com/scummvm/scummvm/commit/8eaf8235e040d8518b93ab68edc53b877ca16ca8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make FilePath a public member of Engine class
Changed paths:
engines/crab/GameParam.h
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/image/ImageManager.cpp
engines/crab/input/input.cpp
engines/crab/mainmenu.cpp
engines/crab/music/MusicManager.cpp
engines/crab/text/TextManager.cpp
engines/crab/ui/FileMenu.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index a53347a9d9d..320320894d7 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -189,9 +189,6 @@ extern TempValue gTemp;
// Whether to draw debug outlines on polygons
extern bool GameDebug;
-// Paths of all files
-extern FilePaths gFilePath;
-
// Strings are stored here to avoid duplicates and invalid values when writing to XML
extern StringPool gStrPool;
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 4e3ee30baae..0b41cd53b66 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -56,7 +56,7 @@ bool App::Init() {
#endif
// Load paths for important files
- gFilePath.Load("res/paths.xml");
+ g_engine->_filePath->Load("res/paths.xml");
// Initialize Steam
// SteamAPI_Init();
@@ -65,7 +65,7 @@ bool App::Init() {
{
const std::string DEFAULT_FILENAME = "res/settings.xml";
- std::string filename = gFilePath.appdata;
+ std::string filename = g_engine->_filePath->appdata;
filename += "settings.xml";
using namespace boost::filesystem;
@@ -99,7 +99,7 @@ bool App::Init() {
return false;
// Set the window icon
- SDL_Surface *icon = IMG_Load(gFilePath.icon.c_str());
+ SDL_Surface *icon = IMG_Load(g_engine->_filePath->icon.c_str());
SDL_SetWindowIcon(gWindow, icon);
SDL_FreeSurface(icon);
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 39172732eec..5f847009033 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -103,6 +103,8 @@ Common::Error CrabEngine::run() {
_optionMenu = new pyrodactyl::ui::OptionMenu();
_loadMenu = new pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData>();
+ _filePath = new FilePaths();
+
_screenSettings = new ScreenSettings();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 250a1614127..cb85642af8c 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -69,6 +69,7 @@
#include "crab/text/TextManager.h"
#include "crab/music/MusicManager.h"
#include "crab/ScreenSettings.h"
+#include "crab/GameParam.h"
#include "crab/detection.h"
@@ -124,6 +125,7 @@ public:
pyrodactyl::ui::OptionMenu *_optionMenu = nullptr;
pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData> *_loadMenu = nullptr;
+ FilePaths *_filePath = nullptr;
ScreenSettings *_screenSettings = nullptr;
Common::FSNode _gameDataDir;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index b11f5c9ffef..6820ac80086 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::input;
// Purpose: Loading stuff
//------------------------------------------------------------------------
void Game::StartNewGame() {
- Init(gFilePath.mod_cur.c_str());
+ Init(g_engine->_filePath->mod_cur.c_str());
LoadLevel(info.CurLocID());
info.IronMan(gTemp.ironman);
savefile.ironman = gTemp.filename.c_str();
@@ -52,7 +52,7 @@ void Game::StartNewGame() {
}
void Game::LoadGame(const std::string &filename) {
- Init(gFilePath.mod_cur.c_str());
+ Init(g_engine->_filePath->mod_cur.c_str());
LoadState(filename);
}
@@ -74,7 +74,7 @@ void Game::Init(const std::string &filename) {
std::string path;
if (NodeValid("level", node)) {
LoadStr(path, "list", node->first_node("level"));
- gFilePath.LoadLevel(path.c_str());
+ g_engine->_filePath->LoadLevel(path.c_str());
}
if (NodeValid("hud", node)) {
@@ -113,23 +113,23 @@ void Game::Init(const std::string &filename) {
}
bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
- if (gFilePath.level.contains(id.c_str())) {
+ if (g_engine->_filePath->level.contains(id.c_str())) {
g_engine->_loadingScreen->Draw();
// Load the assets local to this level
// If the filename is same as the previous one, skip loading
- if (gFilePath.current_r != gFilePath.level[id.c_str()].asset) {
- gFilePath.current_r = gFilePath.level[id.c_str()].asset;
- g_engine->_imageManager->LoadMap(gFilePath.level[id.c_str()].asset);
+ if (g_engine->_filePath->current_r != g_engine->_filePath->level[id.c_str()].asset) {
+ g_engine->_filePath->current_r = g_engine->_filePath->level[id.c_str()].asset;
+ g_engine->_imageManager->LoadMap(g_engine->_filePath->level[id.c_str()].asset);
}
// Load the level itself
level.pop = pop_default;
- level.Load(gFilePath.level[id.c_str()].layout.c_str(), info, game_over, player_x, player_y);
+ level.Load(g_engine->_filePath->level[id.c_str()].layout.c_str(), info, game_over, player_x, player_y);
// Set the current location
info.CurLocID(id);
- info.CurLocName(gFilePath.level[id.c_str()].name.c_str());
+ info.CurLocName(g_engine->_filePath->level[id.c_str()].name.c_str());
map.player_pos = level.map_loc;
// Update and center the world map to the player current position
@@ -802,7 +802,7 @@ void Game::SaveState(const std::string &filename, const bool &overwrite) {
void Game::Quit(bool &ShouldChangeState, GameStateID &NewStateID, const GameStateID &NewStateVal) {
ShouldChangeState = true;
NewStateID = NewStateVal;
- g_engine->_imageManager->LoadMap(gFilePath.mainmenu_r);
+ g_engine->_imageManager->LoadMap(g_engine->_filePath->mainmenu_r);
}
//------------------------------------------------------------------------
// Purpose: Change our internal state
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 4c77d590129..8e50767e5a1 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -115,10 +115,10 @@ private:
void CreateSaveGame(const SaveGameType &savetype);
std::string FullPath(const std::string &filename) {
- std::string res = gFilePath.appdata.c_str();
- res += gFilePath.save_dir.c_str();
+ std::string res = g_engine->_filePath->appdata.c_str();
+ res += g_engine->_filePath->save_dir.c_str();
res += filename;
- res += gFilePath.save_ext.c_str();
+ res += g_engine->_filePath->save_ext.c_str();
return res;
}
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 634a4d40e20..12965e94222 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -91,10 +91,10 @@ bool ImageManager::Init() {
Quit();
// Load common assets
- LoadMap(gFilePath.common, MAP_COMMON);
+ LoadMap(g_engine->_filePath->common, MAP_COMMON);
// Load main menu assets
- LoadMap(gFilePath.current_r, MAP_CURRENT);
+ LoadMap(g_engine->_filePath->current_r, MAP_CURRENT);
invalid_img = map[MAP_COMMON][0];
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 5fede291317..715ed333620 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -112,7 +112,7 @@ void InputManager::Init() {
#if 0
const std::string DEFAULT_FILENAME = "res/controls.xml";
- std::string filename = gFilePath.appdata.c_str();
+ std::string filename = g_engine->_filePath->appdata.c_str();
filename += "controls.xml";
if (!is_regular_file(filename)) {
@@ -198,7 +198,7 @@ void InputManager::Save() {
#if 0
rapidxml::xml_document<char> doc;
- std::string filename = gFilePath.appdata;
+ std::string filename = g_engine->_filePath->appdata;
filename += "controls.xml";
// xml declaration
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 10ff562efb7..9503885bd16 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -43,7 +43,7 @@ using namespace pyrodactyl::ui;
// Purpose: Constructor
//------------------------------------------------------------------------
MainMenu::MainMenu() {
- XMLDoc conf(gFilePath.mainmenu_l);
+ XMLDoc conf(g_engine->_filePath->mainmenu_l);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("main_menu");
if (NodeValid(node)) {
@@ -148,7 +148,7 @@ MainMenu::MainMenu() {
ChangeState(STATE_NORMAL, true);
gTemp.credits = false;
- gFilePath.current_r = gFilePath.mainmenu_r;
+ g_engine->_filePath->current_r = g_engine->_filePath->mainmenu_r;
}
//------------------------------------------------------------------------
@@ -490,9 +490,9 @@ void MainMenu::Draw() {
logo.Draw();
// Draw the game name and mod path if a mod is loaded
- if (gFilePath.mod_cur != "res/default.xml") {
+ if (g_engine->_filePath->mod_cur != "res/default.xml") {
g_engine->_textManager->Draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
- //g_engine->_textManager->Draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2 + 50, gFilePath.mod_cur, 5, 1, ALIGN_CENTER);
+ //g_engine->_textManager->Draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2 + 50, g_engine->_filePath->mod_cur, 5, 1, ALIGN_CENTER);
}
me_main.Draw();
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index e3826258e4e..cbbfcc9aaf1 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -73,7 +73,7 @@ void MusicManager::PlayMusic(const MusicKey &id) {
#if 0
if (bg.id != id) {
- XMLDoc track_list(gFilePath.sound_music);
+ XMLDoc track_list(g_engine->_filePath->sound_music);
if (track_list.ready()) {
rapidxml::xml_node<char> *node = track_list.Doc()->first_node("music");
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
@@ -141,7 +141,7 @@ bool MusicManager::Load(rapidxml::xml_node<char> *node) {
VolMusic(volume_mus);
// Load sound effects
- XMLDoc track_list(gFilePath.sound_effect);
+ XMLDoc track_list(g_engine->_filePath->sound_effect);
if (track_list.ready()) {
rapidxml::xml_node<char> *tnode = track_list.Doc()->first_node("effects");
if (NodeValid(tnode)) {
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 4a3637bc754..85d52bd8dca 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -45,7 +45,7 @@ void TextManager::Init() {
Quit();
// Load the list of fonts
- XMLDoc font_list(gFilePath.font);
+ XMLDoc font_list(g_engine->_filePath->font);
if (font_list.ready()) {
rapidxml::xml_node<char> *node = font_list.Doc()->first_node("fonts");
@@ -77,7 +77,7 @@ void TextManager::Init() {
}
}
- colpool.Load(gFilePath.colors.c_str());
+ colpool.Load(g_engine->_filePath->colors.c_str());
}
void TextManager::Reset() {
diff --git a/engines/crab/ui/FileMenu.cpp b/engines/crab/ui/FileMenu.cpp
index b76160c6241..b8ad9c969cf 100644
--- a/engines/crab/ui/FileMenu.cpp
+++ b/engines/crab/ui/FileMenu.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/FileMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 5f1a2b50b8a..c5f7d75a726 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -31,6 +31,7 @@
#ifndef CRAB_FILEMENU_H
#define CRAB_FILEMENU_H
+#include "crab/crab.h"
#include "crab/ui/FileData.h"
#include "crab/ui/ImageData.h"
#include "crab/ui/PageMenu.h"
@@ -172,8 +173,8 @@ public:
hov[DATA_PLAYERNAME].Load(offnode->first_node("player_name_title"));
}
- extension = gFilePath.save_ext.c_str();
- directory = (gFilePath.appdata + gFilePath.save_dir).c_str();
+ extension = g_engine->_filePath->save_ext.c_str();
+ directory = (g_engine->_filePath->appdata + g_engine->_filePath->save_dir).c_str();
ScanDir();
}
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 17ad5dcb816..283421ee29e 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/ModMenu.h"
namespace Crab {
@@ -71,8 +72,8 @@ void ModMenu::Load(const std::string &filename) {
hov[DATA_WEBSITE].Load(offnode->first_node("website_title"));
}
- extension = gFilePath.mod_ext.c_str();
- directory = gFilePath.mod_path.c_str();
+ extension = g_engine->_filePath->mod_ext.c_str();
+ directory = g_engine->_filePath->mod_path.c_str();
ScanDir();
}
}
@@ -80,7 +81,7 @@ void ModMenu::Load(const std::string &filename) {
bool ModMenu::HandleEvents(const Common::Event &Event) {
int choice = menu.HandleEvents(Event);
if (choice >= 0) {
- gFilePath.mod_cur = slot_info[menu.Index() + choice].path.c_str();
+ g_engine->_filePath->mod_cur = slot_info[menu.Index() + choice].path.c_str();
return true;
}
@@ -91,7 +92,7 @@ bool ModMenu::HandleEvents(const Common::Event &Event) {
bool ModMenu::HandleEvents(const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
if (choice >= 0) {
- gFilePath.mod_cur = slot_info[menu.Index() + choice].path;
+ g_engine->_filePath->mod_cur = slot_info[menu.Index() + choice].path;
return true;
}
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index aeca2537d67..40c2059b3bc 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -402,7 +402,7 @@ void OptionMenu::SaveState() {
std::string xml_as_string;
rapidxml::print(std::back_inserter(xml_as_string), doc);
- std::string settingpath = gFilePath.appdata;
+ std::string settingpath = g_engine->_filePath->appdata;
settingpath += "settings.xml";
std::ofstream save(settingpath, std::ios::out);
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 03329844848..c4a188dc83a 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/PauseMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index fa5dfb2f285..7a67c670885 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -28,6 +28,7 @@
*
*/
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/SaveGameMenu.h"
namespace Crab {
@@ -71,11 +72,11 @@ void GameSaveMenu::ScanDir() {
unsigned int count_slot = 0, count_menu = 0;
// For the save menu, the first slot is a "blank" slot - to create a new save file
- AddButton(gFilePath.save_dir + "New Save" + gFilePath.save_ext, count_menu, count_slot);
+ AddButton(g_engine->_filePath->save_dir + "New Save" + g_engine->_filePath->save_ext, count_menu, count_slot);
// Next, we must load all the files with the same extension as our save file
for (auto i = file_in_dir.begin(); i != file_in_dir.end(); ++i)
- if (is_regular_file(*i) && i->extension().string() == gFilePath.save_ext)
+ if (is_regular_file(*i) && i->extension().string() == g_engine->_filePath->save_ext)
AddButton(*i, count_menu, count_slot);
}
Commit: 41f29967404dbb447782b2a7241b56189b29cd53
https://github.com/scummvm/scummvm/commit/41f29967404dbb447782b2a7241b56189b29cd53
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Stub out Vector2D::SaveState()
Changed paths:
engines/crab/vectors.h
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index 93a4bd8b72b..c96e617e3e7 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -56,10 +56,13 @@ public:
}
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
+ warning("STUB: Vector2D::SaveState()");
+#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
child->append_attribute(doc.allocate_attribute("x", gStrPool.Get((int)x)));
child->append_attribute(doc.allocate_attribute("y", gStrPool.Get((int)y)));
root->append_node(child);
+#endif
}
double Magnitude() { return sqrt(x * x + y * y); }
Commit: 79a120789082086597788df01005e8fe203f425e
https://github.com/scummvm/scummvm/commit/79a120789082086597788df01005e8fe203f425e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make TempValue a public member of Engine class
Changed paths:
engines/crab/GameParam.h
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/mainmenu.cpp
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 320320894d7..728f7c2bc20 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -183,9 +183,6 @@ struct TempValue {
// Our global objects
-// Where we store some temporary data used in between GameState swapping
-extern TempValue gTemp;
-
// Whether to draw debug outlines on polygons
extern bool GameDebug;
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 5f847009033..07f3c32588c 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -104,7 +104,7 @@ Common::Error CrabEngine::run() {
_loadMenu = new pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData>();
_filePath = new FilePaths();
-
+ _tempData = new TempValue();
_screenSettings = new ScreenSettings();
Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index cb85642af8c..7b6f45e4b7a 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -126,6 +126,7 @@ public:
pyrodactyl::ui::FileMenu<pyrodactyl::ui::SaveFileData> *_loadMenu = nullptr;
FilePaths *_filePath = nullptr;
+ TempValue *_tempData = nullptr;
ScreenSettings *_screenSettings = nullptr;
Common::FSNode _gameDataDir;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 6820ac80086..19413e16640 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -43,8 +43,8 @@ using namespace pyrodactyl::input;
void Game::StartNewGame() {
Init(g_engine->_filePath->mod_cur.c_str());
LoadLevel(info.CurLocID());
- info.IronMan(gTemp.ironman);
- savefile.ironman = gTemp.filename.c_str();
+ info.IronMan(g_engine->_tempData->ironman);
+ savefile.ironman = g_engine->_tempData->filename.c_str();
clock.Start();
hud.pause.UpdateMode(info.IronMan());
@@ -629,7 +629,7 @@ bool Game::ApplyResult() {
map.Update(info);
break;
case ER_QUIT:
- gTemp.credits = (i->val == "credits");
+ g_engine->_tempData->credits = (i->val == "credits");
return true;
default:
break;
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 9503885bd16..430bb6f3835 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -142,12 +142,12 @@ MainMenu::MainMenu() {
}
}
- if (gTemp.credits)
+ if (g_engine->_tempData->credits)
ChangeState(STATE_CREDITS, true);
else
ChangeState(STATE_NORMAL, true);
- gTemp.credits = false;
+ g_engine->_tempData->credits = false;
g_engine->_filePath->current_r = g_engine->_filePath->mainmenu_r;
}
@@ -249,7 +249,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
// First menu option is Non-iron man, second is iron man
// For the second choice, we must display a prompt to choose the name of the save game
if (choice == 0) {
- gTemp.ironman = false;
+ g_engine->_tempData->ironman = false;
ShouldChangeState = true;
NewStateID = GAMESTATE_NEW_GAME;
} else if (choice == 1)
@@ -259,8 +259,8 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
case STATE_SAVENAME:
if (save.HandleEvents(Event) || accept.HandleEvents(Event)) {
if (save.text != "") {
- gTemp.filename = save.text.c_str();
- gTemp.ironman = true;
+ g_engine->_tempData->filename = save.text.c_str();
+ g_engine->_tempData->ironman = true;
ShouldChangeState = true;
NewStateID = GAMESTATE_NEW_GAME;
} else
@@ -381,7 +381,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
// First menu option is Non-iron man, second is iron man
// For the second choice, we must display a prompt to choose the name of the save game
if (choice == 0) {
- gTemp.ironman = false;
+ g_engine->_tempData->ironman = false;
ShouldChangeState = true;
NewStateID = GAMESTATE_NEW_GAME;
} else if (choice == 1)
@@ -391,8 +391,8 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
case STATE_SAVENAME:
if (save.HandleEvents(Event) || accept.HandleEvents(Event)) {
if (save.text != "") {
- gTemp.filename = save.text;
- gTemp.ironman = true;
+ g_engine->_tempData->filename = save.text;
+ g_engine->_tempData->ironman = true;
ShouldChangeState = true;
NewStateID = GAMESTATE_NEW_GAME;
} else
Commit: 7d502038a0589bc4c38c280304ccd9a9be449bf6
https://github.com/scummvm/scummvm/commit/7d502038a0589bc4c38c280304ccd9a9be449bf6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use CursorManager properly to render correct cursor
Changed paths:
engines/crab/crab.cpp
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 07f3c32588c..eceded21d0a 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -107,11 +107,8 @@ Common::Error CrabEngine::run() {
_tempData = new TempValue();
_screenSettings = new ScreenSettings();
- Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
- CursorMan.replaceCursor(cursor);
- delete cursor;
-
CursorMan.showMouse(true);
+ _mouse->Reset();
// Set the engine's debugger console
setDebugger(new Console());
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index b90f0eaa84b..84ca4cfcfa6 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -51,6 +51,9 @@ void Cursor::Reset() {
rel.x = 0;
rel.y = 0;
+
+ // set to -1, so its set to 0 on first update
+ state = -1;
}
//------------------------------------------------------------------------
@@ -78,6 +81,8 @@ void Cursor::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void Cursor::HandleEvents(const Common::Event &event) {
g_engine->_mouse->hover = false;
+ byte oldState = state;
+
#if 0
if (event.type == SDL_MOUSEMOTION) {
motion.x = Event.motion.x;
@@ -113,6 +118,22 @@ void Cursor::HandleEvents(const Common::Event &event) {
button.x = event.mouse.x;
button.y = event.mouse.y;
}
+
+ state = hover | (pressed << 1);
+
+ if (state != oldState) {
+ if (hover) {
+ if (pressed)
+ CursorMan.replaceCursor(img_hover_s.texture->rawSurface(), 0, 0, 0);
+ else
+ CursorMan.replaceCursor(img_hover.texture->rawSurface(), 0, 0, 0);
+ } else {
+ if (pressed)
+ CursorMan.replaceCursor(img_s.texture->rawSurface(), 0, 0, 0);
+ else
+ CursorMan.replaceCursor(img.texture->rawSurface(), 0, 0, 0);
+ }
+ }
}
//------------------------------------------------------------------------
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index bd52044ed32..d43f222532a 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -54,6 +54,8 @@ class Cursor {
// Mouse image changes slightly if left click button is pressed
bool pressed;
+ byte state;
+
public:
// Various coordinates
Vector2i motion, button, rel;
Commit: b18ba615cb8983936d653cf4d68b6c30feca7b96
https://github.com/scummvm/scummvm/commit/b18ba615cb8983936d653cf4d68b6c30feca7b96
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not create global object for MusicManager
Changed paths:
engines/crab/music/MusicManager.cpp
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index cbbfcc9aaf1..662db4d41ac 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -37,12 +37,6 @@ namespace Crab {
using namespace pyrodactyl::music;
-namespace pyrodactyl {
-namespace music {
-MusicManager gMusicManager;
-}
-} // End of namespace pyrodactyl
-
//------------------------------------------------------------------------
// Purpose: Clear stored data
//------------------------------------------------------------------------
Commit: d9a1662f807f33fd8dde2bf6d71ddad3f1f8a149
https://github.com/scummvm/scummvm/commit/d9a1662f807f33fd8dde2bf6d71ddad3f1f8a149
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not create global objects for TempValue and FilePath
Changed paths:
engines/crab/GameParam.cpp
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index ec7e3dad5a2..de84257246b 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -31,13 +31,6 @@
#include "crab/GameParam.h"
namespace Crab {
-
-// Temporary values go here
-TempValue gTemp;
-
-// The global file path object
-FilePaths gFilePath;
-
// Are we in debug mode or not?
bool GameDebug = false;
Commit: bfafbe2ce24197bd62948360e5968a12f0f7eed7
https://github.com/scummvm/scummvm/commit/bfafbe2ce24197bd62948360e5968a12f0f7eed7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Convert gStrPool to a pointer
Changed paths:
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/Rectangle.cpp
engines/crab/ScreenSettings.cpp
engines/crab/animation/sprite.cpp
engines/crab/crab.cpp
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/input/input.cpp
engines/crab/input/inputval.h
engines/crab/item/Item.cpp
engines/crab/item/StatPreview.cpp
engines/crab/level/level_load.cpp
engines/crab/music/MusicManager.cpp
engines/crab/people/opinion.cpp
engines/crab/people/person.cpp
engines/crab/people/trait.cpp
engines/crab/stat/Stat.cpp
engines/crab/ui/MapData.cpp
engines/crab/ui/button.h
engines/crab/ui/map.cpp
engines/crab/vectors.h
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index de84257246b..a8f0d120a1b 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -35,7 +35,7 @@ namespace Crab {
bool GameDebug = false;
// A temporary list of strings we use when storing numbers in a file
-StringPool gStrPool;
+StringPool *gStrPool;
// Generate random numbers using this
//RandomNumberGen gRandom;
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 728f7c2bc20..26e0efeabd8 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -187,7 +187,7 @@ struct TempValue {
extern bool GameDebug;
// Strings are stored here to avoid duplicates and invalid values when writing to XML
-extern StringPool gStrPool;
+extern StringPool *gStrPool;
// Generate random numbers using this
//extern RandomNumberGen gRandom;
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 2e4993e4a0e..66e091047bd 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -118,10 +118,10 @@ void Rect::Draw(const int &XOffset, const int &YOffset, const uint8 &r, const ui
void Rect::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("x", gStrPool.Get(x)));
- child->append_attribute(doc.allocate_attribute("y", gStrPool.Get(y)));
- child->append_attribute(doc.allocate_attribute("w", gStrPool.Get(w)));
- child->append_attribute(doc.allocate_attribute("h", gStrPool.Get(h)));
+ child->append_attribute(doc.allocate_attribute("x", gStrPool->Get(x)));
+ child->append_attribute(doc.allocate_attribute("y", gStrPool->Get(y)));
+ child->append_attribute(doc.allocate_attribute("w", gStrPool->Get(w)));
+ child->append_attribute(doc.allocate_attribute("h", gStrPool->Get(h)));
root->append_node(child);
}
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index b796c529cb6..a49e9bb6d00 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -144,15 +144,15 @@ void ScreenSettings::SetMouseTrap() {
}
void ScreenSettings::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("version", gStrPool.Get(version)));
+ root->append_attribute(doc.allocate_attribute("version", gStrPool->Get(version)));
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "screen");
- child->append_attribute(doc.allocate_attribute("w", gStrPool.Get(cur.w)));
- child->append_attribute(doc.allocate_attribute("h", gStrPool.Get(cur.h)));
- child->append_attribute(doc.allocate_attribute("fps", gStrPool.Get(fps)));
+ child->append_attribute(doc.allocate_attribute("w", gStrPool->Get(cur.w)));
+ child->append_attribute(doc.allocate_attribute("h", gStrPool->Get(cur.h)));
+ child->append_attribute(doc.allocate_attribute("fps", gStrPool->Get(fps)));
- child->append_attribute(doc.allocate_attribute("gamma", gStrPool.FGet(gamma)));
- child->append_attribute(doc.allocate_attribute("text_speed", gStrPool.FGet(text_speed)));
+ child->append_attribute(doc.allocate_attribute("gamma", gStrPool->FGet(gamma)));
+ child->append_attribute(doc.allocate_attribute("text_speed", gStrPool->FGet(text_speed)));
SaveBool(vsync, "vsync", doc, child);
SaveBool(border, "border", doc, child);
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 41ddf2e3669..18d683966bc 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -733,8 +733,8 @@ void Sprite::InternalEvents(Info &info, const std::string &player_id, std::vecto
//------------------------------------------------------------------------
void Sprite::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("id", id.c_str()));
- root->append_attribute(doc.allocate_attribute("x", gStrPool.Get(pos.x)));
- root->append_attribute(doc.allocate_attribute("y", gStrPool.Get(pos.y)));
+ root->append_attribute(doc.allocate_attribute("x", gStrPool->Get(pos.x)));
+ root->append_attribute(doc.allocate_attribute("y", gStrPool->Get(pos.y)));
}
//------------------------------------------------------------------------
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index eceded21d0a..2a7848a7fa8 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -105,6 +105,7 @@ Common::Error CrabEngine::run() {
_filePath = new FilePaths();
_tempData = new TempValue();
+ gStrPool = new StringPool();
_screenSettings = new ScreenSettings();
CursorMan.showMouse(true);
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index c54ca60a4a8..46101559837 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -76,12 +76,12 @@ bool EventSeqGroup::ActiveSeq(unsigned int &active_seq) {
void EventSeqGroup::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = end.begin(); i != end.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "end");
- child->value(gStrPool.Get(*i));
+ child->value(gStrPool->Get(*i));
root->append_node(child);
}
for (auto i = seq.begin(); i != seq.end(); ++i)
- i->second.SaveState(doc, root, gStrPool.Get(i->first));
+ i->second.SaveState(doc, root, gStrPool->Get(i->first));
}
void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 716f4140ed3..ecfc7e34900 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -116,12 +116,12 @@ void EventSequence::SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
// Write current event id and name to node
seqnode->append_attribute(doc.allocate_attribute("name", name));
- seqnode->append_attribute(doc.allocate_attribute("current", gStrPool.Get(cur)));
+ seqnode->append_attribute(doc.allocate_attribute("current", gStrPool->Get(cur)));
// Prepare strings of next events and write them
for (unsigned int i = 0; i < next.size(); i++) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "next");
- child->value(gStrPool.Get(next[i]));
+ child->value(gStrPool->Get(next[i]));
seqnode->append_node(child);
}
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 98665473037..d9055d65112 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -336,7 +336,7 @@ void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
for (auto v = var.begin(); v != var.end(); ++v) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
child->append_attribute(doc.allocate_attribute("id", v->first.c_str()));
- child->append_attribute(doc.allocate_attribute("val", gStrPool.Get(v->second)));
+ child->append_attribute(doc.allocate_attribute("val", gStrPool->Get(v->second)));
root->append_node(child);
}
@@ -353,7 +353,7 @@ void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
root->append_node(child_unr);
rapidxml::xml_node<char> *child_img = doc.allocate_node(rapidxml::node_element, "img");
- child_img->append_attribute(doc.allocate_attribute("index", gStrPool.Get(player_img)));
+ child_img->append_attribute(doc.allocate_attribute("index", gStrPool->Get(player_img)));
root->append_node(child_img);
rapidxml::xml_node<char> *child_money = doc.allocate_node(rapidxml::node_element, "money");
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 715ed333620..4ed9f7d9c7f 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -209,7 +209,7 @@ void InputManager::Save() {
// root node
rapidxml::xml_node<char> *root = doc.allocate_node(rapidxml::node_element, "controls");
- root->append_attribute(doc.allocate_attribute("version", gStrPool.Get(version)));
+ root->append_attribute(doc.allocate_attribute("version", gStrPool->Get(version)));
for (int i = 0; i < IT_TOTAL; i++)
iv[i].SaveState(doc, root, "i");
diff --git a/engines/crab/input/inputval.h b/engines/crab/input/inputval.h
index e3ab9d70f44..85abd646419 100644
--- a/engines/crab/input/inputval.h
+++ b/engines/crab/input/inputval.h
@@ -88,8 +88,8 @@ public:
rapidxml::xml_node<char> *child;
child = doc.allocate_node(rapidxml::node_element, "axis");
- //child->append_attribute(doc.allocate_attribute("id", gStrPool.Get(id)));
- child->append_attribute(doc.allocate_attribute("val", gStrPool.Get(val)));
+ //child->append_attribute(doc.allocate_attribute("id", gStrPool->Get(id)));
+ child->append_attribute(doc.allocate_attribute("val", gStrPool->Get(val)));
SaveBool(greater, "greater", doc, child);
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index f73bb1efc78..0baa3de9988 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -76,7 +76,7 @@ void Item::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
root->append_attribute(doc.allocate_attribute("id", id.c_str()));
root->append_attribute(doc.allocate_attribute("name", name.c_str()));
root->append_attribute(doc.allocate_attribute("type", type.c_str()));
- root->append_attribute(doc.allocate_attribute("img", gStrPool.Get(img)));
+ root->append_attribute(doc.allocate_attribute("img", gStrPool->Get(img)));
root->append_attribute(doc.allocate_attribute("desc", desc.c_str()));
for (auto i = bonus.begin(); i != bonus.end(); ++i) {
@@ -100,7 +100,7 @@ void Item::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
break;
}
- n->append_attribute(doc.allocate_attribute("val", gStrPool.Get(i->val)));
+ n->append_attribute(doc.allocate_attribute("val", gStrPool->Get(i->val)));
root->append_node(n);
}
}
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index a00f393465c..3676a58cb1f 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -58,7 +58,7 @@ void StatPreview::Draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
int count = 0;
for (auto i = item.bonus.begin(); i != item.bonus.end(); ++i, ++count) {
stat.Draw(helper.Name(i->type), inc_s.x * count, inc_s.y * count);
- unit.Draw(gStrPool.Get(i->val), inc_u.x * count, inc_u.y * count);
+ unit.Draw(gStrPool->Get(i->val), inc_u.x * count, inc_u.y * count);
}
}
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 34da9934308..3398084d873 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -213,7 +213,7 @@ void Level::LoadConst(const std::string &filename) {
// Purpose: Save all sprite positions to save file
//------------------------------------------------------------------------
void Level::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("player_index", gStrPool.Get(player_index)));
+ root->append_attribute(doc.allocate_attribute("player_index", gStrPool->Get(player_index)));
for (auto &i : objects) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sprite");
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 662db4d41ac..7506eb77069 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -160,11 +160,11 @@ void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<c
#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sound");
- child->append_attribute(doc.allocate_attribute("music", gStrPool.Get(Mix_VolumeMusic(-1))));
- child->append_attribute(doc.allocate_attribute("effects", gStrPool.Get(Mix_Volume(0, -1))));
- child->append_attribute(doc.allocate_attribute("frequency", gStrPool.Get(freq)));
- child->append_attribute(doc.allocate_attribute("channels", gStrPool.Get(channels)));
- child->append_attribute(doc.allocate_attribute("chunk_size", gStrPool.Get(chunksize)));
+ child->append_attribute(doc.allocate_attribute("music", gStrPool->Get(Mix_VolumeMusic(-1))));
+ child->append_attribute(doc.allocate_attribute("effects", gStrPool->Get(Mix_Volume(0, -1))));
+ child->append_attribute(doc.allocate_attribute("frequency", gStrPool->Get(freq)));
+ child->append_attribute(doc.allocate_attribute("channels", gStrPool->Get(channels)));
+ child->append_attribute(doc.allocate_attribute("chunk_size", gStrPool->Get(chunksize)));
root->append_node(child);
#endif
}
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index e0e35ed67b0..d6509b841d1 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -72,9 +72,9 @@ void Opinion::Validate(const OpinionType &type) {
void Opinion::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "opinion");
- child->append_attribute(doc.allocate_attribute("like", gStrPool.Get(val[OPI_LIKE])));
- child->append_attribute(doc.allocate_attribute("fear", gStrPool.Get(val[OPI_FEAR])));
- child->append_attribute(doc.allocate_attribute("respect", gStrPool.Get(val[OPI_RESPECT])));
+ child->append_attribute(doc.allocate_attribute("like", gStrPool->Get(val[OPI_LIKE])));
+ child->append_attribute(doc.allocate_attribute("fear", gStrPool->Get(val[OPI_FEAR])));
+ child->append_attribute(doc.allocate_attribute("respect", gStrPool->Get(val[OPI_RESPECT])));
root->append_node(child);
}
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 23d4810ee1e..fdf42df70fd 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -108,7 +108,7 @@ void Person::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
child->append_attribute(doc.allocate_attribute("name", name.c_str()));
unsigned int val = static_cast<unsigned int>(state);
- child->append_attribute(doc.allocate_attribute("state", gStrPool.Get(val)));
+ child->append_attribute(doc.allocate_attribute("state", gStrPool->Get(val)));
opinion.SaveState(doc, child);
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 00326beec11..c6fc86df8cb 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -61,10 +61,10 @@ void Trait::Clear() {
//------------------------------------------------------------------------
void Trait::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, rootname);
- child->append_attribute(doc.allocate_attribute("id", gStrPool.Get(id)));
+ child->append_attribute(doc.allocate_attribute("id", gStrPool->Get(id)));
child->append_attribute(doc.allocate_attribute("name", name.c_str()));
child->append_attribute(doc.allocate_attribute("desc", desc.c_str()));
- child->append_attribute(doc.allocate_attribute("img", gStrPool.Get(img)));
+ child->append_attribute(doc.allocate_attribute("img", gStrPool->Get(img)));
SaveBool(unread, "unread", doc, child);
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index c4ae1cc07b8..86d18795e9a 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -104,10 +104,10 @@ void Stat::Validate() {
void Stat::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("cur", gStrPool.Get(cur)));
- child->append_attribute(doc.allocate_attribute("def", gStrPool.Get(def)));
- child->append_attribute(doc.allocate_attribute("min", gStrPool.Get(min)));
- child->append_attribute(doc.allocate_attribute("max", gStrPool.Get(max)));
+ child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(cur)));
+ child->append_attribute(doc.allocate_attribute("def", gStrPool->Get(def)));
+ child->append_attribute(doc.allocate_attribute("min", gStrPool->Get(min)));
+ child->append_attribute(doc.allocate_attribute("max", gStrPool->Get(max)));
root->append_node(child);
}
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index 904fa2a4608..aad77269a96 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -57,8 +57,8 @@ void MapData::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
for (auto d = dest.begin(); d != dest.end(); ++d) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "pos");
child->append_attribute(doc.allocate_attribute("name", d->name.c_str()));
- child->append_attribute(doc.allocate_attribute("x", gStrPool.Get(d->pos.x)));
- child->append_attribute(doc.allocate_attribute("y", gStrPool.Get(d->pos.y)));
+ child->append_attribute(doc.allocate_attribute("x", gStrPool->Get(d->pos.x)));
+ child->append_attribute(doc.allocate_attribute("y", gStrPool->Get(d->pos.y)));
child_dest->append_node(child);
}
root->append_node(child_dest);
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index 1e65ff4be9e..c5c9b8dae90 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -73,9 +73,9 @@ struct ButtonImage {
}
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("img_b", gStrPool.Get(normal)));
- root->append_attribute(doc.allocate_attribute("img_s", gStrPool.Get(select)));
- root->append_attribute(doc.allocate_attribute("img_h", gStrPool.Get(hover)));
+ root->append_attribute(doc.allocate_attribute("img_b", gStrPool->Get(normal)));
+ root->append_attribute(doc.allocate_attribute("img_s", gStrPool->Get(select)));
+ root->append_attribute(doc.allocate_attribute("img_h", gStrPool->Get(hover)));
}
};
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index b1b388d7eb7..555b6de3f29 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -475,7 +475,7 @@ void Map::DestDel(const std::string &name) {
void Map::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "map");
- child->append_attribute(doc.allocate_attribute("cur", gStrPool.Get(cur)));
+ child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(cur)));
SaveBool(overlay, "overlay", doc, child);
for (auto r = map.begin(); r != map.end(); ++r) {
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index c96e617e3e7..cdcb1af80a3 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -59,8 +59,8 @@ public:
warning("STUB: Vector2D::SaveState()");
#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("x", gStrPool.Get((int)x)));
- child->append_attribute(doc.allocate_attribute("y", gStrPool.Get((int)y)));
+ child->append_attribute(doc.allocate_attribute("x", gStrPool->Get((int)x)));
+ child->append_attribute(doc.allocate_attribute("y", gStrPool->Get((int)y)));
root->append_node(child);
#endif
}
Commit: a5c8cb267b8e5325226e29949f540d96cb4805e6
https://github.com/scummvm/scummvm/commit/a5c8cb267b8e5325226e29949f540d96cb4805e6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix broken builds on windows due to type mixing errors
Changed paths:
engines/crab/input/cursor.cpp
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 84ca4cfcfa6..de9fc4051f2 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -119,7 +119,7 @@ void Cursor::HandleEvents(const Common::Event &event) {
button.y = event.mouse.y;
}
- state = hover | (pressed << 1);
+ state = (hover ? 1 : 0) | (pressed << 1);
if (state != oldState) {
if (hover) {
Commit: 49d5038f63005b772e1d581df6138bb6b0b897f4
https://github.com/scummvm/scummvm/commit/49d5038f63005b772e1d581df6138bb6b0b897f4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix memory bug in Image::Draw()
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index fae7d267b20..39da5a65ac0 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -258,26 +258,26 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
destRect.bottom = static_cast<int16>(clip->h + y);
}
- Graphics::Surface *s = new Graphics::Surface();
- s->copyFrom(texture->getSubArea(srcRect));
+ Graphics::ManagedSurface s;
+ s.copyFrom(texture->getSubArea(srcRect));
switch(flip) {
case FLIP_NONE:
break;
case FLIP_X:
- s->flipHorizontal(Common::Rect(s->w, s->h));
+ s.surfacePtr()->flipHorizontal(Common::Rect(s.w, s.h));
break;
case FLIP_Y:
- s->flipVertical(Common::Rect(s->w, s->h));
+ s.surfacePtr()->flipVertical(Common::Rect(s.w, s.h));
break;
default:
warning("Flipped texture: %d", flip);
}
- surf->blitFrom(s, Common::Rect(s->w, s->h), destRect);
+ surf->blitFrom(s, Common::Rect(s.w, s.h), destRect);
//g_engine->_renderSurface->blitFrom(s, Common::Rect(s->w, s->h), destRect);
}
Commit: 67c4c7db1ce2009686cc30be422f230e92e7cf15
https://github.com/scummvm/scummvm/commit/67c4c7db1ce2009686cc30be422f230e92e7cf15
Author: Kartik Agarwala (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix cursor img hover not being drawn
Changed paths:
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index de9fc4051f2..015998dfd39 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -81,7 +81,6 @@ void Cursor::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void Cursor::HandleEvents(const Common::Event &event) {
g_engine->_mouse->hover = false;
- byte oldState = state;
#if 0
if (event.type == SDL_MOUSEMOTION) {
@@ -118,7 +117,13 @@ void Cursor::HandleEvents(const Common::Event &event) {
button.x = event.mouse.x;
button.y = event.mouse.y;
}
+}
+//------------------------------------------------------------------------
+// Purpose: Draw
+//------------------------------------------------------------------------
+void Cursor::Draw() {
+ uint8 oldState = state;
state = (hover ? 1 : 0) | (pressed << 1);
if (state != oldState) {
@@ -136,24 +141,4 @@ void Cursor::HandleEvents(const Common::Event &event) {
}
}
-//------------------------------------------------------------------------
-// Purpose: Draw
-//------------------------------------------------------------------------
-void Cursor::Draw() {
-/*
- //warning("Drawing cursor: %d %d", motion.x, motion.y);
- if (hover) {
- if (pressed)
- img_hover_s.Draw(motion.x + hover_offset.x, motion.y + hover_offset.y);
- else
- img_hover.Draw(motion.x + hover_offset.x, motion.y + hover_offset.y);
- } else {
- if (pressed)
- img_s.Draw(motion.x, motion.y);
- else
- img.Draw(motion.x, motion.y);
- }
-*/
-}
-
} // End of namespace Crab
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index d43f222532a..9982c12aedd 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -54,7 +54,7 @@ class Cursor {
// Mouse image changes slightly if left click button is pressed
bool pressed;
- byte state;
+ uint8 state;
public:
// Various coordinates
Commit: 626639fdba251869ede560ace808df15647e8f7c
https://github.com/scummvm/scummvm/commit/626639fdba251869ede560ace808df15647e8f7c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix bug due to which loadingScreen was not drawn
Changed paths:
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 69a98613c58..72b59d40369 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -28,6 +28,7 @@
*
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/LoadingScreen.h"
#include "crab/XMLDoc.h"
@@ -62,6 +63,8 @@ void LoadingScreen::Draw() {
// Draw the loading text
text.Draw((g_engine->_screenSettings->cur.w - text.W()) / 2, (g_engine->_screenSettings->cur.h - text.H()) / 2);
+ g_engine->_screen->update();
+
// Update the screen
//SDL_RenderPresent(gRenderer);
}
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index c19f8c1d598..1a4a15ffd39 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -62,7 +62,7 @@ public:
~LoadingScreen(){};
void Change() {
- // cur = gRandom.Num() % screen.size();
+ cur = g_engine->getRandomNumber(screen.size() - 1);
}
void Load();
Commit: 0a3ff2d9a6192407f7a35d29dc1eee8641d8e2cb
https://github.com/scummvm/scummvm/commit/0a3ff2d9a6192407f7a35d29dc1eee8641d8e2cb
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub StatTemplates::Load()
Changed paths:
engines/crab/stat/StatTemplate.cpp
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index b5100c46239..1dc04d02000 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -37,16 +37,12 @@ namespace Crab {
using namespace pyrodactyl::stat;
void StatTemplates::Load(const std::string &filename) {
- warning("STUB: StatTemplates::Load()");
-
-#if 0
- XMLDoc conf(filename);
+ XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("templates");
for (auto n = node->first_node("stats"); n != NULL; n = n->next_sibling("stats"))
collection.push_back(n);
}
-#endif
}
} // End of namespace Crab
Commit: fe067820a483dec494b93f3063ff377cafbfcad9
https://github.com/scummvm/scummvm/commit/fe067820a483dec494b93f3063ff377cafbfcad9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub Sprite::FlyAround()
Changed paths:
engines/crab/ai/spriteai.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 632503f5aab..2aeb0db23cc 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -29,6 +29,7 @@
*/
#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/animation/sprite.h"
namespace Crab {
@@ -253,9 +254,6 @@ void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const Spri
}
void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
- warning("STUB: Sprite::FlyAround()");
-
-#if 0
// Is this sprite flying right now?
if (ai_data.walk.enabled) {
// We're flying towards the left edge
@@ -265,7 +263,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
ai_data.walk.enabled = false;
// Start the timer, set a semi-random time
- ai_data.walk.timer.Target(sc.fly.delay_min + (gRandom.Num() % sc.fly.delay_max));
+ ai_data.walk.timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
ai_data.walk.timer.Start();
}
}
@@ -276,7 +274,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
ai_data.walk.enabled = false;
// Start the timer, set a semi-random time
- ai_data.walk.timer.Target(sc.fly.delay_min + (gRandom.Num() % sc.fly.delay_max));
+ ai_data.walk.timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
ai_data.walk.timer.Start();
}
}
@@ -293,7 +291,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
ai_data.walk.timer.Stop();
// Decide if the sprite flies from the left or right of the camera
- if (gRandom.Num() % 2 == 1) {
+ if ((g_engine->getRandomNumber(2))) {
// Fly in from the right
X(camera.x + camera.w + sc.fly.start.x);
XVel(-1.0f * sc.fly.vel.x);
@@ -309,14 +307,13 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
dir = DIRECTION_RIGHT;
}
- Y(camera.y + sc.fly.start.y + (gRandom.Num() % (camera.h - (2 * sc.fly.start.y))));
+ Y(camera.y + sc.fly.start.y + (g_engine->getRandomNumber(camera.h - (2 * sc.fly.start.y))));
YVel(sc.fly.vel.y);
// Set state to flying
ai_data.walk.enabled = true;
}
}
-#endif
}
} // End of namespace Crab
Commit: c42e3879d43fd200eb7f113fb705f22d752f2155
https://github.com/scummvm/scummvm/commit/c42e3879d43fd200eb7f113fb705f22d752f2155
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub StatInfo:Draw()
Changed paths:
engines/crab/stat/StatDrawHelper.cpp
engines/crab/stat/StatDrawHelper.h
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index da3c02fab32..b35b61c1f89 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -28,24 +28,25 @@
*
*/
-
+#define FORBIDDEN_SYMBOL_ALLOW_ALL
+#include "crab/crab.h"
#include "crab/stat/StatDrawHelper.h"
namespace Crab {
-//using namespace pyrodactyl::text;
+using namespace pyrodactyl::text;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
void StatInfo::Load(rapidxml::xml_node<char> *node) {
if (NodeValid(node)) {
LoadBool(active, "active", node);
- //desc.Load(node->first_node("info"));
+ desc.Load(node->first_node("info"));
LoadStr(text, "text", node->first_node("info"));
if (NodeValid("value", node)) {
rapidxml::xml_node<char> *valuenode = node->first_node("value");
- //dim.Load(valuenode);
+ dim.Load(valuenode);
LoadImgKey(full, "full", valuenode);
LoadImgKey(empty, "empty", valuenode);
}
@@ -53,8 +54,6 @@ void StatInfo::Load(rapidxml::xml_node<char> *node) {
}
void StatInfo::Draw(const int &val, const int &max) {
- warning("STUB: StatInfo::Draw()");
-#if 0
if (active) {
using namespace pyrodactyl::image;
desc.Draw(text);
@@ -65,7 +64,6 @@ void StatInfo::Draw(const int &val, const int &max) {
for (; i < max; ++i)
g_engine->_imageManager->Draw(dim.x + i * dim.w, dim.y + i * dim.h, empty);
}
-#endif
}
void StatDrawHelper::Load(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index f62648028c1..67596974316 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -32,7 +32,7 @@
#define CRAB_STATDRAWHELPER_H
#include "crab/common_header.h"
-//#include "crab/ui/TextData.h"
+#include "crab/ui/TextData.h"
#include "crab/people/person.h"
namespace Crab {
@@ -41,10 +41,10 @@ namespace pyrodactyl {
namespace stat {
struct StatInfo {
// Used to draw stat value and description
- //pyrodactyl::ui::TextData desc;
+ pyrodactyl::ui::TextData desc;
std::string text;
- //Rect dim;
+ Rect dim;
ImageKey full, empty;
bool active;
Commit: 53bce6b93ccb9f71c67b9b15dd33c0adf9abf4db
https://github.com/scummvm/scummvm/commit/53bce6b93ccb9f71c67b9b15dd33c0adf9abf4db
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Load a random AnimationClip incase random is true
Changed paths:
engines/crab/animation/animframe.cpp
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index 7fd4844bf45..245ec67cd0b 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -86,13 +86,10 @@ void AnimationFrames::Load(rapidxml::xml_node<char> *node) {
}
}
-#if 0
if (random)
- current_clip = gRandom.Num() % frame.size();
+ current_clip = g_engine->getRandomNumber(frame.size() - 1);
else
current_clip = 0;
-#endif
- current_clip = 0;
}
bool AnimationFrames::UpdateClip() {
Commit: a30b1704dd09b3706dc72bc106ff89bd4f04b05a
https://github.com/scummvm/scummvm/commit/a30b1704dd09b3706dc72bc106ff89bd4f04b05a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix range for random numer generated in Sprite::FlyAround()
Changed paths:
engines/crab/ai/spriteai.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 2aeb0db23cc..020a0aa78e2 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -291,7 +291,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
ai_data.walk.timer.Stop();
// Decide if the sprite flies from the left or right of the camera
- if ((g_engine->getRandomNumber(2))) {
+ if (g_engine->getRandomNumber(1)) {
// Fly in from the right
X(camera.x + camera.w + sc.fly.start.x);
XVel(-1.0f * sc.fly.vel.x);
Commit: 7c3f4b3c785668018f1588209467bc6ef71c71be
https://github.com/scummvm/scummvm/commit/7c3f4b3c785668018f1588209467bc6ef71c71be
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use operator[] instead of .at() throughout the engine
Changed paths:
engines/crab/GameParam.h
engines/crab/LoadingScreen.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/ai/movement.cpp
engines/crab/ai/movement.h
engines/crab/animation/PopUp.cpp
engines/crab/animation/animframe.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fightmoves.h
engines/crab/animation/sprite.cpp
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/eventstore.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.h
engines/crab/item/ItemMenu.cpp
engines/crab/level/level_collide.cpp
engines/crab/mainmenu.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/color.cpp
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PauseMenu.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/emotion.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 26e0efeabd8..8bb357c85d4 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -125,7 +125,7 @@ public:
if (pool_i.count(num) == 0)
pool_i[num] = NumberToString<int>(num);
- return pool_i.at(num).c_str();
+ return pool_i[num].c_str();
#endif
if (pool_i.contains(num) == false)
pool_i[num] = NumberToString<int>(num);
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 72b59d40369..aeb9cf157cc 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -58,7 +58,7 @@ void LoadingScreen::Draw() {
// Draw the current screen
if (cur < screen.size())
- screen.at(cur).Draw();
+ screen[cur].Draw();
// Draw the loading text
text.Draw((g_engine->_screenSettings->cur.w - text.W()) / 2, (g_engine->_screenSettings->cur.h - text.H()) / 2);
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index dc34bf13acf..caf60d68f69 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -157,7 +157,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
if (area_trig.size() <= pos)
area_trig.resize(pos + 1);
- area_trig.at(pos) = s;
+ area_trig[pos] = s;
}
} else if (group_name == "stairs") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
@@ -206,7 +206,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
// if (*i == ',') comma = true;
// else if (*i == ' ')
// {
-// path.at(pos).push_back(GetPoint(start, x, y));
+// path[pos].push_back(GetPoint(start, x, y));
// comma = false;
// x.clear();
// y.clear();
@@ -214,7 +214,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
// else if (comma) y.push_back(*i);
// else x.push_back(*i);
// }
-// path.at(pos).push_back(GetPoint(start, x, y));
+// path[pos].push_back(GetPoint(start, x, y));
// }
// }
//}
@@ -350,7 +350,7 @@ bool TMXMap::InsideWalk(const Vector2i &pos) {
bool TMXMap::CollideWithTrigger(const Rect rect, int index) {
if (area_trig.size() > (unsigned int)index)
- return area_trig.at(index).Collide(rect).intersect;
+ return area_trig[index].Collide(rect).intersect;
return false;
}
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 1ca11c6f8a3..d8222a55652 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -105,7 +105,7 @@ void TileSetGroup::PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics:
start.y = 0;
finish.x = layer.tile.size() - 1;
- finish.y = layer.tile.at(0).size() - 1;
+ finish.y = layer.tile[0].size() - 1;
v.x = start.y * tile_size.x;
v.y = start.x * tile_size.y;
@@ -156,7 +156,7 @@ void TileSetGroup::ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i
if (finish.x > (int)layer.tile.size())
finish.x = layer.tile.size();
if (finish.y > (int)layer.tile[0].size())
- finish.y = layer.tile.at(0).size();
+ finish.y = layer.tile[0].size();
v.x = start.y * tile_size.x - camera.x;
v.y = start.x * tile_size.y - camera.y;
@@ -187,7 +187,7 @@ void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &til
// The row and column we end drawing at
finish.x = layer.tile.size() - 1;
- finish.y = layer.tile.at(0).size() - 1;
+ finish.y = layer.tile[0].size() - 1;
v.x = (start.y * tile_size.x - camera.x) * layer.rate.x;
v.y = (start.x * tile_size.y - camera.y) * layer.rate.y;
@@ -230,7 +230,7 @@ void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &til
if (finish.x > (int)layer.tile.size())
finish.x = layer.tile.size();
if (finish.y > (int)layer.tile[0].size())
- finish.y = layer.tile.at(0).size();
+ finish.y = layer.tile[0].size();
v.x = camera.x;
v.y = camera.y;
diff --git a/engines/crab/ai/movement.cpp b/engines/crab/ai/movement.cpp
index 9976f77f9a1..a6e4a235634 100644
--- a/engines/crab/ai/movement.cpp
+++ b/engines/crab/ai/movement.cpp
@@ -50,13 +50,13 @@ void MovementSet::Load(rapidxml::xml_node<char> *node) {
bool MovementSet::InternalEvents(const Rect rect) {
if (enabled) {
// If we are at the current waypoint, get to the next waypoint
- if (path.at(cur).target.Collide(rect)) {
+ if (path[cur].target.Collide(rect)) {
cur = (cur + 1) % path.size();
timer.Start();
}
// Wait according to the delay value in the node
- if (timer.Ticks() >= path.at(cur).delay)
+ if (timer.Ticks() >= path[cur].delay)
return true;
}
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index aa3b1c208ae..514c60c975f 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -82,7 +82,7 @@ struct MovementSet {
void Load(rapidxml::xml_node<char> *node);
bool InternalEvents(const Rect rect);
- Rect Target() { return path.at(cur).target; }
+ Rect Target() { return path[cur].target; }
};
} // End of namespace ai
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 7ee63416ce5..b5c8c83570c 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -94,17 +94,17 @@ bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const std::string &pla
void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
if (cur >= 0 && (unsigned int)cur < element.size()) {
- if (element.at(cur).InternalEvents(info, player_id, result, end_seq)) {
- if (element.at(cur).next <= 0 || (unsigned int)element.at(cur).next >= element.size()) {
+ if (element[cur].InternalEvents(info, player_id, result, end_seq)) {
+ if (element[cur].next <= 0 || (unsigned int)element[cur].next >= element.size()) {
// This means that this popup is the "end" node, we must loop back to start or end this
if (loop) {
cur = 0;
- element.at(cur).Reset();
+ element[cur].Reset();
} else
cur = -1;
} else {
- cur = element.at(cur).next;
- element.at(cur).Reset();
+ cur = element[cur].next;
+ element[cur].Reset();
}
}
}
@@ -126,7 +126,7 @@ void PopUp::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop,
void PopUpCollection::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
if (cur >= 0 && (unsigned int)cur < element.size())
- element.at(cur).Draw(x, y, pop, camera);
+ element[cur].Draw(x, y, pop, camera);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index 245ec67cd0b..f6b21fcd8b4 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -103,7 +103,7 @@ bool AnimationFrames::UpdateClip() {
}
const AnimFrame &AnimationFrames::CurrentFrame() {
- return frame.at(current_clip);
+ return frame[current_clip];
}
} // End of namespace Crab
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 99fe2e24b24..2694ee3a31d 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -65,7 +65,7 @@ void FightMoves::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
bool FightMoves::CurMove(FightMove &fm) {
if (cur >= 0 && (unsigned int)cur < move.size()) {
- fm = move.at(cur);
+ fm = move[cur];
return true;
}
@@ -74,7 +74,7 @@ bool FightMoves::CurMove(FightMove &fm) {
bool FightMoves::NextMove(FightMove &fm) {
if (next >= 0 && (unsigned int)next < move.size()) {
- fm = move.at(next);
+ fm = move[next];
return true;
}
@@ -88,8 +88,8 @@ bool FightMoves::CurFrame(FightAnimFrame &faf, const Direction &d) {
// Check validity of current move
if (cur >= 0 && (unsigned int)cur < move.size()) {
// Check validity of current frame
- if (frame_cur < frame_total && frame_cur < move.at(cur).frames[d].frame.size()) {
- faf = move.at(cur).frames[d].frame.at(frame_cur);
+ if (frame_cur < frame_total && frame_cur < move[cur].frames[d].frame.size()) {
+ faf = move[cur].frames[d].frame[frame_cur];
return true;
}
}
@@ -104,10 +104,10 @@ FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
// Check validity of current move
if (cur >= 0 && (unsigned int)cur < move.size()) {
// Check validity of current frame
- if (frame_cur < frame_total && frame_cur < move.at(cur).frames[d].frame.size()) {
+ if (frame_cur < frame_total && frame_cur < move[cur].frames[d].frame.size()) {
// Has the current frame finished playing?
// OR Is this the first frame of the move?
- if (timer.Ticks() >= move.at(cur).frames[d].frame.at(frame_cur).repeat || start) {
+ if (timer.Ticks() >= move[cur].frames[d].frame[frame_cur].repeat || start) {
frame_cur++;
timer.Start();
start = false;
@@ -161,7 +161,7 @@ bool FightMoves::ForceUpdate(const unsigned int &index, pyrodactyl::input::Fight
frame_total = move[cur].frames[d].frame.size();
if (frame_total > 0) {
input = move[cur].input;
- input.state = move[cur].frames[d].frame.at(0).state;
+ input.state = move[cur].frames[d].frame[0].state;
} else
input.Reset();
@@ -191,7 +191,7 @@ void FightMoves::Evaluate(pyrodactyl::event::Info &info) {
bool FightMoves::Flip(TextureFlipType &flip, Direction d) {
// Check validity of current move
if (ValidMove()) {
- flip = move.at(cur).frames[d].flip;
+ flip = move[cur].frames[d].flip;
return true;
}
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index 7326501432f..6791f3b8322 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -94,7 +94,7 @@ public:
bool Empty() { return move.empty(); }
bool Flip(TextureFlipType &flip, Direction d);
- const ShadowOffset &Shadow(Direction d) { return move.at(cur).frames[d].shadow; }
+ const ShadowOffset &Shadow(Direction d) { return move[cur].frames[d].shadow; }
void Next(int val) { next = val; }
int Next() { return next; }
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 18d683966bc..c3d0a302ebd 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -82,7 +82,7 @@ void Sprite::Load(rapidxml::xml_node<char> *node, std::vector<std::string> &anim
LoadNum(index, "moveset", node);
if (index < animations.size())
- anim_set.Load(animations.at(index));
+ anim_set.Load(animations[index]);
anim_set.fight.ListAttackMoves(ai_data.fight.attack);
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 46101559837..9ae00955ce4 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -45,16 +45,16 @@ void EventSeqGroup::AddSeq(const unsigned int &id, std::string &path) {
}
bool EventSeqGroup::EventInProgress(const unsigned int &id) {
- return seq.count(id) > 0 && seq.at(id).EventInProgress();
+ return seq.count(id) > 0 && seq[id].EventInProgress();
}
GameEvent *EventSeqGroup::CurEvent(const unsigned int &id) {
- return seq.at(id).CurrentEvent();
+ return seq[id].CurrentEvent();
}
void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const std::string &player_id,
std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq, const int choice) {
- return seq.at(id).NextEvent(info, player_id, result, end_seq, choice);
+ return seq[id].NextEvent(info, player_id, result, end_seq, choice);
}
void EventSeqGroup::InternalEvents(Info &info) {
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index d9055d65112..d9b4131f55e 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -98,12 +98,12 @@ void Info::LoadPeople(const std::string &filename) {
//------------------------------------------------------------------------
void Info::Type(const std::string &id, const PersonType &val) {
if (people.count(id) > 0)
- people.at(id).type = val;
+ people[id].type = val;
}
PersonType Info::Type(const std::string &id) {
if (people.count(id) > 0)
- return people.at(id).type;
+ return people[id].type;
return PE_NEUTRAL;
}
@@ -113,12 +113,12 @@ PersonType Info::Type(const std::string &id) {
//------------------------------------------------------------------------
void Info::State(const std::string &id, const PersonState &val) {
if (people.count(id) > 0)
- people.at(id).state = val;
+ people[id].state = val;
}
PersonState Info::State(const std::string &id) {
if (people.count(id) > 0)
- return people.at(id).state;
+ return people[id].state;
return PST_NORMAL;
}
@@ -130,7 +130,7 @@ bool Info::VarGet(const std::string &name, int &val) {
if (var.count(name) == 0)
return false;
else
- val = var.at(name);
+ val = var[name];
return true;
}
@@ -150,28 +150,28 @@ void Info::VarAdd(const std::string &name, const int &val) {
if (var.count(name) == 0)
VarSet(name, 0);
- var.at(name) += val;
+ var[name] += val;
}
void Info::VarSub(const std::string &name, const int &val) {
if (var.count(name) == 0)
VarSet(name, 0);
- var.at(name) -= val;
+ var[name] -= val;
}
void Info::VarMul(const std::string &name, const int &val) {
if (var.count(name) == 0)
VarSet(name, 0);
- var.at(name) *= val;
+ var[name] *= val;
}
void Info::VarDiv(const std::string &name, const int &val) {
if (var.count(name) == 0)
VarSet(name, 0);
- var.at(name) /= val;
+ var[name] /= val;
}
void Info::VarDel(const std::string &name) {
@@ -193,9 +193,9 @@ void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
if (i->id == trait_id)
return;
- p->trait.push_back(g_engine->_eventStore->trait.at(trait_id));
+ p->trait.push_back(g_engine->_eventStore->trait[trait_id]);
- g_engine->_eventStore->SetAchievement(g_engine->_eventStore->trait.at(trait_id).id);
+ g_engine->_eventStore->SetAchievement(g_engine->_eventStore->trait[trait_id].id);
}
}
}
@@ -224,18 +224,18 @@ bool Info::OpinionGet(const std::string &name, const pyrodactyl::people::Opinion
if (people.count(name) == 0)
return false;
- val = people.at(name).opinion.val[type];
+ val = people[name].opinion.val[type];
return true;
}
void Info::OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val) {
if (people.count(name) > 0)
- people.at(name).opinion.Change(type, val);
+ people[name].opinion.Change(type, val);
}
void Info::OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val) {
if (people.count(name) > 0)
- people.at(name).opinion.Set(type, val);
+ people[name].opinion.Set(type, val);
}
//------------------------------------------------------------------------
@@ -245,18 +245,18 @@ bool Info::StatGet(const std::string &name, const pyrodactyl::stat::StatType &ty
if (people.count(name) == 0)
return false;
- num = people.at(name).stat.val[type].cur;
+ num = people[name].stat.val[type].cur;
return true;
}
void Info::StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num) {
if (people.count(name) > 0)
- people.at(name).stat.Set(type, num);
+ people[name].stat.Set(type, num);
}
void Info::StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num) {
if (people.count(name) > 0)
- people.at(name).stat.Change(type, num);
+ people[name].stat.Change(type, num);
}
//------------------------------------------------------------------------
@@ -266,7 +266,7 @@ bool Info::PersonGet(const std::string &id, pyrodactyl::people::Person &p) {
if (people.count(id) == 0)
return false;
- p = people.at(id);
+ p = people[id];
return true;
}
@@ -277,12 +277,12 @@ bool Info::PersonValid(const std::string &id) {
pyrodactyl::people::Person &Info::PersonGet(const std::string &id) {
// Make sure to check PersonValid before doing this!
// Only use this to change parts of an object
- return people.at(id);
+ return people[id];
}
bool Info::CollideWithTrigger(const std::string &id, int rect_index) {
if (people.count(id) > 0) {
- for (auto i = people.at(id).trig.begin(); i != people.at(id).trig.end(); ++i)
+ for (auto i = people[id].trig.begin(); i != people[id].trig.end(); ++i)
if (*i == rect_index)
return true;
}
@@ -297,14 +297,14 @@ void Info::InsertName(std::string &msg) {
// We scan the dialog for #id values, which we convert to actual NPC names
for (unsigned int i = 0; i < msg.size(); ++i) {
// The # symbol indicates that the next string until an end character needs to be replaced by the name
- if (msg.at(i) == '#') {
+ if (msg[i] == '#') {
// The position we want to start from, and the length of the substring
unsigned int start = i, end = i + 1, len = 0;
// First make sure # wasn't the end of the string
for (; end < msg.size(); ++end, ++len)
- if (msg.at(end) == ',' || msg.at(end) == '.' || msg.at(end) == '!' || msg.at(end) == ' ' ||
- msg.at(end) == '?' || msg.at(end) == '-' || msg.at(end) == '\'' || msg.at(end) == '\"')
+ if (msg[end] == ',' || msg[end] == '.' || msg[end] == '!' || msg[end] == ' ' ||
+ msg[end] == '?' || msg[end] == '-' || msg[end] == '\'' || msg[end] == '\"')
break;
if (end < msg.size()) {
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 8684f63370f..5429e2f04e2 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -185,9 +185,9 @@ public:
// Draw the inventory
void InvDraw(const std::string &id) {
if (var.count(money_var) > 0)
- inv.Draw(people.at(id), var.at(money_var));
+ inv.Draw(people[id], var[money_var]);
else
- inv.Draw(people.at(id), 0);
+ inv.Draw(people[id], 0);
}
// Get whether game is iron man or not
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index e13c0483a42..ba0cfed87fe 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -91,7 +91,7 @@ void GameEventStore::SetAchievement(const int &id) {
if (id == 0)
m_pSteamUserStats->SetAchievement("a0");
else
- m_pSteamUserStats->SetAchievement(trait.at(id).id_str.c_str());
+ m_pSteamUserStats->SetAchievement(trait[id].id_str.c_str());
m_pSteamUserStats->StoreStats();
}
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 73a181cd627..8e126aeafd5 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -141,7 +141,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- int choice = reply.HandleEvents(info, g_engine->_eventStore->con.at(cur_event->special), cur_event->title, oh, Event);
+ int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -228,7 +228,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- int choice = reply.HandleEvents(info, g_engine->_eventStore->con.at(cur_event->special), cur_event->title, oh, Event);
+ int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -281,7 +281,7 @@ void Manager::InternalEvents(Info &info, Level &level, std::vector<EventResult>
using namespace pyrodactyl::anim;
DrawType draw_val = DRAW_SAME;
- if (g_engine->_eventStore->anim.at(cur_event->special).InternalEvents(draw_val))
+ if (g_engine->_eventStore->anim[cur_event->special].InternalEvents(draw_val))
event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
@@ -320,7 +320,7 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
if (event_map.count(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_ANIM:
- g_engine->_eventStore->anim.at(cur_event->special).Draw();
+ g_engine->_eventStore->anim[cur_event->special].Draw();
break;
case EVENT_DIALOG:
g_engine->_imageManager->DimScreen();
@@ -374,10 +374,10 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
switch (cur_event->type) {
case EVENT_ANIM:
- g_engine->_eventStore->anim.at(cur_event->special).Start();
+ g_engine->_eventStore->anim[cur_event->special].Start();
break;
case EVENT_REPLY:
- reply.Cache(info, g_engine->_eventStore->con.at(cur_event->special));
+ reply.Cache(info, g_engine->_eventStore->con[cur_event->special]);
break;
default:
break;
@@ -394,7 +394,7 @@ void Manager::EndSequence(const std::string &curloc) {
if (i->cur)
event_map[curloc].EndSeq(active_seq);
else if (event_map.count(i->loc) > 0)
- event_map.at(i->loc).EndSeq(StringToNumber<unsigned int>(i->val));
+ event_map[i->loc].EndSeq(StringToNumber<unsigned int>(i->val));
active_seq = UINT_MAX;
end_seq.clear();
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 8e50767e5a1..9c19a1fe891 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -124,7 +124,7 @@ private:
}
// Load the current player image
- void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->img.at(info.PlayerImg())); }
+ void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->img[info.PlayerImg()]); }
public:
Game() { StartNewGame(); }
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 89930626b35..218f92377d6 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -77,7 +77,7 @@ void ItemMenu::HandleEvents(const Common::Event &Event, const int &XOffset, cons
if (result != -1) {
select_index = result;
for (unsigned int i = 0; i < element.size(); ++i)
- element.at(i).State(i == (unsigned int)select_index);
+ element[i].State(i == (unsigned int)select_index);
}
}
@@ -90,7 +90,7 @@ void ItemMenu::HandleEvents(const SDL_Event &Event, const int &XOffset, const in
if (result != -1) {
select_index = result;
for (unsigned int i = 0; i < element.size(); ++i)
- element.at(i).State(i == select_index);
+ element[i].State(i == select_index);
}
}
#endif
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 87597affe11..9d44831df54 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -124,7 +124,7 @@ bool Level::LayerVisible(Sprite *obj) {
return true;
if ((unsigned int)obj->layer < terrain.layer.size())
- return terrain.layer.at(obj->layer).collide;
+ return terrain.layer[obj->layer].collide;
return false;
}
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 430bb6f3835..b6b319e7fa6 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -161,7 +161,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
int choice = me_main.HandleEvents(Event);
if (choice >= 0) {
for (unsigned i = 0; i < me_main.element.size(); ++i)
- me_main.element.at(i).State(i == (unsigned int)choice);
+ me_main.element[i].State(i == (unsigned int)choice);
switch (choice) {
case 0:
@@ -295,7 +295,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
int choice = me_main.HandleEvents(Event);
if (choice >= 0) {
for (unsigned i = 0; i < me_main.element.size(); ++i)
- me_main.element.at(i).State(i == choice);
+ me_main.element[i].State(i == choice);
switch (choice) {
case 0:
@@ -455,18 +455,18 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
// We are entering the normal state, i.e outside all menus - reset color of menu items
if (state == STATE_NORMAL) {
for (unsigned i = 0; i < me_main.element.size(); ++i)
- me_main.element.at(i).State(false);
+ me_main.element[i].State(false);
}
// Enable keyboard navigation if outside all menus, otherwise disable it
me_main.UseKeyboard((state == STATE_NORMAL));
// Continue button is only enabled if there is a save to load
- me_main.element.at(0).visible = !g_engine->_loadMenu->Empty();
+ me_main.element[0].visible = !g_engine->_loadMenu->Empty();
// Enable credits and quit button if outside all menus, otherwise disable it
- me_main.element.at(6).visible = (state == STATE_NORMAL);
- me_main.element.at(7).visible = (state == STATE_NORMAL);
+ me_main.element[6].visible = (state == STATE_NORMAL);
+ me_main.element[7].visible = (state == STATE_NORMAL);
// If switching to help screen, load latest image otherwise remove it from memory
if (state == STATE_HELP)
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 85d52bd8dca..ac99563b817 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -67,12 +67,12 @@ void TextManager::Init() {
if (font.size() <= pos)
font.resize(pos + 1);
#if 0
- font.at(pos) = TTF_OpenFont(path->value(), StringToNumber<int>(size->value()));
- TTF_SetFontHinting(font.at(pos), TTF_HINTING_LIGHT);
+ font[pos] = TTF_OpenFont(path->value(), StringToNumber<int>(size->value()));
+ TTF_SetFontHinting(font[pos], TTF_HINTING_LIGHT);
#endif
Common::File file;
FileOpen(path->value(), &file);
- font.at(pos) = Graphics::loadTTFFont(file, StringToNumber<int>(size->value()));
+ font[pos] = Graphics::loadTTFFont(file, StringToNumber<int>(size->value()));
}
}
}
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index 8b74347cace..320d2c0c61a 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -51,7 +51,7 @@ SDL_Color &ColorPool::Get(const int &num) {
if (pool.size() <= static_cast<unsigned int>(num))
return invalid;
- return pool.at(num);
+ return pool[num];
}
} // End of namespace Crab
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index 6142ccaa508..fec7d53f87c 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -69,7 +69,7 @@ int GameOverMenu::HandleEvents(const SDL_Event &Event) {
void GameOverMenu::Draw() {
bg.Draw();
if (cur < quote.size())
- title.Draw(quote.at(cur));
+ title.Draw(quote[cur]);
menu.Draw();
}
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 2f8f7c9dc20..f55448da440 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -90,7 +90,7 @@ void GeneralSettingMenu::HandleEvents(const Common::Event &Event) {
int result = text_speed.HandleEvents(Event);
if (result >= 0)
- g_engine->_screenSettings->text_speed = text_speed.element.at(result).val;
+ g_engine->_screenSettings->text_speed = text_speed.element[result].val;
}
#if 0
@@ -115,7 +115,7 @@ void GeneralSettingMenu::HandleEvents(const SDL_Event &Event) {
int result = text_speed.HandleEvents(Event);
if (result >= 0)
- g_engine->_screenSettings->text_speed = text_speed.element.at(result).val;
+ g_engine->_screenSettings->text_speed = text_speed.element[result].val;
}
#endif
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index ebe412bcd63..af12183a7a9 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -103,11 +103,11 @@ void KeyBindMenu::InitMenu(const int &type) {
int xoffset = inc.x * (i / 2) + divide.x * ((i / 2) / dim.x);
int yoffset = inc.y * ((i / 2) % dim.x) + divide.y * ((i / 2) / dim.x);
- menu[type].element.at(i).Init(prim, xoffset, yoffset);
- menu[type].element.at(i).caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].key);
+ menu[type].element[i].Init(prim, xoffset, yoffset);
+ menu[type].element[i].caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].key);
- menu[type].element.at(i + 1).Init(alt, xoffset, yoffset);
- menu[type].element.at(i + 1).caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].alt);
+ menu[type].element[i + 1].Init(alt, xoffset, yoffset);
+ menu[type].element[i + 1].caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].alt);
}
#endif
}
@@ -139,8 +139,8 @@ void KeyBindMenu::SetCaption() {
StartAndSize(sel_controls.cur, start, size);
for (int i = 0; i < size * 2; i += 2) {
- menu[sel_controls.cur].element.at(i).caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].key);
- menu[sel_controls.cur].element.at(i + 1).caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].alt);
+ menu[sel_controls.cur].element[i].caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].key);
+ menu[sel_controls.cur].element[i + 1].caption.text = SDL_GetScancodeName(g_engine->_inputManager->iv[start + (i / 2)].alt);
}
#endif
}
@@ -156,7 +156,7 @@ void KeyBindMenu::HandleEvents(const Common::Event &Event) {
case STATE_NORMAL:
choice = menu[sel_controls.cur].HandleEvents(Event);
if (choice >= 0) {
- prompt.Swap(menu[sel_controls.cur].element.at(choice).caption);
+ prompt.Swap(menu[sel_controls.cur].element[choice].caption);
state = STATE_KEY;
break;
}
@@ -166,7 +166,7 @@ void KeyBindMenu::HandleEvents(const Common::Event &Event) {
if (Event.type == SDL_KEYDOWN) {
SwapKey(Event.key.keysym.scancode);
SetCaption();
- menu[sel_controls.cur].element.at(choice).caption.col = prompt.col_prev;
+ menu[sel_controls.cur].element[choice].caption.col = prompt.col_prev;
state = STATE_NORMAL;
}
break;
@@ -185,7 +185,7 @@ void KeyBindMenu::HandleEvents(const SDL_Event &Event) {
case STATE_NORMAL:
choice = menu[sel_controls.cur].HandleEvents(Event);
if (choice >= 0) {
- prompt.Swap(menu[sel_controls.cur].element.at(choice).caption);
+ prompt.Swap(menu[sel_controls.cur].element[choice].caption);
state = STATE_KEY;
break;
}
@@ -195,7 +195,7 @@ void KeyBindMenu::HandleEvents(const SDL_Event &Event) {
if (Event.type == SDL_KEYDOWN) {
SwapKey(Event.key.keysym.scancode);
SetCaption();
- menu[sel_controls.cur].element.at(choice).caption.col = prompt.col_prev;
+ menu[sel_controls.cur].element[choice].caption.col = prompt.col_prev;
state = STATE_NORMAL;
}
break;
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 40c2059b3bc..9a9b8b2650d 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -50,7 +50,7 @@ void OptionMenu::Load(const std::string &filename) {
menu.Load(node->first_node("state"));
if (!menu.element.empty())
- menu.element.at(0).State(true);
+ menu.element[0].State(true);
}
if (NodeValid("keybind", node))
@@ -101,7 +101,7 @@ void OptionMenu::Reset() {
state = STATE_GENERAL;
for (unsigned i = 0; i < menu.element.size(); ++i)
- menu.element.at(i).State(i == STATE_GENERAL);
+ menu.element[i].State(i == STATE_GENERAL);
}
void OptionMenu::Draw(Button &back) {
@@ -320,7 +320,7 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
if (choice >= 0) {
if (choice < 4)
for (unsigned i = 0; i < menu.element.size(); ++i)
- menu.element.at(i).State(i == choice);
+ menu.element[i].State(i == choice);
switch (choice) {
case 0:
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index 0417833848b..de10f717179 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -47,7 +47,7 @@ class OptionSelect {
void Draw(const int &index) {
if (index >= 0 && (unsigned int)index < text.size())
- data.Draw(text.at(index));
+ data.Draw(text[index]);
}
} option;
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 2edf90624d2..f3080d685f1 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -78,8 +78,8 @@ public:
void Clear() {
menu.resize(1);
- menu.at(0).Clear();
- menu.at(0).UseKeyboard(true);
+ menu[0].Clear();
+ menu[0].UseKeyboard(true);
}
// Get the elements per page
@@ -97,8 +97,8 @@ public:
// Get the index of the hovered element in the menu
int HoverIndex() {
- if (menu.at(current_page).HoverIndex() >= 0)
- return (current_page * elements_per_page) + menu.at(current_page).HoverIndex();
+ if (menu[current_page].HoverIndex() >= 0)
+ return (current_page * elements_per_page) + menu[current_page].HoverIndex();
return -1;
}
@@ -111,7 +111,7 @@ public:
const int &CurX(const int &count) { return menu[current_page].element[count].x; }
const int &CurY(const int &count) { return menu[current_page].element[count].y; }
- void Image(const int &slot, const int &page, ButtonImage &bi) { menu.at(page).element.at(slot).Img(bi); }
+ void Image(const int &slot, const int &page, ButtonImage &bi) { menu[page].element[slot].Img(bi); }
void AssignPaths() {
for (auto m = menu.begin(); m != menu.end(); ++m)
@@ -175,7 +175,7 @@ public:
++page;
slot = 0;
menu.resize(page + 1);
- menu.at(page).UseKeyboard(true);
+ menu[page].UseKeyboard(true);
}
T b;
@@ -189,13 +189,13 @@ public:
void Add() {
unsigned int page = menu.size() - 1;
- unsigned int slot = menu.at(page).element.size();
+ unsigned int slot = menu[page].element.size();
Add(slot, page);
}
void Erase() {
unsigned int page = menu.size() - 1;
- menu.at(page).element.pop_back();
+ menu[page].element.pop_back();
AssignPaths();
UpdateInfo();
}
@@ -219,7 +219,7 @@ public:
current_page = menu.size() - 1;
}
- return menu.at(current_page).HandleEvents(Event);
+ return menu[current_page].HandleEvents(Event);
}
#if 0
@@ -242,13 +242,13 @@ public:
current_page = menu.size() - 1;
}
- return menu.at(current_page).HandleEvents(Event);
+ return menu[current_page].HandleEvents(Event);
}
#endif
void Draw() {
status.Draw(info);
- menu.at(current_page).Draw();
+ menu[current_page].Draw();
if (current_page > 0)
prev.Draw();
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 403755f5e72..d1cc0e04a3e 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -79,8 +79,8 @@ public:
~PauseMenu(void) {}
void UpdateMode(const bool &ironman) {
- menu.element.at(PS_SAVE - 1).visible = !ironman;
- menu.element.at(PS_LOAD - 1).visible = !ironman;
+ menu.element[PS_SAVE - 1].visible = !ironman;
+ menu.element[PS_LOAD - 1].visible = !ironman;
}
void Load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index a65b61fe7e8..fbdd77315bd 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -69,7 +69,7 @@ public:
select = result;
for (int i = 0; i < (int)element.size(); ++i)
- element.at(i).state = (i == result);
+ element[i].state = (i == result);
}
return result;
@@ -83,7 +83,7 @@ public:
select = result;
for (int i = 0; i < element.size(); ++i)
- element.at(i).state = (i == result);
+ element[i].state = (i == result);
}
return result;
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 31e79fa187e..841e03e4e2e 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -68,7 +68,7 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string
bool play_sound = false;
// Loop through any opinion changes required
- for (auto &i : dat.reply[element.at(choice).index].change) {
+ for (auto &i : dat.reply[element[choice].index].change) {
if (i.id == cur_id) {
// This is a special case because we also need to update the opinion bars
oh.OpinionChange(info, i.id, OPI_LIKE, i.val[OPI_LIKE]);
@@ -93,7 +93,7 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string
}
#endif
- return dat.reply[element.at(choice).index].nextid;
+ return dat.reply[element[choice].index].nextid;
}
return -1;
@@ -107,7 +107,7 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string
bool play_sound = false;
// Loop through any opinion changes required
- for (auto &i : dat.reply[element.at(choice).index].change) {
+ for (auto &i : dat.reply[element[choice].index].change) {
if (i.id == cur_id) {
// This is a special case because we also need to update the opinion bars
oh.OpinionChange(info, i.id, OPI_LIKE, i.val[OPI_LIKE]);
@@ -130,7 +130,7 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string
info.sound.rep_inc = true;
}
- return dat.reply[element.at(choice).index].nextid;
+ return dat.reply[element[choice].index].nextid;
}
return -1;
@@ -152,10 +152,10 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
for (auto i = dat.reply.begin(); i != dat.reply.end() && reply_count < dat.reply.size(); ++i, ++reply_count) {
if (i->unlock.Evaluate(info)) {
- element.at(element_count).visible = true;
- element.at(element_count).index = reply_count;
+ element[element_count].visible = true;
+ element[element_count].index = reply_count;
- tone.value.at(element_count) = dat.reply.at(reply_count).tone;
+ tone.value[element_count] = dat.reply[reply_count].tone;
//std::string text = SDL_GetScancodeName(g_engine->_inputManager->iv[IU_REPLY_0 + element_count].key);
//text += ". " + i->text;
@@ -163,9 +163,9 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
info.InsertName(text);
if (element_count == 0)
- element.at(element_count).Cache(text, spacing, 0, &bg);
+ element[element_count].Cache(text, spacing, 0, &bg);
else
- element.at(element_count).Cache(text, spacing, element.at(element_count - 1).y + element.at(element_count - 1).h, &bg);
+ element[element_count].Cache(text, spacing, element[element_count - 1].y + element[element_count - 1].h, &bg);
// Increment the element count only if the reply is unlocked
// This means we will keep checking against element 0 until we find an unlocked reply
@@ -176,7 +176,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
// Unused element buttons are hidden
for (; element_count < element.size(); element_count++)
- element.at(element_count).visible = false;
+ element[element_count].visible = false;
}
void ReplyMenu::SetUI() {
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 3033026d1d9..331d1b5de2e 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -119,7 +119,7 @@ void SlideShow::Refresh() {
img.Delete();
if (index >= 0 && index < path.size())
- img.Load(path.at(index));
+ img.Load(path[index]);
#endif
}
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index c833125240b..d359a211478 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -79,7 +79,7 @@ void TraitMenu::Draw(const pyrodactyl::people::Person *obj) {
i->Draw();
if (select > -1 && (unsigned int)select < obj->trait.size())
- desc.Draw(obj->trait.at(select).desc);
+ desc.Draw(obj->trait[select].desc);
} else
for (auto &i : menu.element)
i.Draw();
@@ -91,12 +91,12 @@ void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const Common::Even
for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
i->State(false);
- menu.element.at(choice).State(true);
+ menu.element[choice].State(true);
select = choice;
if (obj != nullptr) {
if (select > -1 && (unsigned int)select < obj->trait.size())
- obj->trait.at(select).unread = false;
+ obj->trait[select].unread = false;
}
}
}
@@ -108,12 +108,12 @@ void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const SDL_Event &E
for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
i->State(false);
- menu.element.at(choice).State(true);
+ menu.element[choice].State(true);
select = choice;
if (obj != nullptr) {
if (select > -1 && select < obj->trait.size())
- obj->trait.at(select).unread = false;
+ obj->trait[select].unread = false;
}
}
}
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 2b4f561da65..70df126d190 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -42,8 +42,8 @@ void EmotionIndicator::Load(rapidxml::xml_node<char> *node) {
void EmotionIndicator::Draw(const int &select) {
if (select >= 0 && (unsigned int)select < value.size())
- if (value.at(select) < g_engine->_eventStore->tone.size()) {
- text.Draw(g_engine->_eventStore->tone.at(value.at(select)).text);
+ if (value[select] < g_engine->_eventStore->tone.size()) {
+ text.Draw(g_engine->_eventStore->tone[value.at(select)].text);
}
}
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index fbbf23dec06..10b82f6be17 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -88,29 +88,29 @@ void HUD::Draw(pyrodactyl::event::Info &info, const std::string &id) {
menu.Draw();
if (info.unread.journal) {
- g_engine->_imageManager->Draw(menu.element.at(HS_JOURNAL).x + menu.element.at(HS_JOURNAL).w - clip.w / 2,
- menu.element.at(HS_JOURNAL).y - clip.h / 2, notify_anim, &clip);
+ g_engine->_imageManager->Draw(menu.element[HS_JOURNAL].x + menu.element[HS_JOURNAL].w - clip.w / 2,
+ menu.element[HS_JOURNAL].y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.inventory) {
- g_engine->_imageManager->Draw(menu.element.at(HS_INV).x + menu.element.at(HS_INV).w - clip.w / 2,
- menu.element.at(HS_INV).y - clip.h / 2, notify_anim, &clip);
+ g_engine->_imageManager->Draw(menu.element[HS_INV].x + menu.element[HS_INV].w - clip.w / 2,
+ menu.element[HS_INV].y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.trait) {
- g_engine->_imageManager->Draw(menu.element.at(HS_CHAR).x + menu.element.at(HS_CHAR).w - clip.w / 2,
- menu.element.at(HS_CHAR).y - clip.h / 2, notify_anim, &clip);
+ g_engine->_imageManager->Draw(menu.element[HS_CHAR].x + menu.element[HS_CHAR].w - clip.w / 2,
+ menu.element[HS_CHAR].y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.map) {
- g_engine->_imageManager->Draw(menu.element.at(HS_MAP).x + menu.element.at(HS_MAP).w - clip.w / 2,
- menu.element.at(HS_MAP).y - clip.h / 2, notify_anim, &clip);
+ g_engine->_imageManager->Draw(menu.element[HS_MAP].x + menu.element[HS_MAP].w - clip.w / 2,
+ menu.element[HS_MAP].y - clip.h / 2, notify_anim, &clip);
}
//#endif
}
void HUD::InternalEvents(bool ShowMap) {
- menu.element.at(HS_MAP).visible = ShowMap;
+ menu.element[HS_MAP].visible = ShowMap;
if (timer.TargetReached()) {
clip.x += clip.w;
@@ -170,9 +170,9 @@ void HUD::SetTooltip() {
#if 0
int count = 0;
for (auto i = menu.element.begin(); i != menu.element.end() && count < tooltip.size(); ++i, ++count)
- i->tooltip.text = tooltip.at(count) + " (" + i->hotkey.Name() + ")";
+ i->tooltip.text = tooltip[count] + " (" + i->hotkey.Name() + ")";
- menu.element.at(HS_PAUSE).tooltip.text = tooltip.at(HS_PAUSE) + " (" + SDL_GetScancodeName(g_engine->_inputManager->iv[IG_PAUSE].key) + ")";
+ menu.element[HS_PAUSE].tooltip.text = tooltip[HS_PAUSE] + " (" + SDL_GetScancodeName(g_engine->_inputManager->iv[IG_PAUSE].key) + ")";
#endif
}
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index ba81e70000c..35b9f8f6311 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -94,7 +94,7 @@ public:
~HUD() {}
void InternalEvents(bool ShowMap);
- void PlayerImg(const StateButtonImage &img) { menu.element.at(HS_CHAR).Img(img); }
+ void PlayerImg(const StateButtonImage &img) { menu.element[HS_CHAR].Img(img); }
void State(const int &val);
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index adc39fe955c..dbf786c255a 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -91,9 +91,9 @@ void Journal::Init(const std::string &id) {
//------------------------------------------------------------------------
void Journal::Select(const std::string &id, const int &choice) {
for (unsigned int i = 0; i < category.element.size(); ++i)
- category.element.at(i).State(false);
+ category.element[i].State(false);
- category.element.at(choice).State(true);
+ category.element[choice].State(true);
select = choice;
// Always find valid journal group first
@@ -224,7 +224,7 @@ void Journal::Move(const std::string &id, const std::string &Title, const bool &
break;
if (index < jo.menu[source].quest.size()) {
- jo.menu[destination].Add(jo.menu[source].quest.at(index));
+ jo.menu[destination].Add(jo.menu[source].quest[index]);
jo.menu[source].Erase(index);
}
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 555b6de3f29..53691752e2c 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -99,7 +99,7 @@ void Map::Draw(pyrodactyl::event::Info &info) {
if (overlay) {
// The overlay needs to be clipped as well, so we must find the intersection of the camera and the clip itself
- for (auto &i : map.at(cur).reveal) {
+ for (auto &i : map[cur].reveal) {
Rect r = i;
int X = pos.x + i.x - camera.x, Y = pos.y + i.y - camera.y;
@@ -176,10 +176,10 @@ void Map::Validate() {
camera.y = 0;
// decide visibility of scroll buttons
- scroll.element.at(DIRECTION_RIGHT).visible = !(camera.x == size.x - camera.w);
- scroll.element.at(DIRECTION_DOWN).visible = !(camera.y == size.y - camera.h);
- scroll.element.at(DIRECTION_LEFT).visible = !(camera.x == 0);
- scroll.element.at(DIRECTION_UP).visible = !(camera.y == 0);
+ scroll.element[DIRECTION_RIGHT].visible = !(camera.x == size.x - camera.w);
+ scroll.element[DIRECTION_DOWN].visible = !(camera.y == size.y - camera.h);
+ scroll.element[DIRECTION_LEFT].visible = !(camera.x == 0);
+ scroll.element[DIRECTION_UP].visible = !(camera.y == 0);
}
//------------------------------------------------------------------------
@@ -350,7 +350,7 @@ void Map::InternalEvents(pyrodactyl::event::Info &info) {
bool Map::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
int choice = travel.HandleEvents(Event, -1 * camera.x, -1 * camera.y);
if (choice >= 0) {
- cur_loc = travel.element.at(choice).loc;
+ cur_loc = travel.element[choice].loc;
pan = false;
return true;
}
@@ -371,7 +371,7 @@ bool Map::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event
bool Map::HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
int choice = travel.HandleEvents(Event, -1 * camera.x, -1 * camera.y);
if (choice >= 0) {
- cur_loc = travel.element.at(choice).loc;
+ cur_loc = travel.element[choice].loc;
pan = false;
return true;
}
@@ -393,14 +393,14 @@ void Map::SetImage(const unsigned int &val, const bool &force) {
img_bg.Delete();
img_overlay.Delete();
- img_bg.Load(map.at(cur).path_bg.c_str());
- img_overlay.Load(map.at(cur).path_overlay.c_str());
+ img_bg.Load(map[cur].path_bg.c_str());
+ img_overlay.Load(map[cur].path_overlay.c_str());
size.x = img_bg.W();
size.y = img_bg.H();
marker.Clear();
- for (auto &i : map.at(cur).dest)
+ for (auto &i : map[cur].dest)
marker.AddButton(i.name, i.pos.x, i.pos.y);
marker.AssignPaths();
@@ -429,11 +429,11 @@ void Map::Update(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
void Map::RevealAdd(const int &id, const Rect &area) {
if ((unsigned int)id < map.size()) {
- for (auto i = map.at(id).reveal.begin(); i != map.at(id).reveal.end(); ++i)
+ for (auto i = map[id].reveal.begin(); i != map[id].reveal.end(); ++i)
if (*i == area)
return;
- map.at(id).reveal.push_back(area);
+ map[id].reveal.push_back(area);
}
}
@@ -442,7 +442,7 @@ void Map::RevealAdd(const int &id, const Rect &area) {
//------------------------------------------------------------------------
void Map::DestAdd(const std::string &name, const int &x, const int &y) {
if (cur < map.size()) {
- for (auto i = map.at(cur).dest.begin(); i != map.at(cur).dest.end(); ++i) {
+ for (auto i = map[cur].dest.begin(); i != map[cur].dest.end(); ++i) {
if (i->name == name) {
i->pos.x = x;
i->pos.y = y;
@@ -450,7 +450,7 @@ void Map::DestAdd(const std::string &name, const int &x, const int &y) {
}
}
- map.at(cur).DestAdd(name, x, y);
+ map[cur].DestAdd(name, x, y);
marker.AddButton(name, x, y);
marker.AssignPaths();
}
@@ -458,9 +458,9 @@ void Map::DestAdd(const std::string &name, const int &x, const int &y) {
void Map::DestDel(const std::string &name) {
if (cur < map.size()) {
- for (auto i = map.at(cur).dest.begin(); i != map.at(cur).dest.end(); ++i) {
+ for (auto i = map[cur].dest.begin(); i != map[cur].dest.end(); ++i) {
if (i->name == name) {
- map.at(cur).dest.erase(i);
+ map[cur].dest.erase(i);
break;
}
}
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 416a87dfcc7..93026b37c39 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -349,13 +349,13 @@ public:
for (unsigned int i = 1; i < element.size(); i++) {
path.push_back(i);
- int prev_x = element.at(i - 1).x;
- int prev_y = element.at(i - 1).y;
+ int prev_x = element[i - 1].x;
+ int prev_y = element[i - 1].y;
- if (same_x && element.at(i).x != prev_x)
+ if (same_x && element[i].x != prev_x)
same_x = false;
- if (same_y && element.at(i).y != prev_y)
+ if (same_y && element[i].y != prev_y)
same_y = false;
}
}
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index c3e801ac1a5..a627e0a4e8e 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -136,16 +136,16 @@ void QuestMenu::Draw(Button &bu_map) {
else
g_engine->_textManager->Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_n, font, align);
- if (quest.at(i).unread) {
+ if (quest[i].unread) {
using namespace pyrodactyl::image;
g_engine->_imageManager->Draw(base_x + off_unread.x, base_y + off_unread.y, g_engine->_imageManager->notify);
}
}
if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
- text.Draw(quest.at(sel_quest));
+ text.Draw(quest[sel_quest]);
- if (quest.at(sel_quest).marker)
+ if (quest[sel_quest].marker)
bu_map.Draw();
}
}
@@ -163,21 +163,21 @@ bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const Commo
sel_page = menu.CurrentPage();
sel_quest = menu.Index() + sel_bu;
- quest.at(sel_quest).unread = false;
+ quest[sel_quest].unread = false;
text.Reset();
menu.Image(sel_bu, sel_page, img_s);
}
if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
- if (quest.at(sel_quest).marker)
+ if (quest[sel_quest].marker)
if (bu_map.HandleEvents(Event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
- map_title = quest.at(sel_quest).title;
+ map_title = quest[sel_quest].title;
return true;
}
- text.HandleEvents(quest.at(sel_quest), Event);
+ text.HandleEvents(quest[sel_quest], Event);
}
return false;
@@ -197,21 +197,21 @@ bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const SDL_E
sel_page = menu.CurrentPage();
sel_quest = menu.Index() + sel_bu;
- quest.at(sel_quest).unread = false;
+ quest[sel_quest].unread = false;
text.Reset();
menu.Image(sel_bu, sel_page, img_s);
}
if (sel_quest >= 0 && sel_quest < quest.size()) {
- if (quest.at(sel_quest).marker)
+ if (quest[sel_quest].marker)
if (bu_map.HandleEvents(Event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
- map_title = quest.at(sel_quest).title;
+ map_title = quest[sel_quest].title;
return true;
}
- text.HandleEvents(quest.at(sel_quest), Event);
+ text.HandleEvents(quest[sel_quest], Event);
}
return false;
@@ -234,7 +234,7 @@ void QuestMenu::Select(const int &quest_index) {
sel_bu = quest_index % menu.ElementsPerPage();
- quest.at(quest_index).unread = false;
+ quest[quest_index].unread = false;
text.Reset();
menu.Image(sel_bu, sel_page, img_s);
Commit: b1e85e9db6daec3c44f291fef3cd41d42ec69049
https://github.com/scummvm/scummvm/commit/b1e85e9db6daec3c44f291fef3cd41d42ec69049
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace std::vector with Common::Array where possible in UI component
Changed paths:
engines/crab/ui/CreditScreen.h
engines/crab/ui/FileMenu.h
engines/crab/ui/HealthIndicator.h
engines/crab/ui/MapData.h
engines/crab/ui/PageMenu.h
engines/crab/ui/ProgressBar.h
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/emotion.cpp
engines/crab/ui/emotion.h
engines/crab/ui/journal.h
engines/crab/ui/map.h
engines/crab/ui/menu.h
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 23fac197f3c..6a2cbf34dcf 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -56,7 +56,7 @@ class CreditScreen {
pyrodactyl::ui::ImageData bg, logo;
// The names displayed in the credits
- std::vector<CreditText> list;
+ Common::Array<CreditText> list;
// The starting position
Vector2i start;
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index c5f7d75a726..eb96fbb819a 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -59,7 +59,7 @@ protected:
std::string extension, directory;
// The save information for each slot
- std::vector<FileType> slot_info;
+ Common::Array<FileType> slot_info;
TextData td_b[DATA_BUTTON_TOTAL];
// The titles for loc_name, difficulty, time_played and player_name
diff --git a/engines/crab/ui/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
index 7d7559672bb..342bd9b1128 100644
--- a/engines/crab/ui/HealthIndicator.h
+++ b/engines/crab/ui/HealthIndicator.h
@@ -45,7 +45,7 @@ class HealthIndicator {
};
int x, y;
- std::vector<HealthImage> img;
+ Common::Array<HealthImage> img;
// Related to the pulse effect
uint8 alpha;
diff --git a/engines/crab/ui/MapData.h b/engines/crab/ui/MapData.h
index 1f9cad6e60f..057e4bbbc10 100644
--- a/engines/crab/ui/MapData.h
+++ b/engines/crab/ui/MapData.h
@@ -43,7 +43,7 @@ struct MapData {
std::string path_bg, path_overlay;
// The places the player has revealed in this world map
- std::vector<Rect> reveal;
+ Common::Array<Rect> reveal;
struct MarkerData {
// The name of the marker, same name as the quest
@@ -54,7 +54,7 @@ struct MapData {
};
// The set of destinations currently active
- std::vector<MarkerData> dest;
+ Common::Array<MarkerData> dest;
MapData() {}
MapData(rapidxml::xml_node<char> *node) { Load(node); }
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index f3080d685f1..41175b3551b 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -46,7 +46,7 @@ class PageMenu {
Button prev, next;
// Each page is stored separately in a menu object
- std::vector<Menu<T> > menu;
+ Common::Array<Menu<T> > menu;
// Keep track of which page we are at, and how many elements we keep in a page
unsigned int current_page, elements_per_page, rows, cols;
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index 4931614c4b9..84e64efc65e 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -85,7 +85,7 @@ class ProgressBar : public ClipButton {
}
};
- std::vector<CaptionText> ct;
+ Common::Array<CaptionText> ct;
public:
ProgressBar() {
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 1ffae39524a..80bc7489fa3 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -50,7 +50,7 @@ class ResolutionMenu : public ButtonMenu {
Button change, cancel, custom;
// Menu stores the button for each of the item in the dimension array
- std::vector<Dimension> dim;
+ Common::Array<Dimension> dim;
// The reference button for resolution
Button ref;
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 70df126d190..c48242e06ee 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -43,7 +43,7 @@ void EmotionIndicator::Load(rapidxml::xml_node<char> *node) {
void EmotionIndicator::Draw(const int &select) {
if (select >= 0 && (unsigned int)select < value.size())
if (value[select] < g_engine->_eventStore->tone.size()) {
- text.Draw(g_engine->_eventStore->tone[value.at(select)].text);
+ text.Draw(g_engine->_eventStore->tone[value[select]].text);
}
}
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index 7405697c0c6..ebf1ac7ee54 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -45,7 +45,7 @@ struct EmotionIndicator {
TextData text;
// This array is used to store the corresponding tone values to a reply
- std::vector<unsigned int> value;
+ Common::Array<unsigned int> value;
EmotionIndicator() {}
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index cedfac2be37..7549182bbd8 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -77,7 +77,7 @@ class Journal {
};
// This contains journal entries for all characters
- std::vector<Group> journal;
+ Common::Array<Group> journal;
// The reference quest menu, used to copy layouts
QuestMenu ref;
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 99e6d62c8b8..f9f1e90fb1c 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -48,7 +48,7 @@ namespace pyrodactyl {
namespace ui {
class Map {
// We have multiple world maps, each with their own data
- std::vector<MapData> map;
+ Common::Array<MapData> map;
// Index of the currently visible map
unsigned int cur;
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 93026b37c39..da9dee386b9 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -50,7 +50,7 @@ protected:
int hover_index;
// The order in which a keyboard or gamepad traverses the menu
- std::vector<unsigned int> path;
+ Common::Array<unsigned int> path;
// Are keyboard buttons enabled?
bool use_keyboard;
@@ -165,7 +165,7 @@ protected:
public:
// The collection of buttons in the menu
- std::vector<T> element;
+ Common::Array<T> element;
Menu() {
hover_index = -1;
Commit: abf297372d1037e0974b8bf99b6043a45eaa6f66
https://github.com/scummvm/scummvm/commit/abf297372d1037e0974b8bf99b6043a45eaa6f66
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace std::vector with Common::Array in text component
Changed paths:
engines/crab/text/TextManager.h
engines/crab/text/color.h
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index b35a4e095ad..2c7b7746417 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -49,7 +49,7 @@ namespace pyrodactyl {
namespace text {
class TextManager {
// The collection of stored fonts
- std::vector<Graphics::Font *> font;
+ Common::Array<Graphics::Font *> font;
// The size of the cache
int cache_size;
@@ -77,7 +77,7 @@ class TextManager {
};
// Text Cache - done to avoid having to render a texture every time text is drawn
- std::vector<TextCacheUnit> cache;
+ Common::Array<TextCacheUnit> cache;
// The oldest element in the text cache
int oldest;
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index 0e89c9cc7c8..dbeb7162d52 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -43,7 +43,7 @@ namespace text {
class ColorPool {
- std::vector<SDL_Color> pool;
+ Common::Array<SDL_Color> pool;
// Default invalid color
SDL_Color invalid;
Commit: ce4da9f1d95f4a50ef57c1a0708646c94782a52f
https://github.com/scummvm/scummvm/commit/ce4da9f1d95f4a50ef57c1a0708646c94782a52f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace std::vector with Common::Array in TMX and Pathfinding component where possible
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGraphNode.h
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.h
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 075d6085f8b..4db391480e6 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -162,7 +162,7 @@ void PathfindingAgent::Update(long timeslice) {
//{
// for(int y = -1; y < 2; ++y)
// {
- std::vector<PathfindingGraphNode *>::iterator i;
+ Common::Array<PathfindingGraphNode *>::iterator i;
for (i = current->location->neighborNodes.begin(); i != current->location->neighborNodes.end(); ++i) {
// Get the new tile to check
@@ -255,8 +255,8 @@ void PathfindingAgent::shutdown() {
grid = NULL;
}
-std::vector<PathfindingGraphNode const *> const PathfindingAgent::getSolution(PathfindingGraphNode *destNode) const {
- std::vector<PathfindingGraphNode const *> temp;
+Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getSolution(PathfindingGraphNode *destNode) const {
+ Common::Array<PathfindingGraphNode const *> temp;
PlannerNode *current = NULL;
@@ -284,10 +284,10 @@ std::vector<PathfindingGraphNode const *> const PathfindingAgent::getSolution(Pa
return temp;
}
-std::vector<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSolution(PathfindingGraphNode *destNode) {
- std::vector<PathfindingGraphNode const *> temp = getSolution(destNode);
+Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSolution(PathfindingGraphNode *destNode) {
+ Common::Array<PathfindingGraphNode const *> temp = getSolution(destNode);
- std::vector<PathfindingGraphNode const *> returnVec = temp;
+ Common::Array<PathfindingGraphNode const *> returnVec = temp;
// Any node that is not adjacent to an obstacle or an obstacle corner can be removed.
for (int i = 0; (unsigned int)i < temp.size(); ++i) {
@@ -295,10 +295,10 @@ std::vector<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSolut
if (i > 0 && (unsigned int)i < temp.size() - 1) {
// This check to see if the node is a "corner" to an obstacle that should not be pruned
// to prevent hanging on corners.
- std::vector<PathfindingGraphNode *> corners = grid->CornerCheck(temp[i - 1], temp[i + 1]);
+ Common::Array<PathfindingGraphNode *> corners = grid->CornerCheck(temp[i - 1], temp[i + 1]);
if (corners.size() == 0) {
- std::vector<PathfindingGraphNode const *>::iterator theEnd = std::remove(returnVec.begin(), returnVec.end(), temp[i]);
+ Common::Array<PathfindingGraphNode const *>::iterator theEnd = std::remove(returnVec.begin(), returnVec.end(), temp[i]);
returnVec.erase(theEnd);
}
}
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 992fe8be9e2..6b0b6c6d696 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -100,7 +100,7 @@ public:
bool solutionFound;
bool noSolution;
- std::vector<PathfindingGraphNode const *> m_vSolution;
+ Common::Array<PathfindingGraphNode const *> m_vSolution;
void SetNodeBufferDistance(float w) { nodeBufferDistance = w; }
float GetNodeBufferDistance() { return nodeBufferDistance; }
@@ -147,11 +147,11 @@ public:
bool isDone() const;
//! \brief Returns an unmodifiable view of the solution path found by this algorithm.
- std::vector<PathfindingGraphNode const *> const getSolution(PathfindingGraphNode *destNode) const;
+ Common::Array<PathfindingGraphNode const *> const getSolution(PathfindingGraphNode *destNode) const;
// Get the solution removing any nodes that are completely surrounded by open space.
// This will result in a more linear path to the goal.
- std::vector<PathfindingGraphNode const *> const getPrunedSolution(PathfindingGraphNode *destNode);
+ Common::Array<PathfindingGraphNode const *> const getPrunedSolution(PathfindingGraphNode *destNode);
//! \brief Resets the algorithm.
void exit();
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
index 9a92ea8da34..27ddc01bc55 100644
--- a/engines/crab/PathfindingGraphNode.h
+++ b/engines/crab/PathfindingGraphNode.h
@@ -50,8 +50,8 @@ class PathfindingGraphNode {
Rect collisionRect; // Represents spaced covered by the node.
public:
- std::vector<PathfindingGraphNode *> neighborNodes;
- std::vector<float> neighborCosts; // The movement cost for the neighbor nodes (distance to the node X the nodes movement cost)
+ Common::Array<PathfindingGraphNode *> neighborNodes;
+ Common::Array<float> neighborCosts; // The movement cost for the neighbor nodes (distance to the node X the nodes movement cost)
// This is stored to prevent having to recalculate each frame.
PathfindingGraphNode(void);
@@ -69,7 +69,7 @@ public:
// are equidistant
void AddNeighbor(PathfindingGraphNode *node, bool ignoreDistance);
- // const std::vector< PathfindingGraphNode*>& GetNeighbors() const;
+ // const Common::Array< PathfindingGraphNode*>& GetNeighbors() const;
Rect GetRect() const { return collisionRect; }
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 105f4b86998..a4a7e061698 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -102,7 +102,7 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
pos.y += cellSize.y;
- std::vector<Shape> noWalk = map.AreaNoWalk();
+ Common::Array<Shape> noWalk = map.AreaNoWalk();
// Check if the square should count as blocked
for (auto i = noWalk.begin(); i != noWalk.end(); ++i) {
@@ -114,7 +114,7 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
// Check for stairs if the cell isn't blocked
if (nodes[x][y].movementCost >= 0.0f) {
- std::vector<pyrodactyl::level::Stairs> stairs = map.AreaStairs();
+ Common::Array<pyrodactyl::level::Stairs> stairs = map.AreaStairs();
for (auto i = stairs.begin(); i != stairs.end(); ++i) {
if (i->Collide(nodes[x][y].collisionRect).intersect) {
@@ -195,8 +195,8 @@ PathfindingGraphNode *PathfindingGrid::GetNodeAtPoint(Vector2f point) {
return &nodes[x][y];
}
-std::vector<PathfindingGraphNode *> PathfindingGrid::CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2) {
- std::vector<PathfindingGraphNode *> returnNodes;
+Common::Array<PathfindingGraphNode *> PathfindingGrid::CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2) {
+ Common::Array<PathfindingGraphNode *> returnNodes;
// Iterat through both nodes neighbors. If a blocked neighbor is found that is shared between the two,
// It is a corner to them.
@@ -225,7 +225,7 @@ PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vect
std::list<PathfindingGraphNode *> checkNodes;
checkNodes.push_back(startNode);
- std::vector<PathfindingGraphNode *> allUsedNodes;
+ Common::Array<PathfindingGraphNode *> allUsedNodes;
allUsedNodes.push_back(startNode);
// Iterate through the nodes, check if they are open then check their distance from the compare point.
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 107b2173411..46cc81d1e55 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -85,7 +85,7 @@ public:
// Return true if two nodes share and adjacency to the same blocked node.
// Can be used to find corners that shouldn't be cut.
- std::vector<PathfindingGraphNode *> CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2);
+ Common::Array<PathfindingGraphNode *> CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2);
};
} // End of namespace Crab
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 0ce74e009a0..30bf8ae17e3 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -53,7 +53,7 @@ bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
} else {
type = LAYER_NORMAL;
int i = 0;
- std::vector<TileInfo> t;
+ Common::Array<TileInfo> t;
//.tmx stores tiles row-first
for (auto n = node->first_node("data")->first_node("tile"); n != NULL; n = n->next_sibling("tile")) {
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index 1e8884774a8..5c19861fd3c 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -81,7 +81,7 @@ public:
class MapLayer : public Layer {
public:
// The tiles in the layer
- std::vector<std::vector<TileInfo> > tile;
+ Common::Array<Common::Array<TileInfo> > tile;
// The type of layer
LayerType type;
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 856aa549a3c..27b46108e2e 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -55,16 +55,16 @@ protected:
Rect area_walk;
// The non-walk able areas in the level
- std::vector<Shape> area_nowalk;
+ Common::Array<Shape> area_nowalk;
// The trigger rectangles in the level
- std::vector<Shape> area_trig;
+ Common::Array<Shape> area_trig;
// Stairs modify the player walking speed
- std::vector<pyrodactyl::level::Stairs> area_stairs;
+ Common::Array<pyrodactyl::level::Stairs> area_stairs;
// Music areas change the music if player collides with them
- std::vector<pyrodactyl::level::MusicArea> area_music;
+ Common::Array<pyrodactyl::level::MusicArea> area_music;
// Archived methods for loading poly lines in tiled
// void LoadPath(rapidxml::xml_node<char> *node);
@@ -90,10 +90,10 @@ public:
Vector2i path_size;
// The layers of tiles in the level
- std::vector<MapLayer> layer;
+ Common::Array<MapLayer> layer;
// The props in the level
- std::vector<MapLayer> prop;
+ Common::Array<MapLayer> prop;
PathfindingGrid *grid; // The grid of graph nodes used for navigating.
@@ -126,8 +126,8 @@ public:
int W() { return w; }
int H() { return h; }
Rect AreaWalk() { return area_walk; }
- std::vector<Shape> AreaNoWalk() { return area_nowalk; }
- std::vector<pyrodactyl::level::Stairs> AreaStairs() { return area_stairs; }
+ Common::Array<Shape> AreaNoWalk() { return area_nowalk; }
+ Common::Array<pyrodactyl::level::Stairs> AreaStairs() { return area_stairs; }
};
} // End of namespace TMX
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 1719f533470..f3c45b9b11c 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -94,7 +94,7 @@ struct TileSet {
};
class TileSetGroup {
- std::vector<TileSet> tileset;
+ Common::Array<TileSet> tileset;
// The latest tile position
Vector2i v;
Commit: af2fbdb0e1a56576d3890d14e4555d9d44870c8c
https://github.com/scummvm/scummvm/commit/af2fbdb0e1a56576d3890d14e4555d9d44870c8c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace std::vector with Common::Array throughout the engine
Changed paths:
engines/crab/LoadingScreen.h
engines/crab/PathfindingGraphNode.cpp
engines/crab/Polygon.h
engines/crab/PriorityQueue.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/ai/movement.h
engines/crab/ai/spriteai.cpp
engines/crab/ai/spriteai.h
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/animation.h
engines/crab/animation/animframe.h
engines/crab/animation/fightanim.h
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fightmoves.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/conversationdata.h
engines/crab/event/effect.cpp
engines/crab/event/effect.h
engines/crab/event/eventstore.h
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/event/triggerset.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/item/Item.h
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/mainmenu.h
engines/crab/people/person.h
engines/crab/stat/StatTemplate.h
engines/crab/ui/FileMenu.h
engines/crab/ui/SaveGameMenu.cpp
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 1a4a15ffd39..64d01a5fdc7 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -49,7 +49,7 @@ class LoadingScreen {
};
// The different loading screens
- std::vector<Screen> screen;
+ Common::Array<Screen> screen;
// The current loading screen
unsigned int cur;
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 3d099ef788a..78f73bb5c97 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -92,7 +92,7 @@ bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode *otherNode) {
}
//
-// const std::vector< PathfindingGraphNode*>& PathfindingGraphNode::GetNeighbors() const
+// const Common::Array< PathfindingGraphNode*>& PathfindingGraphNode::GetNeighbors() const
//{
// return neighborNodes;
//}
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index 5ce2f321339..5550d34720c 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -59,10 +59,10 @@ class Polygon2D {
public:
// A list of all points
- std::vector<Vector2f> point;
+ Common::Array<Vector2f> point;
// A list of all edges
- std::vector<Vector2f> edge;
+ Common::Array<Vector2f> edge;
Polygon2D() {}
Polygon2D(rapidxml::xml_node<char> *node, Rect &bounds) { Load(node, bounds); }
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index 901adfaebdc..44256030711 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -97,7 +97,7 @@ public:
//! - There must be no <code>NULL</code> pointers in the heap.
//! \post
//! - All nodes should be sorted by this heap's comparator.
- void enumerate(std::vector<Node const *> &sorted) const;
+ void enumerate(Common::Array<Node const *> &sorted) const;
};
template<typename Node>
@@ -140,7 +140,7 @@ void PriorityQueue<Node>::remove(Node const *node) {
}
template<typename Node>
-void PriorityQueue<Node>::enumerate(std::vector<Node const *> &sorted) const {
+void PriorityQueue<Node>::enumerate(Common::Array<Node const *> &sorted) const {
sorted.resize(open.size());
std::copy(open.begin(), open.end(), sorted.begin());
}
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index caf60d68f69..ec0f98829d8 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -355,7 +355,7 @@ bool TMXMap::CollideWithTrigger(const Rect rect, int index) {
return false;
}
-void TMXMap::CollideWithTrigger(const Rect rect, std::vector<int> &collision_table) {
+void TMXMap::CollideWithTrigger(const Rect rect, Common::Array<int> &collision_table) {
int index = 0;
collision_table.clear();
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 27b46108e2e..dc22cb98045 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -72,7 +72,7 @@ protected:
public:
// The exits to different levels
- std::vector<pyrodactyl::level::Exit> area_exit;
+ Common::Array<pyrodactyl::level::Exit> area_exit;
// The layer on top of which objects walk
unsigned int sprite_layer;
@@ -121,7 +121,7 @@ public:
bool CollideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &music);
bool CollideWithTrigger(const Rect rect, int index);
- void CollideWithTrigger(const Rect rect, std::vector<int> &collision_table);
+ void CollideWithTrigger(const Rect rect, Common::Array<int> &collision_table);
int W() { return w; }
int H() { return h; }
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index 514c60c975f..2234f9f1924 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -55,7 +55,7 @@ struct MovementSet {
};
// The path followed by the sprite
- std::vector<Movement> path;
+ Common::Array<Movement> path;
// If true, sprite repeats the path pattern after reaching the last co-ordinate
bool repeat;
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 020a0aa78e2..f881cad04f0 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -153,7 +153,7 @@ bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &velocity, const S
//------------------------------------------------------------------------
// Purpose: AI routine for running to the nearest exit, then disappearing
//------------------------------------------------------------------------
-void Sprite::Flee(pyrodactyl::event::Info &info, std::vector<pyrodactyl::level::Exit> &area_exit, const SpriteConstant &sc) {
+void Sprite::Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level::Exit> &area_exit, const SpriteConstant &sc) {
switch (ai_data.flee.state) {
case FLEESTATE_GETNEARESTEXIT: {
if (area_exit.empty()) {
diff --git a/engines/crab/ai/spriteai.h b/engines/crab/ai/spriteai.h
index cc90eec6a39..2a7804a6624 100644
--- a/engines/crab/ai/spriteai.h
+++ b/engines/crab/ai/spriteai.h
@@ -63,7 +63,7 @@ struct SpriteAIData {
Timer delay;
// The list of moves that can be performed while attacking
- std::vector<unsigned int> attack;
+ Common::Array<unsigned int> attack;
FightData() { state = FIGHTSTATE_GETNEXTMOVE; }
} fight;
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index b5c8c83570c..84f1dc4dd42 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -69,7 +69,7 @@ void PopUpCollection::Load(rapidxml::xml_node<char> *node) {
// Purpose: Internal events
//------------------------------------------------------------------------
bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
- std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
if (visible.Evaluate(info) || started_show) {
if (delay.TargetReached()) {
if (duration.TargetReached(g_engine->_screenSettings->text_speed)) {
@@ -92,7 +92,7 @@ bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const std::string &pla
}
void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
- std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
if (cur >= 0 && (unsigned int)cur < element.size()) {
if (element[cur].InternalEvents(info, player_id, result, end_seq)) {
if (element[cur].next <= 0 || (unsigned int)element[cur].next >= element.size()) {
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index 56b59629f97..f775be48088 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -60,7 +60,7 @@ struct PopUp {
pyrodactyl::event::TriggerSet visible;
// Effects for changing variables and other related stuff
- std::vector<pyrodactyl::event::Effect> effect;
+ Common::Array<pyrodactyl::event::Effect> effect;
// The text displayed
std::string text;
@@ -86,12 +86,12 @@ struct PopUp {
// return true if we should proceed to next event, false otherwise
bool InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
- std::vector<pyrodactyl::event::EventResult> &result, std::vector<pyrodactyl::event::EventSeqInfo> &end_seq);
+ Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
};
struct PopUpCollection {
// Collection of environmental dialog
- std::vector<PopUp> element;
+ Common::Array<PopUp> element;
// The current dialog being played
int cur;
@@ -116,7 +116,7 @@ struct PopUpCollection {
void Load(rapidxml::xml_node<char> *node);
void InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
- std::vector<pyrodactyl::event::EventResult> &result, std::vector<pyrodactyl::event::EventSeqInfo> &end_seq);
+ Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
void Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
};
diff --git a/engines/crab/animation/animation.h b/engines/crab/animation/animation.h
index ed840f84d2c..73bc1164d12 100644
--- a/engines/crab/animation/animation.h
+++ b/engines/crab/animation/animation.h
@@ -42,7 +42,7 @@ namespace pyrodactyl {
namespace anim {
class Animation {
// All the frames are updated simultaneously rather than sequentially
- std::vector<AnimationFrame> frame;
+ Common::Array<AnimationFrame> frame;
// Length of the entire animation in milliseconds
uint32 length;
diff --git a/engines/crab/animation/animframe.h b/engines/crab/animation/animframe.h
index 6310992f788..8851671ec63 100644
--- a/engines/crab/animation/animframe.h
+++ b/engines/crab/animation/animframe.h
@@ -66,7 +66,7 @@ class AnimationFrames {
public:
// The frames for the animation
- std::vector<AnimFrame> frame;
+ Common::Array<AnimFrame> frame;
// The current clip
unsigned int current_clip;
diff --git a/engines/crab/animation/fightanim.h b/engines/crab/animation/fightanim.h
index 76f4a8f240e..a7f5ac57b00 100644
--- a/engines/crab/animation/fightanim.h
+++ b/engines/crab/animation/fightanim.h
@@ -75,7 +75,7 @@ class FightAnimFrames {
public:
// The individual frames for each direction
- std::vector<FightAnimFrame> frame;
+ Common::Array<FightAnimFrame> frame;
// The current clip
unsigned int current_clip;
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 2694ee3a31d..e6954ef216c 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -141,7 +141,7 @@ unsigned int FightMoves::FindMove(const pyrodactyl::input::FightAnimationType &t
//------------------------------------------------------------------------
// Purpose: Function for AI
//------------------------------------------------------------------------
-void FightMoves::ListAttackMoves(std::vector<unsigned int> &list) {
+void FightMoves::ListAttackMoves(Common::Array<unsigned int> &list) {
list.clear();
unsigned int pos = 0;
for (auto i = move.begin(); i != move.end(); ++i, ++pos)
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index 6791f3b8322..686fe593ab8 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -49,7 +49,7 @@ const unsigned int SPRITE_STATE_OVERRIDE = std::numeric_limits<unsigned int>::ma
class FightMoves {
// The fighting moves of a sprite
- std::vector<FightMove> move;
+ Common::Array<FightMove> move;
// The currently selected move
int cur;
@@ -81,7 +81,7 @@ public:
unsigned int FindMove(const pyrodactyl::input::FightAnimationType &type, const int &state);
- void ListAttackMoves(std::vector<unsigned int> &list);
+ void ListAttackMoves(Common::Array<unsigned int> &list);
bool ForceUpdate(const unsigned int &index, pyrodactyl::input::FightInput &input, const Direction &d);
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index c3d0a302ebd..bd21d64aab8 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -724,7 +724,7 @@ void Sprite::ExchangeDamage(Info &info, Sprite &s, const SpriteConstant &sc) {
//------------------------------------------------------------------------
// Purpose: Update status of ambient dialog via popup object
//------------------------------------------------------------------------
-void Sprite::InternalEvents(Info &info, const std::string &player_id, std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
+void Sprite::InternalEvents(Info &info, const std::string &player_id, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
popup.InternalEvents(info, player_id, result, end_seq);
}
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 7d59cd426a8..1b224c0439e 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -186,7 +186,7 @@ public:
void Load(rapidxml::xml_node<char> *node, std::vector<std::string> &animations);
void InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
- std::vector<pyrodactyl::event::EventResult> &result, std::vector<pyrodactyl::event::EventSeqInfo> &end_seq);
+ Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
void Draw(pyrodactyl::event::Info &info, const Rect &camera);
void DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
@@ -223,7 +223,7 @@ public:
// AI behavior routine for sprites running away from the player
// Requires every exit in the level be accessible
- void Flee(pyrodactyl::event::Info &info, std::vector<pyrodactyl::level::Exit> &area_exit, const pyrodactyl::ai::SpriteConstant &sc);
+ void Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level::Exit> &area_exit, const pyrodactyl::ai::SpriteConstant &sc);
// Used for sprites that fly across semi randomly on the screen
void FlyAround(const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc);
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 9ae00955ce4..9d28c9902ca 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -53,7 +53,7 @@ GameEvent *EventSeqGroup::CurEvent(const unsigned int &id) {
}
void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const std::string &player_id,
- std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq, const int choice) {
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq, const int choice) {
return seq[id].NextEvent(info, player_id, result, end_seq, choice);
}
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index 71db34978f4..500b716ca48 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -45,7 +45,7 @@ class EventSeqGroup {
SeqMap seq;
// The sequences that have ended in this group
- std::vector<unsigned int> end;
+ Common::Array<unsigned int> end;
public:
EventSeqGroup(void) {}
@@ -57,8 +57,8 @@ public:
bool ActiveSeq(unsigned int &active_seq);
GameEvent *CurEvent(const unsigned int &id);
- void NextEvent(const unsigned int &id, Info &info, const std::string &player_id, std::vector<EventResult> &result,
- std::vector<EventSeqInfo> &end_seq, const int choice = -1);
+ void NextEvent(const unsigned int &id, Info &info, const std::string &player_id, Common::Array<EventResult> &result,
+ Common::Array<EventSeqInfo> &end_seq, const int choice = -1);
void InternalEvents(Info &info);
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index ecfc7e34900..ed973a21d5f 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -66,8 +66,8 @@ void EventSequence::InternalEvents(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
// Purpose: Go to next event
//------------------------------------------------------------------------
-void EventSequence::NextEvent(pyrodactyl::event::Info &info, const std::string &player_id, std::vector<EventResult> &result,
- std::vector<EventSeqInfo> &end_seq, int NextEventChoice) {
+void EventSequence::NextEvent(pyrodactyl::event::Info &info, const std::string &player_id, Common::Array<EventResult> &result,
+ Common::Array<EventSeqInfo> &end_seq, int NextEventChoice) {
bool sync = false;
event_in_progress = false;
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index 9bd98830c5e..09a04cec3d1 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -44,7 +44,7 @@ namespace Crab {
namespace pyrodactyl {
namespace event {
class EventSequence {
- std::vector<GameEvent> events;
+ Common::Array<GameEvent> events;
bool event_in_progress;
// The event currently in execution - updated only when all trigger conditions are met in InternalEvents
@@ -53,7 +53,7 @@ class EventSequence {
// The events that can happen next - these are updated when the cur event is over
// This means cur and next operate in an alternating way
// scan next until find event, make it cur, end cur and update next, repeat
- std::vector<unsigned int> next;
+ Common::Array<unsigned int> next;
public:
EventSequence() {
@@ -67,8 +67,8 @@ public:
// See if we should trigger any event
void InternalEvents(pyrodactyl::event::Info &info);
- void NextEvent(Info &info, const std::string &player_id, std::vector<EventResult> &result,
- std::vector<EventSeqInfo> &end_seq, int NextEventChoice = -1);
+ void NextEvent(Info &info, const std::string &player_id, Common::Array<EventResult> &result,
+ Common::Array<EventSeqInfo> &end_seq, int NextEventChoice = -1);
bool EventInProgress() { return event_in_progress; }
void EventInProgress(bool val) { event_in_progress = val; }
diff --git a/engines/crab/event/conversationdata.h b/engines/crab/event/conversationdata.h
index 118c38d96ae..9836e9ec42a 100644
--- a/engines/crab/event/conversationdata.h
+++ b/engines/crab/event/conversationdata.h
@@ -54,7 +54,7 @@ struct ReplyChoice {
// The changes to opinion that are possible for this reply
// All NPCs affected by this conversation
- std::vector<ChangeVal> change;
+ Common::Array<ChangeVal> change;
ReplyChoice() {
tone = 0;
@@ -67,7 +67,7 @@ struct ReplyChoice {
struct ConversationData {
// The set of replies
- std::vector<ReplyChoice> reply;
+ Common::Array<ReplyChoice> reply;
ConversationData() {}
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 8f17b9bf205..31f1fbcaca6 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -130,7 +130,7 @@ void Effect::ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::Op
}
bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id,
- std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq) {
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
if (type < EFF_MOVE) {
switch (type) {
case EFF_VAR:
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index 01ba13816ed..8d8ca7e0532 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -108,7 +108,7 @@ struct Effect {
void Load(rapidxml::xml_node<char> *node);
bool Execute(pyrodactyl::event::Info &info, const std::string &player_id,
- std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq);
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq);
void ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType type);
};
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 3322205d879..081acd75d2f 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -43,10 +43,10 @@ namespace event {
// This structure is responsible for storing the special data structures for events like replies, conversations
struct GameEventStore {
// Data related to conversation events
- std::vector<ConversationData> con;
+ Common::Array<ConversationData> con;
// Data related to animations
- std::vector<pyrodactyl::anim::Animation> anim;
+ Common::Array<pyrodactyl::anim::Animation> anim;
// Data related to the tones of a character
struct ToneData {
@@ -54,13 +54,13 @@ struct GameEventStore {
};
// This sets the text the player sees as "tone" during the reply menu
- std::vector<ToneData> tone;
+ Common::Array<ToneData> tone;
// We need to change player character images when switching between characters
- std::vector<pyrodactyl::ui::StateButtonImage> img;
+ Common::Array<pyrodactyl::ui::StateButtonImage> img;
// The set of traits for various characters
- std::vector<pyrodactyl::people::Trait> trait;
+ Common::Array<pyrodactyl::people::Trait> trait;
// Steam UserStats interface
// ISteamUserStats *m_pSteamUserStats;
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index 58047e374fd..0e96bb47123 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -76,13 +76,13 @@ struct GameEvent {
unsigned int special;
// The variables changed/added in the event
- std::vector<Effect> effect;
+ Common::Array<Effect> effect;
// The triggers for the event
TriggerSet trig;
// The id of the next event
- std::vector<EventID> next;
+ Common::Array<EventID> next;
GameEvent();
GameEvent(rapidxml::xml_node<char> *node) { Load(node); }
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 8e126aeafd5..d554d01ece1 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -96,7 +96,7 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Event &Event, HUD &hud, Level &level, std::vector<EventResult> &result) {
+void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
if (event_map.count(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
@@ -183,7 +183,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &Event, HUD &hud, Level &level, std::vector<EventResult> &result) {
+void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
if (event_map.count(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
@@ -270,7 +270,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
-void Manager::InternalEvents(Info &info, Level &level, std::vector<EventResult> &result) {
+void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
if (event_map.count(info.CurLocID()) > 0) {
if (event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index c214887c189..82a4b349815 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -56,7 +56,7 @@ protected:
// THIS IS NOT THE DEFINITIVE LIST OF ENDED SEQUENCES
// JUST A TEMPORARY LIST OF EVENT SEQUENCES TO PASS AROUND
- std::vector<EventSeqInfo> end_seq;
+ Common::Array<EventSeqInfo> end_seq;
// The objects used to draw the dialog box and opinion bars
pyrodactyl::ui::PersonHandler oh;
@@ -93,13 +93,13 @@ public:
void Draw(Info &info, pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level);
// cur_per is also updated here
- void InternalEvents(Info &info, pyrodactyl::level::Level &level, std::vector<EventResult> &result);
+ void InternalEvents(Info &info, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
void HandleEvents(Info &info, const std::string &player_id, Common::Event &Event,
- pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, std::vector<EventResult> &result);
+ pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
#if 0
void HandleEvents(Info &info, const std::string &player_id, SDL_Event &Event,
- pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, std::vector<EventResult> &result);
+ pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
#endif
void CalcActiveSeq(Info &info, pyrodactyl::level::Level &level, const Rect &camera);
diff --git a/engines/crab/event/triggerset.h b/engines/crab/event/triggerset.h
index 8539278ee38..d38c86e0e92 100644
--- a/engines/crab/event/triggerset.h
+++ b/engines/crab/event/triggerset.h
@@ -41,7 +41,7 @@ namespace event {
class TriggerSet {
// The conditions needed to unlock whatever we want
// Places where this is used - events, levels, fighting moves
- std::vector<Trigger> statement;
+ Common::Array<Trigger> statement;
// Is the thing unlocked or not?
bool result;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 19413e16640..8d0796c398f 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -474,7 +474,7 @@ void Game::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
{
// HACK: Since sequences can only be ended in GameEventManager, we use this empty array
// to get effects to work for levels
- std::vector<pyrodactyl::event::EventSeqInfo> end_seq;
+ Common::Array<pyrodactyl::event::EventSeqInfo> end_seq;
ApplyResult(level.InternalEvents(info, event_res, end_seq, gem.EventInProgress()));
}
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 9c19a1fe891..13c7b10547b 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -70,7 +70,7 @@ private:
// These things don't need to be saved
pyrodactyl::ui::HUD hud;
- std::vector<pyrodactyl::event::EventResult> event_res;
+ Common::Array<pyrodactyl::event::EventResult> event_res;
pyrodactyl::ui::ParagraphData pop_default;
pyrodactyl::ui::DebugConsole debug_console;
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index 3b7184d6572..18612662a6f 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -51,7 +51,7 @@ struct Item {
std::string type;
// The stat bonuses provided by the item
- std::vector<pyrodactyl::stat::Bonus> bonus;
+ Common::Array<pyrodactyl::stat::Bonus> bonus;
// The price
unsigned int value;
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 0a7fb2bad7f..5e657738664 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -69,13 +69,13 @@ class Level {
std::vector<std::string> anim_set;
// The movement sets for sprites in levels
- std::vector<pyrodactyl::ai::MovementSet> move_set;
+ Common::Array<pyrodactyl::ai::MovementSet> move_set;
// These sprites are only for animated objects and cannot be interacted with
- std::vector<pyrodactyl::anim::Sprite> background;
+ Common::Array<pyrodactyl::anim::Sprite> background;
// These sprites fly across the screen randomly
- std::vector<pyrodactyl::anim::Sprite> fly;
+ Common::Array<pyrodactyl::anim::Sprite> fly;
// The id of the music track being played
MusicInfo music;
@@ -102,8 +102,8 @@ class Level {
void SortObjectsToDraw();
void MoveObject(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s);
- void Think(pyrodactyl::event::Info &info, std::vector<pyrodactyl::event::EventResult> &result,
- std::vector<pyrodactyl::event::EventSeqInfo> &end_seq, std::string &id);
+ void Think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
+ Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq, std::string &id);
void DrawObjects(pyrodactyl::event::Info &info);
void SetCamera();
@@ -112,7 +112,7 @@ class Level {
public:
// The objects in the level, and the player character
- std::vector<pyrodactyl::anim::Sprite> objects;
+ Common::Array<pyrodactyl::anim::Sprite> objects;
// The notification text drawn if the player is able to talk to a sprite
TalkNotify talk_notify;
@@ -193,8 +193,8 @@ public:
#if 0
void HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
- LevelResult InternalEvents(pyrodactyl::event::Info &info, std::vector<pyrodactyl::event::EventResult> &result,
- std::vector<pyrodactyl::event::EventSeqInfo> &end_seq, bool EventInProgress);
+ LevelResult InternalEvents(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
+ Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq, bool EventInProgress);
void PreDraw();
void PreDrawObjects(Graphics::ManagedSurface *surf);
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 618bc78d8ae..dc94e332ed7 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -45,7 +45,7 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Let the level tick along and notify if we go into an exit
//------------------------------------------------------------------------
-LevelResult Level::InternalEvents(Info &info, std::vector<EventResult> &result, std::vector<EventSeqInfo> &end_seq, bool EventInProgress) {
+LevelResult Level::InternalEvents(Info &info, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq, bool EventInProgress) {
LevelResult l_result;
// input.InternalEvents();
@@ -85,8 +85,8 @@ LevelResult Level::InternalEvents(Info &info, std::vector<EventResult> &result,
//------------------------------------------------------------------------
// Purpose: Let the AI think and animate the level
//------------------------------------------------------------------------
-void Level::Think(Info &info, std::vector<EventResult> &result,
- std::vector<EventSeqInfo> &end_seq, std::string &id) {
+void Level::Think(Info &info, Common::Array<EventResult> &result,
+ Common::Array<EventSeqInfo> &end_seq, std::string &id) {
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
// Only bother if the sprite is visible
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 0f768701628..82d334da166 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -71,7 +71,7 @@ class MainMenu : public GameState {
pyrodactyl::ui::ImageData bg;
// The lights on the background image
- std::vector<pyrodactyl::ui::AlphaImage> lights;
+ Common::Array<pyrodactyl::ui::AlphaImage> lights;
// The game logo
pyrodactyl::ui::ImageData logo;
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index 9d8bc79895a..20b1fa5ca39 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -72,10 +72,10 @@ struct Person {
// ImageKey pic;
// The trigger areas the person is in right now
- std::vector<int> trig;
+ Common::Array<int> trig;
// The traits of a person
- std::vector<Trait> trait;
+ Common::Array<Trait> trait;
Person();
void Load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem);
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index c3cb1020efd..2d7b64f6ffb 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -39,7 +39,7 @@ namespace Crab {
namespace pyrodactyl {
namespace stat {
struct StatTemplates {
- std::vector<StatGroup> collection;
+ Common::Array<StatGroup> collection;
public:
StatTemplates(void) {}
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index eb96fbb819a..00f20569b34 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -121,7 +121,7 @@ public:
path filedir(directory);
if (exists(filedir) && is_directory(filedir)) {
directory_iterator dir_it(filedir);
- std::vector<path> file_in_dir;
+ Common::Array<path> file_in_dir;
std::copy(directory_iterator(filedir), directory_iterator(), std::back_inserter(file_in_dir));
std::sort(file_in_dir.begin(), file_in_dir.end(), PathCompare);
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 7a67c670885..9060ff00ba0 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -62,7 +62,7 @@ void GameSaveMenu::ScanDir() {
if (exists(savedir) && is_directory(savedir)) {
directory_iterator dir_it(savedir);
- std::vector<boost::filesystem::path> file_in_dir;
+ Common::Array<boost::filesystem::path> file_in_dir;
file_in_dir.clear();
// Find all files in the save directory, sort them according to last modified
Commit: 135daff6b41383352d2924bc98dff290cc7616e7
https://github.com/scummvm/scummvm/commit/135daff6b41383352d2924bc98dff290cc7616e7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace std::string with Common::String in TMX
Changed paths:
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/level/level_load.cpp
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 30bf8ae17e3..4582307e2e1 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -42,7 +42,7 @@ bool Layer::Load(rapidxml::xml_node<char> *node) {
return false;
}
-bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
+bool MapLayer::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
if (Layer::Load(node)) {
if (NodeValid("image", node, false)) {
type = LAYER_IMAGE;
@@ -71,7 +71,7 @@ bool MapLayer::Load(const std::string &path, rapidxml::xml_node<char> *node) {
// Is it a prop layer or not? If yes, the prop dimensions
// The rate of scrolling of the layer, used for parallax scrolling
if (NodeValid("properties", node, false)) {
- std::string n, v;
+ Common::String n, v;
for (auto p = node->first_node("properties")->first_node("property"); p != NULL; p = p->next_sibling("property")) {
if (LoadStr(n, "name", p) && LoadStr(v, "value", p)) {
if (n == "prop" && v == "true")
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index 5c19861fd3c..52c95070e24 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -65,7 +65,7 @@ enum LayerType {
class Layer {
public:
// Name of the layer
- std::string name;
+ Common::String name;
// Dimensions of the layer in terms of tiles
int w, h;
@@ -105,7 +105,7 @@ public:
type = LAYER_NORMAL;
collide = false;
}
- bool Load(const std::string &path, rapidxml::xml_node<char> *node);
+ bool Load(const Common::String &path, rapidxml::xml_node<char> *node);
};
} // End of namespace TMX
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index ec0f98829d8..f010c4f68bd 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -62,7 +62,7 @@ TMXMap::TMXMap() {
// Purpose: Load stuff via a .tmx file set to xml storage (no compression)
//------------------------------------------------------------------------
-void TMXMap::Load(const std::string &path, std::string filename) {
+void TMXMap::Load(const Common::String &path, Common::String filename) {
XMLDoc conf((path + filename).c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("map");
@@ -110,7 +110,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
// see the level at which the sprites will be drawn
for (auto groupnode = node->first_node(); groupnode != NULL; groupnode = groupnode->next_sibling()) {
// Store the name for easy comparison
- std::string name = groupnode->name();
+ Common::String name = groupnode->name();
if (name == "layer" || name == "imagelayer") // Is this a tile or an image layer
{
@@ -129,7 +129,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
layer_count++;
} else if (name == "objectgroup") // Is this an object layer
{
- std::string group_name;
+ Common::String group_name;
LoadStr(group_name, "name", groupnode);
if (group_name == "exit") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
@@ -196,7 +196,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
// rapidxml::xml_node<char> *linenode = n->first_node("polyline");
// if (linenode != NULL)
// {
-// std::string points, x, y;
+// Common::String points, x, y;
// LoadStr(points, "points", linenode);
//
// path.resize(pos + 1);
@@ -221,7 +221,7 @@ void TMXMap::Load(const std::string &path, std::string filename) {
//------------------------------------------------------------------------
// Purpose: Convert point from string to vector
//------------------------------------------------------------------------
-// const Vector2i TMXMap::GetPoint(const Vector2i &ref, std::string &x, std::string &y)
+// const Vector2i TMXMap::GetPoint(const Vector2i &ref, Common::String &x, Common::String &y)
//{
// Vector2i v;
// v.x = ref.x + StringToNumber<int>(x);
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index dc22cb98045..38f95e949a0 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -68,7 +68,7 @@ protected:
// Archived methods for loading poly lines in tiled
// void LoadPath(rapidxml::xml_node<char> *node);
- // const Vector2i GetPoint(const Vector2i &ref, std::string &x, std::string &y);
+ // const Vector2i GetPoint(const Vector2i &ref, Common::String &x, Common::String &y);
public:
// The exits to different levels
@@ -106,7 +106,7 @@ public:
~TMXMap() {}
void Reset();
- void Load(const std::string &path, std::string filename);
+ void Load(const Common::String &path, Common::String filename);
void DrawDebug(const Rect &camera);
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index d8222a55652..1a6049dae42 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -37,7 +37,7 @@ namespace Crab {
using namespace TMX;
-void TileSet::Load(const std::string &path, rapidxml::xml_node<char> *node) {
+void TileSet::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
if (NodeValid(node)) {
LoadNum(first_gid, "firstgid", node);
LoadStr(name, "name", node);
@@ -49,7 +49,7 @@ void TileSet::Load(const std::string &path, rapidxml::xml_node<char> *node) {
if (NodeValid("image", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("image");
- std::string filename;
+ Common::String filename;
LoadStr(filename, "source", imgnode);
loc = path + filename;
@@ -73,7 +73,7 @@ void TileSetGroup::Reset() {
tileset.clear();
}
-void TileSetGroup::Load(const std::string &path, rapidxml::xml_node<char> *node) {
+void TileSetGroup::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
Reset();
for (auto n = node->first_node("tileset"); n != NULL; n = n->next_sibling("tileset")) {
TileSet t;
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index f3c45b9b11c..4b71137ab7f 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -40,10 +40,10 @@ namespace Crab {
namespace TMX {
struct TileSet {
// The name of the tileset
- std::string name;
+ Common::String name;
// The location of the tileset image on the disk
- std::string loc;
+ Common::String loc;
// The first gid of the tileset
GidFormat first_gid;
@@ -83,12 +83,12 @@ struct TileSet {
}
TileSet() { Init(); }
- TileSet(const std::string &path, rapidxml::xml_node<char> *node) {
+ TileSet(const Common::String &path, rapidxml::xml_node<char> *node) {
Init();
Load(path, node);
}
- void Load(const std::string &path, rapidxml::xml_node<char> *node);
+ void Load(const Common::String &path, rapidxml::xml_node<char> *node);
void Draw(const Vector2i &pos, const TileInfo &tile);
void PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf);
};
@@ -107,7 +107,7 @@ public:
void Reset();
- void Load(const std::string &path, rapidxml::xml_node<char> *node);
+ void Load(const Common::String &path, rapidxml::xml_node<char> *node);
void Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img);
void PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf);
void ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 3398084d873..cfe343c8a4f 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -75,7 +75,7 @@ void Level::Load(const std::string &filename, pyrodactyl::event::Info &info,
if (NodeValid("map", node)) {
rapidxml::xml_node<char> *mapnode = node->first_node("map");
- std::string path, tmxfile;
+ Common::String path, tmxfile;
LoadStr(path, "path", mapnode);
LoadStr(tmxfile, "file", mapnode);
Commit: 13425ef92e8fa4dddae689385099e81eb6f2dc1d
https://github.com/scummvm/scummvm/commit/13425ef92e8fa4dddae689385099e81eb6f2dc1d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace std::list with Common::list throughout the engine
Changed paths:
engines/crab/PathfindingGrid.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/animation/sprite.h
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index a4a7e061698..35a0bbbd284 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -222,7 +222,7 @@ PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vect
float shortestDistance = 0.0f;
- std::list<PathfindingGraphNode *> checkNodes;
+ Common::List<PathfindingGraphNode *> checkNodes;
checkNodes.push_back(startNode);
Common::Array<PathfindingGraphNode *> allUsedNodes;
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index f010c4f68bd..8581c86f953 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -317,7 +317,7 @@ void TMXMap::DrawDebug(const Rect &camera) {
//------------------------------------------------------------------------
// Purpose: Collision functions
//------------------------------------------------------------------------
-void TMXMap::CollideWithNoWalk(const Rect bounding_box, std::list<CollisionData> &colliders) {
+void TMXMap::CollideWithNoWalk(const Rect bounding_box, Common::List<CollisionData> &colliders) {
CollisionData res;
for (auto i = area_nowalk.begin(); i != area_nowalk.end(); ++i) {
res = i->Collide(bounding_box);
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 38f95e949a0..402797cac69 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -114,7 +114,7 @@ public:
bool InsideWalk(const Vector2i &pos);
bool InsideNoWalk(const Vector2i &pos);
- void CollideWithNoWalk(const Rect bounding_box, std::list<CollisionData> &colliders);
+ void CollideWithNoWalk(const Rect bounding_box, Common::List<CollisionData> &colliders);
bool CollideWithExit(const Rect rect, LevelResult &res);
bool CollideWithStairs(const Rect rect, Vector2f &vel_mod);
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 1b224c0439e..0f4e8fd9a01 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -118,7 +118,7 @@ public:
bool hover;
// The list of collisions currently taking place with the sprite
- std::list<CollisionData> collide_data;
+ Common::List<CollisionData> collide_data;
Sprite();
~Sprite() {}
Commit: 924eee956f1a2b58ede4ab1481575fd197f37d33
https://github.com/scummvm/scummvm/commit/924eee956f1a2b58ede4ab1481575fd197f37d33
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::StableMap instead of std::map
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/common_header.h
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 4db391480e6..adf490c17df 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -136,7 +136,7 @@ void PathfindingAgent::Update(long timeslice) {
return;
}
- std::map<PathfindingGraphNode *, PlannerNode *>::iterator currentIter;
+ Common::StableMap<PathfindingGraphNode *, PlannerNode *>::iterator currentIter;
do {
PlannerNode *current = nodeQueue.front();
@@ -232,7 +232,7 @@ bool PathfindingAgent::isDone() const {
// Clear everything.
void PathfindingAgent::exit() {
- std::map<PathfindingGraphNode *, PlannerNode *>::iterator iter;
+ Common::StableMap<PathfindingGraphNode *, PlannerNode *>::iterator iter;
if (!m_mCreatedList.empty()) {
for (iter = m_mCreatedList.begin(); iter != m_mCreatedList.end(); ++iter) {
delete (*iter).second;
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 6b0b6c6d696..1b2c194b331 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -112,7 +112,7 @@ public:
PriorityQueue<PlannerNode> nodeQueue;
- std::map<PathfindingGraphNode *, PlannerNode *> m_mCreatedList;
+ Common::StableMap<PathfindingGraphNode *, PlannerNode *> m_mCreatedList;
// void SetSprite(pyrodactyl::anim::Sprite* s){entitySprite = s;}
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index e51558dc3b8..f079af540af 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -56,6 +56,7 @@
#include "common/path.h"
#include "common/str.h"
#include "common/hashmap.h"
+#include "common/stablemap.h"
#include "common/list.h"
#include "common/rect.h"
#include "common/stream.h"
Commit: 126bad6e27cbb611f113d1241ce6d4c690591363
https://github.com/scummvm/scummvm/commit/126bad6e27cbb611f113d1241ce6d4c690591363
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::MultiMap instead of std::multimap
Changed paths:
engines/crab/common_header.h
engines/crab/level/level.h
engines/crab/level/level_draw.cpp
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index f079af540af..4f6664ec1e2 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -57,6 +57,7 @@
#include "common/str.h"
#include "common/hashmap.h"
#include "common/stablemap.h"
+#include "common/multimap.h"
#include "common/list.h"
#include "common/rect.h"
#include "common/stream.h"
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 5e657738664..9f6fdf50366 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -63,7 +63,7 @@ class Level {
unsigned int player_index;
// The order in which to draw the sprites
- std::multimap<int, pyrodactyl::anim::Sprite *> obj_seq;
+ Common::MultiMap<int, pyrodactyl::anim::Sprite *> obj_seq;
// The file index which contains the fighting moves of all characters
std::vector<std::string> anim_set;
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 12d3e4f8e28..c1998db7b10 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -236,7 +236,7 @@ void Level::SortObjectsToDraw() {
// add each object to the map to sort it
obj_seq.clear();
for (auto &object : objects)
- obj_seq.insert(std::pair<int, Sprite *>(object.Y() + object.H(), &object));
+ obj_seq.insert(Common::Pair<int, Sprite *>(object.Y() + object.H(), &object));
}
//------------------------------------------------------------------------
Commit: 36a6f31462c3b3b3f3398175ca29e1d87ae23f82
https://github.com/scummvm/scummvm/commit/36a6f31462c3b3b3f3398175ca29e1d87ae23f82
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get rid of STL libs in GameOverMenu and SlideShow
Changed paths:
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index fec7d53f87c..3ccfbf79a0f 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -46,7 +46,7 @@ void GameOverMenu::Load(rapidxml::xml_node<char> *node) {
title.Load(tinode);
for (auto n = tinode->first_node("quote"); n != NULL; n = n->next_sibling("quote")) {
- std::string str;
+ Common::String str;
LoadStr(str, "text", n);
quote.push_back(str);
}
@@ -69,7 +69,7 @@ int GameOverMenu::HandleEvents(const SDL_Event &Event) {
void GameOverMenu::Draw() {
bg.Draw();
if (cur < quote.size())
- title.Draw(quote[cur]);
+ title.Draw(quote[cur].c_str());
menu.Draw();
}
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 366354d75f3..bea787c8a68 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -45,7 +45,7 @@ class GameOverMenu {
ImageData bg;
// The selection of quotes, we pick one out of these
- std::vector<std::string> quote;
+ Common::Array<Common::String> quote;
// The current picked quote
unsigned int cur;
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 331d1b5de2e..380270fb1b3 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -56,7 +56,7 @@ void SlideShow::Load(rapidxml::xml_node<char> *node) {
path.clear();
for (auto n = node->first_node("slide"); n != NULL; n = n->next_sibling("slide")) {
- std::string p;
+ Common::String p;
LoadStr(p, "path", n);
path.push_back(p);
}
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 70589d558fa..cc54d90e861 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -42,7 +42,7 @@ namespace pyrodactyl {
namespace ui {
class SlideShow {
// The list of images and where they are located, and the current image
- std::vector<std::string> path;
+ Common::Array<Common::String> path;
// We only load the current image in memory
pyrodactyl::image::Image img;
Commit: b55d209f47b5a345edfea9400d6c3860538148cc
https://github.com/scummvm/scummvm/commit/b55d209f47b5a345edfea9400d6c3860538148cc
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::String instead of std::String in GameClock
Changed paths:
engines/crab/GameClock.h
engines/crab/game.cpp
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index d131b6da7bf..7355bd51284 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -39,7 +39,7 @@ namespace Crab {
class GameClock {
Timer timer;
uint32 start;
- std::string seperator;
+ Common::String seperator;
public:
GameClock() : seperator(" : ") { start = 0; }
@@ -49,21 +49,21 @@ public:
timer.Start();
}
- void Start(const std::string &str) {
+ void Start(const Common::String &str) {
uint32 ms = 0, hr = 0, min = 0, sec = 0;
- std::string str_hrs, str_min, str_sec;
+ Common::String str_hrs, str_min, str_sec;
- std::size_t found_1 = str.find_first_of(seperator);
- if (found_1 > 0 && found_1 != std::string::npos) {
+ std::size_t found_1 = str.findFirstOf(seperator);
+ if (found_1 > 0 && found_1 != Common::String::npos) {
str_hrs = str.substr(0, found_1);
hr = StringToNumber<uint32>(str_hrs);
- std::size_t found_2 = str.find_last_of(seperator);
+ std::size_t found_2 = str.findFirstOf(seperator);
if (found_2 > 0 && found_2 != std::string::npos) {
str_sec = str.substr(found_2 + 1, std::string::npos);
sec = StringToNumber<uint32>(str_sec);
- str_min = str.substr(found_1 + seperator.length(), found_2 - (2 * seperator.length()));
+ str_min = str.substr(found_1 + seperator.size(), found_2 - (2 * seperator.size()));
min = StringToNumber<uint32>(str_min);
}
}
@@ -72,7 +72,7 @@ public:
Start(ms);
}
- std::string GetTime() {
+ Common::String GetTime() {
uint32 ms = start + timer.Ticks();
uint32 x = ms / 1000;
@@ -81,7 +81,7 @@ public:
uint32 minutes = x % 60;
uint32 hours = x / 60;
- std::string time_str = NumberToString(hours).c_str();
+ Common::String time_str = NumberToString(hours).c_str();
time_str += seperator;
time_str += NumberToString(minutes).c_str();
time_str += seperator;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 8d0796c398f..b142a055c8d 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -690,7 +690,7 @@ void Game::LoadState(const std::string &filename) {
gem.per.Cache(info, level.PlayerID(), level);
- std::string playtime;
+ Common::String playtime;
LoadStr(playtime, "time", node);
clock.Start(playtime);
}
Commit: 2834ce2cff46aafb16fd53b7a348241b242e2567
https://github.com/scummvm/scummvm/commit/2834ce2cff46aafb16fd53b7a348241b242e2567
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get rid of STL string and vector from Option Select
Changed paths:
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 05cdd295356..990a38227b9 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -45,7 +45,7 @@ void OptionSelect::Load(rapidxml::xml_node<char> *node) {
option.text.clear();
for (auto n = node->first_node("option"); n != NULL; n = n->next_sibling("option")) {
- std::string s;
+ Common::String s;
LoadStr(s, "name", n);
option.text.push_back(s);
}
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index de10f717179..a51a6253188 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -42,12 +42,12 @@ namespace ui {
class OptionSelect {
struct
{
- std::vector<std::string> text;
+ Common::Array<Common::String> text;
TextData data;
void Draw(const int &index) {
if (index >= 0 && (unsigned int)index < text.size())
- data.Draw(text[index]);
+ data.Draw(text[index].c_str());
}
} option;
Commit: b2dff13474cd7ced9dbdf54bf1fdd7f2f6b6667e
https://github.com/scummvm/scummvm/commit/b2dff13474cd7ced9dbdf54bf1fdd7f2f6b6667e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get rid of STL vector of std::string from HUD
Changed paths:
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 10b82f6be17..07c1ea528ac 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -77,7 +77,7 @@ void HUD::Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, p
// Create a copy of all the tooltips
for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
- tooltip.push_back(i->tooltip.text);
+ tooltip.push_back(i->tooltip.text.c_str());
SetTooltip();
}
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 35b9f8f6311..62ae49d0680 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -79,7 +79,7 @@ class HUD {
Timer timer;
// The original tooltips as provided in the xml
- std::vector<std::string> tooltip;
+ Common::Array<Common::String> tooltip;
public:
GameOverMenu gom;
Commit: 25742dff7f48737d1d51bddb47be882d0807a820
https://github.com/scummvm/scummvm/commit/25742dff7f48737d1d51bddb47be882d0807a820
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::Array and Common::String instead of STL vector and String for animset
Changed paths:
engines/crab/animation/animset.cpp
engines/crab/animation/animset.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/level/level.h
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 9ebf3cc9f5e..10649a84c07 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::anim;
-void AnimSet::Load(const std::string &filename) {
+void AnimSet::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node();
diff --git a/engines/crab/animation/animset.h b/engines/crab/animation/animset.h
index db024033cf6..5ccf3075f29 100644
--- a/engines/crab/animation/animset.h
+++ b/engines/crab/animation/animset.h
@@ -59,7 +59,7 @@ struct AnimSet {
AnimSet() {}
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
TextureFlipType Flip(const Direction &dir);
const ShadowOffset &Shadow(const Direction &dir);
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index bd21d64aab8..45c4ff4eea1 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -54,7 +54,7 @@ Sprite::Sprite() : img_size(1, 1), vel_mod(1.0f, 1.0f) {
//------------------------------------------------------------------------
// Purpose: Load sprite from XML and animations from the index of all animation files
//------------------------------------------------------------------------
-void Sprite::Load(rapidxml::xml_node<char> *node, std::vector<std::string> &animations) {
+void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations) {
using namespace pyrodactyl::image;
if (NodeValid(node)) {
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 0f4e8fd9a01..01b1872f310 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -184,7 +184,7 @@ public:
void TakeDamage(pyrodactyl::event::Info &info, Sprite &s);
void ExchangeDamage(pyrodactyl::event::Info &info, Sprite &s, const pyrodactyl::ai::SpriteConstant &sc);
- void Load(rapidxml::xml_node<char> *node, std::vector<std::string> &animations);
+ void Load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations);
void InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 9f6fdf50366..00a67ecb02c 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -66,7 +66,7 @@ class Level {
Common::MultiMap<int, pyrodactyl::anim::Sprite *> obj_seq;
// The file index which contains the fighting moves of all characters
- std::vector<std::string> anim_set;
+ Common::Array<Common::String> anim_set;
// The movement sets for sprites in levels
Common::Array<pyrodactyl::ai::MovementSet> move_set;
Commit: 79908b0f2d39d9c7c624f8b81d3a48eadcb82233
https://github.com/scummvm/scummvm/commit/79908b0f2d39d9c7c624f8b81d3a48eadcb82233
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unneeded class member from TMXTileSet
Changed paths:
engines/crab/TMX/TMXTileSet.h
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 4b71137ab7f..1fbf59437ed 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -57,17 +57,6 @@ struct TileSet {
// The image used by the tileset
pyrodactyl::image::Image img;
- struct MyHash {
- std::size_t operator()(const TileInfo& s) const {
- std::size_t h1 = std::hash<int>{}(s.gid);
- std::size_t h2 = std::hash<int>{}(s.flip);
- return h1 ^ (h2 << 1);
- }
- };
-
- // Vector to hold textures for individual tiles in the tileset
- std::unordered_map<TileInfo, pyrodactyl::image::Image, MyHash> tiles;
-
// Stuff used to store temporary data
// The rectangle used to store clip info
@@ -79,7 +68,6 @@ struct TileSet {
tile_h = 1;
total_rows = 1;
total_cols = 1;
- tiles.clear();
}
TileSet() { Init(); }
Commit: 34201c4c59f652fe651b875330026eb4668aa18b
https://github.com/scummvm/scummvm/commit/34201c4c59f652fe651b875330026eb4668aa18b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::Hashmap instead of STL equivalent
Changed paths:
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 9d28c9902ca..7cc6cbf9f5c 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -45,7 +45,7 @@ void EventSeqGroup::AddSeq(const unsigned int &id, std::string &path) {
}
bool EventSeqGroup::EventInProgress(const unsigned int &id) {
- return seq.count(id) > 0 && seq[id].EventInProgress();
+ return seq.contains(id) > 0 && seq[id].EventInProgress();
}
GameEvent *EventSeqGroup::CurEvent(const unsigned int &id) {
@@ -59,13 +59,13 @@ void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const std::str
void EventSeqGroup::InternalEvents(Info &info) {
for (auto it = seq.begin(); it != seq.end(); ++it)
- it->second.InternalEvents(info);
+ it->_value.InternalEvents(info);
}
bool EventSeqGroup::ActiveSeq(unsigned int &active_seq) {
for (auto i = seq.begin(); i != seq.end(); ++i)
- if (i->second.EventInProgress()) {
- active_seq = i->first;
+ if (i->_value.EventInProgress()) {
+ active_seq = i->_key;
return true;
}
@@ -81,7 +81,7 @@ void EventSeqGroup::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<
}
for (auto i = seq.begin(); i != seq.end(); ++i)
- i->second.SaveState(doc, root, gStrPool->Get(i->first));
+ i->_value.SaveState(doc, root, gStrPool->Get(i->_key));
}
void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node) {
@@ -91,7 +91,7 @@ void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set"))
if (n->first_attribute("name") != NULL) {
unsigned int id = StringToNumber<unsigned int>(n->first_attribute("name")->value());
- if (seq.count(id) > 0)
+ if (seq.contains(id) > 0)
seq[id].LoadState(n);
}
}
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index 500b716ca48..ddfdfc2d124 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -39,7 +39,7 @@ namespace Crab {
namespace pyrodactyl {
namespace event {
class EventSeqGroup {
- typedef std::unordered_map<unsigned int, EventSequence> SeqMap;
+ typedef Common::HashMap<unsigned int, EventSequence> SeqMap;
// The event sequences in this group
SeqMap seq;
Commit: d7f83c3608fab016df61042067aebc403cd61296
https://github.com/scummvm/scummvm/commit/d7f83c3608fab016df61042067aebc403cd61296
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::Hashmap and Common::String instead of STL equivalent on GameEventManager
Changed paths:
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index d554d01ece1..bb51fa0249e 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -57,7 +57,7 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
if (conf.ready()) {
rapidxml::xml_node<char> *lnode = conf.Doc()->first_node("event_list");
for (rapidxml::xml_node<char> *loc = lnode->first_node("loc"); loc != NULL; loc = loc->next_sibling("loc")) {
- std::string loc_name;
+ Common::String loc_name;
LoadStr(loc_name, "name", loc);
for (auto n = loc->first_node("file"); n != NULL; n = n->next_sibling("file")) {
@@ -98,7 +98,7 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.count(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID().c_str()) > 0 && event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
@@ -119,7 +119,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
}
if (oh.HandleDlboxEvents(Event)) {
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
oh.show_journal = false;
}
}
@@ -127,7 +127,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP)
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_REPLY:
if (oh.show_journal) {
@@ -143,7 +143,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
}
}
@@ -155,7 +155,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
if (textin.HandleEvents(Event))
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
@@ -165,7 +165,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
intro.show_traits = false;
} else {
if (intro.HandleEvents(Event))
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
per.Cache(info, level.PlayerID(), level);
@@ -175,7 +175,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
break;
}
- EndSequence(info.CurLocID());
+ EndSequence(info.CurLocID().c_str());
}
}
@@ -185,7 +185,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
//------------------------------------------------------------------------
void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.count(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID().c_str()) > 0 && event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
@@ -206,7 +206,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
}
if (oh.HandleDlboxEvents(Event)) {
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
oh.show_journal = false;
}
}
@@ -214,7 +214,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == SDL_KEYUP || Event.type == SDL_MOUSEBUTTONUP)
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_REPLY:
if (oh.show_journal) {
@@ -230,7 +230,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
}
}
@@ -242,7 +242,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
if (textin.HandleEvents(Event))
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
@@ -252,7 +252,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
intro.show_traits = false;
} else {
if (intro.HandleEvents(Event))
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
per.Cache(info, level.PlayerID(), level);
@@ -262,7 +262,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
break;
}
- EndSequence(info.CurLocID());
+ EndSequence(info.CurLocID().c_str());
}
}
#endif
@@ -271,8 +271,8 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &
// Purpose: Internal Events
//------------------------------------------------------------------------
void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
- if (event_map.count(info.CurLocID()) > 0) {
- if (event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID().c_str()) > 0) {
+ if (event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
UpdateDialogBox(info, level);
@@ -282,7 +282,7 @@ void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult
DrawType draw_val = DRAW_SAME;
if (g_engine->_eventStore->anim[cur_event->special].InternalEvents(draw_val))
- event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
draw_game = false;
@@ -290,7 +290,7 @@ void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult
draw_game = true;
} break;
case EVENT_SILENT:
- event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
break;
case EVENT_REPLY:
UpdateDialogBox(info, level);
@@ -302,9 +302,9 @@ void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult
break;
}
- EndSequence(info.CurLocID());
+ EndSequence(info.CurLocID().c_str());
} else {
- event_map[info.CurLocID()].InternalEvents(info);
+ event_map[info.CurLocID().c_str()].InternalEvents(info);
CalcActiveSeq(info, level, level.Camera());
}
}
@@ -317,7 +317,7 @@ void Manager::UpdateDialogBox(Info &info, Level &level) {
// Purpose: Draw
//------------------------------------------------------------------------
void Manager::Draw(Info &info, HUD &hud, Level &level) {
- if (event_map.count(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID().c_str()) > 0 && event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_ANIM:
g_engine->_eventStore->anim[cur_event->special].Draw();
@@ -363,9 +363,9 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
// Purpose: Calculate the current sequence in progress
//------------------------------------------------------------------------
void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
- if (event_map[info.CurLocID()].ActiveSeq(active_seq)) {
+ if (event_map[info.CurLocID().c_str()].ActiveSeq(active_seq)) {
// Set all the pointers to the new values
- cur_event = event_map[info.CurLocID()].CurEvent(active_seq);
+ cur_event = event_map[info.CurLocID().c_str()].CurEvent(active_seq);
oh.Reset(cur_event->title);
cur_sp = level.GetSprite(cur_event->title);
@@ -392,9 +392,9 @@ void Manager::EndSequence(const std::string &curloc) {
if (end_seq.empty() == false) {
for (auto i = end_seq.begin(); i != end_seq.end(); ++i)
if (i->cur)
- event_map[curloc].EndSeq(active_seq);
- else if (event_map.count(i->loc) > 0)
- event_map[i->loc].EndSeq(StringToNumber<unsigned int>(i->val));
+ event_map[curloc.c_str()].EndSeq(active_seq);
+ else if (event_map.contains(i->loc.c_str()) > 0)
+ event_map[i->loc.c_str()].EndSeq(StringToNumber<unsigned int>(i->val));
active_seq = UINT_MAX;
end_seq.clear();
@@ -413,8 +413,8 @@ bool Manager::EventInProgress() {
void Manager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = event_map.begin(); i != event_map.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "loc");
- child->append_attribute(doc.allocate_attribute("name", i->first.c_str()));
- i->second.SaveState(doc, child);
+ child->append_attribute(doc.allocate_attribute("name", i->_key.c_str()));
+ i->_value.SaveState(doc, child);
root->append_node(child);
}
}
@@ -425,8 +425,8 @@ void Manager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
void Manager::LoadState(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
if (n->first_attribute("name") != NULL) {
- std::string name = n->first_attribute("name")->value();
- if (event_map.count(name) > 0)
+ Common::String name = n->first_attribute("name")->value();
+ if (event_map.contains(name) > 0)
event_map[name].LoadState(n);
}
}
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 82a4b349815..7cf1d93d05e 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -49,7 +49,7 @@ namespace event {
class Manager {
protected:
// All the events in the game
- std::unordered_map<std::string, EventSeqGroup> event_map;
+ Common::HashMap<Common::String, EventSeqGroup> event_map;
// The currently happening or active sequence
unsigned int active_seq;
Commit: b76eaf4d56f9011eb38bcd7763bbad056cc465ea
https://github.com/scummvm/scummvm/commit/b76eaf4d56f9011eb38bcd7763bbad056cc465ea
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common Equivalents of STL throughout the engine
Changed paths:
engines/crab/GameClock.h
engines/crab/LevelResult.h
engines/crab/LoadingScreen.cpp
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/ai/spriteai.cpp
engines/crab/animation/AnimationEffect.h
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/fm_ai_data.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/app.cpp
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/changeval.h
engines/crab/event/conversationdata.h
engines/crab/event/effect.cpp
engines/crab/event/effect.h
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/gameevent.cpp
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/event/quest.cpp
engines/crab/event/quest.h
engines/crab/event/trigger.cpp
engines/crab/event/trigger.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/input/inputval.h
engines/crab/item/Item.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/level/LevelExit.cpp
engines/crab/level/LevelExit.h
engines/crab/level/MusicArea.cpp
engines/crab/level/Stairs.cpp
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_load.cpp
engines/crab/level/talknotify.cpp
engines/crab/levelpaths.h
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/people/person.cpp
engines/crab/people/person.h
engines/crab/people/personbase.cpp
engines/crab/people/personbase.h
engines/crab/people/trait.h
engines/crab/stat/Stat.cpp
engines/crab/stat/Stat.h
engines/crab/stat/StatDrawHelper.h
engines/crab/stat/StatTemplate.cpp
engines/crab/stat/StatTemplate.h
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.cpp
engines/crab/text/color.h
engines/crab/ui/Caption.h
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/FileData.h
engines/crab/ui/FileMenu.h
engines/crab/ui/HoverInfo.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapData.cpp
engines/crab/ui/MapData.h
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/PageMenu.h
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/ParagraphData.h
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/ProgressBar.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SectionHeader.h
engines/crab/ui/TextData.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/mapbutton.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/textarea.h
engines/crab/ui/textdata.cpp
engines/crab/url.cpp
engines/crab/url.h
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 7355bd51284..55634a5429b 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -59,8 +59,8 @@ public:
hr = StringToNumber<uint32>(str_hrs);
std::size_t found_2 = str.findFirstOf(seperator);
- if (found_2 > 0 && found_2 != std::string::npos) {
- str_sec = str.substr(found_2 + 1, std::string::npos);
+ if (found_2 > 0 && found_2 != Common::String::npos) {
+ str_sec = str.substr(found_2 + 1, Common::String::npos);
sec = StringToNumber<uint32>(str_sec);
str_min = str.substr(found_1 + seperator.size(), found_2 - (2 * seperator.size()));
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index a32350dc712..d5e02886703 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -42,7 +42,7 @@ enum LevelResultType { LR_NONE,
struct LevelResult {
LevelResultType type;
- std::string val;
+ Common::String val;
int x, y;
LevelResult() : val("") {
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index aeb9cf157cc..c9d45f28b14 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -35,7 +35,7 @@
namespace Crab {
void LoadingScreen::Load() {
- const std::string &filename = "res/layout/loading.xml";
+ const Common::String &filename = "res/layout/loading.xml";
XMLDoc doc(filename.c_str());
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.Doc()->first_node("loading");
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index f96bb3af201..53a7430276a 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -40,7 +40,7 @@ float IntervalDistance(float minA, float maxA, float minB, float maxB) {
return minA - maxB;
}
-void Polygon2D::AddPoint(const Vector2f &ref, const std::string &x, const std::string &y, Vector2f &min, Vector2f &max) {
+void Polygon2D::AddPoint(const Vector2f &ref, const Common::String &x, const Common::String &y, Vector2f &min, Vector2f &max) {
Vector2f p;
p.x = ref.x + StringToNumber<float>(x);
p.y = ref.y + StringToNumber<float>(y);
@@ -70,7 +70,7 @@ void Polygon2D::Load(rapidxml::xml_node<char> *node, Rect &bounds) {
point.clear();
rapidxml::xml_node<char> *polynode = node->first_node("polygon");
if (polynode != NULL) {
- std::string points, x, y;
+ Common::String points, x, y;
LoadStr(points, "points", polynode);
bool comma = false;
@@ -83,9 +83,9 @@ void Polygon2D::Load(rapidxml::xml_node<char> *node, Rect &bounds) {
x.clear();
y.clear();
} else if (comma)
- y.push_back(*i);
+ y += *i;
else
- x.push_back(*i);
+ x += *i;
}
AddPoint(ref, x, y, min, max);
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index 5550d34720c..6a658952ef4 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -55,7 +55,7 @@ struct PolygonCollisionResult {
// Purpose: A simple 2D Polygon class
//------------------------------------------------------------------------
class Polygon2D {
- void AddPoint(const Vector2f &ref, const std::string &x, const std::string &y, Vector2f &min, Vector2f &max);
+ void AddPoint(const Vector2f &ref, const Common::String &x, const Common::String &y, Vector2f &min, Vector2f &max);
public:
// A list of all points
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 66e091047bd..1137d7affb3 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -32,8 +32,8 @@
namespace Crab {
-bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const std::string &x_name, const std::string &y_name,
- const std::string &w_name, const std::string &h_name) {
+bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const Common::String &x_name, const Common::String &y_name,
+ const Common::String &w_name, const Common::String &h_name) {
return LoadNum(x, x_name.c_str(), node, echo) && LoadNum(y, y_name.c_str(), node, echo) && LoadNum(w, w_name.c_str(), node, echo) && LoadNum(h, h_name.c_str(), node, echo);
}
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index c8659534814..334cdc7a33e 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -56,8 +56,8 @@ public:
h = H;
}
- bool Load(rapidxml::xml_node<char> *node, const bool &echo = true, const std::string &x_name = "x",
- const std::string &y_name = "y", const std::string &w_name = "w", const std::string &h_name = "h");
+ bool Load(rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &x_name = "x",
+ const Common::String &y_name = "y", const Common::String &w_name = "w", const Common::String &h_name = "h");
// Is this rectangle colliding with another rectangle?
bool Collide(Rect box);
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index f881cad04f0..0858c32f7d6 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -51,7 +51,7 @@ double Sprite::DistSq(const Sprite &s) {
void Sprite::MoveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
if (ai_data.dest.active) {
int num = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(id.c_str(), pyrodactyl::stat::STAT_SPEED, num);
++num;
float player_speed = static_cast<float>(num);
@@ -66,7 +66,7 @@ void Sprite::MoveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc)
void Sprite::MoveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
if (ai_data.dest.active) {
int num = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(id.c_str(), pyrodactyl::stat::STAT_SPEED, num);
++num;
float player_speed = static_cast<float>(num);
@@ -189,7 +189,7 @@ void Sprite::Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
break;
} else {
int num = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(id.c_str(), pyrodactyl::stat::STAT_SPEED, num);
++num;
float velocity = static_cast<float>(num);
diff --git a/engines/crab/animation/AnimationEffect.h b/engines/crab/animation/AnimationEffect.h
index 5ab9dba40a6..9f93b54c493 100644
--- a/engines/crab/animation/AnimationEffect.h
+++ b/engines/crab/animation/AnimationEffect.h
@@ -72,7 +72,7 @@ struct AnimationEffect {
LoadNum(start, "start", effnode);
LoadNum(finish, "finish", effnode);
- std::string str;
+ Common::String str;
LoadStr(str, "type", effnode);
if (str == "fade_in")
type = FADE_IN;
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 84f1dc4dd42..f4931400883 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -68,7 +68,7 @@ void PopUpCollection::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Internal events
//------------------------------------------------------------------------
-bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
if (visible.Evaluate(info) || started_show) {
if (delay.TargetReached()) {
@@ -91,7 +91,7 @@ bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const std::string &pla
return false;
}
-void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
if (cur >= 0 && (unsigned int)cur < element.size()) {
if (element[cur].InternalEvents(info, player_id, result, end_seq)) {
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index f775be48088..46b7677eef9 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -63,7 +63,7 @@ struct PopUp {
Common::Array<pyrodactyl::event::Effect> effect;
// The text displayed
- std::string text;
+ Common::String text;
// The next popup we should go to, negative values means the end
int next;
@@ -85,7 +85,7 @@ struct PopUp {
void Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
// return true if we should proceed to next event, false otherwise
- bool InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+ bool InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
};
@@ -115,7 +115,7 @@ struct PopUpCollection {
void Load(rapidxml::xml_node<char> *node);
- void InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+ void InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
void Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
diff --git a/engines/crab/animation/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
index 01833d53133..1564bdb01e3 100644
--- a/engines/crab/animation/fm_ai_data.h
+++ b/engines/crab/animation/fm_ai_data.h
@@ -65,7 +65,7 @@ struct FightMoveAIData {
range.Load(node->first_node("range"));
- std::string str;
+ Common::String str;
LoadStr(str, "type", node, false);
if (str == "attack")
type = MOVE_ATTACK;
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 45c4ff4eea1..1d992197628 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -650,7 +650,7 @@ bool Sprite::TakingDamage(Sprite &sp, const SpriteConstant &sc) {
if (BoxV().Collide(sp.BoxD()))
return true;
- /*std::string words = NumberToString(BoxV().x) + " " + NumberToString(BoxV().y)+ " " + NumberToString(BoxV().w)
+ /*Common::String words = NumberToString(BoxV().x) + " " + NumberToString(BoxV().y)+ " " + NumberToString(BoxV().w)
+ " " + NumberToString(BoxV().h) + "\n" + NumberToString(sp.BoxD().x) + " " + NumberToString(sp.BoxD().y)
+ " " + NumberToString(sp.BoxD().w) + " " + NumberToString(sp.BoxD().h) + "\n";
fprintf(stdout,words.c_str());*/
@@ -724,7 +724,7 @@ void Sprite::ExchangeDamage(Info &info, Sprite &s, const SpriteConstant &sc) {
//------------------------------------------------------------------------
// Purpose: Update status of ambient dialog via popup object
//------------------------------------------------------------------------
-void Sprite::InternalEvents(Info &info, const std::string &player_id, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
+void Sprite::InternalEvents(Info &info, const Common::String &player_id, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
popup.InternalEvents(info, player_id, result, end_seq);
}
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 01b1872f310..e73bf0d4a7e 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -55,7 +55,7 @@ namespace anim {
class Sprite {
protected:
// Used to sync sprite to character
- std::string id;
+ Common::String id;
// The position of the sprite
Vector2i pos;
@@ -158,7 +158,7 @@ public:
float YVel() { return vel.y; }
Vector2f Vel() { return vel; }
- const std::string &ID() { return id; }
+ const Common::String &ID() { return id; }
int W() { return clip.w; }
int H() { return clip.h; }
@@ -185,7 +185,7 @@ public:
void ExchangeDamage(pyrodactyl::event::Info &info, Sprite &s, const pyrodactyl::ai::SpriteConstant &sc);
void Load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations);
- void InternalEvents(pyrodactyl::event::Info &info, const std::string &player_id,
+ void InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
void Draw(pyrodactyl::event::Info &info, const Rect &camera);
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 0b41cd53b66..a055545fe1f 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -63,9 +63,9 @@ bool App::Init() {
#if 0
// Load the settings corresponding to the latest version
{
- const std::string DEFAULT_FILENAME = "res/settings.xml";
+ const Common::String DEFAULT_FILENAME = "res/settings.xml";
- std::string filename = g_engine->_filePath->appdata;
+ Common::String filename = g_engine->_filePath->appdata;
filename += "settings.xml";
using namespace boost::filesystem;
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 7cc6cbf9f5c..e71ac7c6b78 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -40,7 +40,7 @@ void EventSeqGroup::EndSeq(const unsigned int &id) {
end.push_back(id);
}
-void EventSeqGroup::AddSeq(const unsigned int &id, std::string &path) {
+void EventSeqGroup::AddSeq(const unsigned int &id, Common::String &path) {
seq[id].Load(path);
}
@@ -52,7 +52,7 @@ GameEvent *EventSeqGroup::CurEvent(const unsigned int &id) {
return seq[id].CurrentEvent();
}
-void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const std::string &player_id,
+void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const Common::String &player_id,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq, const int choice) {
return seq[id].NextEvent(info, player_id, result, end_seq, choice);
}
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index ddfdfc2d124..8d12fd60ae1 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -51,13 +51,13 @@ public:
EventSeqGroup(void) {}
~EventSeqGroup(void) {}
- void AddSeq(const unsigned int &id, std::string &path);
+ void AddSeq(const unsigned int &id, Common::String &path);
void EndSeq(const unsigned int &id);
bool EventInProgress(const unsigned int &id);
bool ActiveSeq(unsigned int &active_seq);
GameEvent *CurEvent(const unsigned int &id);
- void NextEvent(const unsigned int &id, Info &info, const std::string &player_id, Common::Array<EventResult> &result,
+ void NextEvent(const unsigned int &id, Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
Common::Array<EventSeqInfo> &end_seq, const int choice = -1);
void InternalEvents(Info &info);
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index ed973a21d5f..149db731520 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -38,7 +38,7 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void EventSequence::Load(const std::string &filename) {
+void EventSequence::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("events");
@@ -66,7 +66,7 @@ void EventSequence::InternalEvents(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
// Purpose: Go to next event
//------------------------------------------------------------------------
-void EventSequence::NextEvent(pyrodactyl::event::Info &info, const std::string &player_id, Common::Array<EventResult> &result,
+void EventSequence::NextEvent(pyrodactyl::event::Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
Common::Array<EventSeqInfo> &end_seq, int NextEventChoice) {
bool sync = false;
event_in_progress = false;
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index 09a04cec3d1..e1fde6ed00b 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -67,14 +67,14 @@ public:
// See if we should trigger any event
void InternalEvents(pyrodactyl::event::Info &info);
- void NextEvent(Info &info, const std::string &player_id, Common::Array<EventResult> &result,
+ void NextEvent(Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
Common::Array<EventSeqInfo> &end_seq, int NextEventChoice = -1);
bool EventInProgress() { return event_in_progress; }
void EventInProgress(bool val) { event_in_progress = val; }
// Load and save
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
void LoadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index d9b4131f55e..fb69f182b9f 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -79,13 +79,13 @@ void Info::Load(rapidxml::xml_node<char> *node) {
inv.ItemFile(node->first_node("item")->first_attribute("list")->value());
}
-void Info::LoadPeople(const std::string &filename) {
+void Info::LoadPeople(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("people");
if (NodeValid(node)) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
- std::string str;
+ Common::String str;
LoadStr(str, "id", n);
people[str].Load(n, stem);
}
@@ -96,13 +96,13 @@ void Info::LoadPeople(const std::string &filename) {
//------------------------------------------------------------------------
// Purpose: Get/Set information about object type
//------------------------------------------------------------------------
-void Info::Type(const std::string &id, const PersonType &val) {
- if (people.count(id) > 0)
+void Info::Type(const Common::String &id, const PersonType &val) {
+ if (people.contains(id) > 0)
people[id].type = val;
}
-PersonType Info::Type(const std::string &id) {
- if (people.count(id) > 0)
+PersonType Info::Type(const Common::String &id) {
+ if (people.contains(id) > 0)
return people[id].type;
return PE_NEUTRAL;
@@ -111,13 +111,13 @@ PersonType Info::Type(const std::string &id) {
//------------------------------------------------------------------------
// Purpose: Get/Set information about object state
//------------------------------------------------------------------------
-void Info::State(const std::string &id, const PersonState &val) {
- if (people.count(id) > 0)
+void Info::State(const Common::String &id, const PersonState &val) {
+ if (people.contains(id) > 0)
people[id].state = val;
}
-PersonState Info::State(const std::string &id) {
- if (people.count(id) > 0)
+PersonState Info::State(const Common::String &id) {
+ if (people.contains(id) > 0)
return people[id].state;
return PST_NORMAL;
@@ -126,15 +126,15 @@ PersonState Info::State(const std::string &id) {
//------------------------------------------------------------------------
// Purpose: Get/Set information about variables
//------------------------------------------------------------------------
-bool Info::VarGet(const std::string &name, int &val) {
- if (var.count(name) == 0)
+bool Info::VarGet(const Common::String &name, int &val) {
+ if (var.contains(name) == 0)
return false;
else
val = var[name];
return true;
}
-void Info::VarSet(const std::string &name, const std::string &val) {
+void Info::VarSet(const Common::String &name, const Common::String &val) {
int var_val = 0;
bool assign_to_var = std::find_if(val.begin(), val.end(), IsChar) != val.end();
@@ -146,42 +146,42 @@ void Info::VarSet(const std::string &name, const std::string &val) {
var[name] = var_val;
}
-void Info::VarAdd(const std::string &name, const int &val) {
- if (var.count(name) == 0)
+void Info::VarAdd(const Common::String &name, const int &val) {
+ if (var.contains(name) == 0)
VarSet(name, 0);
var[name] += val;
}
-void Info::VarSub(const std::string &name, const int &val) {
- if (var.count(name) == 0)
+void Info::VarSub(const Common::String &name, const int &val) {
+ if (var.contains(name) == 0)
VarSet(name, 0);
var[name] -= val;
}
-void Info::VarMul(const std::string &name, const int &val) {
- if (var.count(name) == 0)
+void Info::VarMul(const Common::String &name, const int &val) {
+ if (var.contains(name) == 0)
VarSet(name, 0);
var[name] *= val;
}
-void Info::VarDiv(const std::string &name, const int &val) {
- if (var.count(name) == 0)
+void Info::VarDiv(const Common::String &name, const int &val) {
+ if (var.contains(name) == 0)
VarSet(name, 0);
var[name] /= val;
}
-void Info::VarDel(const std::string &name) {
+void Info::VarDel(const Common::String &name) {
var.erase(name);
}
//------------------------------------------------------------------------
// Purpose: Get/Set person traits
//------------------------------------------------------------------------
-void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
+void Info::TraitAdd(const Common::String &per_id, const int &trait_id) {
if (PersonValid(per_id)) // Valid person id
{
if (trait_id >= 0 && (unsigned int)trait_id < g_engine->_eventStore->trait.size()) // Valid trait id
@@ -200,7 +200,7 @@ void Info::TraitAdd(const std::string &per_id, const int &trait_id) {
}
}
-void Info::TraitDel(const std::string &per_id, const int &trait_id) {
+void Info::TraitDel(const Common::String &per_id, const int &trait_id) {
if (PersonValid(per_id)) // Valid person id
{
if (trait_id > 0 && (unsigned int)trait_id < g_engine->_eventStore->trait.size()) // Valid trait id
@@ -220,68 +220,68 @@ void Info::TraitDel(const std::string &per_id, const int &trait_id) {
//------------------------------------------------------------------------
// Purpose: Get/Set information about object opinion
//------------------------------------------------------------------------
-bool Info::OpinionGet(const std::string &name, const pyrodactyl::people::OpinionType &type, int &val) {
- if (people.count(name) == 0)
+bool Info::OpinionGet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int &val) {
+ if (people.contains(name) == 0)
return false;
val = people[name].opinion.val[type];
return true;
}
-void Info::OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val) {
- if (people.count(name) > 0)
+void Info::OpinionChange(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
+ if (people.contains(name) > 0)
people[name].opinion.Change(type, val);
}
-void Info::OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val) {
- if (people.count(name) > 0)
+void Info::OpinionSet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
+ if (people.contains(name) > 0)
people[name].opinion.Set(type, val);
}
//------------------------------------------------------------------------
// Purpose: Get/Set information about object stats
//------------------------------------------------------------------------
-bool Info::StatGet(const std::string &name, const pyrodactyl::stat::StatType &type, int &num) {
- if (people.count(name) == 0)
+bool Info::StatGet(const Common::String &name, const pyrodactyl::stat::StatType &type, int &num) {
+ if (people.contains(name) == 0)
return false;
num = people[name].stat.val[type].cur;
return true;
}
-void Info::StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num) {
- if (people.count(name) > 0)
+void Info::StatSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
+ if (people.contains(name) > 0)
people[name].stat.Set(type, num);
}
-void Info::StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num) {
- if (people.count(name) > 0)
+void Info::StatChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
+ if (people.contains(name) > 0)
people[name].stat.Change(type, num);
}
//------------------------------------------------------------------------
// Purpose: Get person object
//------------------------------------------------------------------------
-bool Info::PersonGet(const std::string &id, pyrodactyl::people::Person &p) {
- if (people.count(id) == 0)
+bool Info::PersonGet(const Common::String &id, pyrodactyl::people::Person &p) {
+ if (people.contains(id) == 0)
return false;
p = people[id];
return true;
}
-bool Info::PersonValid(const std::string &id) {
- return people.count(id) > 0;
+bool Info::PersonValid(const Common::String &id) {
+ return people.contains(id) > 0;
}
-pyrodactyl::people::Person &Info::PersonGet(const std::string &id) {
+pyrodactyl::people::Person &Info::PersonGet(const Common::String &id) {
// Make sure to check PersonValid before doing this!
// Only use this to change parts of an object
return people[id];
}
-bool Info::CollideWithTrigger(const std::string &id, int rect_index) {
- if (people.count(id) > 0) {
+bool Info::CollideWithTrigger(const Common::String &id, int rect_index) {
+ if (people.contains(id) > 0) {
for (auto i = people[id].trig.begin(); i != people[id].trig.end(); ++i)
if (*i == rect_index)
return true;
@@ -293,7 +293,7 @@ bool Info::CollideWithTrigger(const std::string &id, int rect_index) {
//------------------------------------------------------------------------
// Purpose: Replace all #values with their appropriate names in a string
//------------------------------------------------------------------------
-void Info::InsertName(std::string &msg) {
+void Info::InsertName(Common::String &msg) {
// We scan the dialog for #id values, which we convert to actual NPC names
for (unsigned int i = 0; i < msg.size(); ++i) {
// The # symbol indicates that the next string until an end character needs to be replaced by the name
@@ -309,7 +309,7 @@ void Info::InsertName(std::string &msg) {
if (end < msg.size()) {
// We use start+1 here because # isn't part of the id
- std::string s = msg.substr(start + 1, len);
+ Common::String s = msg.substr(start + 1, len);
// We use length+1 here because otherwise it lets the last character stay in dialog
if (PersonValid(s))
@@ -319,7 +319,7 @@ void Info::InsertName(std::string &msg) {
}
}
-std::string Info::GetName(const std::string &id) {
+Common::String Info::GetName(const Common::String &id) {
if (PersonValid(id))
return PersonGet(id).name;
@@ -370,7 +370,7 @@ void Info::LoadState(rapidxml::xml_node<char> *node) {
var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object")) {
- std::string id;
+ Common::String id;
LoadStr(id, "id", p);
people[id].LoadState(p);
}
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 5429e2f04e2..d92aedc6d09 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -51,11 +51,11 @@ class Info {
pyrodactyl::stat::StatTemplates stem;
// The variables set by the events so far
- typedef std::unordered_map<std::string, int> VarMap;
+ typedef Common::HashMap<Common::String, int> VarMap;
VarMap var;
// The last object player interacted with
- std::string lastobj;
+ Common::String lastobj;
// Is the game Iron Man or not?
// Iron man means only one save - no reloading
@@ -64,10 +64,10 @@ class Info {
// The player's current location
struct PlayerLoc {
// id of the player's current location
- std::string id;
+ Common::String id;
// The name of the player's current location
- std::string name;
+ Common::String name;
PlayerLoc() : id(""), name("") {}
} loc;
@@ -75,7 +75,7 @@ class Info {
// This image changes to reflect the playable character
int player_img;
- void LoadPeople(const std::string &filename);
+ void LoadPeople(const Common::String &filename);
public:
// The player's one stop shop for objectives and lore
@@ -97,7 +97,7 @@ public:
} unread;
// This is the variable corresponding to money that is drawn
- std::string money_var;
+ Common::String money_var;
// Has the player pressed the talk key
bool TalkKeyDown;
@@ -125,66 +125,66 @@ public:
void Load(rapidxml::xml_node<char> *node);
// Person related stuff
- void Type(const std::string &id, const pyrodactyl::people::PersonType &val);
- pyrodactyl::people::PersonType Type(const std::string &id);
+ void Type(const Common::String &id, const pyrodactyl::people::PersonType &val);
+ pyrodactyl::people::PersonType Type(const Common::String &id);
- void State(const std::string &id, const pyrodactyl::people::PersonState &val);
- pyrodactyl::people::PersonState State(const std::string &id);
+ void State(const Common::String &id, const pyrodactyl::people::PersonState &val);
+ pyrodactyl::people::PersonState State(const Common::String &id);
// Opinion
- bool OpinionGet(const std::string &name, const pyrodactyl::people::OpinionType &type, int &val);
- void OpinionSet(const std::string &name, const pyrodactyl::people::OpinionType &type, int val);
- void OpinionChange(const std::string &name, const pyrodactyl::people::OpinionType &type, int val);
+ bool OpinionGet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int &val);
+ void OpinionSet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val);
+ void OpinionChange(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val);
// Stats
- bool StatGet(const std::string &name, const pyrodactyl::stat::StatType &type, int &num);
- void StatSet(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num);
- void StatChange(const std::string &name, const pyrodactyl::stat::StatType &type, const int &num);
+ bool StatGet(const Common::String &name, const pyrodactyl::stat::StatType &type, int &num);
+ void StatSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num);
+ void StatChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num);
// Variables
- bool VarGet(const std::string &name, int &val);
- void VarSet(const std::string &name, const std::string &val);
- void VarAdd(const std::string &name, const int &val);
- void VarSub(const std::string &name, const int &val);
- void VarMul(const std::string &name, const int &val);
- void VarDiv(const std::string &name, const int &val);
- void VarDel(const std::string &name);
+ bool VarGet(const Common::String &name, int &val);
+ void VarSet(const Common::String &name, const Common::String &val);
+ void VarAdd(const Common::String &name, const int &val);
+ void VarSub(const Common::String &name, const int &val);
+ void VarMul(const Common::String &name, const int &val);
+ void VarDiv(const Common::String &name, const int &val);
+ void VarDel(const Common::String &name);
// The trait functions
- void TraitAdd(const std::string &per_id, const int &trait_id);
- void TraitDel(const std::string &per_id, const int &trait_id);
+ void TraitAdd(const Common::String &per_id, const int &trait_id);
+ void TraitDel(const Common::String &per_id, const int &trait_id);
// Player character button
void PlayerImg(const int &val) { player_img = val; }
int PlayerImg() { return player_img; }
- std::string CurLocID() { return loc.id; }
- void CurLocID(const std::string &id) { loc.id = id; }
+ Common::String CurLocID() { return loc.id; }
+ void CurLocID(const Common::String &id) { loc.id = id; }
- std::string CurLocName() { return loc.name; }
- void CurLocName(const std::string &name) { loc.name = name; }
+ Common::String CurLocName() { return loc.name; }
+ void CurLocName(const Common::String &name) { loc.name = name; }
// Player stuff
- std::string LastPerson() { return lastobj; }
- void LastPerson(const std::string &name) { lastobj = name; }
+ Common::String LastPerson() { return lastobj; }
+ void LastPerson(const Common::String &name) { lastobj = name; }
// Return the variable map for stuff like visibility checks
VarMap &MapGet() { return var; }
- bool PersonGet(const std::string &id, pyrodactyl::people::Person &p);
+ bool PersonGet(const Common::String &id, pyrodactyl::people::Person &p);
- bool PersonValid(const std::string &id);
- pyrodactyl::people::Person &PersonGet(const std::string &id);
+ bool PersonValid(const Common::String &id);
+ pyrodactyl::people::Person &PersonGet(const Common::String &id);
// Is an object colliding with a trigger area
- bool CollideWithTrigger(const std::string &id, int rect_index);
+ bool CollideWithTrigger(const Common::String &id, int rect_index);
// Replace all #values with their appropriate names in a string
- void InsertName(std::string &msg);
- std::string GetName(const std::string &id);
+ void InsertName(Common::String &msg);
+ Common::String GetName(const Common::String &id);
// Draw the inventory
- void InvDraw(const std::string &id) {
- if (var.count(money_var) > 0)
+ void InvDraw(const Common::String &id) {
+ if (var.contains(money_var) > 0)
inv.Draw(people[id], var[money_var]);
else
inv.Draw(people[id], 0);
@@ -194,7 +194,7 @@ public:
bool IronMan() { return ironman; }
void IronMan(const bool &val) { ironman = val; }
void LoadIronMan(rapidxml::xml_node<char> *node) {
- std::string str;
+ Common::String str;
LoadStr(str, "diff", node);
ironman = (str == "Iron Man");
}
diff --git a/engines/crab/event/changeval.h b/engines/crab/event/changeval.h
index 9db9d4cee79..5e1e25e6b0b 100644
--- a/engines/crab/event/changeval.h
+++ b/engines/crab/event/changeval.h
@@ -40,7 +40,7 @@ namespace pyrodactyl {
namespace event {
struct ChangeVal {
// The person whose opinion is changed
- std::string id;
+ Common::String id;
// How much does opinion change?
int val[pyrodactyl::people::OPI_TOTAL];
diff --git a/engines/crab/event/conversationdata.h b/engines/crab/event/conversationdata.h
index 9836e9ec42a..4b7ee970ab7 100644
--- a/engines/crab/event/conversationdata.h
+++ b/engines/crab/event/conversationdata.h
@@ -41,7 +41,7 @@ namespace pyrodactyl {
namespace event {
struct ReplyChoice {
// The text for the reply
- std::string text;
+ Common::String text;
// The tone of the response
unsigned int tone;
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 31f1fbcaca6..71d36276104 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::event;
using namespace pyrodactyl::music;
void Effect::Load(rapidxml::xml_node<char> *node) {
- std::string ty;
+ Common::String ty;
LoadStr(ty, "type", node);
// Should we throw a warning about missing fields? Depends on the type of effect
@@ -129,7 +129,7 @@ void Effect::ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::Op
}
}
-bool Effect::Execute(pyrodactyl::event::Info &info, const std::string &player_id,
+bool Effect::Execute(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
if (type < EFF_MOVE) {
switch (type) {
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index 8d8ca7e0532..e36663d6d82 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -57,7 +57,7 @@ enum EventResultType {
struct EventResult {
EventResultType type;
- std::string val;
+ Common::String val;
int x, y;
EventResult() : val("") {
@@ -69,7 +69,7 @@ struct EventResult {
struct EventSeqInfo {
bool cur;
- std::string loc, val;
+ Common::String loc, val;
EventSeqInfo() { cur = false; }
EventSeqInfo(const bool &Cur) { cur = Cur; }
@@ -101,13 +101,13 @@ enum EffectType {
struct Effect {
EffectType type;
- std::string subject, operation, val;
+ Common::String subject, operation, val;
Effect() { type = EFF_VAR; }
~Effect() {}
void Load(rapidxml::xml_node<char> *node);
- bool Execute(pyrodactyl::event::Info &info, const std::string &player_id,
+ bool Execute(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq);
void ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType type);
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index ba0cfed87fe..419baac25b9 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -43,7 +43,7 @@ void GameEventStore::AddConv(rapidxml::xml_node<char> *node, unsigned int &index
con.push_back(c);
}
-void GameEventStore::Load(const std::string &filename) {
+void GameEventStore::Load(const Common::String &filename) {
// Request current user stats from Steam
// m_pSteamUserStats = SteamUserStats();
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 081acd75d2f..6c811854c21 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -50,7 +50,7 @@ struct GameEventStore {
// Data related to the tones of a character
struct ToneData {
- std::string text;
+ Common::String text;
};
// This sets the text the player sees as "tone" during the reply menu
@@ -77,7 +77,7 @@ struct GameEventStore {
con.clear();
anim.clear();
}
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
void AddConv(rapidxml::xml_node<char> *node, unsigned int &index);
void SetAchievement(const int &id);
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index 2a605b04f1f..d514b6c763a 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -50,7 +50,7 @@ void GameEvent::Load(rapidxml::xml_node<char> *node) {
LoadStr(dialog, "dialog", node);
LoadEnum(state, "state", node, false);
- std::string Type;
+ Common::String Type;
LoadStr(Type, "type", node);
if (Type == "dlg") {
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index 0e96bb47123..e6b8b0ca13b 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -63,10 +63,10 @@ struct GameEvent {
EventID id;
// The heading for the dialog spoken
- std::string title;
+ Common::String title;
// The dialog spoken in the event
- std::string dialog;
+ Common::String dialog;
// The state decides which animation is drawn in the dialog box
pyrodactyl::people::PersonState state;
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index bb51fa0249e..b03deeeea41 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -62,7 +62,7 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
for (auto n = loc->first_node("file"); n != NULL; n = n->next_sibling("file")) {
unsigned int id;
- std::string path;
+ Common::String path;
LoadNum(id, "name", n);
LoadStr(path, "path", n);
event_map[loc_name].AddSeq(id, path);
@@ -96,7 +96,7 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
+void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
if (event_map.contains(info.CurLocID().c_str()) > 0 && event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
switch (cur_event->type) {
@@ -183,7 +183,7 @@ void Manager::HandleEvents(Info &info, const std::string &player_id, Common::Eve
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Manager::HandleEvents(Info &info, const std::string &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
+void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
if (event_map.contains(info.CurLocID().c_str()) > 0 && event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
switch (cur_event->type) {
@@ -388,7 +388,7 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
//------------------------------------------------------------------------
// Purpose: Get/set info
//------------------------------------------------------------------------
-void Manager::EndSequence(const std::string &curloc) {
+void Manager::EndSequence(const Common::String &curloc) {
if (end_seq.empty() == false) {
for (auto i = end_seq.begin(); i != end_seq.end(); ++i)
if (i->cur)
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 7cf1d93d05e..37275eaaa71 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -95,16 +95,16 @@ public:
// cur_per is also updated here
void InternalEvents(Info &info, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
- void HandleEvents(Info &info, const std::string &player_id, Common::Event &Event,
+ void HandleEvents(Info &info, const Common::String &player_id, Common::Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
#if 0
- void HandleEvents(Info &info, const std::string &player_id, SDL_Event &Event,
+ void HandleEvents(Info &info, const Common::String &player_id, SDL_Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
#endif
void CalcActiveSeq(Info &info, pyrodactyl::level::Level &level, const Rect &camera);
- void EndSequence(const std::string &curloc);
+ void EndSequence(const Common::String &curloc);
bool EventInProgress();
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index 44a58625e4f..c08f4e7dbda 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::event;
-Quest::Quest(const std::string &Title, const std::string &Text, const bool &Unread, const bool &Marker) : title(Title) {
+Quest::Quest(const Common::String &Title, const Common::String &Text, const bool &Unread, const bool &Marker) : title(Title) {
text.push_front(Text);
unread = Unread;
marker = Marker;
diff --git a/engines/crab/event/quest.h b/engines/crab/event/quest.h
index 60eb332d98e..c6034f49b50 100644
--- a/engines/crab/event/quest.h
+++ b/engines/crab/event/quest.h
@@ -40,10 +40,10 @@ namespace pyrodactyl {
namespace event {
struct Quest {
// The title of the quest
- std::string title;
+ Common::String title;
// The objective text, the last one being the current objective
- std::deque<std::string> text;
+ std::deque<Common::String> text;
// Keep track of which quests the player has read
bool unread;
@@ -55,7 +55,7 @@ struct Quest {
unread = true;
marker = false;
}
- Quest(const std::string &Title, const std::string &Text, const bool &Unread, const bool &Marker);
+ Quest(const Common::String &Title, const Common::String &Text, const bool &Unread, const bool &Marker);
void LoadState(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index c3b0cebef4c..db9bdfef5b2 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::event;
void Trigger::Load(rapidxml::xml_node<char> *node) {
- std::string ty;
+ Common::String ty;
LoadStr(ty, "type", node);
// Should we throw a warning about missing fields? Depends on the type of trigger
@@ -71,7 +71,7 @@ void Trigger::Load(rapidxml::xml_node<char> *node) {
LoadStr(operation, "operation", node, echo_op);
LoadStr(val, "val", node);
- std::string str;
+ Common::String str;
LoadStr(str, "rel", node, false);
if (str == "or")
rel = OP_OR;
diff --git a/engines/crab/event/trigger.h b/engines/crab/event/trigger.h
index e974bcfe1cd..f1e4344ddbe 100644
--- a/engines/crab/event/trigger.h
+++ b/engines/crab/event/trigger.h
@@ -54,7 +54,7 @@ enum TriggerType {
struct Trigger {
TriggerType type;
- std::string target, subject, operation, val;
+ Common::String target, subject, operation, val;
// Relation to the next trigger
RelOp rel;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index b142a055c8d..ae0986a6dca 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -42,7 +42,7 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
void Game::StartNewGame() {
Init(g_engine->_filePath->mod_cur.c_str());
- LoadLevel(info.CurLocID());
+ LoadLevel(info.CurLocID().c_str());
info.IronMan(g_engine->_tempData->ironman);
savefile.ironman = g_engine->_tempData->filename.c_str();
clock.Start();
@@ -51,12 +51,12 @@ void Game::StartNewGame() {
CreateSaveGame(SAVEGAME_EVENT);
}
-void Game::LoadGame(const std::string &filename) {
+void Game::LoadGame(const Common::String &filename) {
Init(g_engine->_filePath->mod_cur.c_str());
LoadState(filename);
}
-void Game::Init(const std::string &filename) {
+void Game::Init(const Common::String &filename) {
g_engine->_loadingScreen->Dim();
g_engine->_eventStore->Clear();
game_over.Clear(false);
@@ -71,7 +71,7 @@ void Game::Init(const std::string &filename) {
info.Load(node);
- std::string path;
+ Common::String path;
if (NodeValid("level", node)) {
LoadStr(path, "list", node->first_node("level"));
g_engine->_filePath->LoadLevel(path.c_str());
@@ -112,7 +112,7 @@ void Game::Init(const std::string &filename) {
}
}
-bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
+bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
if (g_engine->_filePath->level.contains(id.c_str())) {
g_engine->_loadingScreen->Draw();
@@ -128,7 +128,7 @@ bool Game::LoadLevel(const std::string &id, int player_x, int player_y) {
level.Load(g_engine->_filePath->level[id.c_str()].layout.c_str(), info, game_over, player_x, player_y);
// Set the current location
- info.CurLocID(id);
+ info.CurLocID(id.c_str());
info.CurLocName(g_engine->_filePath->level[id.c_str()].name.c_str());
map.player_pos = level.map_loc;
@@ -213,7 +213,7 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
- info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
+ info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson().c_str(), Event);
level.HandleEvents(info, Event);
@@ -535,7 +535,7 @@ void Game::Draw() {
break;
case STATE_INVENTORY:
g_engine->_imageManager->DimScreen();
- info.InvDraw(level.PlayerID());
+ info.InvDraw(level.PlayerID().c_str());
hud.Draw(info, level.PlayerID());
hud.back.Draw();
break;
@@ -592,9 +592,9 @@ bool Game::ApplyResult() {
break;
case ER_TRAIT:
if (i->x == 42)
- info.TraitDel(i->val, i->y);
+ info.TraitDel(i->val.c_str(), i->y);
else
- info.TraitAdd(i->val, i->y);
+ info.TraitAdd(i->val.c_str(), i->y);
break;
case ER_LEVEL:
if (i->val == "Map")
@@ -661,7 +661,7 @@ void Game::ApplyResult(LevelResult result) {
//------------------------------------------------------------------------
// Purpose: Save/load game
//------------------------------------------------------------------------
-void Game::LoadState(const std::string &filename) {
+void Game::LoadState(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
@@ -681,7 +681,7 @@ void Game::LoadState(const std::string &filename) {
PlayerImg();
- std::string loc;
+ Common::String loc;
LoadStr(loc, "loc_id", node);
LoadLevel(loc);
@@ -699,7 +699,7 @@ void Game::LoadState(const std::string &filename) {
//------------------------------------------------------------------------
// Purpose: Write game state to file
//------------------------------------------------------------------------
-void Game::SaveState(const std::string &filename, const bool &overwrite) {
+void Game::SaveState(const Common::String &filename, const bool &overwrite) {
warning("STUB: Game::SaveState()");
#if 0
@@ -716,21 +716,21 @@ void Game::SaveState(const std::string &filename, const bool &overwrite) {
doc.append_node(root);
// Save location id
- std::string loc = info.CurLocID();
+ Common::String loc = info.CurLocID();
root->append_attribute(doc.allocate_attribute("loc_id", loc.c_str()));
// Save location name
- std::string loc_name = info.CurLocName();
+ Common::String loc_name = info.CurLocName();
root->append_attribute(doc.allocate_attribute("loc_name", loc_name.c_str()));
// Save player character name
- std::string char_name;
+ Common::String char_name;
if (info.PersonValid(level.PlayerID()))
char_name = info.PersonGet(level.PlayerID()).name;
root->append_attribute(doc.allocate_attribute("char_name", char_name.c_str()));
// Difficulty
- std::string diff = "Normal";
+ Common::String diff = "Normal";
if (info.IronMan())
diff = "Iron Man";
root->append_attribute(doc.allocate_attribute("diff", diff.c_str()));
@@ -742,7 +742,7 @@ void Game::SaveState(const std::string &filename, const bool &overwrite) {
root->append_attribute(doc.allocate_attribute("preview", level.preview_path.c_str()));
// Time played
- std::string playtime = clock.GetTime();
+ Common::String playtime = clock.GetTime();
root->append_attribute(doc.allocate_attribute("time", playtime.c_str()));
rapidxml::xml_node<char> *child_gem = doc.allocate_node(rapidxml::node_element, "events");
@@ -761,10 +761,10 @@ void Game::SaveState(const std::string &filename, const bool &overwrite) {
level.SaveState(doc, child_level);
root->append_node(child_level);
- std::string xml_as_string;
+ Common::String xml_as_string;
rapidxml::print(std::back_inserter(xml_as_string), doc);
- std::string fullpath = FullPath(filename);
+ Common::String fullpath = FullPath(filename);
// We don't check for duplicates for auto-saves and iron man saves
if (!overwrite) {
@@ -772,7 +772,7 @@ void Game::SaveState(const std::string &filename, const bool &overwrite) {
if (boost::filesystem::exists(fullpath)) {
// Copy the original filename, add a _1 at the end
// Start from one because that's how humans count
- std::string result = filename + "_1";
+ Common::String result = filename + "_1";
int count = 1;
// Keep trying a filename until it no longer exists or we reach an insanely high number
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 13c7b10547b..1479e3dafcf 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -87,7 +87,7 @@ private:
// The name of the auto save and quick save files
struct SaveFile {
bool auto_slot;
- std::string auto_1, auto_2, auto_quit, quick, ironman;
+ Common::String auto_1, auto_2, auto_quit, quick, ironman;
SaveFile() : auto_1("AutoSave 1"), auto_2("AutoSave 2"), auto_quit("AutoSave"), quick("Quick Save") { auto_slot = false; }
@@ -100,22 +100,22 @@ private:
} savefile;
void StartNewGame();
- void LoadGame(const std::string &filename);
+ void LoadGame(const Common::String &filename);
static void Quit(bool &ShouldChangeState, GameStateID &NewStateID, const GameStateID &NewStateVal);
bool ApplyResult();
void ApplyResult(LevelResult result);
// Load a level
- bool LoadLevel(const std::string &id, int player_x = -1, int player_y = -1);
+ bool LoadLevel(const Common::String &id, int player_x = -1, int player_y = -1);
void ToggleState(const State &s);
// A nice simple function for saving games
void CreateSaveGame(const SaveGameType &savetype);
- std::string FullPath(const std::string &filename) {
- std::string res = g_engine->_filePath->appdata.c_str();
+ Common::String FullPath(const Common::String &filename) {
+ Common::String res = g_engine->_filePath->appdata.c_str();
res += g_engine->_filePath->save_dir.c_str();
res += filename;
res += g_engine->_filePath->save_ext.c_str();
@@ -128,10 +128,10 @@ private:
public:
Game() { StartNewGame(); }
- Game(const std::string &filename) { LoadGame(filename); }
+ Game(const Common::String &filename) { LoadGame(filename); }
~Game() {}
- void Init(const std::string &filename);
+ void Init(const Common::String &filename);
void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#if 0
@@ -140,10 +140,10 @@ public:
void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void Draw();
- void LoadState(const std::string &filename);
+ void LoadState(const Common::String &filename);
// Raw function to save game to file - generally, using the CreateSaveGame function is recommended
- void SaveState(const std::string &filename, const bool &overwrite);
+ void SaveState(const Common::String &filename, const bool &overwrite);
void AutoSave() { CreateSaveGame(SAVEGAME_EXIT); }
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 4ed9f7d9c7f..218612b0c35 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -106,13 +106,13 @@ const int InputManager::Equals(const InputType &val, const SDL_Event &Event) {
//------------------------------------------------------------------------
void InputManager::Init() {
- const std::string DEFAULT_FILENAME = "res/controls.xml";
+ const Common::String DEFAULT_FILENAME = "res/controls.xml";
Load(DEFAULT_FILENAME);
#if 0
- const std::string DEFAULT_FILENAME = "res/controls.xml";
+ const Common::String DEFAULT_FILENAME = "res/controls.xml";
- std::string filename = g_engine->_filePath->appdata.c_str();
+ Common::String filename = g_engine->_filePath->appdata.c_str();
filename += "controls.xml";
if (!is_regular_file(filename)) {
@@ -136,7 +136,7 @@ void InputManager::Init() {
//------------------------------------------------------------------------
// Purpose: Load key & controller binding settings from file
//------------------------------------------------------------------------
-void InputManager::Load(const std::string &filename) {
+void InputManager::Load(const Common::String &filename) {
XMLDoc control_list(filename.c_str());
if (control_list.ready()) {
rapidxml::xml_node<char> *node = control_list.Doc()->first_node("controls");
@@ -198,7 +198,7 @@ void InputManager::Save() {
#if 0
rapidxml::xml_document<char> doc;
- std::string filename = g_engine->_filePath->appdata;
+ Common::String filename = g_engine->_filePath->appdata;
filename += "controls.xml";
// xml declaration
@@ -214,7 +214,7 @@ void InputManager::Save() {
iv[i].SaveState(doc, root, "i");
doc.append_node(root);
- std::string xml_as_string;
+ Common::String xml_as_string;
rapidxml::print(std::back_inserter(xml_as_string), doc);
std::ofstream save(filename, std::ios::out);
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 06a05f47b8e..ee95ea22bf8 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -89,7 +89,7 @@ class InputManager {
InputVal backup[IT_TOTAL];
// Load key configuration from file
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
// The current version of the input scheme
unsigned int version;
diff --git a/engines/crab/input/inputval.h b/engines/crab/input/inputval.h
index 85abd646419..9f32fc81d05 100644
--- a/engines/crab/input/inputval.h
+++ b/engines/crab/input/inputval.h
@@ -43,7 +43,7 @@ namespace input {
class InputVal {
public:
// Name of the key (such as "punch", "up")
- std::string name;
+ Common::String name;
// Keyboard keys
//SDL_Scancode key, alt;
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index 18612662a6f..ae90e529563 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -42,13 +42,13 @@ namespace pyrodactyl {
namespace item {
struct Item {
// The id, name and description of the item
- std::string id, name, desc;
+ Common::String id, name, desc;
// The image for the item
ImageKey img;
// The type of item
- std::string type;
+ Common::String type;
// The stat bonuses provided by the item
Common::Array<pyrodactyl::stat::Bonus> bonus;
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index cc494287997..c22de43f0fa 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -61,16 +61,16 @@ void ItemCollection::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Add a character's inventory if not added already
//------------------------------------------------------------------------
-void ItemCollection::Init(const std::string &char_id) {
- if (item.count(char_id) == 0)
+void ItemCollection::Init(const Common::String &char_id) {
+ if (item.contains(char_id) == 0)
item[char_id].Init(ref, inc, rows, cols, usekeyboard);
}
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void ItemCollection::HandleEvents(const std::string &char_id, const Common::Event &Event) {
- if (item.count(char_id) > 0)
+void ItemCollection::HandleEvents(const Common::String &char_id, const Common::Event &Event) {
+ if (item.contains(char_id) > 0)
item[char_id].HandleEvents(Event);
}
@@ -78,8 +78,8 @@ void ItemCollection::HandleEvents(const std::string &char_id, const Common::Even
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void ItemCollection::HandleEvents(const std::string &char_id, const SDL_Event &Event) {
- if (item.count(char_id) > 0)
+void ItemCollection::HandleEvents(const Common::String &char_id, const SDL_Event &Event) {
+ if (item.contains(char_id) > 0)
item[char_id].HandleEvents(Event);
}
#endif
@@ -87,23 +87,23 @@ void ItemCollection::HandleEvents(const std::string &char_id, const SDL_Event &E
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ItemCollection::Draw(const std::string &char_id) {
- if (item.count(char_id) > 0)
+void ItemCollection::Draw(const Common::String &char_id) {
+ if (item.contains(char_id) > 0)
item[char_id].Draw(item_info);
}
//------------------------------------------------------------------------
// Purpose: Delete an item from a character's inventory
//------------------------------------------------------------------------
-void ItemCollection::Del(const std::string &char_id, const std::string &item_id) {
- if (item.count(char_id) > 0)
+void ItemCollection::Del(const Common::String &char_id, const Common::String &item_id) {
+ if (item.contains(char_id) > 0)
item[char_id].Del(item_id);
}
//------------------------------------------------------------------------
// Purpose: Add an item to a character's inventory
//------------------------------------------------------------------------
-void ItemCollection::Add(const std::string &char_id, Item &item_data) {
+void ItemCollection::Add(const Common::String &char_id, Item &item_data) {
// We might want to give a player character not yet encountered an item before we ever meet them
// Which is why we add a new inventory in case the character inventory does not exist yet
Init(char_id);
@@ -114,8 +114,8 @@ void ItemCollection::Add(const std::string &char_id, Item &item_data) {
//------------------------------------------------------------------------
// Purpose: Find if a character has an item
//------------------------------------------------------------------------
-bool ItemCollection::Has(const std::string &char_id, const std::string &container, const std::string &item_id) {
- if (item.count(char_id) > 0)
+bool ItemCollection::Has(const Common::String &char_id, const Common::String &container, const Common::String &item_id) {
+ if (item.contains(char_id) > 0)
return item[char_id].Has(container, item_id);
return false;
@@ -137,8 +137,8 @@ void ItemCollection::LoadState(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void ItemCollection::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = item.begin(); i != item.end(); ++i) {
- rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, i->first.c_str());
- i->second.SaveState(doc, child);
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, i->_key.c_str());
+ i->_value.SaveState(doc, child);
root->append_node(child);
}
}
@@ -150,7 +150,7 @@ void ItemCollection::SetUI() {
item_info.SetUI();
for (auto i = item.begin(); i != item.end(); ++i)
- i->second.SetUI();
+ i->_value.SetUI();
}
} // End of namespace Crab
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 1afebc0902d..f03b0532ce0 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -42,7 +42,7 @@ namespace item {
// All the items owned by characters controlled by the player
class ItemCollection {
// The items for all player characters
- std::unordered_map<std::string, ItemMenu> item;
+ Common::HashMap<Common::String, ItemMenu> item;
// The reference information for these menus used to display these items
@@ -71,22 +71,22 @@ public:
void Load(rapidxml::xml_node<char> *node);
- void HandleEvents(const std::string &char_id, const Common::Event &Event);
+ void HandleEvents(const Common::String &char_id, const Common::Event &Event);
#if 0
- void HandleEvents(const std::string &char_id, const SDL_Event &Event);
+ void HandleEvents(const Common::String &char_id, const SDL_Event &Event);
#endif
- void Init(const std::string &char_id);
- void Draw(const std::string &char_id);
+ void Init(const Common::String &char_id);
+ void Draw(const Common::String &char_id);
// Requires: id of the character, the item information
- void Add(const std::string &char_id, Item &item_data);
+ void Add(const Common::String &char_id, Item &item_data);
// Requires: id of the character from which to remove the item, and id of the item
- void Del(const std::string &char_id, const std::string &item_id);
+ void Del(const Common::String &char_id, const Common::String &item_id);
// Requires: id of the character, the name of the container and name of the item
- bool Has(const std::string &char_id, const std::string &container, const std::string &item_id);
+ bool Has(const Common::String &char_id, const Common::String &container, const Common::String &item_id);
void LoadState(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 218f92377d6..8a406ce47ef 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -120,7 +120,7 @@ bool ItemMenu::Equip(Item &item) {
//------------------------------------------------------------------------
// Purpose: Remove all instances of an item
//------------------------------------------------------------------------
-bool ItemMenu::Del(const std::string &id) {
+bool ItemMenu::Del(const Common::String &id) {
bool result = false;
for (auto &i : element)
@@ -138,7 +138,7 @@ bool ItemMenu::Del(const std::string &id) {
//------------------------------------------------------------------------
// Purpose: Find out if we have an item with a name
//------------------------------------------------------------------------
-bool ItemMenu::Has(const std::string &container, const std::string &id) {
+bool ItemMenu::Has(const Common::String &container, const Common::String &id) {
for (auto i = element.begin(); i != element.end(); ++i)
if (i->item.id == id) {
if (container == "equip") {
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index c431d01955c..c845ee3b355 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -78,8 +78,8 @@ public:
bool Swap(ItemMenu &target, int index);
bool Equip(Item &item);
- bool Del(const std::string &id);
- bool Has(const std::string &container, const std::string &id);
+ bool Del(const Common::String &id);
+ bool Has(const Common::String &container, const Common::String &id);
// Used to calculate enabled slots
// void SetEnable();
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index a46fdc1c5ff..d6a5f936299 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -53,7 +53,7 @@ void ItemSlot::Load(rapidxml::xml_node<char> *node) {
no_type = false;
}
- std::string name = node->name();
+ Common::String name = node->name();
if (name == "equip")
category = SLOT_EQUIP;
else
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index 8f739684dcc..9fef8507f34 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -49,7 +49,7 @@ class ItemSlot : public pyrodactyl::ui::StateButton {
public:
// The type of item allowed in this slot (can be overridden by item_type)
- std::string item_type;
+ Common::String item_type;
// Is the slot empty?
bool empty;
diff --git a/engines/crab/level/LevelExit.cpp b/engines/crab/level/LevelExit.cpp
index 743074ccdad..9a531b11216 100644
--- a/engines/crab/level/LevelExit.cpp
+++ b/engines/crab/level/LevelExit.cpp
@@ -41,7 +41,7 @@ void Exit::Load(rapidxml::xml_node<char> *node) {
if (NodeValid("properties", node)) {
rapidxml::xml_node<char> *propertynode = node->first_node("properties");
for (auto n = propertynode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
- std::string node_name;
+ Common::String node_name;
LoadStr(node_name, "name", n);
if (node_name == "entry_x") {
if (!LoadNum(entry.x, "value", n))
diff --git a/engines/crab/level/LevelExit.h b/engines/crab/level/LevelExit.h
index 9914c67b422..8f0803f0fd9 100644
--- a/engines/crab/level/LevelExit.h
+++ b/engines/crab/level/LevelExit.h
@@ -41,7 +41,7 @@ namespace Crab {
namespace pyrodactyl {
namespace level {
struct Exit {
- std::string name;
+ Common::String name;
Shape dim;
Vector2i entry;
diff --git a/engines/crab/level/MusicArea.cpp b/engines/crab/level/MusicArea.cpp
index dcbb123a25d..381e694a588 100644
--- a/engines/crab/level/MusicArea.cpp
+++ b/engines/crab/level/MusicArea.cpp
@@ -40,7 +40,7 @@ void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo) {
if (NodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
- std::string name;
+ Common::String name;
if (LoadStr(name, "name", n, echo)) {
if (name == "music")
LoadBool(track, "value", n, echo);
diff --git a/engines/crab/level/Stairs.cpp b/engines/crab/level/Stairs.cpp
index 58859ed968e..8c440d26465 100644
--- a/engines/crab/level/Stairs.cpp
+++ b/engines/crab/level/Stairs.cpp
@@ -40,7 +40,7 @@ void Stairs::Load(rapidxml::xml_node<char> *node, const bool &echo) {
if (NodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
- std::string name;
+ Common::String name;
if (LoadStr(name, "name", n, echo)) {
if (name == "x")
LoadNum(modifier.x, "value", n, echo);
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 2bde60b04af..17b81ec5294 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -70,7 +70,7 @@ void Level::Reset() {
//------------------------------------------------------------------------
// Purpose: Get index of a sprite in the object array
//------------------------------------------------------------------------
-pyrodactyl::anim::Sprite *Level::GetSprite(const std::string &id) {
+pyrodactyl::anim::Sprite *Level::GetSprite(const Common::String &id) {
int count = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++count)
if (i->ID() == id)
@@ -146,7 +146,7 @@ void Level::HandleEvents(Info &info, const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Swap the player sprites
//------------------------------------------------------------------------
-void Level::PlayerID(const std::string &ID, const int &X, const int &Y) {
+void Level::PlayerID(const Common::String &ID, const int &X, const int &Y) {
int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
if (i->ID() == ID) {
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 00a67ecb02c..90c03c28987 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -94,7 +94,7 @@ class Level {
pyrodactyl::ai::SpriteConstant sc_default;
// Protected level functions
- bool CollidingWithObject(pyrodactyl::event::Info &info, std::string &id);
+ bool CollidingWithObject(pyrodactyl::event::Info &info, Common::String &id);
bool CollidingWithLevel(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s);
bool PlayerInCombat(pyrodactyl::event::Info &info);
void BattleAlert(pyrodactyl::event::Info &info);
@@ -103,7 +103,7 @@ class Level {
void MoveObject(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s);
void Think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
- Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq, std::string &id);
+ Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq, Common::String &id);
void DrawObjects(pyrodactyl::event::Info &info);
void SetCamera();
@@ -138,7 +138,7 @@ public:
pyrodactyl::ui::ParagraphData pop;
// The path of the preview image
- std::string preview_path;
+ Common::String preview_path;
// A full rendered image of the level
pyrodactyl::image::Image img;
@@ -158,8 +158,8 @@ public:
void PlayerStop() { objects[player_index].Stop(); }
- const std::string &PlayerID() { return objects[player_index].ID(); }
- void PlayerID(const std::string &ID, const int &X, const int &Y);
+ const Common::String &PlayerID() { return objects[player_index].ID(); }
+ void PlayerID(const Common::String &ID, const int &X, const int &Y);
void ShowMap(bool val) { showmap.normal = val; }
bool ShowMap() { return showmap.current; }
@@ -170,24 +170,24 @@ public:
void CalcProperties(pyrodactyl::event::Info &info);
// Loading function
- void Load(const std::string &filename, pyrodactyl::event::Info &info, pyrodactyl::event::TriggerSet &game_over,
+ void Load(const Common::String &filename, pyrodactyl::event::Info &info, pyrodactyl::event::TriggerSet &game_over,
const int &player_x = -1, const int &player_y = -1);
// One time load called first-time
- void LoadMoves(const std::string &filename);
- void LoadConst(const std::string &filename);
+ void LoadMoves(const Common::String &filename);
+ void LoadConst(const Common::String &filename);
// Used to see if a sprite collides with a rectangle
void CalcTrigCollide(pyrodactyl::event::Info &info);
// See if a player clicked on the sprite in contact
- bool ContainsClick(const std::string &id, const Common::Event &Event);
+ bool ContainsClick(const Common::String &id, const Common::Event &Event);
#if 0
- bool ContainsClick(const std::string &id, const SDL_Event &Event);
+ bool ContainsClick(const Common::String &id, const SDL_Event &Event);
#endif
// Get index of a sprite in the object array
- pyrodactyl::anim::Sprite *GetSprite(const std::string &id);
+ pyrodactyl::anim::Sprite *GetSprite(const Common::String &id);
void HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index dc94e332ed7..898de1bc0cf 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -86,7 +86,7 @@ LevelResult Level::InternalEvents(Info &info, Common::Array<EventResult> &result
// Purpose: Let the AI think and animate the level
//------------------------------------------------------------------------
void Level::Think(Info &info, Common::Array<EventResult> &result,
- Common::Array<EventSeqInfo> &end_seq, std::string &id) {
+ Common::Array<EventSeqInfo> &end_seq, Common::String &id) {
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
// Only bother if the sprite is visible
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 9d44831df54..af928af61a2 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -46,7 +46,7 @@ using namespace pyrodactyl::music;
//------------------------------------------------------------------------
// Purpose: See if player clicked on a sprite they are colliding with
//------------------------------------------------------------------------
-bool Level::ContainsClick(const std::string &id, const Common::Event &Event) {
+bool Level::ContainsClick(const Common::String &id, const Common::Event &Event) {
// If mouse is moved and is hovering on the specified sprite (id), set hover = true
if (Event.type == Common::EVENT_MOUSEMOVE) {
for (auto &i : objects) {
@@ -83,7 +83,7 @@ bool Level::ContainsClick(const std::string &id, const Common::Event &Event) {
//------------------------------------------------------------------------
// Purpose: See if player clicked on a sprite they are colliding with
//------------------------------------------------------------------------
-bool Level::ContainsClick(const std::string &id, const SDL_Event &Event) {
+bool Level::ContainsClick(const Common::String &id, const SDL_Event &Event) {
// If mouse is moved and is hovering on the specified sprite (id), set hover = true
if (Event.type == SDL_MOUSEMOTION) {
for (auto &i : objects) {
@@ -131,7 +131,7 @@ bool Level::LayerVisible(Sprite *obj) {
//------------------------------------------------------------------------
// Purpose: Check if a sprite is colliding with the trigger areas
-// std::string &id is set to the id of colliding object
+// Common::String &id is set to the id of colliding object
//------------------------------------------------------------------------
void Level::CalcTrigCollide(Info &info) {
for (auto i = objects.begin(); i != objects.end(); ++i)
@@ -141,9 +141,9 @@ void Level::CalcTrigCollide(Info &info) {
//------------------------------------------------------------------------
// Purpose: Check if a sprite is colliding with interactive objects
-// std::string &id is set to the id of colliding object
+// Common::String &id is set to the id of colliding object
//------------------------------------------------------------------------
-bool Level::CollidingWithObject(Info &info, std::string &id) {
+bool Level::CollidingWithObject(Info &info, Common::String &id) {
// Clip and Bounding rectangle of player
Rect p_pos = objects[player_index].PosRect(), p_bound = objects[player_index].BoundRect();
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index cfe343c8a4f..4f141fde865 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -51,14 +51,14 @@ bool CompSpriteLayer(const Sprite &a, const Sprite &b) {
//------------------------------------------------------------------------
// Purpose: Load the level
//------------------------------------------------------------------------
-void Level::Load(const std::string &filename, pyrodactyl::event::Info &info,
+void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
pyrodactyl::event::TriggerSet &game_over, const int &player_x, const int &player_y) {
Reset();
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("level");
if (NodeValid(node)) {
- std::string vis;
+ Common::String vis;
LoadStr(vis, "map", node, false);
if (vis == "false")
showmap.Set(false);
@@ -103,7 +103,7 @@ void Level::Load(const std::string &filename, pyrodactyl::event::Info &info,
Sprite s;
s.Load(n, anim_set);
- std::string str = n->name();
+ Common::String str = n->name();
if (str == "player") {
player_index = objects.size();
if (player_x != -1 && player_y != -1) {
@@ -175,7 +175,7 @@ void Level::Load(const std::string &filename, pyrodactyl::event::Info &info,
//------------------------------------------------------------------------
// Purpose: Build an index of all animation files, called once at start
//------------------------------------------------------------------------
-void Level::LoadMoves(const std::string &filename) {
+void Level::LoadMoves(const Common::String &filename) {
XMLDoc mov_list(filename.c_str());
if (mov_list.ready()) {
rapidxml::xml_node<char> *node = mov_list.Doc()->first_node("movelist");
@@ -200,7 +200,7 @@ void Level::LoadMoves(const std::string &filename) {
//------------------------------------------------------------------------
// Purpose: Load the default sprite constant parameters
//------------------------------------------------------------------------
-void Level::LoadConst(const std::string &filename) {
+void Level::LoadConst(const Common::String &filename) {
XMLDoc doc(filename.c_str());
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.Doc()->first_node("constant");
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index b077e3a2978..dfde8e4378d 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -53,7 +53,7 @@ void TalkNotify::Draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s
pos.y = rect.y + offset.y;
// Find the sprite name
- std::string text = info.GetName(s.ID());
+ Common::String text = info.GetName(s.ID());
g_engine->_textManager->Draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
}
diff --git a/engines/crab/levelpaths.h b/engines/crab/levelpaths.h
index eae5cb56110..8195a7d3d13 100644
--- a/engines/crab/levelpaths.h
+++ b/engines/crab/levelpaths.h
@@ -36,7 +36,7 @@
namespace Crab {
class LevelPaths {
- std::string layout, asset;
+ Common::String layout, asset;
public:
LevelPaths() {
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index c5d111d6adf..a3bc65a7cd7 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -47,14 +47,14 @@ bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node
if (parent_node == NULL) {
/*if (echo)
{
- std::string error_msg = "parent node of " + name + " not found \n";
+ Common::String error_msg = "parent node of " + name + " not found \n";
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
}*/
return false;
} else if (parent_node->first_node(name.c_str()) == NULL) {
/*if (echo)
{
- std::string error_msg = "child node " + name + " of parent node " + parent_node->name() + " not found \n";
+ Common::String error_msg = "child node " + name + " of parent node " + parent_node->name() + " not found \n";
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
}*/
return false;
@@ -69,7 +69,7 @@ bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node
else {
/*if (echo)
{
- std::string error_msg = "string " + name + " not found in " + node->name() + "\n";
+ Common::String error_msg = "string " + name + " not found in " + node->name() + "\n";
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
}*/
return false;
@@ -84,7 +84,7 @@ bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char>
else {
/*if (echo)
{
- std::string error_msg = "string " + name + " not found in " + node->name() + "\n";
+ Common::String error_msg = "string " + name + " not found in " + node->name() + "\n";
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
}*/
return false;
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 6a10382bed7..80e320b3a2d 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -73,7 +73,7 @@ bool LoadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node
else {
/*if (echo)
{
- std::string error_msg = "attribute " + name + " not found in node " + node->parent()->name() + " -> " + node->name();
+ Common::String error_msg = "attribute " + name + " not found in node " + node->parent()->name() + " -> " + node->name();
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
}*/
return false;
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index fdf42df70fd..021815edeec 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -52,14 +52,14 @@ void Person::Load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
opinion.Load(node->first_node("opinion"));
if (node->first_attribute("type") != NULL) {
- std::string t;
+ Common::String t;
LoadStr(t, "type", node);
type = StringToPersonType(t);
} else
type = PE_NEUTRAL;
if (node->first_attribute("state") != NULL) {
- std::string s;
+ Common::String s;
LoadStr(s, "state", node);
state = StringToPersonState(s);
} else
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index 20b1fa5ca39..b2be3a30c5f 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -45,7 +45,7 @@ namespace pyrodactyl {
namespace people {
struct Person {
// The id of the object
- std::string id;
+ Common::String id;
// Opinion of the person towards the player
Opinion opinion;
@@ -57,13 +57,13 @@ struct Person {
pyrodactyl::stat::StatGroup stat;
// Name of object
- std::string name;
+ Common::String name;
// Type of object
PersonType type;
// Sometimes a person's journal entry isn't the same as their name
- std::string journal_name;
+ Common::String journal_name;
// If this is true, use the alternate journal name instead
bool alt_journal_name;
@@ -87,7 +87,7 @@ struct Person {
void LoadState(rapidxml::xml_node<char> *node);
};
-typedef std::unordered_map<std::string, Person> PersonMap;
+typedef Common::HashMap<Common::String, Person> PersonMap;
} // End of namespace people
} // End of namespace pyrodactyl
diff --git a/engines/crab/people/personbase.cpp b/engines/crab/people/personbase.cpp
index a51b6298240..e6c5b895dc8 100644
--- a/engines/crab/people/personbase.cpp
+++ b/engines/crab/people/personbase.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::stat;
namespace pyrodactyl {
namespace people {
-PersonType StringToPersonType(const std::string &val) {
+PersonType StringToPersonType(const Common::String &val) {
if (val == "neutral")
return PE_NEUTRAL;
else if (val == "hostile")
@@ -50,7 +50,7 @@ PersonType StringToPersonType(const std::string &val) {
return PE_NEUTRAL;
}
-PersonState StringToPersonState(const std::string &val) {
+PersonState StringToPersonState(const Common::String &val) {
if (val == "ko")
return PST_KO;
else if (val == "fight")
diff --git a/engines/crab/people/personbase.h b/engines/crab/people/personbase.h
index a13e0641e67..6be8772e375 100644
--- a/engines/crab/people/personbase.h
+++ b/engines/crab/people/personbase.h
@@ -60,8 +60,8 @@ enum PersonState { PST_NORMAL,
PST_KO,
PST_DYING };
-PersonType StringToPersonType(const std::string &val);
-PersonState StringToPersonState(const std::string &val);
+PersonType StringToPersonType(const Common::String &val);
+PersonState StringToPersonState(const Common::String &val);
} // End of namespace people
} // End of namespace pyrodactyl
diff --git a/engines/crab/people/trait.h b/engines/crab/people/trait.h
index 35059b64319..f518d9230d3 100644
--- a/engines/crab/people/trait.h
+++ b/engines/crab/people/trait.h
@@ -43,13 +43,13 @@ struct Trait {
int id;
// Used for achievements
- std::string id_str;
+ Common::String id_str;
// The name of the trait
- std::string name;
+ Common::String name;
// The description of the trait
- std::string desc;
+ Common::String desc;
// The image used to draw the trait
ImageKey img;
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index 86d18795e9a..4770b50df00 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -35,7 +35,7 @@ namespace Crab {
namespace pyrodactyl {
namespace stat {
-StatType StringToStatType(const std::string &val) {
+StatType StringToStatType(const Common::String &val) {
if (val == STATNAME_HEALTH)
return STAT_HEALTH;
else if (val == STATNAME_ATTACK)
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index 3a26dd3c4f3..106989f4345 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -70,7 +70,7 @@ struct StatGroup {
void Load(rapidxml::xml_node<char> *node);
};
-StatType StringToStatType(const std::string &val);
+StatType StringToStatType(const Common::String &val);
const char *StatTypeToString(const StatType &val);
} // End of namespace stat
} // End of namespace pyrodactyl
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index 67596974316..16da2a57014 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -42,7 +42,7 @@ namespace stat {
struct StatInfo {
// Used to draw stat value and description
pyrodactyl::ui::TextData desc;
- std::string text;
+ Common::String text;
Rect dim;
ImageKey full, empty;
@@ -68,7 +68,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
void DrawInfo(const pyrodactyl::people::Person &obj);
- const std::string &Name(const StatType &type) { return info[type].text; }
+ const Common::String &Name(const StatType &type) { return info[type].text; }
};
} // End of namespace stat
} // End of namespace pyrodactyl
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index 1dc04d02000..f0b0e77b6b3 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace pyrodactyl::stat;
-void StatTemplates::Load(const std::string &filename) {
+void StatTemplates::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("templates");
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index 2d7b64f6ffb..44bcf0e6f95 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -45,7 +45,7 @@ public:
StatTemplates(void) {}
~StatTemplates(void) {}
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
};
} // End of namespace stat
} // End of namespace pyrodactyl
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index ac99563b817..4103f0519d2 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -88,7 +88,7 @@ void TextManager::Reset() {
//------------------------------------------------------------------------
// Purpose: Search cache for rendered text
//------------------------------------------------------------------------
-int TextManager::Search(const std::string &text, int col, FontKey fontid) {
+int TextManager::Search(const Common::String &text, int col, FontKey fontid) {
int pos = 0;
for (auto i = cache.begin(); i != cache.end(); ++i, ++pos)
if (i->empty == false && i->text == text && i->EqualCol(col) && i->font == fontid)
@@ -112,7 +112,7 @@ int TextManager::FindFreeSlot() {
// Purpose: Render the SDL surface for text
//------------------------------------------------------------------------
#if 0
-SDL_Surface *TextManager::RenderTextBlended(const FontKey &font, const std::string &text, const int &color) {
+SDL_Surface *TextManager::RenderTextBlended(const FontKey &font, const Common::String &text, const int &color) {
if (text.empty())
return TTF_RenderText_Blended(GetFont(font), " ", colpool.Get(color));
@@ -120,7 +120,7 @@ SDL_Surface *TextManager::RenderTextBlended(const FontKey &font, const std::stri
}
#endif
-Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &fKey, const std::string &text, const int &color) {
+Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &fKey, const Common::String &text, const int &color) {
SDL_Color sdlcolor = colpool.Get(color);
uint32 col = g_engine->_format->ARGBToColor(255, sdlcolor.r, sdlcolor.g, sdlcolor.b);
@@ -144,7 +144,7 @@ Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &fKey, co
//------------------------------------------------------------------------
// Purpose: Draw text
//------------------------------------------------------------------------
-void TextManager::Draw(const int &x, const int &y, const std::string &text, const int &color,
+void TextManager::Draw(const int &x, const int &y, const Common::String &text, const int &color,
const FontKey &fontk, const Align &align, const bool &background) {
//warning("STUB: TextManager::Draw()");
@@ -219,12 +219,12 @@ void TextManager::Draw(const int &x, const int &y, const std::string &text, cons
}
}
-void TextManager::Draw(const int &x, int y, const std::string &text, const int &color, const FontKey &fKey, const Align &align,
+void TextManager::Draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &fKey, const Align &align,
const unsigned int &line_width, const unsigned int &line_height, const bool &background) {
- for (unsigned int start_pos = 0, len = text.length(); start_pos < len; y += line_height) {
+ for (unsigned int start_pos = 0, len = text.size(); start_pos < len; y += line_height) {
unsigned int end_pos = start_pos + 1;
int last_interrupt = -1;
- std::string word;
+ Common::String word;
while (end_pos - start_pos <= line_width) {
if (end_pos == len || text[end_pos] == '`') {
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 2c7b7746417..c0a551cfad5 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -59,7 +59,7 @@ class TextManager {
// The data stored in our cache - text and texture
struct TextCacheUnit {
- std::string text;
+ Common::String text;
int col;
FontKey font;
@@ -88,7 +88,7 @@ class TextManager {
// The rectangle used to store the darkened rectangle coordinates
SDL_Rect rect;
- int Search(const std::string &text, int col, FontKey fontid);
+ int Search(const Common::String &text, int col, FontKey fontid);
int FindFreeSlot();
public:
@@ -104,15 +104,15 @@ public:
Graphics::Font *GetFont(const FontKey &fontid) { return font[fontid]; }
- Graphics::ManagedSurface *RenderTextBlended(const FontKey &font, const std::string &text, const int &color);
+ Graphics::ManagedSurface *RenderTextBlended(const FontKey &font, const Common::String &text, const int &color);
#if 0
- SDL_Surface *RenderTextBlended(const FontKey &font, const std::string &text, const int &color);
+ SDL_Surface *RenderTextBlended(const FontKey &font, const Common::String &text, const int &color);
#endif
- void Draw(const int &x, const int &y, const std::string &text, const int &color,
+ void Draw(const int &x, const int &y, const Common::String &text, const int &color,
const FontKey &font = 0, const Align &align = ALIGN_LEFT, const bool &background = false);
- void Draw(const int &x, int y, const std::string &text, const int &color, const FontKey &font, const Align &align,
+ void Draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &font, const Align &align,
const unsigned int &line_width, const unsigned int &line_height, const bool &background = false);
};
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index 320d2c0c61a..a075eb08359 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::text;
-void ColorPool::Load(const std::string &filename) {
+void ColorPool::Load(const Common::String &filename) {
pool.clear();
XMLDoc col_list(filename.c_str());
if (col_list.ready()) {
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index dbeb7162d52..5333bd1f29e 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -57,7 +57,7 @@ public:
}
SDL_Color &Get(const int &num);
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
};
} // End of namespace text
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index 5723cc5c6b6..0f8f1b1e873 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -44,7 +44,7 @@ public:
bool enabled;
int col_s;
- std::string text;
+ Common::String text;
Caption(void) {
col_s = 0;
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 99eb653e0c3..64364ff2227 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -62,7 +62,7 @@ bool ChapterIntro::HandleEvents(SDL_Event &Event) {
}
#endif
-void ChapterIntro::Draw(pyrodactyl::event::Info &info, std::string &text,
+void ChapterIntro::Draw(pyrodactyl::event::Info &info, Common::String &text,
pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state) {
dialog.Draw(false);
dialog.Draw(info, text);
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index 650364ee74d..d7ec1ad5151 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -63,7 +63,7 @@ public:
bool HandleEvents(SDL_Event &Event);
#endif
- void Draw(pyrodactyl::event::Info &info, std::string &text,
+ void Draw(pyrodactyl::event::Info &info, Common::String &text,
pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state);
};
} // End of namespace ui
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 1a4705843a0..09fb8d3b5b5 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -43,7 +43,7 @@ void CreditScreen::Reset() {
speed.cur = speed.slow;
}
-void CreditScreen::Load(const std::string &filename) {
+void CreditScreen::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("credits");
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 6a2cbf34dcf..0bc26c9a063 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -46,7 +46,7 @@ class CreditScreen {
// Text and formatting information
struct CreditText {
// Title of the section (stuff like programmer, designer etc)
- std::string text;
+ Common::String text;
// The style it should be drawn in
bool heading;
@@ -111,7 +111,7 @@ public:
CreditScreen() { Reset(); }
~CreditScreen() {}
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
void Reset();
bool HandleEvents(Common::Event &Event);
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 5a858a36354..db450211f24 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
-void DebugConsole::Load(const std::string &filename) {
+void DebugConsole::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("debug");
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index d4ab3a18020..76b527a5d19 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -54,7 +54,7 @@ class DebugConsole {
TextArea text_field;
// The variable name we're tracking
- std::string var_name;
+ Common::String var_name;
public:
DebugConsole() { state = STATE_NORMAL; }
@@ -63,7 +63,7 @@ public:
// Only restrict input when we're in variable state
bool RestrictInput() { return (state == STATE_VAR || menu.HoverIndex() != -1); }
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
void Draw(pyrodactyl::event::Info &info);
#if 0
diff --git a/engines/crab/ui/FileData.h b/engines/crab/ui/FileData.h
index 282d0eea626..a11deafbbd0 100644
--- a/engines/crab/ui/FileData.h
+++ b/engines/crab/ui/FileData.h
@@ -41,13 +41,13 @@ namespace pyrodactyl {
namespace ui {
class FileData {
public:
- std::string name, path, last_modified;
+ Common::String name, path, last_modified;
//FileData(const boost::filesystem::path &filepath);
};
class SaveFileData : public FileData {
public:
- std::string loc_id, loc_name, char_name, diff, time, preview;
+ Common::String loc_id, loc_name, char_name, diff, time, preview;
// This is to account for the first save slot, called "New Save", which doesn't actually have a file
bool blank;
@@ -58,7 +58,7 @@ public:
class ModFileData : public FileData {
public:
- std::string author, version, info, website, preview;
+ Common::String author, version, info, website, preview;
//ModFileData(boost::filesystem::path filepath);
};
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 00f20569b34..5bf25e967da 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -53,10 +53,10 @@ protected:
PageButtonMenu menu;
// The final filename that is selected
- std::string selected;
+ Common::String selected;
// The extension and directory used by this menu
- std::string extension, directory;
+ Common::String extension, directory;
// The save information for each slot
Common::Array<FileType> slot_info;
@@ -73,7 +73,7 @@ protected:
pyrodactyl::image::Image preview;
// Fallback path if there is no preview image or if we fail to load it
- std::string no_preview_path;
+ Common::String no_preview_path;
// Position of image
Element pos;
@@ -106,8 +106,8 @@ public:
hover = false;
}
- std::string SelectedPath() { return selected; }
- void SelectedPath(const std::string &val) { selected = val; }
+ Common::String SelectedPath() { return selected; }
+ void SelectedPath(const Common::String &val) { selected = val; }
void ScanDir() {
warning("STUB: FileMenu::ScanDir()");
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index d0f4286b744..8cbae3ad426 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -42,7 +42,7 @@ namespace ui {
class HoverInfo : public TextData {
public:
bool enabled;
- std::string text;
+ Common::String text;
HoverInfo(void) { enabled = false; }
~HoverInfo(void) {}
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 87558759fa0..e80828e399a 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load layout
//------------------------------------------------------------------------
-void Inventory::Load(const std::string &filename) {
+void Inventory::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("inventory");
@@ -59,13 +59,13 @@ void Inventory::Load(const std::string &filename) {
}
}
-void Inventory::LoadItem(const std::string &char_id, const std::string &id) {
+void Inventory::LoadItem(const Common::String &char_id, const Common::String &id) {
Item i;
XMLDoc item_list(itemfile.c_str());
if (item_list.ready()) {
rapidxml::xml_node<char> *node = item_list.Doc()->first_node("items");
for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item")) {
- std::string str = n->first_attribute("id")->value();
+ Common::String str = n->first_attribute("id")->value();
if (id == str) {
i.Load(n);
AddItem(char_id, i);
@@ -75,15 +75,15 @@ void Inventory::LoadItem(const std::string &char_id, const std::string &id) {
}
}
-void Inventory::DelItem(const std::string &char_id, const std::string &item_id) {
+void Inventory::DelItem(const Common::String &char_id, const Common::String &item_id) {
collection.Del(char_id, item_id);
}
-void Inventory::AddItem(const std::string &char_id, Item &item) {
+void Inventory::AddItem(const Common::String &char_id, Item &item) {
collection.Add(char_id, item);
}
-bool Inventory::HasItem(const std::string &char_id, const std::string &container, const std::string &item_id) {
+bool Inventory::HasItem(const Common::String &char_id, const Common::String &container, const Common::String &item_id) {
return collection.Has(char_id, container, item_id);
}
@@ -102,7 +102,7 @@ void Inventory::Draw(Person &obj, const int &money_val) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Inventory::HandleEvents(const std::string &char_id, const Common::Event &Event) {
+void Inventory::HandleEvents(const Common::String &char_id, const Common::Event &Event) {
collection.HandleEvents(char_id, Event);
money.HandleEvents(Event);
}
@@ -111,7 +111,7 @@ void Inventory::HandleEvents(const std::string &char_id, const Common::Event &Ev
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Inventory::HandleEvents(const std::string &char_id, const SDL_Event &Event) {
+void Inventory::HandleEvents(const Common::String &char_id, const SDL_Event &Event) {
collection.HandleEvents(char_id, Event);
money.HandleEvents(Event);
}
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index b7692125336..a7356a78116 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -53,7 +53,7 @@ class Inventory {
// pyrodactyl::stat::StatDrawHelper helper;
// The file where all the item information is stored
- std::string itemfile;
+ Common::String itemfile;
// Used to draw the money value
Button money;
@@ -62,25 +62,25 @@ public:
Inventory() {}
~Inventory() {}
- void Init(const std::string &char_id) { collection.Init(char_id); }
+ void Init(const Common::String &char_id) { collection.Init(char_id); }
- void LoadItem(const std::string &char_id, const std::string &name);
- void AddItem(const std::string &char_id, pyrodactyl::item::Item &item);
- void DelItem(const std::string &char_id, const std::string &item_id);
- bool HasItem(const std::string &char_id, const std::string &container, const std::string &item_id);
+ void LoadItem(const Common::String &char_id, const Common::String &name);
+ void AddItem(const Common::String &char_id, pyrodactyl::item::Item &item);
+ void DelItem(const Common::String &char_id, const Common::String &item_id);
+ bool HasItem(const Common::String &char_id, const Common::String &container, const Common::String &item_id);
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
void Draw(pyrodactyl::people::Person &obj, const int &money_val);
- void HandleEvents(const std::string &char_id, const Common::Event &Event);
+ void HandleEvents(const Common::String &char_id, const Common::Event &Event);
#if 0
- void HandleEvents(const std::string &char_id, const SDL_Event &Event);
+ void HandleEvents(const Common::String &char_id, const SDL_Event &Event);
#endif
void LoadState(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void ItemFile(const std::string &filename) { itemfile = filename; }
+ void ItemFile(const Common::String &filename) { itemfile = filename; }
void SetUI();
};
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 8d77696684e..7d8e7f9112a 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -75,7 +75,7 @@ class KeyBindMenu {
struct PromptInfo {
int col, col_prev;
- std::string text;
+ Common::String text;
PromptInfo() {
col = 0;
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index aad77269a96..3c2eab38302 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -39,7 +39,7 @@ void MapData::Load(rapidxml::xml_node<char> *node) {
LoadStr(path_overlay, "overlay", node);
}
-void MapData::DestAdd(const std::string &name, const int &x, const int &y) {
+void MapData::DestAdd(const Common::String &name, const int &x, const int &y) {
MarkerData md;
md.name = name;
md.pos.x = x;
diff --git a/engines/crab/ui/MapData.h b/engines/crab/ui/MapData.h
index 057e4bbbc10..4eed1306c73 100644
--- a/engines/crab/ui/MapData.h
+++ b/engines/crab/ui/MapData.h
@@ -40,14 +40,14 @@ namespace pyrodactyl {
namespace ui {
struct MapData {
// The paths of set of map images - background and the fully revealed map overlay
- std::string path_bg, path_overlay;
+ Common::String path_bg, path_overlay;
// The places the player has revealed in this world map
Common::Array<Rect> reveal;
struct MarkerData {
// The name of the marker, same name as the quest
- std::string name;
+ Common::String name;
// Position of the marker
Vector2i pos;
@@ -61,7 +61,7 @@ struct MapData {
~MapData() {}
void Load(rapidxml::xml_node<char> *node);
- void DestAdd(const std::string &name, const int &x, const int &y);
+ void DestAdd(const Common::String &name, const int &x, const int &y);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void LoadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index dc21ceea2d6..75dcc8a73e0 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -58,7 +58,7 @@ public:
MapMarkerMenu() {}
~MapMarkerMenu() {}
- void AddButton(const std::string &name, const int &x, const int &y) {
+ void AddButton(const Common::String &name, const int &x, const int &y) {
StateButton b;
b.Init(ref, x, y);
b.tooltip.text = name;
@@ -68,12 +68,12 @@ public:
void Clear() { menu.element.clear(); }
void AssignPaths() { menu.AssignPaths(); }
- void SelectDest(const std::string &name) {
+ void SelectDest(const Common::String &name) {
for (auto &i : menu.element)
i.State(i.tooltip.text == name);
}
- void Erase(const std::string &name) {
+ void Erase(const Common::String &name) {
for (auto i = menu.element.begin(); i != menu.element.end(); ++i) {
if (i->tooltip.text == name) {
menu.element.erase(i);
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 283421ee29e..dc0f465e31d 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
-void ModMenu::Load(const std::string &filename) {
+void ModMenu::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("mod_menu");
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index 1285368aa21..9d60fd69630 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -43,7 +43,7 @@ public:
ModMenu() {}
~ModMenu() {}
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
bool HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 9a9b8b2650d..6999a756e84 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -38,7 +38,7 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::music;
-void OptionMenu::Load(const std::string &filename) {
+void OptionMenu::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("option");
@@ -399,10 +399,10 @@ void OptionMenu::SaveState() {
g_engine->_musicManager->SaveState(doc, root);
doc.append_node(root);
- std::string xml_as_string;
+ Common::String xml_as_string;
rapidxml::print(std::back_inserter(xml_as_string), doc);
- std::string settingpath = g_engine->_filePath->appdata;
+ Common::String settingpath = g_engine->_filePath->appdata;
settingpath += "settings.xml";
std::ofstream save(settingpath, std::ios::out);
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 379b9ddd64a..cb0589de028 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -105,7 +105,7 @@ public:
void Reset();
bool DisableHotkeys() { return keybind.DisableHotkeys(); }
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
void Draw(Button &back);
bool HandleEvents(Button &back, const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 41175b3551b..4a1814f3808 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -59,7 +59,7 @@ class PageMenu {
// Display "Page 1 of 3" style information for the menu
TextData status;
- std::string info;
+ Common::String info;
public:
PageMenu() {
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index 259216287ab..d7fe8a6f370 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -43,7 +43,7 @@ bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const boo
return TextData::Load(node, parent, echo);
}
-void ParagraphData::Draw(const std::string &val, const int &XOffset, const int &YOffset) {
+void ParagraphData::Draw(const Common::String &val, const int &XOffset, const int &YOffset) {
g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
}
diff --git a/engines/crab/ui/ParagraphData.h b/engines/crab/ui/ParagraphData.h
index 9a7bca17a4b..57a0f6aafc2 100644
--- a/engines/crab/ui/ParagraphData.h
+++ b/engines/crab/ui/ParagraphData.h
@@ -47,7 +47,7 @@ public:
bool Load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
- void Draw(const std::string &val, const int &XOffset = 0, const int &YOffset = 0);
+ void Draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index d1cc0e04a3e..ea9adffb5f6 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -95,7 +95,7 @@ public:
void Reset() { state = STATE_NORMAL; }
void ScanDir() { save.ScanDir(); }
- std::string SaveFile() { return save.SelectedPath(); }
+ Common::String SaveFile() { return save.SelectedPath(); }
bool DisableHotkeys();
// Should we allow the pause key(default escape) to quit to main menu?
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 2e27fdcc46f..aeaf6708d03 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -70,7 +70,7 @@ void PersonHandler::Load(rapidxml::xml_node<char> *node) {
jb.Load(node->first_node("journal"));
}
-void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const std::string &person_id,
+void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
const bool &player, pyrodactyl::anim::Sprite *s) {
// Draw the dialog box background
dlbox.Draw(player);
@@ -152,7 +152,7 @@ void PersonHandler::InternalEvents(const pyrodactyl::people::PersonState &state,
s->DialogUpdateClip(state);
}
-void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const std::string &id, const pyrodactyl::people::OpinionType &type, const int &val) {
+void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const Common::String &id, const pyrodactyl::people::OpinionType &type, const int &val) {
if (info.PersonValid(id)) {
// First, get the value of the object's opinion
int old = 0;
@@ -172,7 +172,7 @@ void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const std::stri
}
}
-void PersonHandler::Reset(const std::string &id) {
+void PersonHandler::Reset(const Common::String &id) {
if (prev != id) {
using namespace pyrodactyl::people;
opinion[OPI_LIKE].Reset();
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index b111ec557ec..9aed1e2e215 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -76,7 +76,7 @@ class PersonHandler {
Button jb;
// The person id of the changed opinion, we use this to reset bar
- std::string prev;
+ Common::String prev;
public:
// Used by other objects to see if journal needs to be displayed or not
@@ -85,7 +85,7 @@ public:
PersonHandler() { show_journal = false; }
~PersonHandler() {}
- void Reset(const std::string &id);
+ void Reset(const Common::String &id);
void Load(rapidxml::xml_node<char> *node);
@@ -102,10 +102,10 @@ public:
void InternalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s);
- void Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const std::string &person_id,
+ void Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
const bool &player, pyrodactyl::anim::Sprite *s = nullptr);
- void OpinionChange(pyrodactyl::event::Info &info, const std::string &id,
+ void OpinionChange(pyrodactyl::event::Info &info, const Common::String &id,
const pyrodactyl::people::OpinionType &type, const int &val);
void SetUI();
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 68496527a99..39fd2e3849f 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -38,7 +38,7 @@ using namespace pyrodactyl::event;
using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
-void PersonScreen::Load(const std::string &filename) {
+void PersonScreen::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("character");
@@ -58,7 +58,7 @@ void PersonScreen::Load(const std::string &filename) {
}
}
-void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const Common::Event &Event) {
+void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event) {
if (info.PersonValid(id))
menu.HandleEvents(&info.PersonGet(id), Event);
else
@@ -66,7 +66,7 @@ void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const std::string
}
#if 0
-void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const SDL_Event &Event) {
+void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event) {
if (info.PersonValid(id))
menu.HandleEvents(&info.PersonGet(id), Event);
else
@@ -79,7 +79,7 @@ void PersonScreen::InternalEvents() {
cur_sp->DialogUpdateClip(PST_NORMAL);
}
-void PersonScreen::Draw(pyrodactyl::event::Info &info, const std::string &id) {
+void PersonScreen::Draw(pyrodactyl::event::Info &info, const Common::String &id) {
bg.Draw();
if (info.PersonValid(id)) {
@@ -94,7 +94,7 @@ void PersonScreen::Draw(pyrodactyl::event::Info &info, const std::string &id) {
}
}
-void PersonScreen::Cache(Info &info, const std::string &id, pyrodactyl::level::Level &level) {
+void PersonScreen::Cache(Info &info, const Common::String &id, pyrodactyl::level::Level &level) {
cur_sp = level.GetSprite(id);
if (info.PersonValid(id))
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 2a4caed89d7..0cc3fc197af 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -64,16 +64,16 @@ public:
PersonScreen() { cur_sp = nullptr; }
~PersonScreen() {}
- void Load(const std::string &filename);
- void Cache(pyrodactyl::event::Info &info, const std::string &id, pyrodactyl::level::Level &level);
+ void Load(const Common::String &filename);
+ void Cache(pyrodactyl::event::Info &info, const Common::String &id, pyrodactyl::level::Level &level);
- void HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const Common::Event &Event);
+ void HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event);
#if 0
- void HandleEvents(pyrodactyl::event::Info &info, const std::string &id, const SDL_Event &Event);
+ void HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event);
#endif
void InternalEvents();
- void Draw(pyrodactyl::event::Info &info, const std::string &id);
+ void Draw(pyrodactyl::event::Info &info, const Common::String &id);
void SetUI();
};
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index 84e64efc65e..b8d077c0e31 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -70,7 +70,7 @@ class ProgressBar : public ClipButton {
// The caption text changes depending on the value of the progress bar - we store all possible text here
struct CaptionText {
// The text to be drawn
- std::string text;
+ Common::String text;
// The above text is drawn only if the progress bar value is greater than this val
int val;
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 8eb3b6387b6..18244c2e9e3 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -67,7 +67,7 @@ void ReplyButton::Draw(const int &XOffset, const int &YOffset) {
}
}
-void ReplyButton::Cache(const std::string &val, const int &spacing, const int &bottom_edge, Rect *parent) {
+void ReplyButton::Cache(const Common::String &val, const int &spacing, const int &bottom_edge, Rect *parent) {
text = val;
// Find out about the font
@@ -79,7 +79,7 @@ void ReplyButton::Cache(const std::string &val, const int &spacing, const int &b
height = g_engine->_textManager->GetFont(font)->getFontHeight();
// Find out how many line sizes will the text take
- int lines = ((text.length() - 1) / line_size.x) + 1;
+ int lines = ((text.size() - 1) / line_size.x) + 1;
x = orig.x;
y = orig.y;
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index da051d8a458..3797a55ade8 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -50,7 +50,7 @@ class ReplyButton : public Button {
Rect orig;
// The text for this button
- std::string text;
+ Common::String text;
public:
// The object it points to
@@ -72,7 +72,7 @@ public:
// Used to calculate size and set the string
// Spacing is the minimum space between buttons added in case of overflow
// Bottom edge is the y+h value of the previous choice
- void Cache(const std::string &val, const int &spacing, const int &bottom_edge, Rect *parent);
+ void Cache(const Common::String &val, const int &spacing, const int &bottom_edge, Rect *parent);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 841e03e4e2e..4ff70ef1a40 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::music;
using namespace pyrodactyl::event;
using namespace pyrodactyl::people;
-void ReplyMenu::Load(const std::string &filename) {
+void ReplyMenu::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("conversation");
@@ -61,7 +61,7 @@ void ReplyMenu::Load(const std::string &filename) {
}
}
-int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string &cur_id, PersonHandler &oh, const Common::Event &Event) {
+int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event) {
// After that, check if the user has clicked on any reply option
int choice = Menu<ReplyButton>::HandleEvents(Event);
if (choice >= 0 && (unsigned int)choice < dat.reply.size()) {
@@ -100,7 +100,7 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string
}
#if 0
-int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const std::string &cur_id, PersonHandler &oh, const SDL_Event &Event) {
+int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event) {
// After that, check if the user has clicked on any reply option
int choice = Menu<ReplyButton>::HandleEvents(Event);
if (choice >= 0 && choice < dat.reply.size()) {
@@ -157,9 +157,9 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
tone.value[element_count] = dat.reply[reply_count].tone;
- //std::string text = SDL_GetScancodeName(g_engine->_inputManager->iv[IU_REPLY_0 + element_count].key);
+ //Common::String text = SDL_GetScancodeName(g_engine->_inputManager->iv[IU_REPLY_0 + element_count].key);
//text += ". " + i->text;
- std::string text = i->text;
+ Common::String text = i->text;
info.InsertName(text);
if (element_count == 0)
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index b75b99e247e..fcdedb4e831 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -59,13 +59,13 @@ public:
ReplyMenu() { spacing = 20; }
~ReplyMenu() {}
- void Load(const std::string &filename);
+ void Load(const Common::String &filename);
int HandleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
- const std::string &cur_id, PersonHandler &oh, const Common::Event &Event);
+ const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event);
#if 0
int HandleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
- const std::string &cur_id, PersonHandler &oh, const SDL_Event &Event);
+ const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event);
#endif
void Draw();
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 80bc7489fa3..ed042410e64 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -46,7 +46,7 @@ class ResolutionMenu : public ButtonMenu {
} state;
HoverInfo info;
- std::string def_info;
+ Common::String def_info;
Button change, cancel, custom;
// Menu stores the button for each of the item in the dimension array
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 88f8b203fc5..f234b6e251b 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -84,7 +84,7 @@ void SectionHeader::Draw(const int &XOffset, const int &YOffset) {
Draw(text, XOffset, YOffset);
}
-void SectionHeader::Draw(const std::string &str, const int &XOffset, const int &YOffset) {
+void SectionHeader::Draw(const Common::String &str, const int &XOffset, const int &YOffset) {
if (draw_l)
g_engine->_imageManager->Draw(left.x + XOffset, left.y + YOffset, img);
diff --git a/engines/crab/ui/SectionHeader.h b/engines/crab/ui/SectionHeader.h
index ea90169c4bb..567d6885c84 100644
--- a/engines/crab/ui/SectionHeader.h
+++ b/engines/crab/ui/SectionHeader.h
@@ -42,7 +42,7 @@ namespace pyrodactyl {
namespace ui {
class SectionHeader : public TextData {
// The content of the header
- std::string text;
+ Common::String text;
// This image surrounds the text like <img> text <img>, with the right image being flipped horizontally
ImageKey img;
@@ -64,7 +64,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(const int &XOffset = 0, const int &YOffset = 0);
- void Draw(const std::string &str, const int &XOffset = 0, const int &YOffset = 0);
+ void Draw(const Common::String &str, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index a71386f203a..e8eba525e46 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -57,10 +57,10 @@ public:
bool Load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
// Plain drawing
- void Draw(const std::string &val, const int &XOffset = 0, const int &YOffset = 0);
+ void Draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
// Draw with a different color
- void DrawColor(const std::string &val, const int &color, const int &XOffset = 0, const int &YOffset = 0);
+ void DrawColor(const Common::String &val, const int &color, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index b981c1f9723..037fba3e283 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -71,9 +71,9 @@ void GameDialogBox::Draw(const bool &player) {
//------------------------------------------------------------------------
// Purpose: Draw the dialog box text
//------------------------------------------------------------------------
-void GameDialogBox::Draw(pyrodactyl::event::Info &info, std::string &message) {
+void GameDialogBox::Draw(pyrodactyl::event::Info &info, Common::String &message) {
// Create a copy of the string
- std::string msg = message;
+ Common::String msg = message;
info.InsertName(msg);
text.Draw(message);
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index d26a9858c66..0b42df0f1a4 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -69,7 +69,7 @@ public:
void Load(rapidxml::xml_node<char> *node);
- void Draw(pyrodactyl::event::Info &info, std::string &message);
+ void Draw(pyrodactyl::event::Info &info, Common::String &message);
void Draw(const bool &player);
bool HandleEvents(const Common::Event &Event);
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 07c1ea528ac..688ffa49395 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
-void HUD::Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm) {
+void HUD::Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("hud");
@@ -83,7 +83,7 @@ void HUD::Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, p
}
}
-void HUD::Draw(pyrodactyl::event::Info &info, const std::string &id) {
+void HUD::Draw(pyrodactyl::event::Info &info, const Common::String &id) {
bg.Draw();
menu.Draw();
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 62ae49d0680..ee08218009a 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -98,14 +98,14 @@ public:
void State(const int &val);
- void Load(const std::string &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
+ void Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
HUDSignal HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
HUDSignal HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
- void Draw(pyrodactyl::event::Info &info, const std::string &id);
+ void Draw(pyrodactyl::event::Info &info, const Common::String &id);
// Set the tooltips for the buttons in the menu
// The tooltips are of the style <Name> (<Hotkey>), with Name being provided by the xml
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index dbf786c255a..d18177578c8 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
// Purpose: Load game
//------------------------------------------------------------------------
-void Journal::Load(const std::string &filename) {
+void Journal::Load(const Common::String &filename) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("objectives");
@@ -65,7 +65,7 @@ void Journal::Load(const std::string &filename) {
//------------------------------------------------------------------------
// Purpose: Prepare a new character's journal
//------------------------------------------------------------------------
-void Journal::Init(const std::string &id) {
+void Journal::Init(const Common::String &id) {
int found = false;
for (auto &i : journal)
@@ -89,7 +89,7 @@ void Journal::Init(const std::string &id) {
//------------------------------------------------------------------------
// Purpose: Select a category
//------------------------------------------------------------------------
-void Journal::Select(const std::string &id, const int &choice) {
+void Journal::Select(const Common::String &id, const int &choice) {
for (unsigned int i = 0; i < category.element.size(); ++i)
category.element[i].State(false);
@@ -107,7 +107,7 @@ void Journal::Select(const std::string &id, const int &choice) {
//------------------------------------------------------------------------
// Purpose: Draw stuff
//------------------------------------------------------------------------
-void Journal::Draw(const std::string &id) {
+void Journal::Draw(const Common::String &id) {
bg.Draw();
category.Draw();
@@ -129,7 +129,7 @@ void Journal::Draw(const std::string &id) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool Journal::HandleEvents(const std::string &id, const Common::Event &Event) {
+bool Journal::HandleEvents(const Common::String &id, const Common::Event &Event) {
int choice = category.HandleEvents(Event);
if (choice >= 0 && (unsigned int)choice < category.element.size())
Select(id, choice);
@@ -149,7 +149,7 @@ bool Journal::HandleEvents(const std::string &id, const Common::Event &Event) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool Journal::HandleEvents(const std::string &id, const SDL_Event &Event) {
+bool Journal::HandleEvents(const Common::String &id, const SDL_Event &Event) {
int choice = category.HandleEvents(Event);
if (choice >= 0 && choice < category.element.size())
Select(id, choice);
@@ -169,7 +169,7 @@ bool Journal::HandleEvents(const std::string &id, const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Add an entry to journal
//------------------------------------------------------------------------
-void Journal::Add(const std::string &id, const std::string &Category, const std::string &Title, const std::string &Text) {
+void Journal::Add(const Common::String &id, const Common::String &Category, const Common::String &Title, const Common::String &Text) {
// Always find valid journal group first
for (auto &jo : journal)
if (jo.id == id) {
@@ -192,7 +192,7 @@ void Journal::Add(const std::string &id, const std::string &Category, const std:
//------------------------------------------------------------------------
// Purpose: Set the marker of a quest
//------------------------------------------------------------------------
-void Journal::Marker(const std::string &id, const std::string &Title, const bool &val) {
+void Journal::Marker(const Common::String &id, const Common::String &Title, const bool &val) {
// Always find valid journal group first
for (auto &jo : journal)
if (jo.id == id) {
@@ -204,7 +204,7 @@ void Journal::Marker(const std::string &id, const std::string &Title, const bool
//------------------------------------------------------------------------
// Purpose: Move an entry from one category to another
//------------------------------------------------------------------------
-void Journal::Move(const std::string &id, const std::string &Title, const bool &completed) {
+void Journal::Move(const Common::String &id, const Common::String &Title, const bool &completed) {
JournalCategory source, destination;
if (completed) {
source = JE_CUR;
@@ -235,7 +235,7 @@ void Journal::Move(const std::string &id, const std::string &Title, const bool &
//------------------------------------------------------------------------
// Purpose: Open a specific entry in the journal
//------------------------------------------------------------------------
-void Journal::Open(const std::string &id, const JournalCategory &Category, const std::string &Title) {
+void Journal::Open(const Common::String &id, const JournalCategory &Category, const Common::String &Title) {
// Always find valid journal group first
for (auto &jo : journal)
if (jo.id == id) {
@@ -278,7 +278,7 @@ void Journal::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
void Journal::LoadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *n = node->first_node("journal"); n != NULL; n = n->next_sibling("journal")) {
- std::string id;
+ Common::String id;
LoadStr(id, "id", n);
Init(id);
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 7549182bbd8..0d8a3dfeb83 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -70,7 +70,7 @@ class Journal {
// A group contains the entire journal for a single character
struct Group {
// Id of the character who this journal belongs to
- std::string id;
+ Common::String id;
// The set of menus containing all categories of journals
QuestMenu menu[JE_TOTAL];
@@ -85,33 +85,33 @@ class Journal {
// This button is the "go to map" button, shown if the quest has a corresponding map marker
Button bu_map;
- void Select(const std::string &id, const int &choice);
+ void Select(const Common::String &id, const int &choice);
public:
// The title of the quest selected by the "show in map" button
- std::string marker_title;
+ Common::String marker_title;
Journal() { select = 0; }
~Journal() {}
- void Load(const std::string &filename);
- void Draw(const std::string &id);
+ void Load(const Common::String &filename);
+ void Draw(const Common::String &id);
// Return true if "go to map" is selected
- bool HandleEvents(const std::string &id, const Common::Event &Event);
+ bool HandleEvents(const Common::String &id, const Common::Event &Event);
#if 0
- bool HandleEvents(const std::string &id, const SDL_Event &Event);
+ bool HandleEvents(const Common::String &id, const SDL_Event &Event);
#endif
- void Add(const std::string &id, const std::string &Category, const std::string &Title, const std::string &Text);
- void Move(const std::string &id, const std::string &Title, const bool &completed);
- void Marker(const std::string &id, const std::string &Title, const bool &val);
+ void Add(const Common::String &id, const Common::String &Category, const Common::String &Title, const Common::String &Text);
+ void Move(const Common::String &id, const Common::String &Title, const bool &completed);
+ void Marker(const Common::String &id, const Common::String &Title, const bool &val);
// Open a specific entry in the journal
- void Open(const std::string &id, const JournalCategory &Category, const std::string &Title);
+ void Open(const Common::String &id, const JournalCategory &Category, const Common::String &Title);
// Prepare a new character's journal
- void Init(const std::string &id);
+ void Init(const Common::String &id);
void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
void LoadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 53691752e2c..a19b898ce24 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
// Purpose: Load stuff that can't be modified by the user
//------------------------------------------------------------------------
-void Map::Load(const std::string &filename, pyrodactyl::event::Info &info) {
+void Map::Load(const Common::String &filename, pyrodactyl::event::Info &info) {
XMLDoc conf(filename.c_str());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("map");
@@ -410,7 +410,7 @@ void Map::SetImage(const unsigned int &val, const bool &force) {
//------------------------------------------------------------------------
// Purpose: Select the marker corresponding to a quest title
//------------------------------------------------------------------------
-void Map::SelectDest(const std::string &name) {
+void Map::SelectDest(const Common::String &name) {
marker.SelectDest(name);
}
@@ -440,7 +440,7 @@ void Map::RevealAdd(const int &id, const Rect &area) {
//------------------------------------------------------------------------
// Purpose: Add or remove a destination marker from the world map
//------------------------------------------------------------------------
-void Map::DestAdd(const std::string &name, const int &x, const int &y) {
+void Map::DestAdd(const Common::String &name, const int &x, const int &y) {
if (cur < map.size()) {
for (auto i = map[cur].dest.begin(); i != map[cur].dest.end(); ++i) {
if (i->name == name) {
@@ -456,7 +456,7 @@ void Map::DestAdd(const std::string &name, const int &x, const int &y) {
}
}
-void Map::DestDel(const std::string &name) {
+void Map::DestDel(const Common::String &name) {
if (cur < map.size()) {
for (auto i = map[cur].dest.begin(); i != map[cur].dest.end(); ++i) {
if (i->name == name) {
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index f9f1e90fb1c..1377029d1a4 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -102,7 +102,7 @@ class Map {
public:
// The currently selected location
- std::string cur_loc;
+ Common::String cur_loc;
// The coordinates of the player's current location
Vector2i player_pos;
@@ -115,7 +115,7 @@ public:
}
~Map() {}
- void Load(const std::string &filename, pyrodactyl::event::Info &info);
+ void Load(const Common::String &filename, pyrodactyl::event::Info &info);
void Draw(pyrodactyl::event::Info &info);
bool HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
@@ -132,9 +132,9 @@ public:
void Validate();
void RevealAdd(const int &id, const Rect &area);
- void DestAdd(const std::string &name, const int &x, const int &y);
- void DestDel(const std::string &name);
- void SelectDest(const std::string &name);
+ void DestAdd(const Common::String &name, const int &x, const int &y);
+ void DestDel(const Common::String &name);
+ void SelectDest(const Common::String &name);
void Update(pyrodactyl::event::Info &info);
void SetImage(const unsigned int &val, const bool &force = false);
diff --git a/engines/crab/ui/mapbutton.h b/engines/crab/ui/mapbutton.h
index 56e694fb8b3..fa28c3d301e 100644
--- a/engines/crab/ui/mapbutton.h
+++ b/engines/crab/ui/mapbutton.h
@@ -42,7 +42,7 @@ namespace ui {
class MapButton : public Button {
public:
// The id of the location
- std::string loc;
+ Common::String loc;
// Conditions needed for the location to be unlocked in world map
pyrodactyl::event::TriggerSet unlock;
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index a627e0a4e8e..7be3bf2383d 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -84,7 +84,7 @@ void QuestMenu::Load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Add an entry to the menu
//------------------------------------------------------------------------
-void QuestMenu::Add(const std::string &title, const std::string &txt) {
+void QuestMenu::Add(const Common::String &title, const Common::String &txt) {
for (auto i = quest.begin(); i != quest.end(); ++i)
if (i->title == title) // We already have the quest entry
{
@@ -115,7 +115,7 @@ void QuestMenu::Erase(const int &index) {
//------------------------------------------------------------------------
// Purpose: Indicate that this quest has an associated map marker in world map
//------------------------------------------------------------------------
-void QuestMenu::Marker(const std::string &title, const bool &val) {
+void QuestMenu::Marker(const Common::String &title, const bool &val) {
for (auto i = quest.begin(); i != quest.end(); ++i)
if (i->title == title)
i->marker = val;
@@ -153,7 +153,7 @@ void QuestMenu::Draw(Button &bu_map) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const Common::Event &Event) {
+bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event) {
int res = menu.HandleEvents(Event);
if (res != -1) {
if (sel_bu >= 0 && sel_page >= 0)
@@ -187,7 +187,7 @@ bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const Commo
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool QuestMenu::HandleEvents(Button &bu_map, std::string &map_title, const SDL_Event &Event) {
+bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event) {
int res = menu.HandleEvents(Event);
if (res != -1) {
if (sel_bu >= 0 && sel_page >= 0)
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 2ec34c7b518..20d80f754da 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -77,17 +77,17 @@ public:
void Load(rapidxml::xml_node<char> *node);
void Draw(Button &bu_map);
- bool HandleEvents(Button &bu_map, std::string &map_title, const Common::Event &Event);
+ bool HandleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event);
#if 0
- bool HandleEvents(Button &bu_map, std::string &map_title, const SDL_Event &Event);
+ bool HandleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event);
#endif
void UseKeyboard(const bool &val) { menu.UseKeyboard(val); }
void AssignPaths() { menu.AssignPaths(); }
- void Marker(const std::string &title, const bool &val);
+ void Marker(const Common::String &title, const bool &val);
- void Add(const std::string &title, const std::string &txt);
+ void Add(const Common::String &title, const Common::String &txt);
void Add(const pyrodactyl::event::Quest &q);
void Erase(const int &index);
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 9646977bcb7..954a42b3a36 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -56,7 +56,7 @@ class TextArea : public TextData {
pyrodactyl::music::ChunkKey se_entry, se_erase, se_accept;
public:
- std::string text;
+ Common::String text;
TextArea(void) : text("") {
size = 20;
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index ce23df19e28..63154ce01b6 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -50,11 +50,11 @@ bool TextData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &ec
return false;
}
-void TextData::Draw(const std::string &val, const int &XOffset, const int &YOffset) {
+void TextData::Draw(const Common::String &val, const int &XOffset, const int &YOffset) {
g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, col, font, align, background);
}
-void TextData::DrawColor(const std::string &val, const int &color, const int &XOffset, const int &YOffset) {
+void TextData::DrawColor(const Common::String &val, const int &color, const int &XOffset, const int &YOffset) {
g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, color, font, align, background);
}
diff --git a/engines/crab/url.cpp b/engines/crab/url.cpp
index ec8a07f419c..60277c4d5d4 100644
--- a/engines/crab/url.cpp
+++ b/engines/crab/url.cpp
@@ -43,7 +43,7 @@ namespace Crab {
#include <CoreFoundation/CFBundle.h>
#endif
-void OpenURL(const std::string &url_str) {
+void OpenURL(const Common::String &url_str) {
#ifdef __WIN32__
ShellExecuteA(NULL, "open", url_str.c_str(), NULL, NULL, SW_SHOW);
#endif
@@ -61,7 +61,7 @@ void OpenURL(const std::string &url_str) {
#endif
#ifdef __GNUC__
- std::string command = "xdg-open " + url_str;
+ Common::String command = "xdg-open " + url_str;
system(command.c_str());
#endif
}
diff --git a/engines/crab/url.h b/engines/crab/url.h
index 49df1d2ae11..9b4c24fdc0b 100644
--- a/engines/crab/url.h
+++ b/engines/crab/url.h
@@ -35,7 +35,7 @@
namespace Crab {
-void OpenURL(const std::string &url_str);
+void OpenURL(const Common::String &url_str);
} // End of namespace Crab
Commit: 966e6297077cb3bb2b5803915701dc96265a99d8
https://github.com/scummvm/scummvm/commit/966e6297077cb3bb2b5803915701dc96265a99d8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::sort instead of std::sort
Changed paths:
engines/crab/TMX/TMXMap.cpp
engines/crab/level/level_load.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 8581c86f953..7d8d0209ab5 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -177,7 +177,7 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
}
// Sort the props in the level according to y axis
- std::sort(prop.begin(), prop.end(), PropCompare);
+ Common::sort(prop.begin(), prop.end(), PropCompare);
}
}
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 4f141fde865..2c12f19f4e0 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -124,7 +124,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
background.push_back(s);
}
- std::sort(background.begin(), background.end(), CompSpriteLayer);
+ Common::sort(background.begin(), background.end(), CompSpriteLayer);
}
if (NodeValid("fly", node)) {
Commit: c645e08f4f3a2bdc1d3ee791637e7fcccc3305df
https://github.com/scummvm/scummvm/commit/c645e08f4f3a2bdc1d3ee791637e7fcccc3305df
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::find and Common::find_if instead of std::find and std::find_if
Changed paths:
engines/crab/PathfindingGrid.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/trigger.cpp
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 35a0bbbd284..ff28d5492a5 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -203,7 +203,7 @@ Common::Array<PathfindingGraphNode *> PathfindingGrid::CornerCheck(const Pathfin
for (auto iter : node1->neighborNodes) {
for (auto iter2 : node2->neighborNodes) {
if (iter == iter2 && iter->movementCost < 0) {
- if (returnNodes.size() == 0 || (*(std::find(returnNodes.begin(), returnNodes.end(), iter))) == NULL)
+ if (returnNodes.size() == 0 || (*(Common::find(returnNodes.begin(), returnNodes.end(), iter))) == NULL)
returnNodes.push_back(iter);
}
}
@@ -242,7 +242,7 @@ PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vect
} else {
for (unsigned int i = 0; i < checkNodes.front()->neighborNodes.size(); ++i) {
// If the neighbor hasn't been checked yet, add it to the list to check.
- if (std::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->neighborNodes[i]) == allUsedNodes.end()) {
+ if (Common::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->neighborNodes[i]) == allUsedNodes.end()) {
allUsedNodes.push_back(checkNodes.front()->neighborNodes[i]);
checkNodes.push_back(checkNodes.front()->neighborNodes[i]);
}
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index fb69f182b9f..35dced60a79 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -136,7 +136,7 @@ bool Info::VarGet(const Common::String &name, int &val) {
void Info::VarSet(const Common::String &name, const Common::String &val) {
int var_val = 0;
- bool assign_to_var = std::find_if(val.begin(), val.end(), IsChar) != val.end();
+ bool assign_to_var = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
if (assign_to_var)
VarGet(val, var_val);
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index db9bdfef5b2..67e4cfd204c 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -154,7 +154,7 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
case TRIG_STAT: {
StatType ty = StringToStatType(target);
int sub = 0, value = 0;
- bool compare_to_var = std::find_if(val.begin(), val.end(), IsChar) != val.end();
+ bool compare_to_var = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
info.StatGet(subject, ty, sub);
if (compare_to_var)
@@ -180,7 +180,7 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
case TRIG_VAR: {
int var_sub = 0, var_val = 0;
- bool compare_to_var = std::find_if(val.begin(), val.end(), IsChar) != val.end();
+ bool compare_to_var = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
info.VarGet(subject, var_sub);
if (compare_to_var)
Commit: 6d2babc286d82c0c8ec92dd251717415b5043f60
https://github.com/scummvm/scummvm/commit/6d2babc286d82c0c8ec92dd251717415b5043f60
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use size_t instead of std::size_t
Changed paths:
engines/crab/GameClock.h
engines/crab/PriorityQueue.h
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 55634a5429b..0342468f58c 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -53,12 +53,12 @@ public:
uint32 ms = 0, hr = 0, min = 0, sec = 0;
Common::String str_hrs, str_min, str_sec;
- std::size_t found_1 = str.findFirstOf(seperator);
+ size_t found_1 = str.findFirstOf(seperator);
if (found_1 > 0 && found_1 != Common::String::npos) {
str_hrs = str.substr(0, found_1);
hr = StringToNumber<uint32>(str_hrs);
- std::size_t found_2 = str.findFirstOf(seperator);
+ size_t found_2 = str.findFirstOf(seperator);
if (found_2 > 0 && found_2 != Common::String::npos) {
str_sec = str.substr(found_2 + 1, Common::String::npos);
sec = StringToNumber<uint32>(str_sec);
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index 44256030711..14dc06ccf53 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -62,7 +62,7 @@ public:
void clear();
//! \brief Returns the number of nodes currently in the heap.
- std::size_t size() const;
+ size_t size() const;
//! \brief Pushes the specified node onto the heap.
//!
@@ -115,7 +115,7 @@ void PriorityQueue<Node>::clear() {
}
template<typename Node>
-std::size_t PriorityQueue<Node>::size() const {
+size_t PriorityQueue<Node>::size() const {
return open.size();
}
Commit: 5825e872a4611301b4b92c1baf674bb2833ae740
https://github.com/scummvm/scummvm/commit/5825e872a4611301b4b92c1baf674bb2833ae740
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CARB: Delegate to default constructor from parameterized constructor
Changed paths:
engines/crab/event/gameevent.h
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index e6b8b0ca13b..88c8ab43289 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -85,7 +85,7 @@ struct GameEvent {
Common::Array<EventID> next;
GameEvent();
- GameEvent(rapidxml::xml_node<char> *node) { Load(node); }
+ GameEvent(rapidxml::xml_node<char> *node) : GameEvent() { Load(node); }
~GameEvent() {}
void Load(rapidxml::xml_node<char> *node);
Commit: 8b03e939407f84bbad832eb7665bbc0d7e882a8c
https://github.com/scummvm/scummvm/commit/8b03e939407f84bbad832eb7665bbc0d7e882a8c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix warnings temporarily
Changed paths:
engines/crab/music/MusicManager.h
engines/crab/ui/ReplyMenu.cpp
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index b2f193f2833..c39e55b9314 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -65,6 +65,10 @@ public:
notify = -1;
rep_inc = -1;
rep_dec = -1;
+
+ (void)freq;
+ (void)channels;
+ (void)chunksize;
}
~MusicManager() {}
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 4ff70ef1a40..ad3dbba9140 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -83,6 +83,8 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::Str
}
}
+ (void)play_sound;
+
#if 0
// Right now we play sound randomly
if (play_sound) {
Commit: ed263d267a4608d68007631a27bd76c43a7e4b45
https://github.com/scummvm/scummvm/commit/ed263d267a4608d68007631a27bd76c43a7e4b45
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get rid of temporarily defined SDL_Rect
Changed paths:
engines/crab/Rectangle.h
engines/crab/text/TextManager.h
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index 334cdc7a33e..0535827f15d 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -37,18 +37,16 @@
namespace Crab {
-struct SDL_Rect {
+//------------------------------------------------------------------------
+// Purpose: A simple rectangle class
+//------------------------------------------------------------------------
+struct Rect {
+
int x;
int y;
int w;
int h;
-};
-//------------------------------------------------------------------------
-// Purpose: A simple rectangle class
-//------------------------------------------------------------------------
-class Rect : public SDL_Rect {
-public:
Rect(int X = 0, int Y = 0, int W = 0, int H = 0) {
x = X;
y = Y;
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index c0a551cfad5..63e74c5f3b3 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -86,7 +86,7 @@ class TextManager {
ColorPool colpool;
// The rectangle used to store the darkened rectangle coordinates
- SDL_Rect rect;
+ Rect rect;
int Search(const Common::String &text, int col, FontKey fontid);
int FindFreeSlot();
Commit: 1a325c87e8218f376d1843045e178324228a7250
https://github.com/scummvm/scummvm/commit/1a325c87e8218f376d1843045e178324228a7250
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unnecessary conversions to C string
Changed paths:
engines/crab/GameClock.h
engines/crab/LoadingScreen.cpp
engines/crab/Rectangle.cpp
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/ai/spriteai.cpp
engines/crab/animation/animset.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/eventstore.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/input/input.cpp
engines/crab/level/level_load.cpp
engines/crab/levelpaths.h
engines/crab/mainmenu.cpp
engines/crab/stat/StatTemplate.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/color.cpp
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/DevConsole.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/Inventory.cpp
engines/crab/ui/ModMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/QuestText.cpp
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 0342468f58c..667732c6532 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -81,11 +81,11 @@ public:
uint32 minutes = x % 60;
uint32 hours = x / 60;
- Common::String time_str = NumberToString(hours).c_str();
+ Common::String time_str = NumberToString(hours);
time_str += seperator;
- time_str += NumberToString(minutes).c_str();
+ time_str += NumberToString(minutes);
time_str += seperator;
- time_str += NumberToString(seconds).c_str();
+ time_str += NumberToString(seconds);
return time_str;
}
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index c9d45f28b14..d2c6937df54 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -36,7 +36,7 @@ namespace Crab {
void LoadingScreen::Load() {
const Common::String &filename = "res/layout/loading.xml";
- XMLDoc doc(filename.c_str());
+ XMLDoc doc(filename);
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.Doc()->first_node("loading");
if (NodeValid(node)) {
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 1137d7affb3..ba6ff4ec3e1 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -34,7 +34,7 @@ namespace Crab {
bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const Common::String &x_name, const Common::String &y_name,
const Common::String &w_name, const Common::String &h_name) {
- return LoadNum(x, x_name.c_str(), node, echo) && LoadNum(y, y_name.c_str(), node, echo) && LoadNum(w, w_name.c_str(), node, echo) && LoadNum(h, h_name.c_str(), node, echo);
+ return LoadNum(x, x_name, node, echo) && LoadNum(y, y_name, node, echo) && LoadNum(w, w_name, node, echo) && LoadNum(h, h_name, node, echo);
}
bool Rect::Collide(Rect box) {
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 4582307e2e1..98a545b8cd7 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -49,7 +49,7 @@ bool MapLayer::Load(const Common::String &path, rapidxml::xml_node<char> *node)
rapidxml::xml_node<char> *imgnode = node->first_node("image");
if (imgnode->first_attribute("source") != NULL)
- img.Load((path + imgnode->first_attribute("source")->value()).c_str());
+ img.Load((path + imgnode->first_attribute("source")->value()));
} else {
type = LAYER_NORMAL;
int i = 0;
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 7d8d0209ab5..258a88b1c03 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -63,7 +63,7 @@ TMXMap::TMXMap() {
//------------------------------------------------------------------------
void TMXMap::Load(const Common::String &path, Common::String filename) {
- XMLDoc conf((path + filename).c_str());
+ XMLDoc conf((path + filename));
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("map");
if (NodeValid(node)) {
@@ -269,8 +269,8 @@ void TMXMap::DrawDebug(const Rect &camera) {
for (auto i = area_stairs.begin(); i != area_stairs.end(); ++i) {
i->Draw(-camera.x, -camera.y, 0, 254, 0, 254);
- //g_engine->_textManager->Draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x).c_str(), 0);
- //g_engine->_textManager->Draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y).c_str(), 0);
+ //g_engine->_textManager->Draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x), 0);
+ //g_engine->_textManager->Draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y), 0);
}
// Draw the pathfinding grid (SZ)
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 1a6049dae42..0d06a6afb3e 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -53,7 +53,7 @@ void TileSet::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
LoadStr(filename, "source", imgnode);
loc = path + filename;
- img.Load(loc.c_str());
+ img.Load(loc);
total_rows = img.H() / tile_h;
total_cols = img.W() / tile_w;
warning("Total rows : %d Total cols: %d gid: %d", total_rows, total_cols, first_gid);
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 0858c32f7d6..f881cad04f0 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -51,7 +51,7 @@ double Sprite::DistSq(const Sprite &s) {
void Sprite::MoveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
if (ai_data.dest.active) {
int num = 0;
- info.StatGet(id.c_str(), pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float player_speed = static_cast<float>(num);
@@ -66,7 +66,7 @@ void Sprite::MoveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc)
void Sprite::MoveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
if (ai_data.dest.active) {
int num = 0;
- info.StatGet(id.c_str(), pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float player_speed = static_cast<float>(num);
@@ -189,7 +189,7 @@ void Sprite::Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
break;
} else {
int num = 0;
- info.StatGet(id.c_str(), pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float velocity = static_cast<float>(num);
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 10649a84c07..40e5b5742e9 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::anim;
void AnimSet::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node();
if (NodeValid(node)) {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 149db731520..47d819c2e0c 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::event;
// Purpose: Load
//------------------------------------------------------------------------
void EventSequence::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("events");
for (auto n = node->first_node("event"); n != NULL; n = n->next_sibling("event")) {
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 35dced60a79..e85b3eac9c1 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -80,7 +80,7 @@ void Info::Load(rapidxml::xml_node<char> *node) {
}
void Info::LoadPeople(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("people");
if (NodeValid(node)) {
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 419baac25b9..2e1b2b47b0c 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -51,7 +51,7 @@ void GameEventStore::Load(const Common::String &filename) {
// if (m_pSteamUserStats != nullptr)
// m_pSteamUserStats->RequestCurrentStats();
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("store");
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index b03deeeea41..7929f18900b 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -98,7 +98,7 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.contains(info.CurLocID().c_str()) > 0 && event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
@@ -119,7 +119,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
}
if (oh.HandleDlboxEvents(Event)) {
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
oh.show_journal = false;
}
}
@@ -127,7 +127,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP)
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_REPLY:
if (oh.show_journal) {
@@ -143,7 +143,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
}
}
@@ -155,7 +155,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
if (textin.HandleEvents(Event))
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
@@ -165,7 +165,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
intro.show_traits = false;
} else {
if (intro.HandleEvents(Event))
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
per.Cache(info, level.PlayerID(), level);
@@ -175,7 +175,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
break;
}
- EndSequence(info.CurLocID().c_str());
+ EndSequence(info.CurLocID());
}
}
@@ -185,7 +185,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
//------------------------------------------------------------------------
void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.contains(info.CurLocID().c_str()) > 0 && event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
@@ -206,7 +206,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
}
if (oh.HandleDlboxEvents(Event)) {
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
oh.show_journal = false;
}
}
@@ -214,7 +214,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == SDL_KEYUP || Event.type == SDL_MOUSEBUTTONUP)
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_REPLY:
if (oh.show_journal) {
@@ -230,7 +230,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
}
}
@@ -242,7 +242,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
if (textin.HandleEvents(Event))
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
@@ -252,7 +252,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
intro.show_traits = false;
} else {
if (intro.HandleEvents(Event))
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
per.Cache(info, level.PlayerID(), level);
@@ -262,7 +262,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
break;
}
- EndSequence(info.CurLocID().c_str());
+ EndSequence(info.CurLocID());
}
}
#endif
@@ -271,8 +271,8 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
// Purpose: Internal Events
//------------------------------------------------------------------------
void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
- if (event_map.contains(info.CurLocID().c_str()) > 0) {
- if (event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID()) > 0) {
+ if (event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
UpdateDialogBox(info, level);
@@ -282,7 +282,7 @@ void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult
DrawType draw_val = DRAW_SAME;
if (g_engine->_eventStore->anim[cur_event->special].InternalEvents(draw_val))
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
draw_game = false;
@@ -290,7 +290,7 @@ void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult
draw_game = true;
} break;
case EVENT_SILENT:
- event_map[info.CurLocID().c_str()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
break;
case EVENT_REPLY:
UpdateDialogBox(info, level);
@@ -302,9 +302,9 @@ void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult
break;
}
- EndSequence(info.CurLocID().c_str());
+ EndSequence(info.CurLocID());
} else {
- event_map[info.CurLocID().c_str()].InternalEvents(info);
+ event_map[info.CurLocID()].InternalEvents(info);
CalcActiveSeq(info, level, level.Camera());
}
}
@@ -317,7 +317,7 @@ void Manager::UpdateDialogBox(Info &info, Level &level) {
// Purpose: Draw
//------------------------------------------------------------------------
void Manager::Draw(Info &info, HUD &hud, Level &level) {
- if (event_map.contains(info.CurLocID().c_str()) > 0 && event_map[info.CurLocID().c_str()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_ANIM:
g_engine->_eventStore->anim[cur_event->special].Draw();
@@ -363,9 +363,9 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
// Purpose: Calculate the current sequence in progress
//------------------------------------------------------------------------
void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
- if (event_map[info.CurLocID().c_str()].ActiveSeq(active_seq)) {
+ if (event_map[info.CurLocID()].ActiveSeq(active_seq)) {
// Set all the pointers to the new values
- cur_event = event_map[info.CurLocID().c_str()].CurEvent(active_seq);
+ cur_event = event_map[info.CurLocID()].CurEvent(active_seq);
oh.Reset(cur_event->title);
cur_sp = level.GetSprite(cur_event->title);
@@ -392,9 +392,9 @@ void Manager::EndSequence(const Common::String &curloc) {
if (end_seq.empty() == false) {
for (auto i = end_seq.begin(); i != end_seq.end(); ++i)
if (i->cur)
- event_map[curloc.c_str()].EndSeq(active_seq);
- else if (event_map.contains(i->loc.c_str()) > 0)
- event_map[i->loc.c_str()].EndSeq(StringToNumber<unsigned int>(i->val));
+ event_map[curloc].EndSeq(active_seq);
+ else if (event_map.contains(i->loc) > 0)
+ event_map[i->loc].EndSeq(StringToNumber<unsigned int>(i->val));
active_seq = UINT_MAX;
end_seq.clear();
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index ae0986a6dca..b850891ce2a 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -41,10 +41,10 @@ using namespace pyrodactyl::input;
// Purpose: Loading stuff
//------------------------------------------------------------------------
void Game::StartNewGame() {
- Init(g_engine->_filePath->mod_cur.c_str());
- LoadLevel(info.CurLocID().c_str());
+ Init(g_engine->_filePath->mod_cur);
+ LoadLevel(info.CurLocID());
info.IronMan(g_engine->_tempData->ironman);
- savefile.ironman = g_engine->_tempData->filename.c_str();
+ savefile.ironman = g_engine->_tempData->filename;
clock.Start();
hud.pause.UpdateMode(info.IronMan());
@@ -52,7 +52,7 @@ void Game::StartNewGame() {
}
void Game::LoadGame(const Common::String &filename) {
- Init(g_engine->_filePath->mod_cur.c_str());
+ Init(g_engine->_filePath->mod_cur);
LoadState(filename);
}
@@ -65,7 +65,7 @@ void Game::Init(const Common::String &filename) {
gem.Init();
info.Init();
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("config");
@@ -74,7 +74,7 @@ void Game::Init(const Common::String &filename) {
Common::String path;
if (NodeValid("level", node)) {
LoadStr(path, "list", node->first_node("level"));
- g_engine->_filePath->LoadLevel(path.c_str());
+ g_engine->_filePath->LoadLevel(path);
}
if (NodeValid("hud", node)) {
@@ -113,23 +113,23 @@ void Game::Init(const Common::String &filename) {
}
bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
- if (g_engine->_filePath->level.contains(id.c_str())) {
+ if (g_engine->_filePath->level.contains(id)) {
g_engine->_loadingScreen->Draw();
// Load the assets local to this level
// If the filename is same as the previous one, skip loading
- if (g_engine->_filePath->current_r != g_engine->_filePath->level[id.c_str()].asset) {
- g_engine->_filePath->current_r = g_engine->_filePath->level[id.c_str()].asset;
- g_engine->_imageManager->LoadMap(g_engine->_filePath->level[id.c_str()].asset);
+ if (g_engine->_filePath->current_r != g_engine->_filePath->level[id].asset) {
+ g_engine->_filePath->current_r = g_engine->_filePath->level[id].asset;
+ g_engine->_imageManager->LoadMap(g_engine->_filePath->level[id].asset);
}
// Load the level itself
level.pop = pop_default;
- level.Load(g_engine->_filePath->level[id.c_str()].layout.c_str(), info, game_over, player_x, player_y);
+ level.Load(g_engine->_filePath->level[id].layout, info, game_over, player_x, player_y);
// Set the current location
- info.CurLocID(id.c_str());
- info.CurLocName(g_engine->_filePath->level[id.c_str()].name.c_str());
+ info.CurLocID(id);
+ info.CurLocName(g_engine->_filePath->level[id].name);
map.player_pos = level.map_loc;
// Update and center the world map to the player current position
@@ -213,7 +213,7 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
- info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson().c_str(), Event);
+ info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
level.HandleEvents(info, Event);
@@ -535,7 +535,7 @@ void Game::Draw() {
break;
case STATE_INVENTORY:
g_engine->_imageManager->DimScreen();
- info.InvDraw(level.PlayerID().c_str());
+ info.InvDraw(level.PlayerID());
hud.Draw(info, level.PlayerID());
hud.back.Draw();
break;
@@ -592,9 +592,9 @@ bool Game::ApplyResult() {
break;
case ER_TRAIT:
if (i->x == 42)
- info.TraitDel(i->val.c_str(), i->y);
+ info.TraitDel(i->val, i->y);
else
- info.TraitAdd(i->val.c_str(), i->y);
+ info.TraitAdd(i->val, i->y);
break;
case ER_LEVEL:
if (i->val == "Map")
@@ -662,7 +662,7 @@ void Game::ApplyResult(LevelResult result) {
// Purpose: Save/load game
//------------------------------------------------------------------------
void Game::LoadState(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
if (NodeValid(node)) {
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 1479e3dafcf..b9d0835ebce 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -115,10 +115,10 @@ private:
void CreateSaveGame(const SaveGameType &savetype);
Common::String FullPath(const Common::String &filename) {
- Common::String res = g_engine->_filePath->appdata.c_str();
- res += g_engine->_filePath->save_dir.c_str();
+ Common::String res = g_engine->_filePath->appdata;
+ res += g_engine->_filePath->save_dir;
res += filename;
- res += g_engine->_filePath->save_ext.c_str();
+ res += g_engine->_filePath->save_ext;
return res;
}
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 218612b0c35..b4f8d57454f 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -137,7 +137,7 @@ void InputManager::Init() {
// Purpose: Load key & controller binding settings from file
//------------------------------------------------------------------------
void InputManager::Load(const Common::String &filename) {
- XMLDoc control_list(filename.c_str());
+ XMLDoc control_list(filename);
if (control_list.ready()) {
rapidxml::xml_node<char> *node = control_list.Doc()->first_node("controls");
if (NodeValid(node)) {
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 2c12f19f4e0..b06fdc9433a 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -54,7 +54,7 @@ bool CompSpriteLayer(const Sprite &a, const Sprite &b) {
void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
pyrodactyl::event::TriggerSet &game_over, const int &player_x, const int &player_y) {
Reset();
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("level");
if (NodeValid(node)) {
@@ -176,7 +176,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
// Purpose: Build an index of all animation files, called once at start
//------------------------------------------------------------------------
void Level::LoadMoves(const Common::String &filename) {
- XMLDoc mov_list(filename.c_str());
+ XMLDoc mov_list(filename);
if (mov_list.ready()) {
rapidxml::xml_node<char> *node = mov_list.Doc()->first_node("movelist");
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set")) {
@@ -201,7 +201,7 @@ void Level::LoadMoves(const Common::String &filename) {
// Purpose: Load the default sprite constant parameters
//------------------------------------------------------------------------
void Level::LoadConst(const Common::String &filename) {
- XMLDoc doc(filename.c_str());
+ XMLDoc doc(filename);
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.Doc()->first_node("constant");
if (NodeValid(node))
diff --git a/engines/crab/levelpaths.h b/engines/crab/levelpaths.h
index 8195a7d3d13..a7499a36167 100644
--- a/engines/crab/levelpaths.h
+++ b/engines/crab/levelpaths.h
@@ -49,7 +49,7 @@ public:
asset = Asset;
}
- const char *LayoutPath() { return layout.c_str(); }
+ const char *LayoutPath() { return layout; }
void LayoutPath(const char *str) { layout = str; }
const char *AssetPath() { return asset.c_str(); }
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index b6b319e7fa6..e397e24996d 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -259,7 +259,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
case STATE_SAVENAME:
if (save.HandleEvents(Event) || accept.HandleEvents(Event)) {
if (save.text != "") {
- g_engine->_tempData->filename = save.text.c_str();
+ g_engine->_tempData->filename = save.text;
g_engine->_tempData->ironman = true;
ShouldChangeState = true;
NewStateID = GAMESTATE_NEW_GAME;
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index f0b0e77b6b3..cda9689736c 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -37,7 +37,7 @@ namespace Crab {
using namespace pyrodactyl::stat;
void StatTemplates::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("templates");
for (auto n = node->first_node("stats"); n != NULL; n = n->next_sibling("stats"))
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 4103f0519d2..25be2bfc3b2 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -77,7 +77,7 @@ void TextManager::Init() {
}
}
- colpool.Load(g_engine->_filePath->colors.c_str());
+ colpool.Load(g_engine->_filePath->colors);
}
void TextManager::Reset() {
@@ -132,10 +132,10 @@ Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &fKey, co
surf = new Graphics::ManagedSurface(rec.width(), h + (h / 2), *g_engine->_format);
GetFont(fKey)->drawString(surf, " ", 0, 0, rec.width(), col);
} else {
- Common::Rect rec = GetFont(fKey)->getBoundingBox(text.c_str());
+ Common::Rect rec = GetFont(fKey)->getBoundingBox(text);
int h = rec.height();
surf = new Graphics::ManagedSurface(rec.width(), h + (h / 2), *g_engine->_format);
- GetFont(fKey)->drawString(surf, text.c_str(), 0, 0, rec.width(), col);
+ GetFont(fKey)->drawString(surf, text, 0, 0, rec.width(), col);
}
return surf;
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index a075eb08359..075cf6ab79c 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -36,7 +36,7 @@ using namespace pyrodactyl::text;
void ColorPool::Load(const Common::String &filename) {
pool.clear();
- XMLDoc col_list(filename.c_str());
+ XMLDoc col_list(filename);
if (col_list.ready()) {
rapidxml::xml_node<char> *node = col_list.Doc()->first_node("colors");
for (rapidxml::xml_node<char> *n = node->first_node("color"); n != NULL; n = n->next_sibling("color")) {
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 09fb8d3b5b5..163e6feb0eb 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -44,7 +44,7 @@ void CreditScreen::Reset() {
}
void CreditScreen::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("credits");
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index db450211f24..69bac531c73 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
void DebugConsole::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("debug");
if (NodeValid(node)) {
@@ -78,7 +78,7 @@ void DebugConsole::Draw(pyrodactyl::event::Info &info) {
{
int temp = 0;
if (info.VarGet(var_name, temp))
- value.Draw(NumberToString(temp).c_str());
+ value.Draw(NumberToString(temp));
else
value.Draw("Does not exist.");
}
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 5bf25e967da..1ab77684aa7 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -173,8 +173,8 @@ public:
hov[DATA_PLAYERNAME].Load(offnode->first_node("player_name_title"));
}
- extension = g_engine->_filePath->save_ext.c_str();
- directory = (g_engine->_filePath->appdata + g_engine->_filePath->save_dir).c_str();
+ extension = g_engine->_filePath->save_ext;
+ directory = (g_engine->_filePath->appdata + g_engine->_filePath->save_dir);
ScanDir();
}
@@ -223,8 +223,8 @@ public:
if (!img.loaded || prev_hover != i) {
img.loaded = true;
prev_hover = i;
- if (!img.preview.Load(slot_info[i].preview.c_str()))
- img.preview.Load(img.no_preview_path.c_str());
+ if (!img.preview.Load(slot_info[i].preview))
+ img.preview.Load(img.no_preview_path);
}
hover = true;
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index 3ccfbf79a0f..0982d562731 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -69,7 +69,7 @@ int GameOverMenu::HandleEvents(const SDL_Event &Event) {
void GameOverMenu::Draw() {
bg.Draw();
if (cur < quote.size())
- title.Draw(quote[cur].c_str());
+ title.Draw(quote[cur]);
menu.Draw();
}
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index e80828e399a..7a302356af3 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::people;
// Purpose: Load layout
//------------------------------------------------------------------------
void Inventory::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("inventory");
if (NodeValid(node)) {
@@ -61,7 +61,7 @@ void Inventory::Load(const Common::String &filename) {
void Inventory::LoadItem(const Common::String &char_id, const Common::String &id) {
Item i;
- XMLDoc item_list(itemfile.c_str());
+ XMLDoc item_list(itemfile);
if (item_list.ready()) {
rapidxml::xml_node<char> *node = item_list.Doc()->first_node("items");
for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item")) {
@@ -95,7 +95,7 @@ void Inventory::Draw(Person &obj, const int &money_val) {
// helper.DrawInfo(obj);
collection.Draw(obj.id /*, helper*/);
- money.caption.text = NumberToString(money_val).c_str();
+ money.caption.text = NumberToString(money_val);
money.Draw();
}
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index dc0f465e31d..d14c1a1ffdc 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
void ModMenu::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("mod_menu");
@@ -72,8 +72,8 @@ void ModMenu::Load(const Common::String &filename) {
hov[DATA_WEBSITE].Load(offnode->first_node("website_title"));
}
- extension = g_engine->_filePath->mod_ext.c_str();
- directory = g_engine->_filePath->mod_path.c_str();
+ extension = g_engine->_filePath->mod_ext;
+ directory = g_engine->_filePath->mod_path;
ScanDir();
}
}
@@ -81,7 +81,7 @@ void ModMenu::Load(const Common::String &filename) {
bool ModMenu::HandleEvents(const Common::Event &Event) {
int choice = menu.HandleEvents(Event);
if (choice >= 0) {
- g_engine->_filePath->mod_cur = slot_info[menu.Index() + choice].path.c_str();
+ g_engine->_filePath->mod_cur = slot_info[menu.Index() + choice].path;
return true;
}
@@ -115,8 +115,8 @@ void ModMenu::Draw() {
if (!img.loaded || prev_hover != i) {
img.loaded = true;
prev_hover = i;
- if (!img.preview.Load(slot_info[i].preview.c_str()))
- img.preview.Load(img.no_preview_path.c_str());
+ if (!img.preview.Load(slot_info[i].preview))
+ img.preview.Load(img.no_preview_path);
}
hover = true;
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 6999a756e84..4cd86e1cd0f 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::music;
void OptionMenu::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("option");
if (NodeValid(node)) {
@@ -139,7 +139,7 @@ void OptionMenu::Draw(Button &back) {
break;
case STATE_CONFIRM:
notice_res.Draw();
- countdown.Draw(NumberToString(timer.RemainingTicks() / 1000).c_str());
+ countdown.Draw(NumberToString(timer.RemainingTicks() / 1000));
break;
default:
break;
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index a51a6253188..d6c9a88070a 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -47,7 +47,7 @@ class OptionSelect {
void Draw(const int &index) {
if (index >= 0 && (unsigned int)index < text.size())
- data.Draw(text[index].c_str());
+ data.Draw(text[index]);
}
} option;
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 4a1814f3808..636af7afb0c 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -134,9 +134,9 @@ public:
}
void UpdateInfo() {
- info = NumberToString(current_page + 1).c_str();
+ info = NumberToString(current_page + 1);
info += " of ";
- info += NumberToString(menu.size()).c_str();
+ info += NumberToString(menu.size());
}
void Load(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 39fd2e3849f..c9db6eb0f5e 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
void PersonScreen::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("character");
if (NodeValid(node)) {
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 190e8afd064..701905ce29a 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -106,7 +106,7 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
total_page = page_count + 1;
// Update the text
- status.text = (NumberToString(current_page + 1) + " of " + NumberToString(total_page)).c_str();
+ status.text = (NumberToString(current_page + 1) + " of " + NumberToString(total_page));
// Now, start drawing the quest
status.Draw();
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 18244c2e9e3..d7fe3407ded 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -73,9 +73,9 @@ void ReplyButton::Cache(const Common::String &val, const int &spacing, const int
// Find out about the font
int width = 0, height = 0;
#if 0
- TTF_SizeText(g_engine->_textManager->GetFont(font), val.c_str(), &width, &height);
+ TTF_SizeText(g_engine->_textManager->GetFont(font), val, &width, &height);
#endif
- width = g_engine->_textManager->GetFont(font)->getStringWidth(val.c_str());
+ width = g_engine->_textManager->GetFont(font)->getStringWidth(val);
height = g_engine->_textManager->GetFont(font)->getFontHeight();
// Find out how many line sizes will the text take
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index ad3dbba9140..b511f16a1d8 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -42,7 +42,7 @@ using namespace pyrodactyl::event;
using namespace pyrodactyl::people;
void ReplyMenu::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("conversation");
if (NodeValid(node)) {
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 685349317db..9dbfa865ff6 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -66,9 +66,9 @@ void ResolutionMenu::Load(rapidxml::xml_node<char> *node) {
dim.push_back(d);
Button b;
b.Init(ref, inc.x * (count_slot % columns), inc.y * (count_slot / columns));
- b.caption.text = NumberToString(d.w).c_str();
+ b.caption.text = NumberToString(d.w);
b.caption.text += " x ";
- b.caption.text += NumberToString(d.h).c_str();
+ b.caption.text += NumberToString(d.h);
element.push_back(b);
}
}
@@ -159,9 +159,9 @@ int ResolutionMenu::HandleEvents(const SDL_Event &Event) {
void ResolutionMenu::SetInfo() {
info.text = def_info;
- info.text += NumberToString(g_engine->_screenSettings->cur.w).c_str();
+ info.text += NumberToString(g_engine->_screenSettings->cur.w);
info.text += " x ";
- info.text += NumberToString(g_engine->_screenSettings->cur.h).c_str();
+ info.text += NumberToString(g_engine->_screenSettings->cur.h);
}
void ResolutionMenu::SetUI() {
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 688ffa49395..96c9692421a 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -42,7 +42,7 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
void HUD::Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("hud");
if (NodeValid(node)) {
@@ -77,7 +77,7 @@ void HUD::Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
// Create a copy of all the tooltips
for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
- tooltip.push_back(i->tooltip.text.c_str());
+ tooltip.push_back(i->tooltip.text);
SetTooltip();
}
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index d18177578c8..2e61ec3864f 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::ui;
// Purpose: Load game
//------------------------------------------------------------------------
void Journal::Load(const Common::String &filename) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("objectives");
if (NodeValid(node)) {
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index a19b898ce24..c70ec580197 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -42,7 +42,7 @@ using namespace pyrodactyl::input;
// Purpose: Load stuff that can't be modified by the user
//------------------------------------------------------------------------
void Map::Load(const Common::String &filename, pyrodactyl::event::Info &info) {
- XMLDoc conf(filename.c_str());
+ XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("map");
if (NodeValid(node)) {
@@ -393,8 +393,8 @@ void Map::SetImage(const unsigned int &val, const bool &force) {
img_bg.Delete();
img_overlay.Delete();
- img_bg.Load(map[cur].path_bg.c_str());
- img_overlay.Load(map[cur].path_overlay.c_str());
+ img_bg.Load(map[cur].path_bg);
+ img_overlay.Load(map[cur].path_overlay);
size.x = img_bg.W();
size.y = img_bg.H();
Commit: 8b5ee5a4293c71d4c4c8007faa2816a7bf4db1b8
https://github.com/scummvm/scummvm/commit/8b5ee5a4293c71d4c4c8007faa2816a7bf4db1b8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Refactor code to draw transparent black box around text
Changed paths:
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 25be2bfc3b2..ae8e6923600 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -173,6 +173,13 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
if (background) {
rect.w = cache[pos].img.W() + (2 * pad_bg.x);
rect.h = cache[pos].img.H() + (2 * pad_bg.y);
+
+ uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
+ Graphics::Surface surf;
+ surf.create(rect.w, rect.h, *g_engine->_format);
+ surf.fillRect(Common::Rect(rect.w, rect.h), col);
+ g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
+
#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 128);
@@ -185,8 +192,6 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
- g_engine->_screen->fillRect(Common::Rect(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h), col);
cache[pos].img.Draw(x, y);
} else if (align == ALIGN_CENTER) {
rect.x = x - cache[pos].img.W() / 2 - pad_bg.x;
@@ -195,8 +200,6 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
- g_engine->_screen->fillRect(Common::Rect(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h), col);
cache[pos].img.Draw(x - cache[pos].img.W() / 2, y - cache[pos].img.H() / 2);
} else {
rect.x = x - cache[pos].img.W() - pad_bg.x;
@@ -205,8 +208,6 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
- g_engine->_screen->fillRect(Common::Rect(rect.x, rect.y, rect.x + rect.w, rect.y + rect.h), col);
cache[pos].img.Draw(x - cache[pos].img.W(), y);
}
} else {
Commit: e4d5733fd4f35db65287d727fdb74048cd5ca13e
https://github.com/scummvm/scummvm/commit/e4d5733fd4f35db65287d727fdb74048cd5ca13e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub Map::Draw()
Changed paths:
engines/crab/ui/map.cpp
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index c70ec580197..207f856d61c 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -91,9 +91,7 @@ void Map::Load(const Common::String &filename, pyrodactyl::event::Info &info) {
// Purpose: Draw
//------------------------------------------------------------------------
void Map::Draw(pyrodactyl::event::Info &info) {
- warning("STUB: Map::Draw()");
-#if 0
// The map graphic is clipped to fit inside the UI
img_bg.Draw(pos.x, pos.y, &camera);
@@ -145,7 +143,6 @@ void Map::Draw(pyrodactyl::event::Info &info) {
marker.Draw(pos, player_pos, camera);
scroll.Draw();
-#endif
}
//------------------------------------------------------------------------
Commit: 5026cc47156148c1f710f329d3334fac4262ef9d
https://github.com/scummvm/scummvm/commit/5026cc47156148c1f710f329d3334fac4262ef9d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix bug due to which textboxes were not rendered correctly
Changed paths:
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index ae8e6923600..0220e203d4a 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -178,7 +178,6 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
Graphics::Surface surf;
surf.create(rect.w, rect.h, *g_engine->_format);
surf.fillRect(Common::Rect(rect.w, rect.h), col);
- g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
@@ -188,6 +187,7 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
if (align == ALIGN_LEFT) {
rect.x = x - pad_bg.x;
rect.y = y - pad_bg.y;
+ g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
#if 0
SDL_RenderFillRect(gRenderer, &rect);
@@ -196,6 +196,7 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
} else if (align == ALIGN_CENTER) {
rect.x = x - cache[pos].img.W() / 2 - pad_bg.x;
rect.y = y - cache[pos].img.H() / 2 - pad_bg.y;
+ g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
#if 0
SDL_RenderFillRect(gRenderer, &rect);
@@ -204,6 +205,7 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
} else {
rect.x = x - cache[pos].img.W() - pad_bg.x;
rect.y = y - pad_bg.y;
+ g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
#if 0
SDL_RenderFillRect(gRenderer, &rect);
Commit: 92547ac546e88234ad3ea72eb611e6aa5badba30
https://github.com/scummvm/scummvm/commit/92547ac546e88234ad3ea72eb611e6aa5badba30
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove overloads for std::string
Changed paths:
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/numstr.h
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index a3bc65a7cd7..c93162ba7c1 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -78,21 +78,6 @@ bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node
return true;
}
-bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo) {
- if (node->first_attribute(name.c_str()) != NULL)
- val = node->first_attribute(name.c_str())->value();
- else {
- /*if (echo)
- {
- Common::String error_msg = "string " + name + " not found in " + node->name() + "\n";
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
- }*/
- return false;
- }
-
- return true;
-}
-
#if 0
bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 80e320b3a2d..27e06a28e61 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -46,7 +46,6 @@ bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node
// Functions to load attributes from xml files
// return true on success, false on failure
bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
-bool LoadStr(std::string &val, const std::string &name, rapidxml::xml_node<char> *node, const bool &echo = true);
// Used for loading numerical types
template<typename T>
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 366bdb2bbb4..fbf142c7bda 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -75,11 +75,6 @@ T StringToNumber(const Common::String &Text) {
return StringToNumber<T>(const_cast<char *>(Text.c_str()));
}
-template<typename T>
-T StringToNumber(const std::string &Text) {
- return StringToNumber<T>(const_cast<char *>(Text.c_str()));
-}
-
template<typename T>
void GetPoint(T &v, Common::String &coords) {
int comma = coords.findFirstOf(',');
Commit: f79690c4c5d21f2e8e051b1f171d919120029e1f
https://github.com/scummvm/scummvm/commit/f79690c4c5d21f2e8e051b1f171d919120029e1f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get rid of std::stringstream
Changed paths:
engines/crab/numstr.h
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index fbf142c7bda..e5738ae4d6e 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -30,6 +30,7 @@
#ifndef CRAB_NUMSTR_H
#define CRAB_NUMSTR_H
+#include <cstring>
#include "crab/common_header.h"
namespace Crab {
@@ -63,11 +64,28 @@ Common::String NumberToString(T Number) {
return revStr;
}
-template<typename T>
-T StringToNumber(char *Text) {
- std::stringstream ss(Text);
- T result;
- return (ss >> result) ? result : 0;
+template<typename T>
+inline T StringToNumber(char *Text) {
+ int res = 0;
+ if (sscanf(Text, "%d", &res) > 0)
+ return static_cast<T>(res); // static cast to deal with signed to unsigned conversions
+ return 0;
+}
+
+template<>
+inline float StringToNumber<float>(char *Text) {
+ float res = 0.0f;
+ if (sscanf(Text, "%f", &res) > 0)
+ return res;
+ return 0.0f;
+}
+
+template<>
+inline double StringToNumber<double>(char *Text) {
+ double res = 0.0;
+ if (sscanf(Text, "%lf", &res) > 0)
+ return res;
+ return 0.0;
}
template<typename T>
Commit: 21092e726ceab16a9ed7ac8a5bf426dfbdfe12db
https://github.com/scummvm/scummvm/commit/21092e726ceab16a9ed7ac8a5bf426dfbdfe12db
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Explicitly specify c_str() in LevelPaths
Changed paths:
engines/crab/levelpaths.h
diff --git a/engines/crab/levelpaths.h b/engines/crab/levelpaths.h
index a7499a36167..8195a7d3d13 100644
--- a/engines/crab/levelpaths.h
+++ b/engines/crab/levelpaths.h
@@ -49,7 +49,7 @@ public:
asset = Asset;
}
- const char *LayoutPath() { return layout; }
+ const char *LayoutPath() { return layout.c_str(); }
void LayoutPath(const char *str) { layout = str; }
const char *AssetPath() { return asset.c_str(); }
Commit: 13e4a834cabbde572877d358cf5e67da404d48e1
https://github.com/scummvm/scummvm/commit/13e4a834cabbde572877d358cf5e67da404d48e1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix warning generated by GameEventInfo
Changed paths:
engines/crab/event/GameEventInfo.h
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index d92aedc6d09..213d56eb4ab 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -184,7 +184,7 @@ public:
// Draw the inventory
void InvDraw(const Common::String &id) {
- if (var.contains(money_var) > 0)
+ if (var.contains(money_var))
inv.Draw(people[id], var[money_var]);
else
inv.Draw(people[id], 0);
Commit: 426bb043f4616a9f728c8cc854a03bbd7b122353
https://github.com/scummvm/scummvm/commit/426bb043f4616a9f728c8cc854a03bbd7b122353
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace of std::deque with Common::Array in quest related classes
Changed paths:
engines/crab/event/quest.cpp
engines/crab/event/quest.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index c08f4e7dbda..40ff9cb8e05 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::event;
Quest::Quest(const Common::String &Title, const Common::String &Text, const bool &Unread, const bool &Marker) : title(Title) {
- text.push_front(Text);
+ text.insert_at(0, Text);
unread = Unread;
marker = Marker;
}
diff --git a/engines/crab/event/quest.h b/engines/crab/event/quest.h
index c6034f49b50..dbf11d5ffeb 100644
--- a/engines/crab/event/quest.h
+++ b/engines/crab/event/quest.h
@@ -43,7 +43,7 @@ struct Quest {
Common::String title;
// The objective text, the last one being the current objective
- std::deque<Common::String> text;
+ Common::Array<Common::String> text;
// Keep track of which quests the player has read
bool unread;
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 7be3bf2383d..a97e3fa60ad 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -88,19 +88,19 @@ void QuestMenu::Add(const Common::String &title, const Common::String &txt) {
for (auto i = quest.begin(); i != quest.end(); ++i)
if (i->title == title) // We already have the quest entry
{
- i->text.push_front(txt); // Just add the new string to the start of the quest messages and return
+ i->text.insert_at(0, txt); // Just add the new string to the start of the quest messages and return
i->unread = true;
return;
}
Quest q(title, txt, true, false);
- quest.push_front(q);
+ quest.insert_at(0, q);
menu.Add();
unread = true;
}
void QuestMenu::Add(const pyrodactyl::event::Quest &q) {
- quest.push_front(q);
+ quest.insert_at(0, q);
menu.Add();
}
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 20d80f754da..9de1191dd15 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -66,7 +66,7 @@ class QuestMenu {
public:
// All the quests currently in this menu
- std::deque<pyrodactyl::event::Quest> quest;
+ Common::Array<pyrodactyl::event::Quest> quest;
// Keep track of unread notifications for each category button
bool unread;
Commit: 89a6923cf02269934512dfcbedd919b36e5b7d2f
https://github.com/scummvm/scummvm/commit/89a6923cf02269934512dfcbedd919b36e5b7d2f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove dependence on STL libs from PriorityQueue
Changed paths:
engines/crab/PriorityQueue.h
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index 14dc06ccf53..747c195d0cc 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -43,7 +43,7 @@ namespace Crab {
//! class template and the <a href="http://www.sgi.com/tech/stl/">STL</a> heap operations.
template<typename Node>
class PriorityQueue {
- std::deque<Node *> open;
+ Common::Array<Node *> open;
bool (*compare)(Node const *, Node const *);
public:
@@ -121,7 +121,7 @@ size_t PriorityQueue<Node>::size() const {
template<typename Node>
void PriorityQueue<Node>::push(Node *node) {
- open.insert(std::upper_bound(open.begin(), open.end(), node, compare), node);
+ open.insert(Common::upperBound(open.begin(), open.end(), node, compare), node);
}
template<typename Node>
@@ -136,13 +136,13 @@ void PriorityQueue<Node>::pop() {
template<typename Node>
void PriorityQueue<Node>::remove(Node const *node) {
- open.erase(std::remove(open.begin(), open.end(), node), open.end());
+ open.erase(Common::remove(open.begin(), open.end(), node), open.end());
}
template<typename Node>
void PriorityQueue<Node>::enumerate(Common::Array<Node const *> &sorted) const {
sorted.resize(open.size());
- std::copy(open.begin(), open.end(), sorted.begin());
+ Common::copy(open.begin(), open.end(), sorted.begin());
}
} // End of namespace Crab
Commit: 376d65329d013f241d8e1d96790bd151087c04df
https://github.com/scummvm/scummvm/commit/376d65329d013f241d8e1d96790bd151087c04df
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use Common::remove instead of std::remove in PathfindingAgent
Changed paths:
engines/crab/PathfindingAgent.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index adf490c17df..54a63c0f82d 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -298,7 +298,7 @@ Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSol
Common::Array<PathfindingGraphNode *> corners = grid->CornerCheck(temp[i - 1], temp[i + 1]);
if (corners.size() == 0) {
- Common::Array<PathfindingGraphNode const *>::iterator theEnd = std::remove(returnVec.begin(), returnVec.end(), temp[i]);
+ Common::Array<PathfindingGraphNode const *>::iterator theEnd = Common::remove(returnVec.begin(), returnVec.end(), temp[i]);
returnVec.erase(theEnd);
}
}
Commit: 8905e9e5ce52e45a0fc4dac0a2692b5fa65beead
https://github.com/scummvm/scummvm/commit/8905e9e5ce52e45a0fc4dac0a2692b5fa65beead
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not include STL headers
Changed paths:
engines/crab/PriorityQueue.h
engines/crab/common_header.h
engines/crab/levelpaths.h
engines/crab/url.h
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index 747c195d0cc..7472b4bbe5e 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -31,9 +31,7 @@
#ifndef CRAB_PRIORITYQUEUE_H
#define CRAB_PRIORITYQUEUE_H
-#include <algorithm>
-#include <deque>
-#include <vector>
+#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 4f6664ec1e2..ad2dd5659b4 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -31,27 +31,7 @@
#ifndef CRAB_COMMON_HEADER_H
#define CRAB_COMMON_HEADER_H
-#include <algorithm>
-#include <cmath>
-//#include <ctime>
-#include <deque>
-//#include <fstream>
#include <limits>
-#include <map>
-//#include <random>
-//#include <sstream>
-#include <list>
-#include <string>
-#include <unordered_map>
-#include <vector>
-#include <sstream>
-
-#if 0
-#include <SDL2/SDL.h>
-#include <SDL2/SDL_image.h>
-#include <SDL2/SDL_mixer.h>
-#include <SDL2/SDL_ttf.h>
-#endif
#include "common/path.h"
#include "common/str.h"
diff --git a/engines/crab/levelpaths.h b/engines/crab/levelpaths.h
index 8195a7d3d13..08d87f1d1bd 100644
--- a/engines/crab/levelpaths.h
+++ b/engines/crab/levelpaths.h
@@ -31,7 +31,7 @@
#ifndef LEVELPATHS_H
#define LEVELPATHS_H
-#include <string>
+#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/url.h b/engines/crab/url.h
index 9b4c24fdc0b..2d8dea8ba97 100644
--- a/engines/crab/url.h
+++ b/engines/crab/url.h
@@ -31,7 +31,7 @@
#ifndef CRAB_URL_H
#define CRAB_URL_H
-#include <string>
+#include "crab/common_header.h"
namespace Crab {
Commit: 5f3b249691091738363d86759544daea3a3765c1
https://github.com/scummvm/scummvm/commit/5f3b249691091738363d86759544daea3a3765c1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not use isdigit
Changed paths:
engines/crab/event/GameEventInfo.cpp
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index e85b3eac9c1..69e0f92b298 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -37,7 +37,9 @@ namespace Crab {
namespace pyrodactyl {
namespace event {
bool IsChar(char c) {
- return !isdigit(c);
+ if (c >= '0' && c <= '9')
+ return false;
+ return true;
}
} // End of namespace event
} // End of namespace pyrodactyl
Commit: 15daa2c34d2190e6830e7cc4b24fce4945df6102
https://github.com/scummvm/scummvm/commit/15daa2c34d2190e6830e7cc4b24fce4945df6102
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename PathfindingAgent::exit() to PathfindingAgent::reset()
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 54a63c0f82d..a8ae9a2f567 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -79,7 +79,7 @@ void PathfindingAgent::SetDestination(Vector2f d, bool r) {
destination = d;
// TODO: This could be optimized to cache the route somehow... (SZ)
- exit();
+ reset();
m_pStartTile = grid->GetNodeAtPoint(position);
// m_pGoalTile = grid->GetNodeAtPoint(d);
@@ -231,7 +231,7 @@ bool PathfindingAgent::isDone() const {
}
// Clear everything.
-void PathfindingAgent::exit() {
+void PathfindingAgent::reset() {
Common::StableMap<PathfindingGraphNode *, PlannerNode *>::iterator iter;
if (!m_mCreatedList.empty()) {
for (iter = m_mCreatedList.begin(); iter != m_mCreatedList.end(); ++iter) {
@@ -250,7 +250,7 @@ void PathfindingAgent::exit() {
}
void PathfindingAgent::shutdown() {
- exit();
+ reset();
grid = NULL;
}
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 1b2c194b331..b313e026cff 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -154,7 +154,7 @@ public:
Common::Array<PathfindingGraphNode const *> const getPrunedSolution(PathfindingGraphNode *destNode);
//! \brief Resets the algorithm.
- void exit();
+ void reset();
//! \brief Uninitializes the algorithm before the tile map is unloaded.
void shutdown();
Commit: e2f726ea1a7e07dd5946827049be1d3fe3472273
https://github.com/scummvm/scummvm/commit/e2f726ea1a7e07dd5946827049be1d3fe3472273
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: FORBIDDEN_SYMBOL_ALLOW_ALL is no longer needed
Changed paths:
engines/crab/Line.cpp
engines/crab/LoadingScreen.cpp
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGrid.cpp
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/ai/spriteai.cpp
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/imageeffect.cpp
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/effect.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/image/Image.cpp
engines/crab/image/ImageManager.cpp
engines/crab/input/cursor.cpp
engines/crab/input/fightinput.cpp
engines/crab/item/Item.cpp
engines/crab/item/ItemSlot.cpp
engines/crab/level/level.cpp
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/level/level_objects.cpp
engines/crab/level/talknotify.cpp
engines/crab/metaengine.cpp
engines/crab/splash.cpp
engines/crab/stat/StatDrawHelper.cpp
engines/crab/text/TextManager.cpp
engines/crab/timer.cpp
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ClipButton.cpp
engines/crab/ui/FileMenu.cpp
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/ImageData.cpp
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/ModMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/QuestText.cpp
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/StateButton.cpp
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/button.cpp
engines/crab/ui/dialogbox.cpp
engines/crab/ui/element.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/ui/questmenu.cpp
engines/crab/ui/slider.cpp
engines/crab/ui/textdata.cpp
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index cd2bfaaf759..4fb5c16ea97 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/Line.h"
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index d2c6937df54..80f62babe93 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -27,7 +27,6 @@
* Licensed under MIT
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/LoadingScreen.h"
#include "crab/XMLDoc.h"
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index a8ae9a2f567..ec240ca7e1d 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/PathfindingAgent.h"
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index ff28d5492a5..6056b26ea0f 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/PathfindingGrid.h"
#include "crab/TMX/TMXMap.h"
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 98a545b8cd7..3ebbe5cacb9 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/TMX/TMXLayer.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 258a88b1c03..019d100843e 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/TMX/TMXMap.h"
#include "crab/text/TextManager.h"
#include "crab/collision.h"
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 0d06a6afb3e..5af519a92b0 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/TMX/TMXTileSet.h"
#include "crab/text/TextManager.h"
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index f881cad04f0..287c789af34 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/animation/sprite.h"
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index 3447ae355a3..2a7a72ce2c6 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/animation/AnimationFrame.h"
diff --git a/engines/crab/animation/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
index c2c50bf3325..8c768a70b14 100644
--- a/engines/crab/animation/imageeffect.cpp
+++ b/engines/crab/animation/imageeffect.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/animation/imageeffect.h"
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 1d992197628..054a5e0e11b 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index a055545fe1f..9e993f760ed 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/events.h"
#include "crab/app.h"
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 2a7848a7fa8..919d5742543 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -49,7 +49,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "common/config-manager.h"
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 69e0f92b298..121a71068c1 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/event/GameEventInfo.h"
#include "crab/event/eventstore.h"
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 71d36276104..ec610b3cbda 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/event/effect.h"
#include "crab/music/MusicManager.h"
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 7929f18900b..a561c0b883d 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/event/gameeventmanager.h"
namespace Crab {
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index b850891ce2a..3869061a838 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/game.h"
namespace Crab {
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 39da5a65ac0..8547ab639a3 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -27,7 +27,6 @@
* Licensed under MIT
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "graphics/blit.h"
#include "crab/crab.h"
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 12965e94222..76346f87355 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -32,7 +32,6 @@
// Author: Arvind
// Purpose: Contains the image manager class - used to manage in-game images
//=============================================================================
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/image/ImageManager.h"
#include "crab/XMLDoc.h"
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 015998dfd39..95989e01fc6 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -32,7 +32,6 @@
// Author: Arvind
// Purpose: Cursor class
//=============================================================================
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/input/cursor.h"
#include "crab/crab.h"
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index 76d0f3b3da7..fd4b12097d8 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/input/fightinput.h"
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 0baa3de9988..634b31242f0 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/item/Item.h"
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index d6a5f936299..b7bc140b59e 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/item/ItemSlot.h"
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 17b81ec5294..8acfee30de3 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 898de1bc0cf..0c79e3c1a8c 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index af928af61a2..ea99f787e9b 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index c1998db7b10..183b1c5ef21 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index b06fdc9433a..18bc728faf4 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index 1d3dbb95c1d..19d3ad71489 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/level/level_objects.h"
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index dfde8e4378d..c2789969674 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/level/talknotify.h"
namespace Crab {
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index ba35cec419d..27d49354a19 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -49,7 +49,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "common/translation.h"
#include "crab/crab.h"
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 852a4c6af88..2dbd611aed2 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -33,7 +33,6 @@
// Author: Arvind
// Purpose: Splash functions
//=============================================================================
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/splash.h"
namespace Crab {
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index b35b61c1f89..db14f060a2a 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/stat/StatDrawHelper.h"
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 0220e203d4a..7e51bd65e5e 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/text/TextManager.h"
#include "crab/XMLDoc.h"
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index 5bded77745c..c3db78abc79 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -33,7 +33,6 @@
// Author: Arvind
// Purpose: Timer functions
//=============================================================================
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 007bfd8ceb6..42c9685bfe5 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/AlphaImage.h"
#include "crab/text/TextManager.h"
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 64364ff2227..1a2dc94dcad 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -27,7 +27,6 @@
* Licensed under MIT
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/ChapterIntro.h"
namespace Crab {
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index 4339162e521..c49a7d17bfe 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/ClipButton.h"
diff --git a/engines/crab/ui/FileMenu.cpp b/engines/crab/ui/FileMenu.cpp
index b8ad9c969cf..b76160c6241 100644
--- a/engines/crab/ui/FileMenu.cpp
+++ b/engines/crab/ui/FileMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/FileMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index f55448da440..3f9b7f2f578 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -29,7 +29,6 @@
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/GeneralSettingMenu.h"
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 64b800b847c..60ea00bcc26 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/GfxSettingMenu.h"
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index cd4b8d83db2..0398d8bf044 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/HealthIndicator.h"
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index d111042ab28..c21797160c2 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/ImageData.h"
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index af12183a7a9..e90e07e6e7f 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/KeyBindMenu.h"
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index d14c1a1ffdc..4dceb2d6eb8 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/ModMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 4cd86e1cd0f..7db9d6aa9ef 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/OptionMenu.h"
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index d7fe8a6f370..4f1150c8a0f 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/ParagraphData.h"
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index c4a188dc83a..03329844848 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/PauseMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index aeaf6708d03..40808afc8b8 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/PersonHandler.h"
namespace Crab {
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index c9db6eb0f5e..560ebc9c98f 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/PersonScreen.h"
namespace Crab {
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 701905ce29a..b8353a37951 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/QuestText.h"
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index d7fe3407ded..31038542efb 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/ReplyButton.h"
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index b511f16a1d8..c4db1893235 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/ReplyMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 9dbfa865ff6..1a0c60ee9e0 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/ResolutionMenu.h"
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 9060ff00ba0..3df5f823111 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/SaveGameMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index f234b6e251b..a0ccd8f9d4e 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/SectionHeader.h"
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 380270fb1b3..2ff5f37408a 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -27,7 +27,6 @@
* Licensed under MIT
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/SlideShow.h"
namespace Crab {
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index 5617f0f3c81..f6d5f01f05c 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/StateButton.h"
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 838986458b6..54ffb175f9a 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/ToggleButton.h"
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index c249c601ff9..2f3d30e9075 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/TraitButton.h"
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index d359a211478..a0ed9b51795 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/TraitMenu.h"
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 457752550b3..361d827cbaa 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -32,7 +32,6 @@
// Author: Arvind
// Purpose: Contains the button functions
//=============================================================================
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/button.h"
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index 037fba3e283..fc40f1768e5 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -32,7 +32,6 @@
// Author: Arvind
// Purpose: Dialog box!
//=============================================================================
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/dialogbox.h"
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 52b4918609e..171695221da 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -27,7 +27,6 @@
* Licensed under MIT
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/element.h"
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 96c9692421a..eaf5d2ef860 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -32,7 +32,6 @@
// Author: Arvind
// Purpose: The tray where you have inventory, map and GameObjectives icons
//=============================================================================
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/ui/hud.h"
namespace Crab {
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 2e61ec3864f..f75d5499d9b 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/journal.h"
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 207f856d61c..20dc138138d 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/map.h"
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index a97e3fa60ad..f3e4de403fb 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/questmenu.h"
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index ebf35ec10e3..cdf424595c9 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/slider.h"
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index 63154ce01b6..92099e24b88 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -28,7 +28,6 @@
*
*/
-#define FORBIDDEN_SYMBOL_ALLOW_ALL
#include "crab/crab.h"
#include "crab/ui/TextData.h"
Commit: b1bc78a10586734fd24a5c002b3558952eab206c
https://github.com/scummvm/scummvm/commit/b1bc78a10586734fd24a5c002b3558952eab206c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup and stub out OpenURL()
Changed paths:
engines/crab/url.cpp
diff --git a/engines/crab/url.cpp b/engines/crab/url.cpp
index 60277c4d5d4..d6017347dd9 100644
--- a/engines/crab/url.cpp
+++ b/engines/crab/url.cpp
@@ -32,38 +32,8 @@
namespace Crab {
-#ifdef __WIN32__
-#include <ShellAPI.h>
-#include <windows.h>
-#pragma comment(lib, "ws2_32.lib")
-#endif
-
-#ifdef __APPLE__
-#include <ApplicationServices/ApplicationServices.h>
-#include <CoreFoundation/CFBundle.h>
-#endif
-
void OpenURL(const Common::String &url_str) {
-#ifdef __WIN32__
- ShellExecuteA(NULL, "open", url_str.c_str(), NULL, NULL, SW_SHOW);
-#endif
-
-#ifdef __APPLE__
- CFURLRef url = CFURLCreateWithBytes(
- NULL, // allocator
- (UInt8 *)url_str.c_str(), // URLBytes
- url_str.length(), // length
- kCFStringEncodingASCII, // encoding
- NULL // baseURL
- );
- LSOpenCFURLRef(url, 0);
- CFRelease(url);
-#endif
-
-#ifdef __GNUC__
- Common::String command = "xdg-open " + url_str;
- system(command.c_str());
-#endif
+ warning("STUB: OpenUrl()");
}
} // End of namespace Crab
Commit: 33f203abb9564601cb3f6471415d9d06b9368585
https://github.com/scummvm/scummvm/commit/33f203abb9564601cb3f6471415d9d06b9368585
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unneeded rapixml includes
Changed paths:
R engines/crab/rapidxml/rapidxml_iterators.hpp
R engines/crab/rapidxml/rapidxml_utils.hpp
diff --git a/engines/crab/rapidxml/rapidxml_iterators.hpp b/engines/crab/rapidxml/rapidxml_iterators.hpp
deleted file mode 100644
index b9568c5f8ba..00000000000
--- a/engines/crab/rapidxml/rapidxml_iterators.hpp
+++ /dev/null
@@ -1,168 +0,0 @@
-#ifndef RAPIDXML_ITERATORS_HPP_INCLUDED
-#define RAPIDXML_ITERATORS_HPP_INCLUDED
-
-// Copyright (C) 2006, 2009 Marcin Kalicinski
-// Version 1.13
-// Revision $DateTime: 2009/05/13 01:46:17 $
-//! \file rapidxml_iterators.hpp This file contains rapidxml iterators
-
-#include "rapidxml.hpp"
-
-namespace rapidxml
-{
- //! Iterator of child nodes of xml_node
- template<class Ch>
- class node_iterator
- {
- public:
-
- typedef typename xml_node<Ch> value_type;
- typedef typename xml_node<Ch> &reference;
- typedef typename xml_node<Ch> *pointer;
- typedef std::ptrdiff_t difference_type;
- typedef std::bidirectional_iterator_tag iterator_category;
-
- node_iterator()
- : m_node(0)
- {
- }
-
- node_iterator(xml_node<Ch> *node)
- : m_node(node->first_node())
- {
- }
-
- reference operator *() const
- {
- assert(m_node);
- return *m_node;
- }
-
- pointer operator->() const
- {
- assert(m_node);
- return m_node;
- }
-
- node_iterator& operator++()
- {
- assert(m_node);
- m_node = m_node->next_sibling();
- return *this;
- }
-
- node_iterator operator++(int)
- {
- node_iterator tmp = *this;
- ++this;
- return tmp;
- }
-
- node_iterator& operator--()
- {
- assert(m_node && m_node->previous_sibling());
- m_node = m_node->previous_sibling();
- return *this;
- }
-
- node_iterator operator--(int)
- {
- node_iterator tmp = *this;
- ++this;
- return tmp;
- }
-
- bool operator ==(const node_iterator<Ch> &rhs)
- {
- return m_node == rhs.m_node;
- }
-
- bool operator !=(const node_iterator<Ch> &rhs)
- {
- return m_node != rhs.m_node;
- }
-
- private:
-
- xml_node<Ch> *m_node;
- };
-
- //! Iterator of child attributes of xml_node
- template<class Ch>
- class attribute_iterator
- {
- public:
-
- typedef typename xml_attribute<Ch> value_type;
- typedef typename xml_attribute<Ch> &reference;
- typedef typename xml_attribute<Ch> *pointer;
- typedef std::ptrdiff_t difference_type;
- typedef std::bidirectional_iterator_tag iterator_category;
-
- attribute_iterator()
- : m_attribute(0)
- {
- }
-
- attribute_iterator(xml_node<Ch> *node)
- : m_attribute(node->first_attribute())
- {
- }
-
- reference operator *() const
- {
- assert(m_attribute);
- return *m_attribute;
- }
-
- pointer operator->() const
- {
- assert(m_attribute);
- return m_attribute;
- }
-
- attribute_iterator& operator++()
- {
- assert(m_attribute);
- m_attribute = m_attribute->next_attribute();
- return *this;
- }
-
- attribute_iterator operator++(int)
- {
- attribute_iterator tmp = *this;
- ++this;
- return tmp;
- }
-
- attribute_iterator& operator--()
- {
- assert(m_attribute && m_attribute->previous_attribute());
- m_attribute = m_attribute->previous_attribute();
- return *this;
- }
-
- attribute_iterator operator--(int)
- {
- attribute_iterator tmp = *this;
- ++this;
- return tmp;
- }
-
- bool operator ==(const attribute_iterator<Ch> &rhs)
- {
- return m_attribute == rhs.m_attribute;
- }
-
- bool operator !=(const attribute_iterator<Ch> &rhs)
- {
- return m_attribute != rhs.m_attribute;
- }
-
- private:
-
- xml_attribute<Ch> *m_attribute;
- };
-}
-
-#endif
\ No newline at end of file
diff --git a/engines/crab/rapidxml/rapidxml_utils.hpp b/engines/crab/rapidxml/rapidxml_utils.hpp
deleted file mode 100644
index 15eab2dbc74..00000000000
--- a/engines/crab/rapidxml/rapidxml_utils.hpp
+++ /dev/null
@@ -1,118 +0,0 @@
-#ifndef RAPIDXML_UTILS_HPP_INCLUDED
-#define RAPIDXML_UTILS_HPP_INCLUDED
-
-// Copyright (C) 2006, 2009 Marcin Kalicinski
-// Version 1.13
-// Revision $DateTime: 2009/05/13 01:46:17 $
-//! \file rapidxml_utils.hpp This file contains high-level rapidxml utilities that can be useful
-//! in certain simple scenarios. They should probably not be used if maximizing performance is the main GameObjective.
-
-#include "rapidxml.hpp"
-#include <vector>
-#include <string>
-#include <fstream>
-#include <stdexcept>
-
-namespace rapidxml
-{
- //! Represents data loaded from a file
- template<class Ch = char>
- class file
- {
- public:
-
- //! Loads file into the memory. Data will be automatically destroyed by the destructor.
- //! \param filename Filename to load.
- file(const char *filename)
- {
- using namespace std;
-
- // Open stream
- basic_ifstream<Ch> stream(filename, ios::binary);
- if (!stream)
- throw runtime_error(string("cannot open file ") + filename);
- stream.unsetf(ios::skipws);
-
- // Determine stream size
- stream.seekg(0, ios::end);
- size_t size = stream.tellg();
- stream.seekg(0);
-
- // Load data and add terminating 0
- m_data.resize(size + 1);
- stream.read(&m_data.front(), static_cast<streamsize>(size));
- m_data[size] = 0;
- }
-
- //! Loads file into the memory. Data will be automatically destroyed by the destructor
- //! \param stream Stream to load from
- file(std::basic_istream<Ch> &stream)
- {
- using namespace std;
-
- // Load data and add terminating 0
- stream.unsetf(ios::skipws);
- m_data.assign(istreambuf_iterator<Ch>(stream), istreambuf_iterator<Ch>());
- if (stream.fail() || stream.bad())
- throw runtime_error("error reading stream");
- m_data.push_back(0);
- }
-
- //! Gets file data.
- //! \return Pointer to data of file.
- Ch *data()
- {
- return &m_data.front();
- }
-
- //! Gets file data.
- //! \return Pointer to data of file.
- const Ch *data() const
- {
- return &m_data.front();
- }
-
- //! Gets file data size.
- //! \return Size of file data, in characters.
- std::size_t size() const
- {
- return m_data.size();
- }
-
- private:
-
- std::vector<Ch> m_data; // File data
- };
-
- //! Counts children of node. Time complexity is O(n).
- //! \return Number of children of node
- template<class Ch>
- inline std::size_t count_children(xml_node<Ch> *node)
- {
- xml_node<Ch> *child = node->first_node();
- std::size_t count = 0;
- while (child)
- {
- ++count;
- child = child->next_sibling();
- }
- return count;
- }
-
- //! Counts attributes of node. Time complexity is O(n).
- //! \return Number of attributes of node
- template<class Ch>
- inline std::size_t count_attributes(xml_node<Ch> *node)
- {
- xml_attribute<Ch> *attr = node->first_attribute();
- std::size_t count = 0;
- while (attr)
- {
- ++count;
- attr = attr->next_attribute();
- }
- return count;
- }
-}
-
-#endif
\ No newline at end of file
Commit: 7fe602fe1a180733da311e542be8d064bc80d480
https://github.com/scummvm/scummvm/commit/7fe602fe1a180733da311e542be8d064bc80d480
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup rapidxml includes
Changed paths:
engines/crab/rapidxml/rapidxml.hpp
engines/crab/rapidxml/rapidxml_print.hpp
diff --git a/engines/crab/rapidxml/rapidxml.hpp b/engines/crab/rapidxml/rapidxml.hpp
index ff6f1c78c4a..781402d4540 100644
--- a/engines/crab/rapidxml/rapidxml.hpp
+++ b/engines/crab/rapidxml/rapidxml.hpp
@@ -1,17 +1,15 @@
#ifndef RAPIDXML_HPP_INCLUDED
#define RAPIDXML_HPP_INCLUDED
+// The file below has been edited to clean-up the includes as necessiated by ScummVM.
+// Notably, code which was dependent on exception header has been removed.
+
// Copyright (C) 2006, 2009 Marcin Kalicinski
// Version 1.13
// Revision $DateTime: 2009/05/13 01:46:17 $
//! \file rapidxml.hpp This file contains rapidxml parser and DOM implementation
-// If standard library is disabled, user must provide implementations of required functions and typedefs
-#if !defined(RAPIDXML_NO_STDLIB)
- #include <cstdlib> // For std::size_t
- #include <cassert> // For assert
- #include <new> // For placement new
-#endif
+#include "common/scummsys.h"
// On MSVC, disable "conditional expression is constant" warning (level 4).
// This warning is almost impossible to avoid with certain types of templated code
@@ -23,8 +21,6 @@
///////////////////////////////////////////////////////////////////////////
// RAPIDXML_PARSE_ERROR
-#if defined(RAPIDXML_NO_EXCEPTIONS)
-
#define RAPIDXML_PARSE_ERROR(what, where) { parse_error_handler(what, where); assert(0); }
namespace rapidxml
@@ -48,61 +44,6 @@ namespace rapidxml
void parse_error_handler(const char *what, void *where);
}
-#else
-
-#include <exception> // For std::exception
-
-#define RAPIDXML_PARSE_ERROR(what, where) throw parse_error(what, where)
-
-namespace rapidxml
-{
- //! Parse error exception.
- //! This exception is thrown by the parser when an error occurs.
- //! Use what() function to get human-readable error message.
- //! Use where() function to get a pointer to position within source text where error was detected.
- //! <br><br>
- //! If throwing exceptions by the parser is undesirable,
- //! it can be disabled by defining RAPIDXML_NO_EXCEPTIONS macro before rapidxml.hpp is included.
- //! This will cause the parser to call rapidxml::parse_error_handler() function instead of throwing an exception.
- //! This function must be defined by the user.
- //! <br><br>
- //! This class derives from <code>std::exception</code> class.
- class parse_error: public std::exception
- {
- public:
-
- //! Constructs parse error
- parse_error(const char *what, void *where)
- : m_what(what)
- , m_where(where)
- {
- }
-
- //! Gets human readable description of error.
- //! \return Pointer to null terminated description of the error.
- virtual const char *what() const throw()
- {
- return m_what;
- }
-
- //! Gets pointer to character data where error happened.
- //! Ch should be the same as char type of xml_document that produced the error.
- //! \return Pointer to location within the parsed string where error occured.
- template<class Ch>
- Ch *where() const
- {
- return reinterpret_cast<Ch *>(m_where);
- }
-
- private:
-
- const char *m_what;
- void *m_where;
- };
-}
-
-#endif
-
///////////////////////////////////////////////////////////////////////////
// Pool sizes
diff --git a/engines/crab/rapidxml/rapidxml_print.hpp b/engines/crab/rapidxml/rapidxml_print.hpp
index aefc1f8832e..73174c52cab 100644
--- a/engines/crab/rapidxml/rapidxml_print.hpp
+++ b/engines/crab/rapidxml/rapidxml_print.hpp
@@ -1,6 +1,9 @@
#ifndef RAPIDXML_PRINT_HPP_INCLUDED
#define RAPIDXML_PRINT_HPP_INCLUDED
+// The file below has been edited to clean-up the includes as necessiated by ScummVM.
+// Notably, code which was dependent on streams has been removed.
+
// Copyright (C) 2006, 2009 Marcin Kalicinski
// Version 1.13
// Revision $DateTime: 2009/05/13 01:46:17 $
@@ -8,12 +11,6 @@
#include "rapidxml.hpp"
-// Only include streams if not disabled
-#ifndef RAPIDXML_NO_STREAMS
-#include <ostream>
-#include <iterator>
-#endif
-
namespace rapidxml
{
///////////////////////////////////////////////////////////////////////
@@ -399,32 +396,6 @@ namespace rapidxml
{
return internal::print_node(out, &node, flags, 0);
}
-
-#ifndef RAPIDXML_NO_STREAMS
-
- //! Prints XML to given output stream.
- //! \param out Output stream to print to.
- //! \param node Node to be printed. Pass xml_document to print entire document.
- //! \param flags Flags controlling how XML is printed.
- //! \return Output stream.
- template<class Ch>
- inline std::basic_ostream<Ch> &print(std::basic_ostream<Ch> &out, const xml_node<Ch> &node, int flags = 0)
- {
- print(std::ostream_iterator<Ch>(out), node, flags);
- return out;
- }
-
- //! Prints formatted XML to given output stream. Uses default printing flags. Use print() function to customize printing process.
- //! \param out Output stream to print to.
- //! \param node Node to be printed.
- //! \return Output stream.
- template<class Ch>
- inline std::basic_ostream<Ch> &operator <<(std::basic_ostream<Ch> &out, const xml_node<Ch> &node)
- {
- return print(out, node);
- }
-
-#endif
}
#endif
\ No newline at end of file
Commit: 0ebc9710554075d833880774bac7947b1262fb8c
https://github.com/scummvm/scummvm/commit/0ebc9710554075d833880774bac7947b1262fb8c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use scummsys instead of including standard library headers directly
Changed paths:
engines/crab/PathfindingGrid.h
engines/crab/common_header.h
engines/crab/numstr.h
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 46cc81d1e55..07580fad624 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -31,7 +31,6 @@
#ifndef CRAB_PATHFINDINGGRID_H
#define CRAB_PATHFINDINGGRID_H
-#include <math.h>
#include "crab/PathfindingGraphNode.h"
#include "crab/common_header.h"
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index ad2dd5659b4..6cd75093d37 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -31,8 +31,7 @@
#ifndef CRAB_COMMON_HEADER_H
#define CRAB_COMMON_HEADER_H
-#include <limits>
-
+#include "common/scummsys.h"
#include "common/path.h"
#include "common/str.h"
#include "common/hashmap.h"
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index e5738ae4d6e..c25c456b2a3 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -30,7 +30,6 @@
#ifndef CRAB_NUMSTR_H
#define CRAB_NUMSTR_H
-#include <cstring>
#include "crab/common_header.h"
namespace Crab {
@@ -64,7 +63,7 @@ Common::String NumberToString(T Number) {
return revStr;
}
-template<typename T>
+template<typename T>
inline T StringToNumber(char *Text) {
int res = 0;
if (sscanf(Text, "%d", &res) > 0)
Commit: 434c65e1ba3f625ff2f865c156daa223fcad3238
https://github.com/scummvm/scummvm/commit/434c65e1ba3f625ff2f865c156daa223fcad3238
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add basic keyboard controls using keymapper
Changed paths:
engines/crab/app.cpp
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/metaengine.cpp
engines/crab/metaengine.h
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 9e993f760ed..6ea2f4fcc5c 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -227,6 +227,16 @@ void App::Run() {
#endif
while (g_system->getEventManager()->pollEvent(e)) {
+ switch (e.type) {
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ g_engine->_inputManager->_ivState[e.customType] = true;
+ break;
+
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
+ g_engine->_inputManager->_ivState[e.customType] = false;
+ break;
+ }
+
// Do state Event handling
CurrentState->HandleEvents(e, ShouldChangeState, NextStateID);
}
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index b4f8d57454f..8852a5a89db 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::input;
// Purpose: Return pressed/depressed state of key
//------------------------------------------------------------------------
bool InputManager::State(const InputType &val) {
- warning("STUB: InputManager::State()");
+ return _ivState[val];
#if 0
const Uint8 *keystate = SDL_GetKeyboardState(NULL);
@@ -56,7 +56,7 @@ bool InputManager::State(const InputType &val) {
}
#endif
- return false;
+ //return false;
}
#if 0
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index ee95ea22bf8..f99d9f0cd1a 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -98,6 +98,9 @@ public:
InputManager() {
//controller = nullptr;
version = 0;
+
+ for (int i = 0; i < IT_TOTAL; i++)
+ _ivState[i] = false;
}
~InputManager() {}
void Quit() {
@@ -114,6 +117,7 @@ public:
// Inputs used in the game
InputVal iv[IT_TOTAL];
+ bool _ivState[IT_TOTAL];
// Our controller object
//SDL_GameController *controller;
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index 27d49354a19..cc33668045c 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -55,6 +55,10 @@
#include "crab/detection.h"
#include "crab/metaengine.h"
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/standard-actions.h"
+
namespace Crab {
static const ADExtraGuiOptionsMap optionsList[] = {
@@ -82,6 +86,46 @@ Common::Error CrabMetaEngine::createInstance(OSystem *syst, Engine **engine, con
return Common::kNoError;
}
+Common::KeymapArray CrabMetaEngine::initKeymaps(const char *target) const {
+ using namespace Common;
+
+ Keymap *keymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest", "Unrest");
+
+ Action *act;
+
+ act = new Action(kStandardActionMoveUp, _("Up"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_UP);
+ act->addDefaultInputMapping("UP");
+ act->addDefaultInputMapping("JOY_UP");
+ keymap->addAction(act);
+
+ act = new Action(kStandardActionMoveDown, _("Down"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_DOWN);
+ act->addDefaultInputMapping("DOWN");
+ act->addDefaultInputMapping("JOY_DOWN");
+ keymap->addAction(act);
+
+ act = new Action(kStandardActionMoveLeft, _("Left"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_LEFT);
+ act->addDefaultInputMapping("LEFT");
+ act->addDefaultInputMapping("JOY_LEFT");
+ keymap->addAction(act);
+
+ act = new Action(kStandardActionMoveRight, _("Right"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_RIGHT);
+ act->addDefaultInputMapping("RIGHT");
+ act->addDefaultInputMapping("JOY_RIGHT");
+ keymap->addAction(act);
+
+ act = new Action("TALK", _("Talk/Interact"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_TALK);
+ act->addDefaultInputMapping("RETURN");
+ act->addDefaultInputMapping("JOY_A");
+ keymap->addAction(act);
+
+ return Keymap::arrayOf(keymap);
+}
+
bool CrabMetaEngine::hasFeature(MetaEngineFeature f) const {
return checkExtendedSaves(f) ||
(f == kSupportsLoadingDuringStartup);
diff --git a/engines/crab/metaengine.h b/engines/crab/metaengine.h
index e2dfda8a1ea..d2f55ae8434 100644
--- a/engines/crab/metaengine.h
+++ b/engines/crab/metaengine.h
@@ -67,6 +67,8 @@ public:
*/
bool hasFeature(MetaEngineFeature f) const override;
+ Common::KeymapArray initKeymaps(const char *target) const override;
+
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
};
Commit: 0ee6bda96bf2d67548d0c5cfee536106b7052fc8
https://github.com/scummvm/scummvm/commit/0ee6bda96bf2d67548d0c5cfee536106b7052fc8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub keybaord controls in Sprite::HandleEvents()
Changed paths:
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 054a5e0e11b..23100772802 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -368,7 +368,6 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
YVel(0.0f);
} else // Keyboard movement
{
- #if 0
// Disable destination as soon as player presses a direction key
// X axis
if (g_engine->_inputManager->State(IG_LEFT)) {
@@ -389,7 +388,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
YVel(player_speed * sc.walk_vel_mod.y);
} else if (!ai_data.dest.active)
YVel(0.0f);
- #endif
+
}
UpdateMove(input.HandleEvents(Event));
Commit: 145955dfd6d75e7d41dfc8670a099ba12d290fdf
https://github.com/scummvm/scummvm/commit/145955dfd6d75e7d41dfc8670a099ba12d290fdf
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Specify default block to deal with unhandled cases
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 6ea2f4fcc5c..fe5b783806f 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -235,6 +235,10 @@ void App::Run() {
case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
g_engine->_inputManager->_ivState[e.customType] = false;
break;
+
+ // explicitly specify the default block to turn off unhandled case warnings
+ default:
+ break;
}
// Do state Event handling
Commit: a360d850fe7abdcdc9ff1db9615f8c7548b497d9
https://github.com/scummvm/scummvm/commit/a360d850fe7abdcdc9ff1db9615f8c7548b497d9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add more keymaps
Changed paths:
engines/crab/metaengine.cpp
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index cc33668045c..4cd723f5555 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -123,6 +123,81 @@ Common::KeymapArray CrabMetaEngine::initKeymaps(const char *target) const {
act->addDefaultInputMapping("JOY_A");
keymap->addAction(act);
+ act = new Action("MAP", _("Map"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_MAP);
+ act->addDefaultInputMapping("m");
+ keymap->addAction(act);
+
+ act = new Action("JOURNAL", _("Journal"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_JOURNAL);
+ act->addDefaultInputMapping("j");
+ keymap->addAction(act);
+
+ act = new Action("INVENTORY", _("Inventory"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_INVENTORY);
+ act->addDefaultInputMapping("i");
+ keymap->addAction(act);
+
+ act = new Action("TRAITS", _("Traits"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_CHARACTER);
+ act->addDefaultInputMapping("t");
+ keymap->addAction(act);
+
+
+ act = new Action("UI_UP", _("Up"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_UP);
+ act->addDefaultInputMapping("UP");
+ act->addDefaultInputMapping("JOY_UP");
+ keymap->addAction(act);
+
+ act = new Action("UI_DOWN", _("Down"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_DOWN);
+ act->addDefaultInputMapping("DOWN");
+ act->addDefaultInputMapping("JOY_DOWN");
+ keymap->addAction(act);
+
+ act = new Action("UI_LEFT", _("Left"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_LEFT);
+ act->addDefaultInputMapping("LEFT");
+ act->addDefaultInputMapping("JOY_LEFT");
+ keymap->addAction(act);
+
+ act = new Action("UI_RIGHT", _("Right"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_RIGHT);
+ act->addDefaultInputMapping("RIGHT");
+ act->addDefaultInputMapping("JOY_RIGHT");
+ keymap->addAction(act);
+
+ act = new Action("REPLY1", _("Reply 1"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_0);
+ act->addDefaultInputMapping("1");
+ keymap->addAction(act);
+
+ act = new Action("REPLY2", _("Reply 2"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_1);
+ act->addDefaultInputMapping("2");
+ keymap->addAction(act);
+
+ act = new Action("REPLY3", _("Reply 3"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_2);
+ act->addDefaultInputMapping("3");
+ keymap->addAction(act);
+
+ act = new Action("REPLY4", _("Reply 4"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_3);
+ act->addDefaultInputMapping("4");
+ keymap->addAction(act);
+
+ act = new Action("REPLY5", _("Reply 5"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_4);
+ act->addDefaultInputMapping("5");
+ keymap->addAction(act);
+
+ act = new Action("REPLY6", _("Reply 6"));
+ act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_5);
+ act->addDefaultInputMapping("6");
+ keymap->addAction(act);
+
return Keymap::arrayOf(keymap);
}
Commit: 251cc23bafef622b89256c9beaf48ad6acd9a9ff
https://github.com/scummvm/scummvm/commit/251cc23bafef622b89256c9beaf48ad6acd9a9ff
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add function to query the key associated with an InputType
Changed paths:
engines/crab/input/input.cpp
engines/crab/input/input.h
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 8852a5a89db..5cdf452792c 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -28,6 +28,9 @@
*
*/
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/action.h"
+#include "crab/crab.h"
#include "crab/input/input.h"
namespace Crab {
@@ -189,6 +192,22 @@ void InputManager::RestoreBackup() {
iv[i] = backup[i];
}
+Common::String InputManager::GetAssociatedKey(const InputType &type) const {
+ Common::Keymap *keymap = g_system->getEventManager()->getKeymapper()->getKeymap("Unrest");
+ const Common::Keymap::ActionArray actions = keymap->getActions();
+ Common::String res = "";
+
+ for (Common::Action *action : actions) {
+ if (action->event.customType == type) {
+ res = Common::String(keymap->getActionMapping(action)[0].description);
+ res.toUppercase();
+ break;
+ }
+ }
+
+ return res;
+}
+
//------------------------------------------------------------------------
// Purpose: Save to file
//------------------------------------------------------------------------
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index f99d9f0cd1a..8f2e6008df2 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -137,6 +137,8 @@ public:
// Initialize the controller if it is plugged in
void AddController();
+ Common::String GetAssociatedKey(const InputType &type) const;
+
#if 0
// Handle plugging and unplugging of controllers on the fly
void HandleController(const SDL_Event &Event);
Commit: fc0aadbaedaf97fbd6d51ebb178f9762cb44fa9b
https://github.com/scummvm/scummvm/commit/fc0aadbaedaf97fbd6d51ebb178f9762cb44fa9b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make hotkey class usable
Changed paths:
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index ba3d9da1980..cd32c23ba45 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/crab.h"
#include "crab/input/hotkey.h"
namespace Crab {
@@ -36,6 +37,8 @@ using namespace pyrodactyl::input;
void HotKey::Load(rapidxml::xml_node<char> *node) {
LoadEnum(input, "input", node);
+
+ name = g_engine->_inputManager->GetAssociatedKey(input);
}
#if 0
@@ -56,13 +59,17 @@ bool HotKey::HandleEvents(const SDL_Event &Event) {
#endif
bool HotKey::HandleEvents(const Common::Event &Event) {
- warning("STUB: HotKey::HandleEvents()");
+ //warning("STUB: HotKey::HandleEvents()");
+
+ if (input > IT_NONE && input < IT_TOTAL) {
+ return g_engine->_inputManager->State(input);
+ }
return false;
}
const char *HotKey::Name() {
- warning("STUB: HotKey::Name()");
+ return name.c_str();
#if 0
if (input > IT_NONE && input < IT_TOTAL)
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 28fd3c8f16e..6ba066a3ace 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -31,6 +31,7 @@
#ifndef CRAB_HOTKEY_H
#define CRAB_HOTKEY_H
+#include "crab/crab.h"
#include "crab/common_header.h"
#include "crab/input/input.h"
@@ -46,13 +47,20 @@ class HotKey {
// Has the key been pressed?
bool keydown;
+ // Description of the key associated with the Input
+ Common::String name;
+
public:
HotKey() {
input = IT_NONE;
keydown = false;
}
- void Set(const InputType &val) { input = val; }
+ void Set(const InputType &val) {
+ input = val;
+ name = g_engine->_inputManager->GetAssociatedKey(input);
+ }
+
const char *Name();
void Load(rapidxml::xml_node<char> *node);
Commit: 5f597e11c0192f37eae6321de42123c6fcab050e
https://github.com/scummvm/scummvm/commit/5f597e11c0192f37eae6321de42123c6fcab050e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable hotkey usage in Button class
Changed paths:
engines/crab/ui/button.cpp
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 361d827cbaa..04187fd5a15 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -64,8 +64,8 @@ void Button::Load(rapidxml::xml_node<char> *node, const bool &echo) {
LoadNum(se_click, "click", node, echo);
LoadNum(se_hover, "hover", node, echo);
- //if (NodeValid("hotkey", node, false))
- // hotkey.Load(node->first_node("hotkey"));
+ if (NodeValid("hotkey", node, false))
+ hotkey.Load(node->first_node("hotkey"));
tooltip.Load(node->first_node("tooltip"), this);
caption.Load(node->first_node("caption"), this);
Commit: 74f5d6f963aa7ece5300177afde9a6172d9ed59c
https://github.com/scummvm/scummvm/commit/74f5d6f963aa7ece5300177afde9a6172d9ed59c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub HUD::SetTooltip
Changed paths:
engines/crab/ui/hud.cpp
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index eaf5d2ef860..ff457c27d2a 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -164,15 +164,11 @@ void HUD::State(const int &val) {
}
void HUD::SetTooltip() {
- warning("STUB: HUD::SetTooltip()");
-
-#if 0
- int count = 0;
+ unsigned int count = 0;
for (auto i = menu.element.begin(); i != menu.element.end() && count < tooltip.size(); ++i, ++count)
i->tooltip.text = tooltip[count] + " (" + i->hotkey.Name() + ")";
- menu.element[HS_PAUSE].tooltip.text = tooltip[HS_PAUSE] + " (" + SDL_GetScancodeName(g_engine->_inputManager->iv[IG_PAUSE].key) + ")";
-#endif
+ menu.element[HS_PAUSE].tooltip.text = tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->GetAssociatedKey(IG_PAUSE) + ")";
}
void HUD::SetUI() {
Commit: 012f5e76d5c488100e820bfb587f1de5fb4fa381
https://github.com/scummvm/scummvm/commit/012f5e76d5c488100e820bfb587f1de5fb4fa381
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Enable keyboard usage to navigate menu
Changed paths:
engines/crab/ui/menu.h
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index da9dee386b9..3f9877e8636 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -35,6 +35,7 @@
#ifndef CRAB_MENU_H
#define CRAB_MENU_H
+#include "crab/crab.h"
#include "crab/image/ImageManager.h"
#include "crab/ui/button.h"
#include "crab/common_header.h"
@@ -77,7 +78,7 @@ protected:
} else {
unsigned int curpos = 0;
for (; curpos < path.size(); curpos++)
- if (path[curpos] == hover_index)
+ if ((int)path[curpos] == hover_index)
break;
for (unsigned int nextloc = (curpos + 1) % element.size(); nextloc != curpos; nextloc = (nextloc + 1) % element.size())
@@ -101,11 +102,11 @@ protected:
} else {
unsigned int curpos = 0;
for (; curpos < path.size(); curpos++)
- if (path[curpos] == hover_index)
+ if ((int)path[curpos] == hover_index)
break;
int nextloc = curpos - 1;
- while (nextloc != curpos) {
+ while (nextloc != (int)curpos) {
if (nextloc < 0)
nextloc = element.size() - 1;
@@ -119,6 +120,48 @@ protected:
}
}
+ //------------------------------------------------------------------------
+ // Purpose: Handle keyboard input
+ //------------------------------------------------------------------------
+ int HandleKeyboard(const Common::Event &Event) {
+ using namespace pyrodactyl::input;
+
+ if (!element.empty()) {
+ if (path_type != PATH_HORIZONTAL) {
+ if (g_engine->_inputManager->State(IU_DOWN)) {
+ Next();
+ latest_input = KEYBOARD;
+ } else if (g_engine->_inputManager->State(IU_UP)) {
+ Prev();
+ latest_input = KEYBOARD;
+ }
+ }
+
+ if (path_type != PATH_VERTICAL) {
+ if (g_engine->_inputManager->State(IU_RIGHT)) {
+ Next();
+ latest_input = KEYBOARD;
+ } else if (g_engine->_inputManager->State(IU_LEFT)) {
+ Prev();
+ latest_input = KEYBOARD;
+ }
+ }
+
+ if (g_engine->_inputManager->State(IU_ACCEPT) && hover_index != -1)
+ return hover_index;
+
+ // We pressed a key, which means we have to update the hovering status
+ if (latest_input == KEYBOARD) {
+ // Update hover status of keys according to the current index
+ int i = 0;
+ for (auto it = element.begin(); it != element.end(); ++it, ++i)
+ it->hover_key = (i == hover_index);
+ }
+ }
+
+ return -1;
+ }
+
#if 0
//------------------------------------------------------------------------
// Purpose: Handle keyboard input
@@ -210,7 +253,6 @@ public:
//------------------------------------------------------------------------
int HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
// The keyboard/joystick event handling bit
- /*
if (use_keyboard) {
int result = HandleKeyboard(Event);
@@ -221,7 +263,6 @@ public:
return result;
}
}
- */
// Check if we have moved or clicked the mouse
if (Common::isMouseEvent(Event)) {
@@ -251,13 +292,11 @@ public:
}
}
- /*
if (latest_input == KEYBOARD) {
// The latest input is the keyboard, which means we have to forget the mouse hover states
for (auto it = element.begin(); it != element.end(); ++it)
it->hover_mouse = false;
}
- */
return -1;
}
Commit: 6a83b30f4faa98a98df4173ec317d32f561e2e3f
https://github.com/scummvm/scummvm/commit/6a83b30f4faa98a98df4173ec317d32f561e2e3f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Show hotkeys in ReplyMenu
Changed paths:
engines/crab/ui/ReplyMenu.cpp
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index c4db1893235..7b4272b4793 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -158,9 +158,9 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
tone.value[element_count] = dat.reply[reply_count].tone;
- //Common::String text = SDL_GetScancodeName(g_engine->_inputManager->iv[IU_REPLY_0 + element_count].key);
- //text += ". " + i->text;
- Common::String text = i->text;
+ const InputType type = static_cast<InputType>(IU_REPLY_0 + element_count);
+ Common::String text = g_engine->_inputManager->GetAssociatedKey(type);
+ text += ". " + i->text;
info.InsertName(text);
if (element_count == 0)
Commit: 1ba5dee659b5d4d67df8aba1314a6a9ed17f041c
https://github.com/scummvm/scummvm/commit/1ba5dee659b5d4d67df8aba1314a6a9ed17f041c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Create and use separate keymappings for UI and Game
Changed paths:
engines/crab/crab.cpp
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/metaengine.cpp
engines/crab/metaengine.h
engines/crab/ui/menu.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 919d5742543..c621d3e0c1f 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -110,6 +110,8 @@ Common::Error CrabEngine::run() {
CursorMan.showMouse(true);
_mouse->Reset();
+ _inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
+
// Set the engine's debugger console
setDebugger(new Console());
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 5cdf452792c..ed5fab9e003 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -27,9 +27,8 @@
* Licensed under MIT
*
*/
+#include "common/translation.h"
-#include "backends/keymapper/keymapper.h"
-#include "backends/keymapper/action.h"
#include "crab/crab.h"
#include "crab/input/input.h"
@@ -193,12 +192,14 @@ void InputManager::RestoreBackup() {
}
Common::String InputManager::GetAssociatedKey(const InputType &type) const {
+
Common::Keymap *keymap = g_system->getEventManager()->getKeymapper()->getKeymap("Unrest");
+
const Common::Keymap::ActionArray actions = keymap->getActions();
Common::String res = "";
for (Common::Action *action : actions) {
- if (action->event.customType == type) {
+ if ((int)action->event.customType == type) {
res = Common::String(keymap->getActionMapping(action)[0].description);
res.toUppercase();
break;
@@ -247,4 +248,176 @@ void InputManager::Save() {
#endif
}
+Common::Keymap* InputManager::GetDefaultKeyMapsForGame() {
+ using namespace Common;
+
+ Keymap *keymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest", "Keymappings for Game");
+
+ Action *act;
+
+ act = new Action(kStandardActionMoveUp, _("Up"));
+ act->setCustomEngineActionEvent(IG_UP);
+ act->addDefaultInputMapping("UP");
+ act->addDefaultInputMapping("JOY_UP");
+ keymap->addAction(act);
+
+ act = new Action(kStandardActionMoveDown, _("Down"));
+ act->setCustomEngineActionEvent(IG_DOWN);
+ act->addDefaultInputMapping("DOWN");
+ act->addDefaultInputMapping("JOY_DOWN");
+ keymap->addAction(act);
+
+ act = new Action(kStandardActionMoveLeft, _("Left"));
+ act->setCustomEngineActionEvent(IG_LEFT);
+ act->addDefaultInputMapping("LEFT");
+ act->addDefaultInputMapping("JOY_LEFT");
+ keymap->addAction(act);
+
+ act = new Action(kStandardActionMoveRight, _("Right"));
+ act->setCustomEngineActionEvent(IG_RIGHT);
+ act->addDefaultInputMapping("RIGHT");
+ act->addDefaultInputMapping("JOY_RIGHT");
+ keymap->addAction(act);
+
+ act = new Action("TALK", _("Talk/Interact"));
+ act->setCustomEngineActionEvent(IG_TALK);
+ act->addDefaultInputMapping("RETURN");
+ act->addDefaultInputMapping("JOY_A");
+ keymap->addAction(act);
+
+ return keymap;
+}
+
+Common::Keymap* InputManager::GetDefaultKeyMapsForUI() {
+ using namespace Common;
+
+ Keymap *uiKeymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest", "Keymappings for UI");
+
+ Action *act;
+
+ act = new Action("UI_UP", _("Up"));
+ act->setCustomEngineActionEvent(IU_UP);
+ act->addDefaultInputMapping("UP");
+ act->addDefaultInputMapping("JOY_UP");
+ uiKeymap->addAction(act);
+
+ act = new Action("UI_DOWN", _("Down"));
+ act->setCustomEngineActionEvent(IU_DOWN);
+ act->addDefaultInputMapping("DOWN");
+ act->addDefaultInputMapping("JOY_DOWN");
+ uiKeymap->addAction(act);
+
+ act = new Action("UI_LEFT", _("Left"));
+ act->setCustomEngineActionEvent(IU_LEFT);
+ act->addDefaultInputMapping("LEFT");
+ act->addDefaultInputMapping("JOY_LEFT");
+ uiKeymap->addAction(act);
+
+ act = new Action("UI_RIGHT", _("Right"));
+ act->setCustomEngineActionEvent(IU_RIGHT);
+ act->addDefaultInputMapping("RIGHT");
+ act->addDefaultInputMapping("JOY_RIGHT");
+ uiKeymap->addAction(act);
+
+ act = new Action("UI_ACCEPT", _("Accept"));
+ act->setCustomEngineActionEvent(IU_ACCEPT);
+ act->addDefaultInputMapping("RETURN");
+ act->addDefaultInputMapping("JOY_A");
+ uiKeymap->addAction(act);
+
+ act = new Action("REPLY1", _("Reply 1"));
+ act->setCustomEngineActionEvent(IU_REPLY_0);
+ act->addDefaultInputMapping("1");
+ uiKeymap->addAction(act);
+
+ act = new Action("REPLY2", _("Reply 2"));
+ act->setCustomEngineActionEvent(IU_REPLY_1);
+ act->addDefaultInputMapping("2");
+ uiKeymap->addAction(act);
+
+ act = new Action("REPLY3", _("Reply 3"));
+ act->setCustomEngineActionEvent(IU_REPLY_2);
+ act->addDefaultInputMapping("3");
+ uiKeymap->addAction(act);
+
+ act = new Action("REPLY4", _("Reply 4"));
+ act->setCustomEngineActionEvent(IU_REPLY_3);
+ act->addDefaultInputMapping("4");
+ uiKeymap->addAction(act);
+
+ act = new Action("REPLY5", _("Reply 5"));
+ act->setCustomEngineActionEvent(IU_REPLY_4);
+ act->addDefaultInputMapping("5");
+ uiKeymap->addAction(act);
+
+ act = new Action("REPLY6", _("Reply 6"));
+ act->setCustomEngineActionEvent(IU_REPLY_5);
+ act->addDefaultInputMapping("6");
+ uiKeymap->addAction(act);
+
+ return uiKeymap;
+}
+
+Common::Keymap* InputManager::GetDefaultKeyMapsForHUD() {
+ using namespace Common;
+
+ Keymap *hudKeymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest", "Keymappings for HUD");
+
+ Action *act;
+
+ act = new Action("MAP", _("Map"));
+ act->setCustomEngineActionEvent(IG_MAP);
+ act->addDefaultInputMapping("m");
+ hudKeymap->addAction(act);
+
+ act = new Action("JOURNAL", _("Journal"));
+ act->setCustomEngineActionEvent(IG_JOURNAL);
+ act->addDefaultInputMapping("j");
+ hudKeymap->addAction(act);
+
+ act = new Action("INVENTORY", _("Inventory"));
+ act->setCustomEngineActionEvent(IG_INVENTORY);
+ act->addDefaultInputMapping("i");
+ hudKeymap->addAction(act);
+
+ act = new Action("TRAITS", _("Traits"));
+ act->setCustomEngineActionEvent(IG_CHARACTER);
+ act->addDefaultInputMapping("t");
+ hudKeymap->addAction(act);
+
+ return hudKeymap;
+}
+
+void InputManager::SetKeyBindingMode(KeyBindingMode mode) {
+ _keyMode = mode;
+
+ Common::Keymap *gameKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForGame();
+ Common::Keymap *uiKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForUI();
+ Common::Keymap *hudKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForHUD();
+
+ Common::Keymapper *const mapper = g_engine->getEventManager()->getKeymapper();
+ mapper->cleanupGameKeymaps();
+
+ Common::Keymap *keymap;
+
+ switch (mode) {
+
+ case KBM_GAME:
+ keymap = gameKeymaps;
+ break;
+
+ case KBM_UI:
+ keymap = uiKeymaps;
+ break;
+ }
+ for (Common::Action *a: hudKeymaps->getActions()) {
+ keymap->addAction(a);
+ }
+
+ mapper->addGameKeymap(keymap);
+
+ // Clear All inputs
+ ClearInputs();
+}
+
} // End of namespace Crab
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 8f2e6008df2..c2ff66790df 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -31,6 +31,10 @@
#ifndef CRAB_INPUT_H
#define CRAB_INPUT_H
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymapper.h"
+#include "backends/keymapper/standard-actions.h"
+
#include "crab/common_header.h"
#include "crab/input/inputval.h"
@@ -80,6 +84,11 @@ enum InputType {
IT_TOTAL
};
+enum KeyBindingMode {
+ KBM_GAME = 0,
+ KBM_UI = 1
+};
+
// Constants related to menu size
const int IG_START = IG_UP, IG_SIZE = IG_BLOCK - IG_START + 1;
const int IU_START = IU_UP, IU_SIZE = IT_TOTAL - IU_START;
@@ -94,15 +103,32 @@ class InputManager {
// The current version of the input scheme
unsigned int version;
+ // The current mode of keymap applied
+ KeyBindingMode _keyMode;
+
public:
InputManager() {
//controller = nullptr;
version = 0;
+ ClearInputs();
+ }
+
+ ~InputManager() {}
+
+ static Common::Keymap* GetDefaultKeyMapsForGame();
+ static Common::Keymap* GetDefaultKeyMapsForUI();
+ static Common::Keymap* GetDefaultKeyMapsForHUD();
+
+ void ClearInputs() {
for (int i = 0; i < IT_TOTAL; i++)
_ivState[i] = false;
}
- ~InputManager() {}
+
+ void SetKeyBindingMode(KeyBindingMode mode);
+
+ KeyBindingMode GetKeyBindingMode() const { return _keyMode; }
+
void Quit() {
warning("STUB: InputManager::Quit()");
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index 4cd723f5555..6e724e36cdf 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -89,116 +89,17 @@ Common::Error CrabMetaEngine::createInstance(OSystem *syst, Engine **engine, con
Common::KeymapArray CrabMetaEngine::initKeymaps(const char *target) const {
using namespace Common;
- Keymap *keymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest", "Unrest");
-
- Action *act;
-
- act = new Action(kStandardActionMoveUp, _("Up"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_UP);
- act->addDefaultInputMapping("UP");
- act->addDefaultInputMapping("JOY_UP");
- keymap->addAction(act);
-
- act = new Action(kStandardActionMoveDown, _("Down"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_DOWN);
- act->addDefaultInputMapping("DOWN");
- act->addDefaultInputMapping("JOY_DOWN");
- keymap->addAction(act);
-
- act = new Action(kStandardActionMoveLeft, _("Left"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_LEFT);
- act->addDefaultInputMapping("LEFT");
- act->addDefaultInputMapping("JOY_LEFT");
- keymap->addAction(act);
-
- act = new Action(kStandardActionMoveRight, _("Right"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_RIGHT);
- act->addDefaultInputMapping("RIGHT");
- act->addDefaultInputMapping("JOY_RIGHT");
- keymap->addAction(act);
-
- act = new Action("TALK", _("Talk/Interact"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_TALK);
- act->addDefaultInputMapping("RETURN");
- act->addDefaultInputMapping("JOY_A");
- keymap->addAction(act);
-
- act = new Action("MAP", _("Map"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_MAP);
- act->addDefaultInputMapping("m");
- keymap->addAction(act);
-
- act = new Action("JOURNAL", _("Journal"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_JOURNAL);
- act->addDefaultInputMapping("j");
- keymap->addAction(act);
-
- act = new Action("INVENTORY", _("Inventory"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_INVENTORY);
- act->addDefaultInputMapping("i");
- keymap->addAction(act);
-
- act = new Action("TRAITS", _("Traits"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IG_CHARACTER);
- act->addDefaultInputMapping("t");
- keymap->addAction(act);
-
-
- act = new Action("UI_UP", _("Up"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_UP);
- act->addDefaultInputMapping("UP");
- act->addDefaultInputMapping("JOY_UP");
- keymap->addAction(act);
-
- act = new Action("UI_DOWN", _("Down"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_DOWN);
- act->addDefaultInputMapping("DOWN");
- act->addDefaultInputMapping("JOY_DOWN");
- keymap->addAction(act);
-
- act = new Action("UI_LEFT", _("Left"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_LEFT);
- act->addDefaultInputMapping("LEFT");
- act->addDefaultInputMapping("JOY_LEFT");
- keymap->addAction(act);
-
- act = new Action("UI_RIGHT", _("Right"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_RIGHT);
- act->addDefaultInputMapping("RIGHT");
- act->addDefaultInputMapping("JOY_RIGHT");
- keymap->addAction(act);
-
- act = new Action("REPLY1", _("Reply 1"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_0);
- act->addDefaultInputMapping("1");
- keymap->addAction(act);
-
- act = new Action("REPLY2", _("Reply 2"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_1);
- act->addDefaultInputMapping("2");
- keymap->addAction(act);
-
- act = new Action("REPLY3", _("Reply 3"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_2);
- act->addDefaultInputMapping("3");
- keymap->addAction(act);
-
- act = new Action("REPLY4", _("Reply 4"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_3);
- act->addDefaultInputMapping("4");
- keymap->addAction(act);
-
- act = new Action("REPLY5", _("Reply 5"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_4);
- act->addDefaultInputMapping("5");
- keymap->addAction(act);
-
- act = new Action("REPLY6", _("Reply 6"));
- act->setCustomEngineActionEvent(Crab::pyrodactyl::input::IU_REPLY_5);
- act->addDefaultInputMapping("6");
- keymap->addAction(act);
-
- return Keymap::arrayOf(keymap);
+ KeymapArray arr;
+
+ Keymap *gameKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForGame();
+ Keymap *uiKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForUI();
+ Keymap *hudKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForHUD();
+
+ arr.push_back(gameKeymaps);
+ arr.push_back(uiKeymaps);
+ arr.push_back(hudKeymaps);
+
+ return arr;
}
bool CrabMetaEngine::hasFeature(MetaEngineFeature f) const {
diff --git a/engines/crab/metaengine.h b/engines/crab/metaengine.h
index d2f55ae8434..f98bca9313a 100644
--- a/engines/crab/metaengine.h
+++ b/engines/crab/metaengine.h
@@ -52,6 +52,7 @@
#ifndef CRAB_METAENGINE_H
#define CRAB_METAENGINE_H
+#include "backends/keymapper/keymapper.h"
#include "engines/advancedDetector.h"
class CrabMetaEngine : public AdvancedMetaEngine {
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 3f9877e8636..1eb34f8cec6 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -35,6 +35,7 @@
#ifndef CRAB_MENU_H
#define CRAB_MENU_H
+#include "crab/metaengine.h"
#include "crab/crab.h"
#include "crab/image/ImageManager.h"
#include "crab/ui/button.h"
@@ -126,6 +127,10 @@ protected:
int HandleKeyboard(const Common::Event &Event) {
using namespace pyrodactyl::input;
+ if (g_engine->_inputManager->GetKeyBindingMode() != KBM_UI) {
+ g_engine->_inputManager->SetKeyBindingMode(KBM_UI);
+ }
+
if (!element.empty()) {
if (path_type != PATH_HORIZONTAL) {
if (g_engine->_inputManager->State(IU_DOWN)) {
@@ -260,6 +265,7 @@ public:
if (result != -1) {
// Reset the menu state
Reset();
+ g_engine->_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
return result;
}
}
@@ -278,6 +284,7 @@ public:
if (it->HandleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
// Reset the menu state
Reset();
+ g_engine->_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
return i;
}
Commit: 20485df18ab491b8849092783b6cf56607981b12
https://github.com/scummvm/scummvm/commit/20485df18ab491b8849092783b6cf56607981b12
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Free surface after use in TextManager
Changed paths:
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 7e51bd65e5e..96d87245073 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -211,6 +211,9 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
#endif
cache[pos].img.Draw(x - cache[pos].img.W(), y);
}
+
+ surf.free();
+
} else {
if (align == ALIGN_LEFT)
cache[pos].img.Draw(x, y);
Commit: e75ca85bd462568eecba4fd82912ec13af8cc263
https://github.com/scummvm/scummvm/commit/e75ca85bd462568eecba4fd82912ec13af8cc263
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cache mapped keys during intialization of the engine
Changed paths:
engines/crab/crab.cpp
engines/crab/input/hotkey.cpp
engines/crab/input/input.cpp
engines/crab/input/input.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index c621d3e0c1f..6877c9fd8fd 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -110,6 +110,7 @@ Common::Error CrabEngine::run() {
CursorMan.showMouse(true);
_mouse->Reset();
+ _inputManager->PopulateKeyTable();
_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
// Set the engine's debugger console
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index cd32c23ba45..54c494c6de8 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "crab/crab.h"
#include "crab/input/hotkey.h"
+#include "crab/crab.h"
namespace Crab {
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index ed5fab9e003..f6e4d916295 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -191,22 +191,38 @@ void InputManager::RestoreBackup() {
iv[i] = backup[i];
}
-Common::String InputManager::GetAssociatedKey(const InputType &type) const {
+void InputManager::PopulateKeyTable() {
+ for (unsigned int type = IG_START; type < IT_TOTAL; type++) {
+ _keyDescs[type] = '\0';
+ }
- Common::Keymap *keymap = g_system->getEventManager()->getKeymapper()->getKeymap("Unrest");
+ SetKeyBindingMode(KBM_GAME);
+ for (unsigned int i = IG_START; i < IG_SIZE + IG_START; i++) {
+ GetAssociatedKey((InputType)i);
+ }
- const Common::Keymap::ActionArray actions = keymap->getActions();
- Common::String res = "";
+ SetKeyBindingMode(KBM_UI);
+ for (unsigned int i = IU_START; i < IU_SIZE + IU_START; i++) {
+ GetAssociatedKey((InputType)i);
+ }
+}
+
+Common::String InputManager::GetAssociatedKey(const InputType &type) {
+ // Return cached copy if available
+ if (_keyDescs[type].size() > 0)
+ return _keyDescs[type];
+ Common::Keymap *keymap = g_system->getEventManager()->getKeymapper()->getKeymap("Unrest");
+ const Common::Keymap::ActionArray actions = keymap->getActions();
for (Common::Action *action : actions) {
if ((int)action->event.customType == type) {
- res = Common::String(keymap->getActionMapping(action)[0].description);
- res.toUppercase();
+ _keyDescs[type] = Common::String(keymap->getActionMapping(action)[0].description);
+ _keyDescs[type].toUppercase();
break;
}
}
- return res;
+ return _keyDescs[type];
}
//------------------------------------------------------------------------
@@ -391,9 +407,9 @@ Common::Keymap* InputManager::GetDefaultKeyMapsForHUD() {
void InputManager::SetKeyBindingMode(KeyBindingMode mode) {
_keyMode = mode;
- Common::Keymap *gameKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForGame();
- Common::Keymap *uiKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForUI();
- Common::Keymap *hudKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForHUD();
+ Common::Keymap *gameKeymaps = GetDefaultKeyMapsForGame();
+ Common::Keymap *uiKeymaps = GetDefaultKeyMapsForUI();
+ Common::Keymap *hudKeymaps = GetDefaultKeyMapsForHUD();
Common::Keymapper *const mapper = g_engine->getEventManager()->getKeymapper();
mapper->cleanupGameKeymaps();
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index c2ff66790df..ff697a6b38d 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -106,6 +106,9 @@ class InputManager {
// The current mode of keymap applied
KeyBindingMode _keyMode;
+ // The keybinds in string format for hotkeys and other places
+ Common::String _keyDescs[IT_TOTAL];
+
public:
InputManager() {
//controller = nullptr;
@@ -125,6 +128,8 @@ public:
_ivState[i] = false;
}
+ void PopulateKeyTable();
+
void SetKeyBindingMode(KeyBindingMode mode);
KeyBindingMode GetKeyBindingMode() const { return _keyMode; }
@@ -163,7 +168,7 @@ public:
// Initialize the controller if it is plugged in
void AddController();
- Common::String GetAssociatedKey(const InputType &type) const;
+ Common::String GetAssociatedKey(const InputType &type);
#if 0
// Handle plugging and unplugging of controllers on the fly
Commit: 326d735c5ea18a98763ef15f8cde5833091fb551
https://github.com/scummvm/scummvm/commit/326d735c5ea18a98763ef15f8cde5833091fb551
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Free objects created by CrabEngine class
Changed paths:
engines/crab/crab.cpp
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 6877c9fd8fd..897f359cc4b 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -72,6 +72,26 @@ CrabEngine::CrabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engin
}
CrabEngine::~CrabEngine() {
+
+ delete _screenSettings;
+ delete gStrPool;
+ delete _tempData;
+ delete _filePath;
+
+ delete _loadMenu;
+ delete _optionMenu;
+
+ delete _helpScreen;
+ delete _loadingScreen;
+
+ delete _eventStore;
+ delete _mouse;
+
+ delete _musicManager;
+ delete _inputManager;
+ delete _textManager;
+ delete _imageManager;
+
delete _screen;
}
Commit: 0a2b1ffd0612b82995a87276fb5562ae591ab23e
https://github.com/scummvm/scummvm/commit/0a2b1ffd0612b82995a87276fb5562ae591ab23e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix memory-leak due to format not being free'd
Changed paths:
engines/crab/crab.cpp
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 897f359cc4b..ce6cdff5f34 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -93,6 +93,7 @@ CrabEngine::~CrabEngine() {
delete _imageManager;
delete _screen;
+ delete _format;
}
uint32 CrabEngine::getFeatures() const {
Commit: c7a4e53c79db484fafa3c839e4af5b9f64165308
https://github.com/scummvm/scummvm/commit/c7a4e53c79db484fafa3c839e4af5b9f64165308
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix incorrect usage of delete
Changed paths:
engines/crab/PathfindingGrid.cpp
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 6056b26ea0f..a348dcbac57 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -47,7 +47,7 @@ PathfindingGrid::~PathfindingGrid(void) {
delete[] nodes[x];
}
- delete nodes;
+ delete[] nodes;
}
void PathfindingGrid::SetupNodes(TMXMap map) {
Commit: ee6233484e570a1f1d6cdbfdd898b99ac048a3f6
https://github.com/scummvm/scummvm/commit/ee6233484e570a1f1d6cdbfdd898b99ac048a3f6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix memory leaks by freeing objects in app class
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index fe5b783806f..d78233fe5e8 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -296,6 +296,8 @@ void App::Run() {
g_system->delayMillis(delay);
}
}
+
+ delete CurrentState;
}
void App::LoadSettings(const Common::String &filename) {
@@ -319,6 +321,11 @@ void App::LoadSettings(const Common::String &filename) {
}
App::~App() {
+ g_engine->_imageManager->Quit();
+ g_engine->_musicManager->Quit();
+ g_engine->_textManager->Quit();
+ g_engine->_inputManager->Quit();
+ g_engine->_loadingScreen->Quit();
#if 0
// SteamAPI_Shutdown();
Commit: d36588b72b7557fe3804bf4bbef981586c118800
https://github.com/scummvm/scummvm/commit/d36588b72b7557fe3804bf4bbef981586c118800
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Free app class in CrabEngine destructor
Changed paths:
engines/crab/crab.cpp
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index ce6cdff5f34..15d5d4435b4 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -72,6 +72,7 @@ CrabEngine::CrabEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engin
}
CrabEngine::~CrabEngine() {
+ delete _app;
delete _screenSettings;
delete gStrPool;
Commit: 030144588132302cca2ae49b20ffc7ac9350c3c3
https://github.com/scummvm/scummvm/commit/030144588132302cca2ae49b20ffc7ac9350c3c3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Check for h and w as well in Image::Delete()
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 8547ab639a3..c84dff0dbcb 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -313,7 +313,7 @@ void Image::FastDraw(const int &x, const int &y, Rect *clip) {
// Purpose: Delete texture data
//------------------------------------------------------------------------
void Image::Delete() {
- if (texture != nullptr) {
+ if (texture != nullptr && w > 0 && h > 0) {
texture->free();
delete texture;
texture = nullptr;
Commit: 384f0227ced0c5410411a0e344a162c799e67f86
https://github.com/scummvm/scummvm/commit/384f0227ced0c5410411a0e344a162c799e67f86
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Invalid_img is already freed by this point
Changed paths:
engines/crab/image/ImageManager.cpp
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 76346f87355..7c4189233ed 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -189,8 +189,6 @@ void ImageManager::Quit() {
map[i].clear();
}
-
- invalid_img.Delete();
}
} // End of namespace Crab
Commit: 56df01afccf4d684a6c748433396c3e0ca8ea404
https://github.com/scummvm/scummvm/commit/56df01afccf4d684a6c748433396c3e0ca8ea404
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Call Level::Reset from Level destructor as well
Changed paths:
engines/crab/level/level.h
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 90c03c28987..5d35c697110 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -144,7 +144,7 @@ public:
pyrodactyl::image::Image img;
Level() { Reset(); }
- ~Level() {}
+ ~Level() { Reset(); }
void Reset();
Commit: 659dde2cd070099d0c00afbd9ac6bcae66c544d1
https://github.com/scummvm/scummvm/commit/659dde2cd070099d0c00afbd9ac6bcae66c544d1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use the implicit destructor in Game
Changed paths:
engines/crab/game.h
diff --git a/engines/crab/game.h b/engines/crab/game.h
index b9d0835ebce..478573019ce 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -129,7 +129,6 @@ private:
public:
Game() { StartNewGame(); }
Game(const Common::String &filename) { LoadGame(filename); }
- ~Game() {}
void Init(const Common::String &filename);
Commit: a5abea6e8f13786eaedffb3ae6df272e5ccab8e9
https://github.com/scummvm/scummvm/commit/a5abea6e8f13786eaedffb3ae6df272e5ccab8e9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub TextManager::Quit()
Changed paths:
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 96d87245073..ab1edc0c192 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -265,11 +265,8 @@ void TextManager::Draw(const int &x, int y, const Common::String &text, const in
// Purpose: Quit
//------------------------------------------------------------------------
void TextManager::Quit() {
- warning("STUB: TextManager::Quit()");
-
-#if 0
for (auto i = font.begin(); i != font.end(); ++i)
- TTF_CloseFont(*i);
+ delete *i;
for (auto i = cache.begin(); i != cache.end(); ++i) {
if (i->empty == false) {
@@ -277,7 +274,6 @@ void TextManager::Quit() {
i->empty = true;
}
}
-#endif
}
} // End of namespace Crab
Commit: 2ac2678d6590565ca002b301d9142a4bbd466ae1
https://github.com/scummvm/scummvm/commit/2ac2678d6590565ca002b301d9142a4bbd466ae1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Free cursor hover textures
Changed paths:
engines/crab/input/cursor.h
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index 9982c12aedd..455d74e40b3 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -76,7 +76,10 @@ public:
void Quit() {
img.Delete();
img_s.Delete();
+ img_hover.Delete();
+ img_hover_s.Delete();
}
+
void Reset();
void Load(rapidxml::xml_node<char> *node);
Commit: dd1da417ac0d408872f3f40fbff3e84fd546c9eb
https://github.com/scummvm/scummvm/commit/dd1da417ac0d408872f3f40fbff3e84fd546c9eb
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix a possible double free
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index d78233fe5e8..4c693151ee7 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -146,6 +146,7 @@ void App::Run() {
if (ShouldChangeState) {
// Delete the current state
delete CurrentState;
+ CurrentState = nullptr;
if (NextStateID == GAMESTATE_EXIT)
break;
@@ -297,7 +298,8 @@ void App::Run() {
}
}
- delete CurrentState;
+ if (CurrentState)
+ delete CurrentState;
}
void App::LoadSettings(const Common::String &filename) {
Commit: 8862a714790883a577a842fe6e5137929ebf0bea
https://github.com/scummvm/scummvm/commit/8862a714790883a577a842fe6e5137929ebf0bea
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Free cursor on exit
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 4c693151ee7..a95c4fe9ddc 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -328,6 +328,7 @@ App::~App() {
g_engine->_textManager->Quit();
g_engine->_inputManager->Quit();
g_engine->_loadingScreen->Quit();
+ g_engine->_mouse->Quit();
#if 0
// SteamAPI_Shutdown();
Commit: 4e9416d900be704f5464dd10aedce0c12a3041a3
https://github.com/scummvm/scummvm/commit/4e9416d900be704f5464dd10aedce0c12a3041a3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix incorrrect order of calls for InputManager
Changed paths:
engines/crab/app.cpp
engines/crab/crab.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index a95c4fe9ddc..4d67f4fbe91 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -118,7 +118,6 @@ bool App::Init() {
g_engine->_inputManager->AddController();
#endif
// Initialize and load input
- g_engine->_inputManager->Init();
LoadSettings("res/settings.xml");
g_engine->_screenSettings->in_game = false;
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 15d5d4435b4..7459d6c6f11 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -132,6 +132,7 @@ Common::Error CrabEngine::run() {
CursorMan.showMouse(true);
_mouse->Reset();
+ _inputManager->Init();
_inputManager->PopulateKeyTable();
_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
Commit: 225f393d10ba55953b24a2689b56cd0c2f87dd5c
https://github.com/scummvm/scummvm/commit/225f393d10ba55953b24a2689b56cd0c2f87dd5c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix memleaks in level
Changed paths:
engines/crab/level/level.cpp
engines/crab/level/level.h
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 8acfee30de3..011071cded7 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -64,6 +64,8 @@ void Level::Reset() {
first_hit = true;
music.id = -1;
preview_path.clear();
+
+ img.Delete();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 5d35c697110..c299820c4c0 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -143,7 +143,7 @@ public:
// A full rendered image of the level
pyrodactyl::image::Image img;
- Level() { Reset(); }
+ Level() : player_index(0) { Reset(); }
~Level() { Reset(); }
void Reset();
Commit: 6d3bf8cb8598c454f7026742143822d966cd928b
https://github.com/scummvm/scummvm/commit/6d3bf8cb8598c454f7026742143822d966cd928b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix memleak due to PathfindingAgent not being reset
Changed paths:
engines/crab/animation/sprite.h
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index e73bf0d4a7e..b84ae290424 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -121,7 +121,7 @@ public:
Common::List<CollisionData> collide_data;
Sprite();
- ~Sprite() {}
+ ~Sprite() { pathing.reset(); }
void Visible(bool val) { visible.Result(val); }
bool Visible() { return visible.Result(); }
Commit: 7a028f0265d0e3f43a71b2dc04ad11c4c6efb67d
https://github.com/scummvm/scummvm/commit/7a028f0265d0e3f43a71b2dc04ad11c4c6efb67d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix memleaks due to image textures not being freed in map
Changed paths:
engines/crab/ui/map.h
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 1377029d1a4..06dad6a1db5 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -113,7 +113,10 @@ public:
cur = 0;
overlay = true;
}
- ~Map() {}
+ ~Map() {
+ img_bg.Delete();
+ img_overlay.Delete();
+ }
void Load(const Common::String &filename, pyrodactyl::event::Info &info);
Commit: 3fb26d00819dde344bff34b6acd3054a0b242a55
https://github.com/scummvm/scummvm/commit/3fb26d00819dde344bff34b6acd3054a0b242a55
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix memleak in Level::PreDraw
Changed paths:
engines/crab/level/level_draw.cpp
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 183b1c5ef21..680cb9b62c7 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -40,7 +40,6 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
using namespace pyrodactyl::input;
-
// Purpose: Pre render the terrain layer
void Level::PreDraw() {
Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(terrain.W(), terrain.H(), *g_engine->_format);
@@ -58,6 +57,7 @@ void Level::PreDraw() {
PreDrawObjects(surf);
img.Load(surf);
+ delete surf;
}
//------------------------------------------------------------------------
@@ -76,7 +76,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
g_engine->_imageManager->tileset.Draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].PosRect(), img);
Vector2i pos = objects[player_index].ai_data.dest;
- Rect newpos(pos.x - (dest_marker.size.x/2), pos.y - (dest_marker.size.y/2), dest_marker.size.x, dest_marker.size.y);
+ Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
@@ -144,7 +144,7 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
dest_marker.Draw(objects[player_index].ai_data.dest, camera);
Vector2i pos = objects[player_index].ai_data.dest;
- Rect newpos(pos.x - (dest_marker.size.x/2), pos.y - (dest_marker.size.y/2), dest_marker.size.x, dest_marker.size.y);
+ Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
if (terrain.prop.empty()) {
for (auto &entry : obj_seq) {
Commit: 3a10a273b7023ad8cde785ff0d477ef51900c855
https://github.com/scummvm/scummvm/commit/3a10a273b7023ad8cde785ff0d477ef51900c855
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove uneeded if block
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 4d67f4fbe91..081117e7157 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -297,8 +297,7 @@ void App::Run() {
}
}
- if (CurrentState)
- delete CurrentState;
+ delete CurrentState;
}
void App::LoadSettings(const Common::String &filename) {
Commit: fa96b846401e82a89aec38a3e41c934ad7a40a1e
https://github.com/scummvm/scummvm/commit/fa96b846401e82a89aec38a3e41c934ad7a40a1e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rework keymapper logic
Changed paths:
engines/crab/input/input.cpp
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index f6e4d916295..7e3ebae1a71 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -111,6 +111,21 @@ void InputManager::Init() {
const Common::String DEFAULT_FILENAME = "res/controls.xml";
Load(DEFAULT_FILENAME);
+ //g_engine->getEventManager()->getKeymapper()->cleanupGameKeymaps();
+
+ /*
+ Common::Keymap *keymap = gameKeymaps;
+ for (Common::Action *a: hudKeymaps->getActions()) {
+ keymap->addAction(a);
+ }
+
+ keymap = uiKeymaps;
+ for (Common::Action *a: hudKeymaps->getActions()) {
+ keymap->addAction(a);
+ }
+ */
+
+
#if 0
const Common::String DEFAULT_FILENAME = "res/controls.xml";
@@ -212,13 +227,18 @@ Common::String InputManager::GetAssociatedKey(const InputType &type) {
if (_keyDescs[type].size() > 0)
return _keyDescs[type];
- Common::Keymap *keymap = g_system->getEventManager()->getKeymapper()->getKeymap("Unrest");
- const Common::Keymap::ActionArray actions = keymap->getActions();
- for (Common::Action *action : actions) {
- if ((int)action->event.customType == type) {
- _keyDescs[type] = Common::String(keymap->getActionMapping(action)[0].description);
- _keyDescs[type].toUppercase();
- break;
+ Common::KeymapArray keymaparr = g_system->getEventManager()->getKeymapper()->getKeymaps();
+ for(Common::Keymap *keymap : keymaparr) {
+ if (keymap->getType() != Common::Keymap::kKeymapTypeGame)
+ continue;
+
+ const Common::Keymap::ActionArray actions = keymap->getActions();
+ for (Common::Action *action : actions) {
+ if ((int)action->event.customType == type) {
+ _keyDescs[type] = Common::String(keymap->getActionMapping(action)[0].description);
+ _keyDescs[type].toUppercase();
+ break;
+ }
}
}
@@ -267,7 +287,7 @@ void InputManager::Save() {
Common::Keymap* InputManager::GetDefaultKeyMapsForGame() {
using namespace Common;
- Keymap *keymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest", "Keymappings for Game");
+ Keymap *keymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest-Game", "Keymappings for Game");
Action *act;
@@ -307,7 +327,7 @@ Common::Keymap* InputManager::GetDefaultKeyMapsForGame() {
Common::Keymap* InputManager::GetDefaultKeyMapsForUI() {
using namespace Common;
- Keymap *uiKeymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest", "Keymappings for UI");
+ Keymap *uiKeymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest-UI", "Keymappings for UI");
Action *act;
@@ -377,7 +397,7 @@ Common::Keymap* InputManager::GetDefaultKeyMapsForUI() {
Common::Keymap* InputManager::GetDefaultKeyMapsForHUD() {
using namespace Common;
- Keymap *hudKeymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest", "Keymappings for HUD");
+ Keymap *hudKeymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest-HUD", "Keymappings for HUD");
Action *act;
@@ -407,30 +427,21 @@ Common::Keymap* InputManager::GetDefaultKeyMapsForHUD() {
void InputManager::SetKeyBindingMode(KeyBindingMode mode) {
_keyMode = mode;
- Common::Keymap *gameKeymaps = GetDefaultKeyMapsForGame();
- Common::Keymap *uiKeymaps = GetDefaultKeyMapsForUI();
- Common::Keymap *hudKeymaps = GetDefaultKeyMapsForHUD();
-
Common::Keymapper *const mapper = g_engine->getEventManager()->getKeymapper();
- mapper->cleanupGameKeymaps();
+ mapper->disableAllGameKeymaps();
- Common::Keymap *keymap;
+ mapper->setGameKeymapState("Unrest-HUD", true);
switch (mode) {
case KBM_GAME:
- keymap = gameKeymaps;
+ mapper->setGameKeymapState("Unrest-Game", true);
break;
case KBM_UI:
- keymap = uiKeymaps;
+ mapper->setGameKeymapState("Unrest-UI", true);
break;
}
- for (Common::Action *a: hudKeymaps->getActions()) {
- keymap->addAction(a);
- }
-
- mapper->addGameKeymap(keymap);
// Clear All inputs
ClearInputs();
Commit: 828b29e42249f511ce63f5ae9f5478238720985f
https://github.com/scummvm/scummvm/commit/828b29e42249f511ce63f5ae9f5478238720985f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix memleak in PathfindingGrid
Changed paths:
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index a348dcbac57..61986ef0505 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -40,17 +40,37 @@ PathfindingGrid::PathfindingGrid(void) {
openCost = OPEN;
stairsCost = STAIRS;
nodes = nullptr;
+
+ dimensions.x = 0;
+ dimensions.y = 0;
+
+ cellSize.x = 0.0;
+ cellSize.y = 0.0;
}
PathfindingGrid::~PathfindingGrid(void) {
+ Reset();
+}
+
+void PathfindingGrid::Reset() {
for (int x = 0; x < dimensions.x; ++x) {
delete[] nodes[x];
}
delete[] nodes;
+ nodes = nullptr;
+
+ dimensions.x = 0;
+ dimensions.y = 0;
+
+ cellSize.x = 0.0;
+ cellSize.y = 0.0;
}
void PathfindingGrid::SetupNodes(TMXMap map) {
+ // delete nodes if they exist
+ Reset();
+
dimensions.x = map.path_rows; // Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
dimensions.y = map.path_cols;
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 07580fad624..e9eb964a3e0 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -67,6 +67,8 @@ public:
PathfindingGrid(void);
~PathfindingGrid(void);
+ void Reset();
+
void SetupNodes(TMX::TMXMap map);
// Return the node at the given point (SZ)
Commit: b4ed1635e7fe080817257d851cebbd221a2fcd84
https://github.com/scummvm/scummvm/commit/b4ed1635e7fe080817257d851cebbd221a2fcd84
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do no render text if it only contains whitespace
Changed paths:
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index ab1edc0c192..ea52b2dd32d 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -147,6 +147,8 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
const FontKey &fontk, const Align &align, const bool &background) {
//warning("STUB: TextManager::Draw()");
+ if (text == " ") return;
+
int pos = Search(text, color, fontk);
if (pos == -1) {
pos = FindFreeSlot();
Commit: 0af468927f66be896fc2342e7f1b8d4b36f90fdf
https://github.com/scummvm/scummvm/commit/0af468927f66be896fc2342e7f1b8d4b36f90fdf
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add texture rotation for properly rendering textures
Changed paths:
engines/crab/image/Image.cpp
engines/crab/image/Image.h
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index c84dff0dbcb..b14edb8d800 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -28,10 +28,8 @@
*
*/
-#include "graphics/blit.h"
#include "crab/crab.h"
#include "crab/image/Image.h"
-#include "image/png.h"
using ImageDecoder = Image::PNGDecoder;
@@ -150,15 +148,15 @@ bool Image::Load(const Image &image, Rect *clip, const TextureFlipType &flip) {
texture = new Graphics::ManagedSurface();
texture->copyFrom(image.texture->getSubArea(srcRect));
- switch(flip) {
- case FLIP_NONE:
+ switch (flip) {
+ case FLIP_NONE:
break;
- case FLIP_X:
+ case FLIP_X:
texture->surfacePtr()->flipHorizontal(Common::Rect(texture->w, texture->h));
break;
- default:
+ default:
warning("Flipped texture: %d", flip);
}
@@ -241,15 +239,51 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
break;
}
#endif
+}
+Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, byte rotation) {
+ assert(!src.empty());
+ assert(src.w == src.h);
+ assert(rotation >= 1 && rotation <= 2);
+ assert(src.format.bytesPerPixel == 4);
+
+ Graphics::Surface *dest = new Graphics::Surface();
+ dest->create(src.w, src.h, src.format);
+
+ const uint size = src.w;
+ const uint32 *s = (const uint32 *)src.getBasePtr(0, 0);
+
+ switch (rotation) {
+ case 1 :
+ // 90 degrees
+ for (uint y = 0; y < size; ++y) {
+ for (uint x = 0; x < size; ++x, ++s) {
+ *((uint32 *)dest->getBasePtr(size - y - 1, x)) = *s;
+ }
+ }
+
+ break;
+
+ case 2 :
+ // 270 degrees
+ for (uint y = 0; y < size; ++y) {
+ for (uint x = 0; x < size; ++x, ++s) {
+ *((uint32 *)dest->getBasePtr(y, size - x - 1)) = *s;
+ }
+ }
+
+ break;
+ }
+
+ return dest;
}
void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip, Graphics::ManagedSurface *surf) {
if (surf == NULL)
surf = g_engine->_screen;
- Common::Rect srcRect {0, 0, static_cast<int16>(w + 0), static_cast<int16>(h + 0)};
- Common::Rect destRect {static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
+ Common::Rect srcRect{0, 0, static_cast<int16>(w + 0), static_cast<int16>(h + 0)};
+ Common::Rect destRect{static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
if (clip) {
srcRect = {static_cast<int16>(clip->x), static_cast<int16>(clip->y), static_cast<int16>(clip->x + clip->w), static_cast<int16>(clip->y + clip->h)};
@@ -260,19 +294,48 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
Graphics::ManagedSurface s;
s.copyFrom(texture->getSubArea(srcRect));
+ Graphics::Surface *rotated_surf = nullptr;
+
switch(flip) {
- case FLIP_NONE:
+ case FLIP_NONE:
break;
- case FLIP_X:
+ case FLIP_X:
s.surfacePtr()->flipHorizontal(Common::Rect(s.w, s.h));
break;
- case FLIP_Y:
+ case FLIP_Y:
s.surfacePtr()->flipVertical(Common::Rect(s.w, s.h));
break;
- default:
+ case FLIP_XY:
+ s.surfacePtr()->flipHorizontal(Common::Rect(s.w, s.h));
+ s.surfacePtr()->flipVertical(Common::Rect(s.w, s.h));
+ break;
+
+ case FLIP_D:
+ s.surfacePtr()->flipHorizontal(Common::Rect(s.w, s.h));
+ rotated_surf = rotate(s, 2);
+ s.copyFrom(rotated_surf);
+ break;
+
+ case FLIP_DX:
+ rotated_surf = rotate(s, 1);
+ s.copyFrom(rotated_surf);
+ break;
+
+ case FLIP_DY:
+ rotated_surf = rotate(s, 2);
+ s.copyFrom(rotated_surf);
+ break;
+
+ case FLIP_XYD:
+ s.surfacePtr()->flipVertical(Common::Rect(s.w, s.h));
+ rotated_surf = rotate(s, 2);
+ s.copyFrom(rotated_surf);
+ break;
+
+ default:
warning("Flipped texture: %d", flip);
}
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 63180de74a1..3132fad51b0 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -55,6 +55,8 @@ public:
Image() : texture(nullptr), w(0), h(0) {}
~Image() {}
+ Graphics::Surface* rotate(const Graphics::ManagedSurface &src, byte rotation);
+
// Set color modulation
void Color(const uint8 &r, const uint8 &g, const uint8 &b) {
#if 0
Commit: 0a9370d77c7ea2a9c04537f783e1e6a6a335d6d4
https://github.com/scummvm/scummvm/commit/0a9370d77c7ea2a9c04537f783e1e6a6a335d6d4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Skip PreDraw if it is an ImageLayer
Changed paths:
engines/crab/TMX/TMXTileSet.cpp
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 5af519a92b0..ba6684c0fe8 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -100,6 +100,9 @@ void TileSet::PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::Manag
}
void TileSetGroup::PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf) {
+ if (layer.type == LAYER_IMAGE)
+ return;
+
start.x = 0;
start.y = 0;
@@ -141,6 +144,10 @@ void TileSetGroup::PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics:
}
void TileSetGroup::ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos) {
+
+ if (layer.type == LAYER_IMAGE)
+ return;
+
layer.collide = layer.pos.Collide(player_pos);
// Normal and prop layers are drawn this way
Commit: 44fd620ea62017e42c1008e10a87bda10ee62e4e
https://github.com/scummvm/scummvm/commit/44fd620ea62017e42c1008e10a87bda10ee62e4e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use enum instead of arbitary numbers for rotation
Changed paths:
engines/crab/image/Image.cpp
engines/crab/image/Image.h
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index b14edb8d800..38dd5833cfa 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -241,7 +241,7 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
#endif
}
-Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, byte rotation) {
+Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, ImageRotateDegrees rotation) {
assert(!src.empty());
assert(src.w == src.h);
assert(rotation >= 1 && rotation <= 2);
@@ -254,8 +254,7 @@ Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, byte rotat
const uint32 *s = (const uint32 *)src.getBasePtr(0, 0);
switch (rotation) {
- case 1 :
- // 90 degrees
+ case kImageRotateBy90:
for (uint y = 0; y < size; ++y) {
for (uint x = 0; x < size; ++x, ++s) {
*((uint32 *)dest->getBasePtr(size - y - 1, x)) = *s;
@@ -264,8 +263,7 @@ Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, byte rotat
break;
- case 2 :
- // 270 degrees
+ case kImageRotateBy270:
for (uint y = 0; y < size; ++y) {
for (uint x = 0; x < size; ++x, ++s) {
*((uint32 *)dest->getBasePtr(y, size - x - 1)) = *s;
@@ -315,23 +313,23 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
case FLIP_D:
s.surfacePtr()->flipHorizontal(Common::Rect(s.w, s.h));
- rotated_surf = rotate(s, 2);
+ rotated_surf = rotate(s, kImageRotateBy270);
s.copyFrom(rotated_surf);
break;
case FLIP_DX:
- rotated_surf = rotate(s, 1);
+ rotated_surf = rotate(s, kImageRotateBy90);
s.copyFrom(rotated_surf);
break;
case FLIP_DY:
- rotated_surf = rotate(s, 2);
+ rotated_surf = rotate(s, kImageRotateBy270);
s.copyFrom(rotated_surf);
break;
case FLIP_XYD:
s.surfacePtr()->flipVertical(Common::Rect(s.w, s.h));
- rotated_surf = rotate(s, 2);
+ rotated_surf = rotate(s, kImageRotateBy270);
s.copyFrom(rotated_surf);
break;
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 3132fad51b0..afd14d448ca 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -49,13 +49,18 @@ class Image {
// The actual hardware texture
//SDL_Texture *texture;
+ enum ImageRotateDegrees {
+ kImageRotateBy90,
+ kImageRotateBy270
+ };
+
public:
Graphics::ManagedSurface *texture;
Image() : texture(nullptr), w(0), h(0) {}
~Image() {}
- Graphics::Surface* rotate(const Graphics::ManagedSurface &src, byte rotation);
+ Graphics::Surface* rotate(const Graphics::ManagedSurface &src, ImageRotateDegrees rotation);
// Set color modulation
void Color(const uint8 &r, const uint8 &g, const uint8 &b) {
Commit: 77726cc2a446817d3511f101e23b33833a76fec8
https://github.com/scummvm/scummvm/commit/77726cc2a446817d3511f101e23b33833a76fec8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add rotation by 180 degrees
Changed paths:
engines/crab/image/Image.cpp
engines/crab/image/Image.h
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 38dd5833cfa..f64ca61cfa8 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -244,7 +244,6 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, ImageRotateDegrees rotation) {
assert(!src.empty());
assert(src.w == src.h);
- assert(rotation >= 1 && rotation <= 2);
assert(src.format.bytesPerPixel == 4);
Graphics::Surface *dest = new Graphics::Surface();
@@ -263,6 +262,20 @@ Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, ImageRotat
break;
+ case kImageRotateBy180: {
+ // 180 degrees
+ uint32 *d;
+ for (uint y = 0; y < size; ++y) {
+ const uint32 *e = (const uint32 *)src.getBasePtr(size - 1, y);
+ d = (uint32 *)dest->getBasePtr(size - 1, size - y - 1);
+ for (; s < e; ++s, --d) {
+ *d = *s;
+ }
+ }
+
+ break;
+ }
+
case kImageRotateBy270:
for (uint y = 0; y < size; ++y) {
for (uint x = 0; x < size; ++x, ++s) {
@@ -307,8 +320,8 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
break;
case FLIP_XY:
- s.surfacePtr()->flipHorizontal(Common::Rect(s.w, s.h));
- s.surfacePtr()->flipVertical(Common::Rect(s.w, s.h));
+ rotated_surf = rotate(s, kImageRotateBy180);
+ s.copyFrom(rotated_surf);
break;
case FLIP_D:
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index afd14d448ca..cafa9abf437 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -51,6 +51,7 @@ class Image {
enum ImageRotateDegrees {
kImageRotateBy90,
+ kImageRotateBy180,
kImageRotateBy270
};
Commit: a7df9e6964255615d94cba4b8f050f1c1b50aec9
https://github.com/scummvm/scummvm/commit/a7df9e6964255615d94cba4b8f050f1c1b50aec9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup unnecessary static_casts in various Image drawing functions
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index f64ca61cfa8..7ec9201818b 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -140,10 +140,10 @@ bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
bool Image::Load(const Image &image, Rect *clip, const TextureFlipType &flip) {
Delete();
- Common::Rect srcRect {0, 0, static_cast<int16>(w + 0), static_cast<int16>(h + 0)};
+ Common::Rect srcRect (0, 0, w, h);
if (clip)
- srcRect = {static_cast<int16>(clip->x), static_cast<int16>(clip->y), static_cast<int16>(clip->x + clip->w), static_cast<int16>(clip->y + clip->h)};
+ srcRect = Common::Rect(clip->x, clip->y, clip->x + clip->w, clip->y + clip->h);
texture = new Graphics::ManagedSurface();
texture->copyFrom(image.texture->getSubArea(srcRect));
@@ -175,10 +175,10 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
if (clip != NULL) {
srcRect = *clip;
} else {
- srcRect = Common::Rect{static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
+ srcRect = Common::Rect(x, y, w + x, h + y);
}
- Common::Rect destRect {static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
+ Common::Rect destRect(x, y, w + x, h + y);
if (clip != NULL) {
destRect.right = clip->right;
destRect.bottom = clip->bottom;
@@ -293,11 +293,11 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
if (surf == NULL)
surf = g_engine->_screen;
- Common::Rect srcRect{0, 0, static_cast<int16>(w + 0), static_cast<int16>(h + 0)};
- Common::Rect destRect{static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
+ Common::Rect srcRect(0, 0, w, h);
+ Common::Rect destRect(x, y, w + x, h + y);
if (clip) {
- srcRect = {static_cast<int16>(clip->x), static_cast<int16>(clip->y), static_cast<int16>(clip->x + clip->w), static_cast<int16>(clip->y + clip->h)};
+ srcRect = Common::Rect(clip->x, clip->y, clip->x + clip->w, clip->y + clip->h);
destRect.right = static_cast<int16>(clip->w + x);
destRect.bottom = static_cast<int16>(clip->h + y);
}
@@ -355,7 +355,7 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
}
void Image::FastDraw(const int &x, const int &y, Rect *clip) {
- Common::Rect destRect {static_cast<int16>(x), static_cast<int16>(y), static_cast<int16>(w + x), static_cast<int16>(h + y)};
+ Common::Rect destRect(x, y, w + x, h + y);
int in_y = 0, in_x = 0;
if (clip) {
Commit: 883e467c2dc8c546a7c933bf7d517fbea24aa590
https://github.com/scummvm/scummvm/commit/883e467c2dc8c546a7c933bf7d517fbea24aa590
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove and Cleanup unneeded code
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 7ec9201818b..7ee688dbe57 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -47,19 +47,6 @@ bool Image::Load(Graphics::Surface *surface) {
w = surface->w;
h = surface->h;
return true;
-#if 0
- // Create texture from surface pixels
- texture = SDL_CreateTextureFromSurface(gRenderer, surface);
- if (texture == NULL) {
- fprintf(stderr, "Unable to create texture from SDL_Surface! SDL Error: %s\n", SDL_GetError());
- return false;
- }
-
- // Get image dimensions
- w = surface->w;
- h = surface->h;
- return true;
-#endif
}
bool Image::Load(Graphics::ManagedSurface *surface) {
@@ -68,19 +55,6 @@ bool Image::Load(Graphics::ManagedSurface *surface) {
w = surface->w;
h = surface->h;
return true;
-#if 0
- // Create texture from surface pixels
- texture = SDL_CreateTextureFromSurface(gRenderer, surface);
- if (texture == NULL) {
- fprintf(stderr, "Unable to create texture from SDL_Surface! SDL Error: %s\n", SDL_GetError());
- return false;
- }
-
- // Get image dimensions
- w = surface->w;
- h = surface->h;
- return true;
-#endif
}
bool Image::Load(const Common::String &path) {
@@ -104,30 +78,6 @@ bool Image::Load(const Common::String &path) {
}
return texture != nullptr;
-
-#if 0
- SDL_Surface *loadedSurface = IMG_Load(path.c_str());
- if (loadedSurface == NULL) {
- fprintf(stderr, "Unable to load image %s! SDL_image Error: %s\n", path.c_str(), IMG_GetError());
- } else {
- // Create texture from surface pixels
- texture = SDL_CreateTextureFromSurface(gRenderer, loadedSurface);
-
- if (texture == NULL)
- fprintf(stderr, "Unable to create texture from %s! SDL Error: %s\n", path.c_str(), SDL_GetError());
- else {
- // Get image dimensions
- w = loadedSurface->w;
- h = loadedSurface->h;
- }
-
- // Get rid of old loaded surface
- SDL_FreeSurface(loadedSurface);
- }
-
- // Return success
- return texture != NULL;
-#endif
}
bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
@@ -140,7 +90,7 @@ bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
bool Image::Load(const Image &image, Rect *clip, const TextureFlipType &flip) {
Delete();
- Common::Rect srcRect (0, 0, w, h);
+ Common::Rect srcRect(0, 0, w, h);
if (clip)
srcRect = Common::Rect(clip->x, clip->y, clip->x + clip->w, clip->y + clip->h);
@@ -186,59 +136,6 @@ void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
// TODO: Do proper clipping
g_engine->_screen->blitFrom(*texture, Common::Point(static_cast<int16>(x), static_cast<int16>(y)));
- //g_engine->_renderSurface->blitFrom(*texture, Common::Point(x, y));
- //g_engine->_renderSurface->copyRectToSurface(texture->getPixels(), texture->pitch, x, y, texture->w, texture->h);
-#if 0
- // Set rendering space and render to screen
- SDL_Rect renderQuad = {x, y, w, h};
-
- // Set clip rendering dimensions
- if (clip != NULL) {
- renderQuad.w = clip->w;
- renderQuad.h = clip->h;
- }
-
- switch (flip) {
- case FLIP_NONE:
- // Render to screen
- SDL_RenderCopy(gRenderer, texture, clip, &renderQuad);
- break;
- case FLIP_X:
- // Bottom right <-> Bottom left
- // Top right <-> Top left
- SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 0, NULL, SDL_FLIP_HORIZONTAL);
- break;
- case FLIP_Y:
- // Top right <-> Bottom right
- // Top left <-> Bottom left
- SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 0, NULL, SDL_FLIP_VERTICAL);
- break;
- case FLIP_XY:
- // Top right <-> Bottom left
- // Top left <-> Bottom right
- SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 180, NULL, SDL_FLIP_NONE);
- break;
- case FLIP_D:
- // Top left <-> Bottom right
- SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_HORIZONTAL);
- break;
- case FLIP_DX:
- // Rotate 90 degrees clockwise
- SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 90, NULL, SDL_FLIP_NONE);
- break;
- case FLIP_DY:
- // Rotate 270 degrees clockwise
- SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_NONE);
- break;
- case FLIP_XYD:
- // This is just flipping across the diagonal, instead of the anti-diagonal
- // Top right <-> Bottom left
- SDL_RenderCopyEx(gRenderer, texture, clip, &renderQuad, 270, NULL, SDL_FLIP_VERTICAL);
- break;
- default:
- break;
- }
-#endif
}
Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, ImageRotateDegrees rotation) {
@@ -351,7 +248,6 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
}
surf->blitFrom(s, Common::Rect(s.w, s.h), destRect);
- //g_engine->_renderSurface->blitFrom(s, Common::Rect(s->w, s->h), destRect);
}
void Image::FastDraw(const int &x, const int &y, Rect *clip) {
Commit: f2cc4568f4eefd5e16334e94b06e89b2e1908a44
https://github.com/scummvm/scummvm/commit/f2cc4568f4eefd5e16334e94b06e89b2e1908a44
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix bug where start.x could be less than 0
Changed paths:
engines/crab/TMX/TMXTileSet.cpp
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index ba6684c0fe8..a6eac076170 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -155,6 +155,9 @@ void TileSetGroup::ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i
start.x = player_pos.y / tile_size.y;
start.y = player_pos.x / tile_size.x;
+ if(start.x < 0 || start.y < 0)
+ return;
+
// The row and column we end drawing at
finish.x = (player_pos.y + player_pos.h) / tile_size.y + 1;
finish.y = (player_pos.x + player_pos.w) / tile_size.x + 1;
Commit: e5cc0bda7158dc12814efee238de0f34a1c56831
https://github.com/scummvm/scummvm/commit/e5cc0bda7158dc12814efee238de0f34a1c56831
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix error due to which last tiles in a scene weren't drawn
Changed paths:
engines/crab/TMX/TMXTileSet.cpp
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index a6eac076170..fb07cca77e2 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -106,8 +106,8 @@ void TileSetGroup::PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics:
start.x = 0;
start.y = 0;
- finish.x = layer.tile.size() - 1;
- finish.y = layer.tile[0].size() - 1;
+ finish.x = layer.tile.size();
+ finish.y = layer.tile[0].size();
v.x = start.y * tile_size.x;
v.y = start.x * tile_size.y;
Commit: dbbfd39405f729143f1bd64c1129fcfd4bfaa458
https://github.com/scummvm/scummvm/commit/dbbfd39405f729143f1bd64c1129fcfd4bfaa458
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub Button::ImageCaptionOnlyDraw
Changed paths:
engines/crab/ui/button.cpp
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 04187fd5a15..2a56ba21754 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -121,9 +121,6 @@ void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
}
void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
- warning("STUB: Button::ImageCaptionOnly()");
-
-#if 0
if (visible) {
if (mousepressed) {
g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.select, clip);
@@ -136,7 +133,6 @@ void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *
caption.Draw(false, XOffset, YOffset);
}
}
-#endif
}
void Button::HoverInfoOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
Commit: bab60b050a3fc33a3038ab0bbcda83660a4fa82c
https://github.com/scummvm/scummvm/commit/bab60b050a3fc33a3038ab0bbcda83660a4fa82c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub SectionHeader::Load
Changed paths:
engines/crab/ui/SectionHeader.cpp
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index a0ccd8f9d4e..b94481eb81d 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -38,12 +38,10 @@ using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
void SectionHeader::Load(rapidxml::xml_node<char> *node) {
- warning("STUB: SectionHeader::Load()");
-#if 0
if (TextData::Load(node, NULL, false)) {
LoadStr(text, "text", node);
- text.insert(0, " ");
+ text.insertChar(' ', 0);
text += " ";
LoadImgKey(img, "img", node);
@@ -51,7 +49,7 @@ void SectionHeader::Load(rapidxml::xml_node<char> *node) {
LoadBool(draw_l, "left", node);
LoadBool(draw_r, "right", node);
- SDL_Surface *surf = g_engine->_textManager->RenderTextBlended(font, text, col);
+ Graphics::ManagedSurface *surf = g_engine->_textManager->RenderTextBlended(font, text, col);
if (align == ALIGN_CENTER) {
left.x = x - surf->w / 2 - g_engine->_imageManager->GetTexture(img).W();
@@ -73,9 +71,8 @@ void SectionHeader::Load(rapidxml::xml_node<char> *node) {
right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
}
- SDL_FreeSurface(surf);
+ delete surf;
}
-#endif
}
Commit: a4aff67661e0bc090164017e5b4b373dfcb1ad23
https://github.com/scummvm/scummvm/commit/a4aff67661e0bc090164017e5b4b373dfcb1ad23
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add backInserter()
Changed paths:
A engines/crab/backInserter.h
diff --git a/engines/crab/backInserter.h b/engines/crab/backInserter.h
new file mode 100644
index 00000000000..bbef026c0db
--- /dev/null
+++ b/engines/crab/backInserter.h
@@ -0,0 +1,39 @@
+#include "crab/common_header.h"
+
+#ifndef CRAB_BACKINSERTER_H
+#define CRAB_BACKINSERTER_H
+
+namespace Crab {
+
+template<class Container>
+class backInserterIterator {
+protected:
+ Container *_container;
+
+public:
+ explicit backInserterIterator(Container& x) : _container(&x) {}
+
+ backInserterIterator& operator=(const typename Container::value_type& value) {
+ *_container += value;
+ return *this;
+ }
+
+ backInserterIterator& operator=(const typename Container::value_type&& value) {
+ *_container += Common::move(value);
+ return *this;
+ }
+
+ backInserterIterator& operator*() { return *this; }
+ backInserterIterator& operator++() { return *this; }
+ backInserterIterator& operator++(int) { return *this; }
+};
+
+template<class Container>
+backInserterIterator<Container>
+backInserter(Container &x) {
+ return backInserterIterator<Container>(x);
+}
+
+} // End of namespace Crab
+
+#endif
\ No newline at end of file
Commit: f1927067a509fd9210c6b100c380eb03e4458062
https://github.com/scummvm/scummvm/commit/f1927067a509fd9210c6b100c380eb03e4458062
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add necessary include for savefiles
Changed paths:
engines/crab/common_header.h
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 6cd75093d37..1e04bda01cc 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -42,6 +42,7 @@
#include "common/stream.h"
#include "common/file.h"
#include "common/events.h"
+#include "common/savefile.h"
#include "graphics/surface.h"
#include "graphics/managed_surface.h"
Commit: 934eef9cf193cf14aa5834bc18b57dcc784d43e1
https://github.com/scummvm/scummvm/commit/934eef9cf193cf14aa5834bc18b57dcc784d43e1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix boxy look incase of FLIP_XY
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 7ee688dbe57..bcec4bdef69 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -217,8 +217,8 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
break;
case FLIP_XY:
- rotated_surf = rotate(s, kImageRotateBy180);
- s.copyFrom(rotated_surf);
+ s.surfacePtr()->flipHorizontal(Common::Rect(s.w, s.h));
+ s.surfacePtr()->flipVertical(Common::Rect(s.w, s.h));
break;
case FLIP_D:
Commit: caabd15c4680b39ef950db7174187f995baa28a7
https://github.com/scummvm/scummvm/commit/caabd15c4680b39ef950db7174187f995baa28a7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Create a new constructor for XMLDoc()
Changed paths:
engines/crab/XMLDoc.h
diff --git a/engines/crab/XMLDoc.h b/engines/crab/XMLDoc.h
index 7deb64b998b..bd05f099fbd 100644
--- a/engines/crab/XMLDoc.h
+++ b/engines/crab/XMLDoc.h
@@ -47,6 +47,11 @@ public:
Load(filename);
}
+ XMLDoc(uint8 *data) {
+ text = (char*)data;
+ doc.parse<0>(text);
+ }
+
~XMLDoc() { delete[] text; }
// Load the text from the specified file into the rapidxml format
Commit: 125157fe3661c1a2c70c2a33e91df7eaa7134edd
https://github.com/scummvm/scummvm/commit/125157fe3661c1a2c70c2a33e91df7eaa7134edd
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make FileData compilable
Changed paths:
engines/crab/module.mk
engines/crab/ui/FileData.cpp
engines/crab/ui/FileData.h
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 65659e7da29..efc6254cb2b 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -82,6 +82,7 @@ MODULE_OBJS = \
ui/dialogbox.o \
ui/element.o \
ui/emotion.o \
+ ui/FileData.o \
ui/FileMenu.o \
ui/GameOverMenu.o \
ui/GeneralSettingMenu.o \
diff --git a/engines/crab/ui/FileData.cpp b/engines/crab/ui/FileData.cpp
index 7063c424d0a..78626b8c3b7 100644
--- a/engines/crab/ui/FileData.cpp
+++ b/engines/crab/ui/FileData.cpp
@@ -28,37 +28,32 @@
*
*/
+#include "crab/crab.h"
+#include "crab/common_header.h"
#include "crab/ui/FileData.h"
namespace Crab {
-include <iomanip>
-
using namespace pyrodactyl::ui;
-FileData::FileData(const boost::filesystem::path &filepath) {
- if (boost::filesystem::exists(filepath)) {
- name = boost::filesystem::basename(filepath);
- path = filepath.string();
+SaveFileData::SaveFileData(const Common::String &file) {
+ path = file;
-#if defined(__WIN32__) || defined(__APPLE__)
- std::time_t temp = boost::filesystem::last_write_time(filepath);
- last_modified = NumberToString(std::put_time(std::localtime(&temp), "%d %b %Y %H:%M:%S"));
-#else
- // Workaround for GNU C++ not having implemented std::put_time
- std::time_t temp = boost::filesystem::last_write_time(filepath);
- char timestr[100];
+ // Extract String between _ and . For eg., CRAB_Autosave 1.unr -> Autosave 1
+ // 4 => .unr
+ size_t pos = file.findFirstOf('_');
+ name = file.substr(pos + 1, file.size() - (pos + 1) - 4);
- std::strftime(timestr, sizeof(timestr), "%d %b %Y %H:%M:%S", std::localtime(&temp));
- last_modified = timestr;
-#endif
- } else
- name = "New Save";
-}
+ if (g_engine->getSaveFileManager()->exists(file)) {
+ Common::InSaveFile *savefile = g_engine->getSaveFileManager()->openForLoading(file);
-SaveFileData::SaveFileData(const boost::filesystem::path &filepath) : FileData(filepath) {
- if (boost::filesystem::exists(filepath)) {
- XMLDoc conf(filepath.string());
+ uint64 len = savefile->size();
+ uint8 *data = new uint8[len + 1];
+ data[len] = '\0';
+
+ savefile->read(data, len);
+
+ XMLDoc conf(data);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
if (NodeValid(node)) {
@@ -74,7 +69,9 @@ SaveFileData::SaveFileData(const boost::filesystem::path &filepath) : FileData(f
}
}
-ModFileData::ModFileData(boost::filesystem::path filepath) : FileData(filepath) {
+ModFileData::ModFileData(const Common::String &file) {
+
+#if 0
if (boost::filesystem::exists(filepath)) {
XMLDoc conf(filepath.string());
if (conf.ready()) {
@@ -88,6 +85,7 @@ ModFileData::ModFileData(boost::filesystem::path filepath) : FileData(filepath)
}
}
}
+#endif
}
} // End of namespace Crab
diff --git a/engines/crab/ui/FileData.h b/engines/crab/ui/FileData.h
index a11deafbbd0..5cd0fbeead4 100644
--- a/engines/crab/ui/FileData.h
+++ b/engines/crab/ui/FileData.h
@@ -42,7 +42,6 @@ namespace ui {
class FileData {
public:
Common::String name, path, last_modified;
- //FileData(const boost::filesystem::path &filepath);
};
class SaveFileData : public FileData {
@@ -52,14 +51,14 @@ public:
// This is to account for the first save slot, called "New Save", which doesn't actually have a file
bool blank;
- //SaveFileData(const boost::filesystem::path &filepath);
+ SaveFileData(const Common::String &filepath);
SaveFileData(const bool empty);
};
class ModFileData : public FileData {
public:
Common::String author, version, info, website, preview;
- //ModFileData(boost::filesystem::path filepath);
+ ModFileData(const Common::String &filepath);
};
// The types of data shown about the save file
@@ -76,6 +75,7 @@ enum { DATA_AUTHOR,
DATA_VERSION,
DATA_INFO,
DATA_WEBSITE };
+
const int DATA_HOVER_TOTAL = 4;
} // End of namespace ui
} // End of namespace pyrodactyl
Commit: 1b09c220c084b79b24bc576250019ea41012ec1e
https://github.com/scummvm/scummvm/commit/1b09c220c084b79b24bc576250019ea41012ec1e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not blit if height/width are invalid
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index bcec4bdef69..8eafb6bd5f2 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -202,6 +202,9 @@ void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
Graphics::ManagedSurface s;
s.copyFrom(texture->getSubArea(srcRect));
+ if (s.w < 1 || s.h < 1)
+ return;
+
Graphics::Surface *rotated_surf = nullptr;
switch(flip) {
Commit: e3e7c52c96769c2ea46a9e39bbc3277babf8bd5c
https://github.com/scummvm/scummvm/commit/e3e7c52c96769c2ea46a9e39bbc3277babf8bd5c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not try to open files if path is empty
Changed paths:
engines/crab/filesystem.cpp
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index eec5cf9c475..9e43bd89f9c 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -33,6 +33,9 @@
namespace Crab {
bool FileOpen(const Common::Path &path, char *&data) {
+ if (path.empty())
+ return false;
+
if (data != NULL)
delete[] data;
@@ -56,6 +59,9 @@ bool FileOpen(const Common::Path &path, char *&data) {
}
bool FileOpen(const Common::Path &path, Common::File *file) {
+ if (path.empty())
+ return false;
+
if (file->isOpen())
file->close();
Commit: de7f3dc064a9af58dd4fb87f86eb98e290bc8190
https://github.com/scummvm/scummvm/commit/de7f3dc064a9af58dd4fb87f86eb98e290bc8190
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement stubbed out functions in TextArea
Changed paths:
engines/crab/ui/textarea.cpp
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index f4283e01262..4bfd551c1d7 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -32,6 +32,7 @@
// Author: Arvind
// Purpose: TextArea functions
//=============================================================================
+#include "crab/crab.h"
#include "crab/ui/textarea.h"
namespace Crab {
@@ -56,6 +57,36 @@ void TextArea::Load(rapidxml::xml_node<char> *node) {
bool TextArea::HandleEvents(const Common::Event &Event, bool numbers_only) {
warning("STUB: TextArea::HandleEvents()");
+ if (Event.type == Common::EVENT_KEYDOWN && Event.kbd.ascii == Common::ASCII_BACKSPACE && text.size() != 0) {
+ // Now play the text erase sound
+ g_engine->_musicManager->PlayEffect(se_erase, 0);
+
+ // If backspace was pressed and the string isn't blank, remove a character from the end
+ text.erase(text.size() - 1);
+ } else if (Event.type == Common::EVENT_KEYDOWN) {
+ // If the string less than maximum size and does not contain invalid characters \ / : * ? " < > |
+ if (text.size() < size && Event.kbd.ascii != '\\' \
+ && Event.kbd.ascii != '/' && Event.kbd.ascii != ':' \
+ && Event.kbd.ascii != '*' && Event.kbd.ascii != '?' \
+ && Event.kbd.ascii != '\"' && Event.kbd.ascii != '<' \
+ && Event.kbd.ascii != '>' && Event.kbd.ascii != '|') {
+ // Should we only accept numbers?
+ if (numbers_only && (Event.kbd.ascii < '0' || Event.kbd.ascii > '9'))
+ return false;
+
+ // Now play the text input sound
+ g_engine->_musicManager->PlayEffect(se_entry, 0);
+
+ // Append the character to string
+ text += Event.kbd.ascii;
+ }
+ } else if (g_engine->_inputManager->State(IU_ACCEPT) && text.size() != 0) {
+ // Now play the accept sound
+ g_engine->_musicManager->PlayEffect(se_accept, 0);
+
+ return true;
+ }
+
return false;
}
@@ -65,9 +96,9 @@ bool TextArea::HandleEvents(const SDL_Event &Event, bool numbers_only) {
// If a key was pressed
if (Event.type == SDL_TEXTINPUT) {
// If the string less than maximum size and does not contain invalid characters \ / : * ? " < > |
- if (text.length() < size && Event.text.text[0] != '\\' && Event.text.text[0] != '/' && Event.text.text[0] != ':' && Event.text.text[0] != '*' && Event.text.text[0] != '?' && Event.text.text[0] != '\"' && Event.text.text[0] != '<' && Event.text.text[0] != '>' && Event.text.text[0] != '|') {
+ if (text.length() < size && Event.kbd.ascii != '\\' && Event.kbd.ascii != '/' && Event.kbd.ascii != ':' && Event.kbd.ascii != '*' && Event.kbd.ascii != '?' && Event.kbd.ascii != '\"' && Event.kbd.ascii != '<' && Event.kbd.ascii != '>' && Event.kbd.ascii != '|') {
// Should we only accept numbers?
- if (numbers_only && !isdigit(Event.text.text[0]))
+ if (numbers_only && !isdigit(Event.kbd.ascii))
return false;
// Now play the text input sound
Commit: 2dcc8f975e003ace40bb6bfb916364ad4c20aa54
https://github.com/scummvm/scummvm/commit/2dcc8f975e003ace40bb6bfb916364ad4c20aa54
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add rapidxml_print
Changed paths:
engines/crab/common_header.h
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
index 1e04bda01cc..d9c8966efd8 100644
--- a/engines/crab/common_header.h
+++ b/engines/crab/common_header.h
@@ -54,5 +54,6 @@
#define RAPIDXML_NO_EXCEPTIONS
#include "crab/rapidxml/rapidxml.hpp"
+#include "crab/rapidxml/rapidxml_print.hpp"
#endif // CRAB_COMMON_HEADER_H
Commit: c25edc3f8bbb9be458b9e8577968536527093f89
https://github.com/scummvm/scummvm/commit/c25edc3f8bbb9be458b9e8577968536527093f89
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement stubbed out Game::SaveStae()
Changed paths:
engines/crab/game.cpp
engines/crab/game.h
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 3869061a838..d074fdf7999 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/game.h"
+#include "crab/backInserter.h"
namespace Crab {
@@ -157,8 +158,8 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
g_engine->_mouse->HandleEvents(Event);
-// if (GameDebug)
-// debug_console.HandleEvents(Event);
+ // if (GameDebug)
+ // debug_console.HandleEvents(Event);
if (!debug_console.RestrictInput()) {
if (state == STATE_LOSE_MENU) {
@@ -661,7 +662,16 @@ void Game::ApplyResult(LevelResult result) {
// Purpose: Save/load game
//------------------------------------------------------------------------
void Game::LoadState(const Common::String &filename) {
- XMLDoc conf(filename);
+ Common::InSaveFile *file = g_engine->getSaveFileManager()->openForLoading(filename);
+
+ uint64 len = file->size();
+ uint8 *data = new uint8[len + 1];
+ data[len] = '\0';
+
+ file->read(data, len);
+
+ XMLDoc conf(data);
+
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
if (NodeValid(node)) {
@@ -699,9 +709,6 @@ void Game::LoadState(const Common::String &filename) {
// Purpose: Write game state to file
//------------------------------------------------------------------------
void Game::SaveState(const Common::String &filename, const bool &overwrite) {
- warning("STUB: Game::SaveState()");
-
-#if 0
rapidxml::xml_document<char> doc;
// xml declaration
@@ -761,8 +768,16 @@ void Game::SaveState(const Common::String &filename, const bool &overwrite) {
root->append_node(child_level);
Common::String xml_as_string;
- rapidxml::print(std::back_inserter(xml_as_string), doc);
+ rapidxml::print(Crab::backInserter(xml_as_string), doc);
+
+ Common::String full = FullPath(filename);
+
+ Common::OutSaveFile *outSaveFile = g_engine->getSaveFileManager()->openForSaving(full);
+ outSaveFile->writeString(xml_as_string);
+ delete outSaveFile;
+
+#if 0
Common::String fullpath = FullPath(filename);
// We don't check for duplicates for auto-saves and iron man saves
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 478573019ce..5c9f114a08f 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -115,11 +115,8 @@ private:
void CreateSaveGame(const SaveGameType &savetype);
Common::String FullPath(const Common::String &filename) {
- Common::String res = g_engine->_filePath->appdata;
- res += g_engine->_filePath->save_dir;
- res += filename;
+ Common::String res = "CRAB_" + filename;
res += g_engine->_filePath->save_ext;
-
return res;
}
Commit: b52ae746ae2ecef446247fb93c9332bd137bd50b
https://github.com/scummvm/scummvm/commit/b52ae746ae2ecef446247fb93c9332bd137bd50b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement necessary functions for save/load menu
Changed paths:
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 3df5f823111..a74c64147ec 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -42,47 +42,32 @@ void GameSaveMenu::Load(rapidxml::xml_node<char> *node) {
FileMenu<SaveFileData>::Load(node);
}
-#if 0
-void GameSaveMenu::AddButton(boost::filesystem::path p, unsigned int &slot_index, unsigned int &menu_index) {
+void GameSaveMenu::AddButton(const Common::String &p, unsigned int &slot_index, unsigned int &menu_index) {
slot_info.push_back(SaveFileData(p));
menu.Add(slot_index, menu_index);
}
void GameSaveMenu::ScanDir() {
- using namespace boost::filesystem;
+ Common::String res = "CRAB_*";
+ res += g_engine->_filePath->save_ext;
+ Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
slot_info.clear();
menu.Clear();
- path savedir(directory);
+ unsigned int count_slot = 0, count_menu = 0;
- if (!exists(savedir))
- create_directories(savedir);
+ // For the save menu, the first slot is a "blank" slot - to create a new save file
+ AddButton("CRAB_New Save" + g_engine->_filePath->save_ext, count_menu, count_slot);
- if (exists(savedir) && is_directory(savedir)) {
- directory_iterator dir_it(savedir);
- Common::Array<boost::filesystem::path> file_in_dir;
- file_in_dir.clear();
-
- // Find all files in the save directory, sort them according to last modified
- std::copy(directory_iterator(savedir), directory_iterator(), std::back_inserter(file_in_dir));
- std::sort(file_in_dir.begin(), file_in_dir.end(), PathCompare);
-
- unsigned int count_slot = 0, count_menu = 0;
-
- // For the save menu, the first slot is a "blank" slot - to create a new save file
- AddButton(g_engine->_filePath->save_dir + "New Save" + g_engine->_filePath->save_ext, count_menu, count_slot);
-
- // Next, we must load all the files with the same extension as our save file
- for (auto i = file_in_dir.begin(); i != file_in_dir.end(); ++i)
- if (is_regular_file(*i) && i->extension().string() == g_engine->_filePath->save_ext)
- AddButton(*i, count_menu, count_slot);
+ for (const Common::String& save : saves) {
+ AddButton(save, count_menu, count_slot);
}
menu.AssignPaths();
}
-bool GameSaveMenu::HandleEvents(const SDL_Event &Event) {
+bool GameSaveMenu::HandleEvents(const Common::Event &Event) {
int choice = -1;
switch (state) {
case STATE_NORMAL:
@@ -97,20 +82,26 @@ bool GameSaveMenu::HandleEvents(const SDL_Event &Event) {
ta_name.text = slot_info[index].name;
else
ta_name.text = "";
+
state = STATE_NAME;
}
break;
case STATE_NAME:
+ if (g_engine->_inputManager->GetKeyBindingMode() != input::KBM_UI)
+ g_engine->_inputManager->SetKeyBindingMode(KBM_UI);
+
if (ta_name.HandleEvents(Event)) {
- if (index <= slot_info.size() && index != 0)
- boost::filesystem::remove(slot_info[index].path);
+ if (index <= (int)slot_info.size() && index != 0)
+ g_engine->getSaveFileManager()->removeSavefile(slot_info[index].path);
+
selected = ta_name.text;
state = STATE_NORMAL;
Reset();
+ g_engine->_inputManager->SetKeyBindingMode(KBM_GAME);
return true;
}
- if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_RELEASED) {
+ if (g_engine->_inputManager->State(IU_BACK)) {
ta_name.text = "New Save";
state = STATE_NORMAL;
}
@@ -120,12 +111,6 @@ bool GameSaveMenu::HandleEvents(const SDL_Event &Event) {
return false;
}
-#endif
-
-bool GameSaveMenu::HandleEvents(const Common::Event &Event) {
- warning("STUB: GameSaveMenu::HandleEvents()");
- return false;
-}
void GameSaveMenu::Draw() {
bg.Draw();
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 9305a289b59..13360821980 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -51,9 +51,7 @@ class GameSaveMenu : public FileMenu<SaveFileData> {
// The index of the selected button
int index;
-#if 0
- void AddButton(boost::filesystem::path p, unsigned int &slot_index, unsigned int &menu_index);
-#endif
+ void AddButton(const Common::String &p, unsigned int &slot_index, unsigned int &menu_index);
public:
GameSaveMenu() {
Commit: b3fea6d2134d8a3e512083f0a3cfd32d6f450791
https://github.com/scummvm/scummvm/commit/b3fea6d2134d8a3e512083f0a3cfd32d6f450791
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Repopulate saves list when load/save menu are opened
Changed paths:
engines/crab/ui/PauseMenu.cpp
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 03329844848..391f1696d0f 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -81,11 +81,11 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
return PS_RESUME;
case 1:
state = STATE_SAVE;
- //save.ScanDir();
+ save.ScanDir();
break;
case 2:
state = STATE_LOAD;
- //g_engine->_loadMenu->ScanDir();
+ g_engine->_loadMenu->ScanDir();
break;
case 3:
state = STATE_OPTION;
Commit: e41cbbbd2203f97e5b6482a4f5f30cdff4c9500f
https://github.com/scummvm/scummvm/commit/e41cbbbd2203f97e5b6482a4f5f30cdff4c9500f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Allow loading saves from main menu
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 081117e7157..aefce201aa8 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -175,15 +175,9 @@ void App::Run() {
break;
case GAMESTATE_LOAD_GAME:
-#if 0
- if (boost::filesystem::exists(g_engine->_loadMenu->SelectedPath()))
- CurrentState = new Game(pyrodactyl::ui::.SelectedPath());
- else
- CurrentState = new Game();
-
+ CurrentState = new Game(g_engine->_loadMenu->SelectedPath());
g_engine->_screenSettings->in_game = true;
break;
-#endif
default:
// Encountering an undefined state, exit with an error code
Commit: d70de1ea86baceed3224b59c484d94c833994a2e
https://github.com/scummvm/scummvm/commit/d70de1ea86baceed3224b59c484d94c833994a2e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Explicity specify maximum number of slots
Changed paths:
engines/crab/metaengine.cpp
engines/crab/metaengine.h
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index 6e724e36cdf..47c6dadf5b0 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -107,6 +107,10 @@ bool CrabMetaEngine::hasFeature(MetaEngineFeature f) const {
(f == kSupportsLoadingDuringStartup);
}
+int CrabMetaEngine::getMaximumSaveSlot() const {
+ return 999;
+}
+
#if PLUGIN_ENABLED_DYNAMIC(CRAB)
REGISTER_PLUGIN_DYNAMIC(CRAB, PLUGIN_TYPE_ENGINE, CrabMetaEngine);
#else
diff --git a/engines/crab/metaengine.h b/engines/crab/metaengine.h
index f98bca9313a..1c5e5559f5f 100644
--- a/engines/crab/metaengine.h
+++ b/engines/crab/metaengine.h
@@ -71,6 +71,8 @@ public:
Common::KeymapArray initKeymaps(const char *target) const override;
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
+
+ virtual int getMaximumSaveSlot() const override;
};
#endif // CRAB_METAENGINE_H
Commit: 502e3603231032eb2c42bcba9d4ce1351f8a36eb
https://github.com/scummvm/scummvm/commit/502e3603231032eb2c42bcba9d4ce1351f8a36eb
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not support loading savegames directly
Changed paths:
engines/crab/metaengine.cpp
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index 47c6dadf5b0..e08014fd144 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -103,8 +103,7 @@ Common::KeymapArray CrabMetaEngine::initKeymaps(const char *target) const {
}
bool CrabMetaEngine::hasFeature(MetaEngineFeature f) const {
- return checkExtendedSaves(f) ||
- (f == kSupportsLoadingDuringStartup);
+ return checkExtendedSaves(f);
}
int CrabMetaEngine::getMaximumSaveSlot() const {
Commit: f13391ce3cae58239cfc2c36b0d898f853fbb441
https://github.com/scummvm/scummvm/commit/f13391ce3cae58239cfc2c36b0d898f853fbb441
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use ScummVM's load/save dailogs
Changed paths:
engines/crab/ui/PauseMenu.cpp
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 391f1696d0f..863518d79fb 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -49,14 +49,6 @@ bool PauseMenu::Draw(Button &back) {
bg.Draw();
menu.Draw();
break;
- case STATE_SAVE:
- save.Draw();
- back.Draw();
- break;
- case STATE_LOAD:
- g_engine->_loadMenu->Draw();
- back.Draw();
- break;
case STATE_OPTION:
g_engine->_optionMenu->Draw(back);
return true;
@@ -80,12 +72,18 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
state = STATE_NORMAL;
return PS_RESUME;
case 1:
- state = STATE_SAVE;
- save.ScanDir();
+ if (g_engine->saveGameDialog()) {
+ state = STATE_NORMAL;
+ return PS_SAVE;
+ } else
+ state = STATE_NORMAL;
break;
case 2:
- state = STATE_LOAD;
- g_engine->_loadMenu->ScanDir();
+ if (g_engine->loadGameDialog()) {
+ state = STATE_NORMAL;
+ return PS_LOAD;
+ } else
+ state = STATE_NORMAL;
break;
case 3:
state = STATE_OPTION;
@@ -101,13 +99,6 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
}
}
break;
- case STATE_SAVE:
- if (save.HandleEvents(Event)) {
- state = STATE_NORMAL;
- return PS_SAVE;
- } else if (back.HandleEvents(Event) == BUAC_LCLICK && !save.DisableHotkeys())
- state = STATE_NORMAL;
- break;
case STATE_OPTION:
if (g_engine->_optionMenu->HandleEvents(back, Event)) {
g_engine->_optionMenu->Reset();
@@ -115,9 +106,9 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
}
break;
case STATE_LOAD:
- if (g_engine->_loadMenu->HandleEvents(Event))
+ if (g_engine->loadGameDialog())
return PS_LOAD;
- else if (back.HandleEvents(Event) == BUAC_LCLICK)
+ else
state = STATE_NORMAL;
break;
default:
Commit: 2f9d204ae2aa96c5df158eb83d2324cd7907e5a5
https://github.com/scummvm/scummvm/commit/2f9d204ae2aa96c5df158eb83d2324cd7907e5a5
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make LoadState and SaveState read/write directly from streams
Changed paths:
engines/crab/game.cpp
engines/crab/game.h
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index d074fdf7999..cdc2e74882a 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -51,9 +51,8 @@ void Game::StartNewGame() {
CreateSaveGame(SAVEGAME_EVENT);
}
-void Game::LoadGame(const Common::String &filename) {
+void Game::LoadGame() {
Init(g_engine->_filePath->mod_cur);
- LoadState(filename);
}
void Game::Init(const Common::String &filename) {
@@ -110,6 +109,8 @@ void Game::Init(const Common::String &filename) {
debug_console.Load(path);
}
}
+
+ _isInited = true;
}
bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
@@ -251,8 +252,8 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
hud.SetTooltip();
break;
case PS_LOAD:
- ShouldChangeState = true;
- NewStateID = GAMESTATE_LOAD_GAME;
+ //ShouldChangeState = true;
+ //NewStateID = GAMESTATE_LOAD_GAME;
return;
case PS_HELP:
@@ -661,16 +662,21 @@ void Game::ApplyResult(LevelResult result) {
//------------------------------------------------------------------------
// Purpose: Save/load game
//------------------------------------------------------------------------
-void Game::LoadState(const Common::String &filename) {
- Common::InSaveFile *file = g_engine->getSaveFileManager()->openForLoading(filename);
+void Game::LoadState(Common::SeekableReadStream *stream) {
+ if (!_isInited)
+ LoadGame();
+
+ Common::String data = stream->readString();
+ // +1 to include > as well
+ size_t end = data.findLastOf(">") + 1;
- uint64 len = file->size();
- uint8 *data = new uint8[len + 1];
- data[len] = '\0';
+ uint8 *dataC = new uint8[end + 1];
+ dataC[end] = '\0';
+ memcpy(dataC, data.c_str(), end);
- file->read(data, len);
+ warning("Output: %s", dataC);
- XMLDoc conf(data);
+ XMLDoc conf(dataC);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
@@ -708,7 +714,7 @@ void Game::LoadState(const Common::String &filename) {
//------------------------------------------------------------------------
// Purpose: Write game state to file
//------------------------------------------------------------------------
-void Game::SaveState(const Common::String &filename, const bool &overwrite) {
+void Game::SaveState(Common::SeekableWriteStream *stream) {
rapidxml::xml_document<char> doc;
// xml declaration
@@ -770,12 +776,7 @@ void Game::SaveState(const Common::String &filename, const bool &overwrite) {
Common::String xml_as_string;
rapidxml::print(Crab::backInserter(xml_as_string), doc);
- Common::String full = FullPath(filename);
-
- Common::OutSaveFile *outSaveFile = g_engine->getSaveFileManager()->openForSaving(full);
- outSaveFile->writeString(xml_as_string);
-
- delete outSaveFile;
+ stream->writeString(xml_as_string);
#if 0
Common::String fullpath = FullPath(filename);
@@ -842,6 +843,7 @@ void Game::ToggleState(const State &s) {
// Purpose: Use this function to actually save your games
//------------------------------------------------------------------------
void Game::CreateSaveGame(const SaveGameType &savetype) {
+#if 0
// Disregard type in iron man mode, we only save to one file
if (info.IronMan())
SaveState(savefile.ironman, true);
@@ -870,6 +872,7 @@ void Game::CreateSaveGame(const SaveGameType &savetype) {
break;
}
}
+#endif
}
void Game::SetUI() {
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 5c9f114a08f..b86e16a61a1 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -69,6 +69,7 @@ private:
};
// These things don't need to be saved
+ bool _isInited;
pyrodactyl::ui::HUD hud;
Common::Array<pyrodactyl::event::EventResult> event_res;
pyrodactyl::ui::ParagraphData pop_default;
@@ -99,8 +100,6 @@ private:
}
} savefile;
- void StartNewGame();
- void LoadGame(const Common::String &filename);
static void Quit(bool &ShouldChangeState, GameStateID &NewStateID, const GameStateID &NewStateVal);
bool ApplyResult();
@@ -124,11 +123,16 @@ private:
void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->img[info.PlayerImg()]); }
public:
- Game() { StartNewGame(); }
- Game(const Common::String &filename) { LoadGame(filename); }
+ Game() : _isInited(false) {}
+ ~Game() {
+ warning("Game destructor called");
+ }
void Init(const Common::String &filename);
+ void StartNewGame();
+ void LoadGame();
+
void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#if 0
void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
@@ -136,10 +140,10 @@ public:
void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void Draw();
- void LoadState(const Common::String &filename);
+ void LoadState(Common::SeekableReadStream *stream);
// Raw function to save game to file - generally, using the CreateSaveGame function is recommended
- void SaveState(const Common::String &filename, const bool &overwrite);
+ void SaveState(Common::SeekableWriteStream *stream);
void AutoSave() { CreateSaveGame(SAVEGAME_EXIT); }
Commit: e0a9f09af41764d98269a202ae3cb0e9c140742a
https://github.com/scummvm/scummvm/commit/e0a9f09af41764d98269a202ae3cb0e9c140742a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Game a class member of app class
Changed paths:
engines/crab/app.cpp
engines/crab/app.h
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index aefce201aa8..801d6a4fe79 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -136,6 +136,8 @@ void App::Run() {
Common::Event e;
int fpscount = 0, fpsval = 1, lasts = 0;
+ _game = new Game();
+
// While the user hasn't quit - This is the main game loop
while (CurrentStateID != GAMESTATE_EXIT && !SHOULD_QUIT) {
// Start the frame timer
@@ -144,8 +146,10 @@ void App::Run() {
// Change state if needed
if (ShouldChangeState) {
// Delete the current state
- delete CurrentState;
- CurrentState = nullptr;
+ if (CurrentState != _game) {
+ delete CurrentState;
+ CurrentState = nullptr;
+ }
if (NextStateID == GAMESTATE_EXIT)
break;
@@ -170,12 +174,13 @@ void App::Run() {
break;
case GAMESTATE_NEW_GAME:
- CurrentState = new Game();
+ _game->StartNewGame();
+ CurrentState = _game;
g_engine->_screenSettings->in_game = true;
break;
case GAMESTATE_LOAD_GAME:
- CurrentState = new Game(g_engine->_loadMenu->SelectedPath());
+ CurrentState = _game;
g_engine->_screenSettings->in_game = true;
break;
@@ -291,7 +296,9 @@ void App::Run() {
}
}
- delete CurrentState;
+ if (CurrentState != _game)
+ delete CurrentState;
+ delete _game;
}
void App::LoadSettings(const Common::String &filename) {
diff --git a/engines/crab/app.h b/engines/crab/app.h
index 0e403585bfb..e50dfbbd2a9 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -46,8 +46,10 @@
namespace Crab {
class App {
- void LoadSettings(const Common::String &filename);
+private:
+ Game *_game;
+ void LoadSettings(const Common::String &filename);
public:
App(void) {
#if 0
@@ -61,6 +63,9 @@ public:
bool Init();
void Run();
+ Game *GetGame() const {
+ return _game;
+ }
};
} // End of namespace Crab
Commit: 3d043f424f347b143d51c297e48abc2771ee8515
https://github.com/scummvm/scummvm/commit/3d043f424f347b143d51c297e48abc2771ee8515
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement functions needed to load/save from GMM
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 7459d6c6f11..4e419c5c349 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -155,6 +155,38 @@ void CrabEngine::initializePath(const Common::FSNode &gamePath) {
SearchMan.addDirectory("res", gamePath, 0, 5);
}
+Common::Error CrabEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
+ Common::OutSaveFile *saveFile = _saveFileMan->openForSaving(getSaveStateName(slot));
+
+ if (!saveFile)
+ return Common::kWritingFailed;
+
+ _app->GetGame()->SaveState(saveFile);
+ getMetaEngine()->appendExtendedSave(saveFile, getTotalPlayTime(), desc, isAutosave);
+
+ saveFile->finalize();
+
+ delete saveFile;
+ return Common::kNoError;
+}
+
+Common::Error CrabEngine::loadGameState(int slot) {
+ saveAutosaveIfEnabled();
+
+ Common::InSaveFile *saveFile = _saveFileMan->openForLoading(getSaveStateName(slot));
+
+ if (!saveFile)
+ return Common::kReadingFailed;
+
+ _app->GetGame()->LoadState(saveFile);
+ ExtendedSavegameHeader header;
+ if (MetaEngine::readSavegameHeader(saveFile, &header))
+ setTotalPlayTime(header.playtime);
+
+ delete saveFile;
+ return Common::kNoError;
+}
+
Common::Error CrabEngine::syncGame(Common::Serializer &s) {
// The Serializer has methods isLoading() and isSaving()
// if you need to specific steps; for example setting
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 7b6f45e4b7a..5e2c84f9e84 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -168,14 +168,8 @@ public:
*/
Common::Error syncGame(Common::Serializer &s);
- Common::Error saveGameStream(Common::WriteStream *stream, bool isAutosave = false) override {
- Common::Serializer s(nullptr, stream);
- return syncGame(s);
- }
- Common::Error loadGameStream(Common::SeekableReadStream *stream) override {
- Common::Serializer s(stream, nullptr);
- return syncGame(s);
- }
+ Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
+ Common::Error loadGameState(int slot) override;
};
extern CrabEngine *g_engine;
Commit: ef51102af135baefa877eda7927affc91a64d9ca
https://github.com/scummvm/scummvm/commit/ef51102af135baefa877eda7927affc91a64d9ca
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Only allow saving when inside game
Changed paths:
engines/crab/crab.h
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 5e2c84f9e84..40061cd437d 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -159,7 +159,7 @@ public:
return true;
}
bool canSaveGameStateCurrently() override {
- return true;
+ return _screenSettings->in_game;
}
/**
Commit: 2d6361589941c9c16764ace7ec5740917deea651
https://github.com/scummvm/scummvm/commit/2d6361589941c9c16764ace7ec5740917deea651
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Open GMM load menu from main menu
Changed paths:
engines/crab/mainmenu.cpp
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index e397e24996d..42e6e6be354 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -235,8 +235,9 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
case STATE_LOAD:
- if (g_engine->_loadMenu->HandleEvents(Event)) {
+ if (!g_engine->loadGameDialog())
ChangeState(STATE_NORMAL);
+ else {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
return;
@@ -513,12 +514,6 @@ void MainMenu::Draw() {
credits.Draw();
break;
- case STATE_LOAD:
- g_engine->_loadMenu->Draw();
- back.Draw();
- me_main.Draw();
- break;
-
case STATE_DIFF:
diff.bg.Draw();
diff.heading.Draw();
Commit: a20f835b26b62eb33f5ca76c05ea23ff800a722e
https://github.com/scummvm/scummvm/commit/a20f835b26b62eb33f5ca76c05ea23ff800a722e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port FileMenu::ScanDir
Changed paths:
engines/crab/ui/FileMenu.h
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 1ab77684aa7..72440531d91 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -31,6 +31,8 @@
#ifndef CRAB_FILEMENU_H
#define CRAB_FILEMENU_H
+#include "common/savefile.h"
+
#include "crab/crab.h"
#include "crab/ui/FileData.h"
#include "crab/ui/ImageData.h"
@@ -112,6 +114,21 @@ public:
void ScanDir() {
warning("STUB: FileMenu::ScanDir()");
+ Common::String res = "CRAB_*";
+ res += g_engine->_filePath->save_ext;
+ Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
+
+ slot_info.clear();
+ menu.Clear();
+
+ unsigned int count_slot = 0, count_menu = 0;
+ for (const Common::String& save : saves) {
+ slot_info.push_back(FileType(save));
+ menu.Add(count_slot, count_menu);
+ }
+
+ menu.AssignPaths();
+
#if 0
using namespace boost::filesystem;
Commit: ec510a5597cdf1bdc37d2ccabfeb7ff6312118d6
https://github.com/scummvm/scummvm/commit/ec510a5597cdf1bdc37d2ccabfeb7ff6312118d6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make XMLDoc follow ScummVM formatting convention
Changed paths:
engines/crab/GameParam.cpp
engines/crab/LoadingScreen.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/XMLDoc.cpp
engines/crab/XMLDoc.h
engines/crab/animation/animset.cpp
engines/crab/app.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/eventstore.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/image/ImageManager.cpp
engines/crab/input/input.cpp
engines/crab/level/level_load.cpp
engines/crab/loaders.cpp
engines/crab/mainmenu.cpp
engines/crab/music/MusicManager.cpp
engines/crab/stat/StatTemplate.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/color.cpp
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/DevConsole.cpp
engines/crab/ui/FileData.cpp
engines/crab/ui/Inventory.cpp
engines/crab/ui/ModMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index a8f0d120a1b..f47275582a7 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -71,7 +71,7 @@ void FilePaths::LoadLevel(const Common::String &filename) {
level.clear();
XMLDoc lev_list(filename);
if (lev_list.ready()) {
- rapidxml::xml_node<char> *node = lev_list.Doc()->first_node("world");
+ rapidxml::xml_node<char> *node = lev_list.doc()->first_node("world");
for (rapidxml::xml_node<char> *n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
LevelPath l;
@@ -88,7 +88,7 @@ void FilePaths::LoadLevel(const Common::String &filename) {
void FilePaths::Load(const Common::String &filename) {
XMLDoc settings(filename);
if (settings.ready()) {
- rapidxml::xml_node<char> *node = settings.Doc()->first_node("paths");
+ rapidxml::xml_node<char> *node = settings.doc()->first_node("paths");
if (NodeValid(node) && !loaded) {
if (NodeValid("icon", node)) {
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 80f62babe93..2322064bd2b 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -37,7 +37,7 @@ void LoadingScreen::Load() {
const Common::String &filename = "res/layout/loading.xml";
XMLDoc doc(filename);
if (doc.ready()) {
- rapidxml::xml_node<char> *node = doc.Doc()->first_node("loading");
+ rapidxml::xml_node<char> *node = doc.doc()->first_node("loading");
if (NodeValid(node)) {
if (NodeValid("screens", node)) {
rapidxml::xml_node<char> *scrnode = node->first_node("screens");
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 019d100843e..ed601c90932 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -64,7 +64,7 @@ TMXMap::TMXMap() {
void TMXMap::Load(const Common::String &path, Common::String filename) {
XMLDoc conf((path + filename));
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("map");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("map");
if (NodeValid(node)) {
LoadNum(tile_rows, "width", node);
LoadNum(tile_cols, "height", node);
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index af8671ee874..2fa5b0715f2 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -39,20 +39,19 @@ namespace rapidxml {
namespace Crab {
-void XMLDoc::Load(const Common::String &filename) {
+void XMLDoc::load(const Common::String &filename) {
const Common::Path path(filename);
if (ready())
- doc.clear();
+ _doc.clear();
- if (FileOpen(path, text))
- if (text != NULL)
- doc.parse<0>(text);
+ if (FileOpen(path, _text) && _text)
+ _doc.parse<0>(_text);
}
-const rapidxml::xml_document<> *XMLDoc::Doc() const {
- if (text != NULL)
- return &doc;
+const rapidxml::xml_document<> *XMLDoc::doc() const {
+ if (_text != NULL)
+ return &_doc;
else
return NULL;
}
diff --git a/engines/crab/XMLDoc.h b/engines/crab/XMLDoc.h
index bd05f099fbd..d51ca6c7381 100644
--- a/engines/crab/XMLDoc.h
+++ b/engines/crab/XMLDoc.h
@@ -37,31 +37,38 @@
namespace Crab {
class XMLDoc {
- rapidxml::xml_document<char> doc;
- char *text;
+ rapidxml::xml_document<char> _doc;
+ char *_text;
public:
- XMLDoc() { text = NULL; }
+ XMLDoc() {
+ _text = NULL;
+ }
+
XMLDoc(const Common::String &filename) {
- text = NULL;
- Load(filename);
+ _text = NULL;
+ load(filename);
}
XMLDoc(uint8 *data) {
- text = (char*)data;
- doc.parse<0>(text);
+ _text = (char*)data;
+ _doc.parse<0>(_text);
}
- ~XMLDoc() { delete[] text; }
+ ~XMLDoc() {
+ delete[] _text;
+ }
// Load the text from the specified file into the rapidxml format
// Each function that references it must parse it there
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
// Check if document is ready for parsing
- bool ready() const { return text != NULL; }
+ bool ready() const {
+ return _text != NULL;
+ }
- const rapidxml::xml_document<> *Doc() const;
+ const rapidxml::xml_document<> *doc() const;
};
} // End of namespace Crab
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 40e5b5742e9..011e899d343 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::anim;
void AnimSet::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node();
+ rapidxml::xml_node<char> *node = conf.doc()->first_node();
if (NodeValid(node)) {
fight.Load(node);
walk.Load(node);
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 801d6a4fe79..2b618490709 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -304,7 +304,7 @@ void App::Run() {
void App::LoadSettings(const Common::String &filename) {
XMLDoc settings(filename);
if (settings.ready()) {
- rapidxml::xml_node<char> *node = settings.Doc()->first_node("settings");
+ rapidxml::xml_node<char> *node = settings.doc()->first_node("settings");
if (NodeValid(node)) {
// Load the version
LoadNum(g_engine->_screenSettings->version, "version", node);
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 47d819c2e0c..6d2b7a9e676 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::event;
void EventSequence::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("events");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("events");
for (auto n = node->first_node("event"); n != NULL; n = n->next_sibling("event")) {
GameEvent e(n);
events.push_back(e);
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 121a71068c1..b2454019239 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -57,7 +57,7 @@ void Info::Load(rapidxml::xml_node<char> *node) {
XMLDoc conf(pnode->first_attribute("list")->value());
if (conf.ready()) {
- rapidxml::xml_node<char> *cnode = conf.Doc()->first_node("characters");
+ rapidxml::xml_node<char> *cnode = conf.doc()->first_node("characters");
if (NodeValid(cnode)) {
LoadNum(OPINION_MIN, "op_min", cnode);
LoadNum(OPINION_MAX, "op_max", cnode);
@@ -83,7 +83,7 @@ void Info::Load(rapidxml::xml_node<char> *node) {
void Info::LoadPeople(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("people");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("people");
if (NodeValid(node)) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
Common::String str;
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 2e1b2b47b0c..3dfddee0c90 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -53,7 +53,7 @@ void GameEventStore::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("store");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("store");
if (NodeValid("animations", node)) {
rapidxml::xml_node<char> *animnode = node->first_node("animations");
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index a561c0b883d..2fa3847ba65 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -54,7 +54,7 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
if (NodeValid(node)) {
XMLDoc conf(node->first_attribute("list")->value());
if (conf.ready()) {
- rapidxml::xml_node<char> *lnode = conf.Doc()->first_node("event_list");
+ rapidxml::xml_node<char> *lnode = conf.doc()->first_node("event_list");
for (rapidxml::xml_node<char> *loc = lnode->first_node("loc"); loc != NULL; loc = loc->next_sibling("loc")) {
Common::String loc_name;
LoadStr(loc_name, "name", loc);
@@ -71,9 +71,9 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
active_seq = UINT_MAX;
- conf.Load(node->first_attribute("layout")->value());
+ conf.load(node->first_attribute("layout")->value());
if (conf.ready()) {
- rapidxml::xml_node<char> *layout = conf.Doc()->first_node("layout");
+ rapidxml::xml_node<char> *layout = conf.doc()->first_node("layout");
if (NodeValid(layout)) {
if (NodeValid("character", layout))
oh.Load(layout->first_node("character"));
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index cdc2e74882a..378cda3d10b 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -66,7 +66,7 @@ void Game::Init(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("config");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("config");
info.Load(node);
@@ -679,7 +679,7 @@ void Game::LoadState(Common::SeekableReadStream *stream) {
XMLDoc conf(dataC);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("save");
if (NodeValid(node)) {
info.LoadIronMan(node);
LoadStr(savefile.ironman, "file", node);
diff --git a/engines/crab/game.h b/engines/crab/game.h
index b86e16a61a1..9d143689ed8 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -124,9 +124,6 @@ private:
public:
Game() : _isInited(false) {}
- ~Game() {
- warning("Game destructor called");
- }
void Init(const Common::String &filename);
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 7c4189233ed..084fbf3b085 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -50,7 +50,7 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
map[mapid].clear();
XMLDoc image_list(filename);
if (image_list.ready()) {
- rapidxml::xml_node<char> *node = image_list.Doc()->first_node("res");
+ rapidxml::xml_node<char> *node = image_list.doc()->first_node("res");
for (auto n = node->first_node("image"); n != NULL; n = n->next_sibling("image")) {
ImageKey key;
if (LoadImgKey(key, "name", n)) {
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 7e3ebae1a71..19c15d1d03d 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -156,7 +156,7 @@ void InputManager::Init() {
void InputManager::Load(const Common::String &filename) {
XMLDoc control_list(filename);
if (control_list.ready()) {
- rapidxml::xml_node<char> *node = control_list.Doc()->first_node("controls");
+ rapidxml::xml_node<char> *node = control_list.doc()->first_node("controls");
if (NodeValid(node)) {
LoadNum(version, "version", node);
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 18bc728faf4..b6a0f74d08b 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -55,7 +55,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
Reset();
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("level");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("level");
if (NodeValid(node)) {
Common::String vis;
LoadStr(vis, "map", node, false);
@@ -177,7 +177,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
void Level::LoadMoves(const Common::String &filename) {
XMLDoc mov_list(filename);
if (mov_list.ready()) {
- rapidxml::xml_node<char> *node = mov_list.Doc()->first_node("movelist");
+ rapidxml::xml_node<char> *node = mov_list.doc()->first_node("movelist");
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set")) {
unsigned int pos = anim_set.size();
@@ -202,7 +202,7 @@ void Level::LoadMoves(const Common::String &filename) {
void Level::LoadConst(const Common::String &filename) {
XMLDoc doc(filename);
if (doc.ready()) {
- rapidxml::xml_node<char> *node = doc.Doc()->first_node("constant");
+ rapidxml::xml_node<char> *node = doc.doc()->first_node("constant");
if (NodeValid(node))
sc_default.Load(node);
}
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index c93162ba7c1..0d42877a863 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -204,7 +204,7 @@ unsigned int Version(const Common::String &filename) {
XMLDoc doc(filename);
if (doc.ready()) {
- rapidxml::xml_node<char> *node = doc.Doc()->first_node();
+ rapidxml::xml_node<char> *node = doc.doc()->first_node();
if (NodeValid(node))
LoadNum(version, "version", node);
}
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 42e6e6be354..4b7a8169445 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -45,7 +45,7 @@ using namespace pyrodactyl::ui;
MainMenu::MainMenu() {
XMLDoc conf(g_engine->_filePath->mainmenu_l);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("main_menu");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("main_menu");
if (NodeValid(node)) {
me_main.Load(node->first_node("main"));
logo.Load(node->first_node("logo"));
@@ -63,7 +63,7 @@ MainMenu::MainMenu() {
{
XMLDoc loadconf(node->first_node("load")->first_attribute("path")->value());
if (loadconf.ready()) {
- rapidxml::xml_node<char> *loadnode = loadconf.Doc()->first_node("load_menu");
+ rapidxml::xml_node<char> *loadnode = loadconf.doc()->first_node("load_menu");
if (NodeValid(loadnode))
g_engine->_loadMenu->Load(loadnode);
}
@@ -72,7 +72,7 @@ MainMenu::MainMenu() {
{
XMLDoc helpconf(node->first_node("help")->first_attribute("path")->value());
if (helpconf.ready()) {
- rapidxml::xml_node<char> *hnode = helpconf.Doc()->first_node("help");
+ rapidxml::xml_node<char> *hnode = helpconf.doc()->first_node("help");
if (NodeValid(hnode))
g_engine->_helpScreen->Load(hnode);
}
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 7506eb77069..6d59311ffb7 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -69,7 +69,7 @@ void MusicManager::PlayMusic(const MusicKey &id) {
if (bg.id != id) {
XMLDoc track_list(g_engine->_filePath->sound_music);
if (track_list.ready()) {
- rapidxml::xml_node<char> *node = track_list.Doc()->first_node("music");
+ rapidxml::xml_node<char> *node = track_list.doc()->first_node("music");
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *att = n->first_attribute("id");
if (att != NULL && id == StringToNumber<MusicKey>(att->value())) {
@@ -137,7 +137,7 @@ bool MusicManager::Load(rapidxml::xml_node<char> *node) {
// Load sound effects
XMLDoc track_list(g_engine->_filePath->sound_effect);
if (track_list.ready()) {
- rapidxml::xml_node<char> *tnode = track_list.Doc()->first_node("effects");
+ rapidxml::xml_node<char> *tnode = track_list.doc()->first_node("effects");
if (NodeValid(tnode)) {
LoadNum(notify, "notify", tnode);
LoadNum(rep_inc, "rep_inc", tnode);
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index cda9689736c..ffe6f5b73fc 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::stat;
void StatTemplates::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("templates");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("templates");
for (auto n = node->first_node("stats"); n != NULL; n = n->next_sibling("stats"))
collection.push_back(n);
}
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index ea52b2dd32d..c694be695e8 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -46,7 +46,7 @@ void TextManager::Init() {
// Load the list of fonts
XMLDoc font_list(g_engine->_filePath->font);
if (font_list.ready()) {
- rapidxml::xml_node<char> *node = font_list.Doc()->first_node("fonts");
+ rapidxml::xml_node<char> *node = font_list.doc()->first_node("fonts");
LoadNum(cache_size, "cache_size", node);
cache.resize(cache_size);
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index 075cf6ab79c..b53b9898516 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -38,7 +38,7 @@ void ColorPool::Load(const Common::String &filename) {
pool.clear();
XMLDoc col_list(filename);
if (col_list.ready()) {
- rapidxml::xml_node<char> *node = col_list.Doc()->first_node("colors");
+ rapidxml::xml_node<char> *node = col_list.doc()->first_node("colors");
for (rapidxml::xml_node<char> *n = node->first_node("color"); n != NULL; n = n->next_sibling("color")) {
SDL_Color c;
LoadColor(c, n);
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 163e6feb0eb..a1220bf399e 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -46,7 +46,7 @@ void CreditScreen::Reset() {
void CreditScreen::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("credits");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("credits");
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 69bac531c73..b03baeda0d6 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::ui;
void DebugConsole::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("debug");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("debug");
if (NodeValid(node)) {
if (NodeValid("menu", node))
menu.Load(node->first_node("menu"));
diff --git a/engines/crab/ui/FileData.cpp b/engines/crab/ui/FileData.cpp
index 78626b8c3b7..4b2e257915b 100644
--- a/engines/crab/ui/FileData.cpp
+++ b/engines/crab/ui/FileData.cpp
@@ -55,7 +55,7 @@ SaveFileData::SaveFileData(const Common::String &file) {
XMLDoc conf(data);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("save");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("save");
if (NodeValid(node)) {
LoadStr(diff, "diff", node);
LoadStr(loc_id, "loc_id", node);
@@ -75,7 +75,7 @@ ModFileData::ModFileData(const Common::String &file) {
if (boost::filesystem::exists(filepath)) {
XMLDoc conf(filepath.string());
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("config");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("config");
if (NodeValid(node)) {
LoadStr(author, "author", node);
LoadStr(version, "version", node);
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 7a302356af3..b189fcd8e9e 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -43,7 +43,7 @@ using namespace pyrodactyl::people;
void Inventory::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("inventory");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("inventory");
if (NodeValid(node)) {
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
@@ -63,7 +63,7 @@ void Inventory::LoadItem(const Common::String &char_id, const Common::String &id
Item i;
XMLDoc item_list(itemfile);
if (item_list.ready()) {
- rapidxml::xml_node<char> *node = item_list.Doc()->first_node("items");
+ rapidxml::xml_node<char> *node = item_list.doc()->first_node("items");
for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item")) {
Common::String str = n->first_attribute("id")->value();
if (id == str) {
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 4dceb2d6eb8..512a4d29997 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::ui;
void ModMenu::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("mod_menu");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("mod_menu");
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 7db9d6aa9ef..be01e39526f 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::music;
void OptionMenu::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("option");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("option");
if (NodeValid(node)) {
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 560ebc9c98f..e12933ed8b5 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::people;
void PersonScreen::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("character");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("character");
if (NodeValid(node)) {
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 7b4272b4793..9649f20c274 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -43,7 +43,7 @@ using namespace pyrodactyl::people;
void ReplyMenu::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("conversation");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("conversation");
if (NodeValid(node)) {
if (NodeValid("tone", node))
tone.Load(node->first_node("tone"));
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index ff457c27d2a..2f37d1efdb8 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -43,7 +43,7 @@ using namespace pyrodactyl::input;
void HUD::Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("hud");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("hud");
if (NodeValid(node)) {
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index f75d5499d9b..11209d60068 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -42,7 +42,7 @@ using namespace pyrodactyl::ui;
void Journal::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("objectives");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("objectives");
if (NodeValid(node)) {
if (NodeValid("bg", node))
bg.Load(node->first_node("bg"));
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 20dc138138d..17f6a8b1bdd 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -43,7 +43,7 @@ using namespace pyrodactyl::input;
void Map::Load(const Common::String &filename, pyrodactyl::event::Info &info) {
XMLDoc conf(filename);
if (conf.ready()) {
- rapidxml::xml_node<char> *node = conf.Doc()->first_node("map");
+ rapidxml::xml_node<char> *node = conf.doc()->first_node("map");
if (NodeValid(node)) {
if (NodeValid("img", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("img");
Commit: 6cd9527c885b79f4e5c2e75c2da45f290738bb60
https://github.com/scummvm/scummvm/commit/6cd9527c885b79f4e5c2e75c2da45f290738bb60
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make MoveEffect struct follow code formatting conventions
Changed paths:
engines/crab/ai/moveeffect.cpp
engines/crab/ai/moveeffect.h
engines/crab/animation/fightmove.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/ai/moveeffect.cpp b/engines/crab/ai/moveeffect.cpp
index f0f5b8a0c28..017b87e6359 100644
--- a/engines/crab/ai/moveeffect.cpp
+++ b/engines/crab/ai/moveeffect.cpp
@@ -35,31 +35,31 @@ namespace Crab {
using namespace pyrodactyl::anim;
FightMoveEffect::FightMoveEffect() {
- activate = -1;
- hit = -1;
- dmg = 0;
- stun = 0;
- hurt = -1;
- death = -1;
+ _activate = -1;
+ _hit = -1;
+ _dmg = 0;
+ _stun = 0;
+ _hurt = -1;
+ _death = -1;
}
-void FightMoveEffect::Load(rapidxml::xml_node<char> *node) {
- LoadNum(stun, "stun", node);
- LoadNum(dmg, "damage", node);
- LoadNum(hurt, "hurt", node);
- LoadNum(death, "death", node);
+void FightMoveEffect::load(rapidxml::xml_node<char> *node) {
+ LoadNum(_stun, "stun", node);
+ LoadNum(_dmg, "damage", node);
+ LoadNum(_hurt, "hurt", node);
+ LoadNum(_death, "death", node);
if (NodeValid("image", node, false))
- img.Load(node->first_node("image"));
+ _img.Load(node->first_node("image"));
if (NodeValid("sound", node)) {
rapidxml::xml_node<char> *soundnode = node->first_node("sound");
- if (!LoadNum(activate, "activate", soundnode, false))
- activate = -1;
+ if (!LoadNum(_activate, "activate", soundnode, false))
+ _activate = -1;
- if (!LoadNum(activate, "hit", soundnode, false))
- activate = -1;
+ if (!LoadNum(_activate, "hit", soundnode, false))
+ _activate = -1;
}
}
diff --git a/engines/crab/ai/moveeffect.h b/engines/crab/ai/moveeffect.h
index 59712df530f..a98ca438f12 100644
--- a/engines/crab/ai/moveeffect.h
+++ b/engines/crab/ai/moveeffect.h
@@ -41,29 +41,29 @@ namespace pyrodactyl {
namespace anim {
struct FightMoveEffect {
// The image displayed on being hit
- ImageEffect img;
+ ImageEffect _img;
// The sound played by this move when it's activated
- pyrodactyl::music::ChunkKey activate;
+ pyrodactyl::music::ChunkKey _activate;
// The sound played by this move when it hits opponent
- pyrodactyl::music::ChunkKey hit;
+ pyrodactyl::music::ChunkKey _hit;
// The move the sprite hit by our current move performs - if living (hurt animation)
- int hurt;
+ int _hurt;
// The move the sprite hit by our current move performs - if it dies as a result (dying animation)
- int death;
+ int _death;
// The stun time for the enemy if this move hits a sprite
- unsigned int stun;
+ unsigned int _stun;
// The base damage of the move if it hits a sprite
- int dmg;
+ int _dmg;
FightMoveEffect();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/fightmove.cpp b/engines/crab/animation/fightmove.cpp
index da823234df2..dcde8ed4b5c 100644
--- a/engines/crab/animation/fightmove.cpp
+++ b/engines/crab/animation/fightmove.cpp
@@ -47,7 +47,7 @@ void FightMove::Load(rapidxml::xml_node<char> *node) {
unlock.Load(node->first_node("unlock"));
if (NodeValid("effect", node))
- eff.Load(node->first_node("effect"));
+ eff.load(node->first_node("effect"));
if (NodeValid("ai", node, false))
ai.Load(node->first_node("ai"));
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index e6954ef216c..cc391b8440d 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -167,7 +167,7 @@ bool FightMoves::ForceUpdate(const unsigned int &index, pyrodactyl::input::Fight
timer.Start();
start = true;
- g_engine->_musicManager->PlayEffect(move[cur].eff.activate, 0);
+ g_engine->_musicManager->PlayEffect(move[cur].eff._activate, 0);
return true;
}
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 23100772802..70513484277 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -665,7 +665,7 @@ void Sprite::TakeDamage(Info &info, Sprite &s) {
FightMove f;
if (s.anim_set.fight.CurMove(f) && info.PersonValid(s.ID()) && info.PersonValid(id)) {
- int dmg = -1 * (f.eff.dmg + info.PersonGet(s.ID()).stat.val[STAT_ATTACK].cur - info.PersonGet(id).stat.val[STAT_DEFENSE].cur);
+ int dmg = -1 * (f.eff._dmg + info.PersonGet(s.ID()).stat.val[STAT_ATTACK].cur - info.PersonGet(id).stat.val[STAT_DEFENSE].cur);
if (dmg >= 0)
dmg = -1;
@@ -675,13 +675,13 @@ void Sprite::TakeDamage(Info &info, Sprite &s) {
info.StatGet(id, STAT_HEALTH, health);
// Play death animation if dead, hurt animation otherwise
- if (health <= 0 && f.eff.death != -1)
- ForceUpdateMove(f.eff.death);
- else if (f.eff.hurt != -1)
- ForceUpdateMove(f.eff.hurt);
+ if (health <= 0 && f.eff._death != -1)
+ ForceUpdateMove(f.eff._death);
+ else if (f.eff._hurt != -1)
+ ForceUpdateMove(f.eff._hurt);
- g_engine->_musicManager->PlayEffect(f.eff.hit, 0);
- img_eff = f.eff.img;
+ g_engine->_musicManager->PlayEffect(f.eff._hit, 0);
+ img_eff = f.eff._img;
}
Stop();
Commit: 7d05908d6fd6d1ebabc78376f50b9bc842b4846a
https://github.com/scummvm/scummvm/commit/7d05908d6fd6d1ebabc78376f50b9bc842b4846a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make MovementSet struct follow code formatting conventions
Changed paths:
engines/crab/ai/movement.cpp
engines/crab/ai/movement.h
engines/crab/ai/spriteai.cpp
engines/crab/animation/sprite.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
diff --git a/engines/crab/ai/movement.cpp b/engines/crab/ai/movement.cpp
index a6e4a235634..d5af38b9f79 100644
--- a/engines/crab/ai/movement.cpp
+++ b/engines/crab/ai/movement.cpp
@@ -37,26 +37,26 @@ using namespace pyrodactyl::ai;
//------------------------------------------------------------------------
// Purpose: Walk in preset paths
//------------------------------------------------------------------------
-void MovementSet::Load(rapidxml::xml_node<char> *node) {
- enabled = true;
- LoadBool(repeat, "repeat", node);
+void MovementSet::load(rapidxml::xml_node<char> *node) {
+ _enabled = true;
+ LoadBool(_repeat, "repeat", node);
for (auto n = node->first_node("walk"); n != NULL; n = n->next_sibling("walk"))
- path.push_back(n);
+ _path.push_back(n);
}
//------------------------------------------------------------------------
// Purpose: To make the AI patrol/wait along certain points
//------------------------------------------------------------------------
-bool MovementSet::InternalEvents(const Rect rect) {
- if (enabled) {
+bool MovementSet::internalEvents(const Rect rect) {
+ if (_enabled) {
// If we are at the current waypoint, get to the next waypoint
- if (path[cur].target.Collide(rect)) {
- cur = (cur + 1) % path.size();
- timer.Start();
+ if (_path[_cur]._target.Collide(rect)) {
+ _cur = (_cur + 1) % _path.size();
+ _timer.Start();
}
// Wait according to the delay value in the node
- if (timer.Ticks() >= path[cur].delay)
+ if (_timer.Ticks() >= _path[_cur]._delay)
return true;
}
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index 2234f9f1924..c730bc952d2 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -43,46 +43,47 @@ namespace ai {
struct MovementSet {
struct Movement {
// The position this sprite has to move to
- Rect target;
+ Rect _target;
// The time the sprite waits before it starts moving to pos
- uint32 delay;
+ uint32 _delay;
Movement(rapidxml::xml_node<char> *node) {
- target.Load(node);
- LoadNum(delay, "delay", node);
+ _target.Load(node);
+ LoadNum(_delay, "delay", node);
}
};
// The path followed by the sprite
- Common::Array<Movement> path;
+ Common::Array<Movement> _path;
// If true, sprite repeats the path pattern after reaching the last co-ordinate
- bool repeat;
+ bool _repeat;
// The current path node we are traveling to
- unsigned int cur;
+ unsigned int _cur;
// The time the sprite has spent waiting is calculated here
- Timer timer;
+ Timer _timer;
// Is this set enabled?
- bool enabled;
+ bool _enabled;
MovementSet() {
- cur = 0;
- repeat = false;
- enabled = false;
+ _cur = 0;
+ _repeat = false;
+ _enabled = false;
}
+
MovementSet(rapidxml::xml_node<char> *node) {
- cur = 0;
- Load(node);
+ _cur = 0;
+ load(node);
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
- bool InternalEvents(const Rect rect);
- Rect Target() { return path[cur].target; }
+ bool internalEvents(const Rect rect);
+ Rect target() { return _path[_cur]._target; }
};
} // End of namespace ai
} // End of namespace pyrodactyl
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 287c789af34..798fcbeb8ce 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -254,40 +254,40 @@ void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const Spri
void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
// Is this sprite flying right now?
- if (ai_data.walk.enabled) {
+ if (ai_data.walk._enabled) {
// We're flying towards the left edge
if (XVel() < 0) {
// Are we completely out of the left edge of the camera?
if (X() < camera.x - W()) {
- ai_data.walk.enabled = false;
+ ai_data.walk._enabled = false;
// Start the timer, set a semi-random time
- ai_data.walk.timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
- ai_data.walk.timer.Start();
+ ai_data.walk._timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
+ ai_data.walk._timer.Start();
}
}
// Flying towards the right edge
else if (XVel() > 0) {
// Are we completely out of the left edge of the camera?
if (X() > camera.x + camera.w + W()) {
- ai_data.walk.enabled = false;
+ ai_data.walk._enabled = false;
// Start the timer, set a semi-random time
- ai_data.walk.timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
- ai_data.walk.timer.Start();
+ ai_data.walk._timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
+ ai_data.walk._timer.Start();
}
}
Move(sc);
} else {
// Safety condition in case timer isn't running
- if (!ai_data.walk.timer.Started())
- ai_data.walk.timer.Start();
+ if (!ai_data.walk._timer.Started())
+ ai_data.walk._timer.Start();
// Is it time to start flying?
- if (ai_data.walk.timer.TargetReached()) {
+ if (ai_data.walk._timer.TargetReached()) {
// Stop the timer
- ai_data.walk.timer.Stop();
+ ai_data.walk._timer.Stop();
// Decide if the sprite flies from the left or right of the camera
if (g_engine->getRandomNumber(1)) {
@@ -310,7 +310,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
YVel(sc.fly.vel.y);
// Set state to flying
- ai_data.walk.enabled = true;
+ ai_data.walk._enabled = true;
}
}
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 70513484277..440fb16556c 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -93,7 +93,7 @@ void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
visible.Load(node->first_node("visible"));
if (NodeValid("movement", node, false))
- ai_data.walk.Load(node->first_node("movement"));
+ ai_data.walk.load(node->first_node("movement"));
if (NodeValid("popup", node, false))
popup.Load(node->first_node("popup"));
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 680cb9b62c7..add3e4db0b9 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -111,7 +111,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
// Fliers are drawn above every sprite but below popup text
for (auto &i : fly) {
// Only draw if it is supposed to be flying
- if (i.ai_data.walk.enabled)
+ if (i.ai_data.walk._enabled)
i.Draw(info, camera);
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index b6a0f74d08b..668d4f7022c 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -134,7 +134,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
// Set the timer target for the first time
//s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
- s.ai_data.walk.timer.Target(sc_default.fly.delay_max);
+ s.ai_data.walk._timer.Target(sc_default.fly.delay_max);
fly.push_back(s);
}
Commit: c13dd00e9afa20f9213f18c6ad65d69394ba420e
https://github.com/scummvm/scummvm/commit/c13dd00e9afa20f9213f18c6ad65d69394ba420e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make SpriteAIData struct follow code formatting conventions
Changed paths:
engines/crab/ai/spriteai.cpp
engines/crab/ai/spriteai.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 798fcbeb8ce..9a2c3bd7659 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -48,14 +48,14 @@ double Sprite::DistSq(const Sprite &s) {
// Purpose: Used for player movement
//------------------------------------------------------------------------
void Sprite::MoveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
- if (ai_data.dest.active) {
+ if (ai_data._dest._active) {
int num = 0;
info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float player_speed = static_cast<float>(num);
- if (MoveToLoc(ai_data.dest, player_speed, sc)) {
- ai_data.dest.active = false;
+ if (MoveToLoc(ai_data._dest, player_speed, sc)) {
+ ai_data._dest._active = false;
XVel(0.0f);
YVel(0.0f);
}
@@ -63,7 +63,7 @@ void Sprite::MoveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc)
}
void Sprite::MoveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
- if (ai_data.dest.active) {
+ if (ai_data._dest._active) {
int num = 0;
info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
++num;
@@ -78,10 +78,10 @@ void Sprite::MoveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteCo
// IF there is no solution OR
// IF we haven't yet found a solution
// THEN stop.
- if ((MoveToLocPathfinding(ai_data.dest, player_speed, sc) && pathing.solutionFound &&
+ if ((MoveToLocPathfinding(ai_data._dest, player_speed, sc) && pathing.solutionFound &&
pathing.GetImmediateDest() == Vector2i(pathing.destination.x, pathing.destination.y)) ||
pathing.noSolution || !pathing.solutionFound) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
XVel(0.0f);
YVel(0.0f);
}
@@ -153,14 +153,14 @@ bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &velocity, const S
// Purpose: AI routine for running to the nearest exit, then disappearing
//------------------------------------------------------------------------
void Sprite::Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level::Exit> &area_exit, const SpriteConstant &sc) {
- switch (ai_data.flee.state) {
+ switch (ai_data._flee._state) {
case FLEESTATE_GETNEARESTEXIT: {
if (area_exit.empty()) {
// No valid exits in the level
- ai_data.flee.state = FLEESTATE_CANTFLEE;
+ ai_data._flee._state = FLEESTATE_CANTFLEE;
break;
} else {
- ai_data.flee.state = FLEESTATE_GETNEARESTEXIT;
+ ai_data._flee._state = FLEESTATE_GETNEARESTEXIT;
// Standard way to find nearest exit
int min_dist = INT_MAX;
@@ -173,18 +173,18 @@ void Sprite::Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
min_dist = dist;
// Set the destination of sprite to this exit
- ai_data.Dest(i.dim.rect.x + i.dim.rect.w / 2, i.dim.rect.y + i.dim.rect.h / 2);
+ ai_data.dest(i.dim.rect.x + i.dim.rect.w / 2, i.dim.rect.y + i.dim.rect.h / 2);
- pathing.SetDestination(Vector2f((float)ai_data.dest.x, (float)ai_data.dest.y));
+ pathing.SetDestination(Vector2f((float)ai_data._dest.x, (float)ai_data._dest.y));
}
}
}
} break;
case FLEESTATE_RUNTOEXIT: {
Rect b = BoundRect();
- if (b.Contains(ai_data.dest)) {
+ if (b.Contains(ai_data._dest)) {
// We have reached the exit, time to make the sprite disappear
- ai_data.flee.state = FLEESTATE_DISAPPEAR;
+ ai_data._flee._state = FLEESTATE_DISAPPEAR;
break;
} else {
int num = 0;
@@ -193,7 +193,7 @@ void Sprite::Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
float velocity = static_cast<float>(num);
// MoveToLoc(ai_data.dest, vel, sc);
- MoveToLocPathfinding(ai_data.dest, velocity, sc);
+ MoveToLocPathfinding(ai_data._dest, velocity, sc);
}
} break;
case FLEESTATE_DISAPPEAR:
@@ -211,16 +211,16 @@ void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const Spri
warning("STUB: Sprite::Attack()");
#if 0
- switch (ai_data.fight.state) {
+ switch (ai_data.fight._state) {
case FIGHTSTATE_GETNEXTMOVE: {
- ai_data.fight.state = FIGHTSTATE_GETINRANGE;
+ ai_data.fight._state = FIGHTSTATE_GETINRANGE;
ai_data.fight.delay.Start();
unsigned int size = ai_data.fight.attack.size();
if (size > 1)
anim_set.fight.Next(ai_data.fight.attack[gRandom.Num() % ai_data.fight.attack.size()]);
else if (size <= 0)
- ai_data.fight.state = FIGHTSTATE_CANTFIGHT;
+ ai_data.fight._state = FIGHTSTATE_CANTFIGHT;
else
anim_set.fight.Next(ai_data.fight.attack[0]);
} break;
@@ -237,13 +237,13 @@ void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const Spri
FightMove f;
if (anim_set.fight.NextMove(f) && FightCollide(target_sp.BoxV(), target_sp.BoundRect(), f.ai.range, sc)) {
if (ai_data.fight.delay.Ticks() > f.ai.delay)
- ai_data.fight.state = FIGHTSTATE_EXECUTEMOVE;
+ ai_data.fight._state = FIGHTSTATE_EXECUTEMOVE;
} else if (input.Idle())
MoveToDestPathfinding(info, sc);
} break;
case FIGHTSTATE_EXECUTEMOVE:
UpdateMove(anim_set.fight.Next());
- ai_data.fight.state = FIGHTSTATE_GETNEXTMOVE;
+ ai_data.fight._state = FIGHTSTATE_GETNEXTMOVE;
ai_data.fight.delay.Stop();
break;
default:
@@ -254,40 +254,40 @@ void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const Spri
void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
// Is this sprite flying right now?
- if (ai_data.walk._enabled) {
+ if (ai_data._walk._enabled) {
// We're flying towards the left edge
if (XVel() < 0) {
// Are we completely out of the left edge of the camera?
if (X() < camera.x - W()) {
- ai_data.walk._enabled = false;
+ ai_data._walk._enabled = false;
// Start the timer, set a semi-random time
- ai_data.walk._timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
- ai_data.walk._timer.Start();
+ ai_data._walk._timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
+ ai_data._walk._timer.Start();
}
}
// Flying towards the right edge
else if (XVel() > 0) {
// Are we completely out of the left edge of the camera?
if (X() > camera.x + camera.w + W()) {
- ai_data.walk._enabled = false;
+ ai_data._walk._enabled = false;
// Start the timer, set a semi-random time
- ai_data.walk._timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
- ai_data.walk._timer.Start();
+ ai_data._walk._timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
+ ai_data._walk._timer.Start();
}
}
Move(sc);
} else {
// Safety condition in case timer isn't running
- if (!ai_data.walk._timer.Started())
- ai_data.walk._timer.Start();
+ if (!ai_data._walk._timer.Started())
+ ai_data._walk._timer.Start();
// Is it time to start flying?
- if (ai_data.walk._timer.TargetReached()) {
+ if (ai_data._walk._timer.TargetReached()) {
// Stop the timer
- ai_data.walk._timer.Stop();
+ ai_data._walk._timer.Stop();
// Decide if the sprite flies from the left or right of the camera
if (g_engine->getRandomNumber(1)) {
@@ -310,7 +310,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
YVel(sc.fly.vel.y);
// Set state to flying
- ai_data.walk._enabled = true;
+ ai_data._walk._enabled = true;
}
}
}
diff --git a/engines/crab/ai/spriteai.h b/engines/crab/ai/spriteai.h
index 2a7804a6624..7123ab625a4 100644
--- a/engines/crab/ai/spriteai.h
+++ b/engines/crab/ai/spriteai.h
@@ -40,62 +40,76 @@ namespace Crab {
// class PathfindingAgent;
namespace pyrodactyl {
namespace ai {
+
// States of a fighting sprite
-enum AIFightState { FIGHTSTATE_GETNEXTMOVE,
- FIGHTSTATE_GETINRANGE,
- FIGHTSTATE_EXECUTEMOVE,
- FIGHTSTATE_CANTFIGHT };
+enum AIFightState {
+ FIGHTSTATE_GETNEXTMOVE,
+ FIGHTSTATE_GETINRANGE,
+ FIGHTSTATE_EXECUTEMOVE,
+ FIGHTSTATE_CANTFIGHT
+};
// States of a fleeing sprite
-enum AIFleeState { FLEESTATE_GETNEARESTEXIT,
- FLEESTATE_RUNTOEXIT,
- FLEESTATE_DISAPPEAR,
- FLEESTATE_CANTFLEE };
+enum AIFleeState {
+ FLEESTATE_GETNEARESTEXIT,
+ FLEESTATE_RUNTOEXIT,
+ FLEESTATE_DISAPPEAR,
+ FLEESTATE_CANTFLEE
+};
struct SpriteAIData {
// Data required for fighting
struct FightData {
// The state of the sprite
- AIFightState state;
+ AIFightState _state;
// Used to count down the time NPCs wait before their next move
// Usually varies per move which is why we don't load target for it
- Timer delay;
+ Timer _delay;
// The list of moves that can be performed while attacking
- Common::Array<unsigned int> attack;
+ Common::Array<unsigned int> _attack;
- FightData() { state = FIGHTSTATE_GETNEXTMOVE; }
- } fight;
+ FightData() {
+ _state = FIGHTSTATE_GETNEXTMOVE;
+ }
+ } _fight;
// The pattern a peaceful sprite walks in
- MovementSet walk;
+ MovementSet _walk;
// Data required to flee
struct FleeData {
- AIFleeState state;
+ AIFleeState _state;
- FleeData() { state = FLEESTATE_GETNEARESTEXIT; }
- } flee;
+ FleeData() {
+ _state = FLEESTATE_GETNEARESTEXIT;
+ }
+ } _flee;
// The next location the sprite has to reach
// PLAYER: Used for adventure game style point-n-click movement
// AI: Used for path-finding (usually to the player's location)
struct Destination : public Vector2i {
// Are we trying to reach the destination?
- bool active;
+ bool _active;
- Destination() { active = false; }
- } dest;
+ Destination() {
+ _active = false;
+ }
+ } _dest;
SpriteAIData() {}
- void Dest(const int &x, const int &y, const bool &Active = true) {
- dest.x = x;
- dest.y = y;
- dest.active = Active;
+ void dest(const int &x, const int &y, const bool &active = true) {
+ _dest.x = x;
+ _dest.y = y;
+ _dest._active = active;
+ }
+
+ void dest(const Vector2i &v, const bool &active = true) {
+ dest(v.x, v.y, active);
}
- void Dest(const Vector2i &v, const bool &Active = true) { Dest(v.x, v.y, Active); }
};
} // End of namespace ai
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 440fb16556c..59c5ef982e7 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -83,7 +83,7 @@ void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
if (index < animations.size())
anim_set.Load(animations[index]);
- anim_set.fight.ListAttackMoves(ai_data.fight.attack);
+ anim_set.fight.ListAttackMoves(ai_data._fight._attack);
LoadDirection(dir, node);
clip = anim_set.walk.Clip(dir);
@@ -93,7 +93,7 @@ void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
visible.Load(node->first_node("visible"));
if (NodeValid("movement", node, false))
- ai_data.walk.load(node->first_node("movement"));
+ ai_data._walk.load(node->first_node("movement"));
if (NodeValid("popup", node, false))
popup.Load(node->first_node("popup"));
@@ -343,7 +343,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!ai_data.dest.active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
+ if (!ai_data._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
int x = pos.x - camera.x - anim_set.AnchorX(dir), y = pos.y - camera.y - anim_set.AnchorY(dir);
@@ -371,22 +371,22 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// Disable destination as soon as player presses a direction key
// X axis
if (g_engine->_inputManager->State(IG_LEFT)) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
XVel(-player_speed * sc.walk_vel_mod.x);
} else if (g_engine->_inputManager->State(IG_RIGHT)) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
XVel(player_speed * sc.walk_vel_mod.x);
- } else if (!ai_data.dest.active)
+ } else if (!ai_data._dest._active)
XVel(0.0f);
// Y axis
if (g_engine->_inputManager->State(IG_UP)) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
YVel(-player_speed * sc.walk_vel_mod.y);
} else if (g_engine->_inputManager->State(IG_DOWN)) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
YVel(player_speed * sc.walk_vel_mod.y);
- } else if (!ai_data.dest.active)
+ } else if (!ai_data._dest._active)
YVel(0.0f);
}
@@ -409,7 +409,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!ai_data.dest.active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
+ if (!ai_data._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
int x = pos.x - camera.x - anim_set.AnchorX(dir), y = pos.y - camera.y - anim_set.AnchorY(dir);
@@ -437,22 +437,22 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// Disable destination as soon as player presses a direction key
// X axis
if (g_engine->_inputManager->State(IG_LEFT)) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
XVel(-player_speed * sc.walk_vel_mod.x);
} else if (g_engine->_inputManager->State(IG_RIGHT)) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
XVel(player_speed * sc.walk_vel_mod.x);
- } else if (!ai_data.dest.active)
+ } else if (!ai_data._dest._active)
XVel(0.0f);
// Y axis
if (g_engine->_inputManager->State(IG_UP)) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
YVel(-player_speed * sc.walk_vel_mod.y);
} else if (g_engine->_inputManager->State(IG_DOWN)) {
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
YVel(player_speed * sc.walk_vel_mod.y);
- } else if (!ai_data.dest.active)
+ } else if (!ai_data._dest._active)
YVel(0.0f);
}
@@ -467,7 +467,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// Purpose: Set destination for sprite movement
//------------------------------------------------------------------------
void Sprite::SetDestPathfinding(const Vector2i &dest, bool reachable) {
- ai_data.Dest(dest, true);
+ ai_data.dest(dest, true);
pathing.SetDestination(dest, reachable);
}
@@ -479,9 +479,9 @@ void Sprite::Walk(const pyrodactyl::people::PersonState &pst) {
bool first_x = true;
- if (ai_data.dest.active) {
+ if (ai_data._dest._active) {
Rect b = BoundRect();
- if (pos.x - ai_data.dest.x > -b.w && pos.x - ai_data.dest.x < b.w)
+ if (pos.x - ai_data._dest.x > -b.w && pos.x - ai_data._dest.x < b.w)
first_x = false;
}
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index b84ae290424..88615493987 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -134,7 +134,7 @@ public:
int X() { return pos.x; }
int Y() { return pos.y; }
- void WalkPattern(const pyrodactyl::ai::MovementSet &set) { ai_data.walk = set; }
+ void WalkPattern(const pyrodactyl::ai::MovementSet &set) { ai_data._walk = set; }
void Move(const pyrodactyl::ai::SpriteConstant &sc);
@@ -147,7 +147,7 @@ public:
void Stop() {
vel.Set();
target.Set();
- ai_data.dest.active = false;
+ ai_data._dest._active = false;
}
void InputStop() { input.Reset(); }
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index add3e4db0b9..0c3acb479ce 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -75,7 +75,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
// Draw the terrain layer
g_engine->_imageManager->tileset.Draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].PosRect(), img);
- Vector2i pos = objects[player_index].ai_data.dest;
+ Vector2i pos = objects[player_index].ai_data._dest;
Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
@@ -111,7 +111,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
// Fliers are drawn above every sprite but below popup text
for (auto &i : fly) {
// Only draw if it is supposed to be flying
- if (i.ai_data.walk._enabled)
+ if (i.ai_data._walk._enabled)
i.Draw(info, camera);
}
@@ -140,10 +140,10 @@ void Level::Draw(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
void Level::DrawObjects(pyrodactyl::event::Info &info) {
// Draw player destination marker
- if (objects[player_index].ai_data.dest.active)
- dest_marker.Draw(objects[player_index].ai_data.dest, camera);
+ if (objects[player_index].ai_data._dest._active)
+ dest_marker.Draw(objects[player_index].ai_data._dest, camera);
- Vector2i pos = objects[player_index].ai_data.dest;
+ Vector2i pos = objects[player_index].ai_data._dest;
Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
if (terrain.prop.empty()) {
@@ -164,7 +164,7 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
}
- if (i.Contains(objects[player_index].ai_data.dest)) {
+ if (i.Contains(objects[player_index].ai_data._dest)) {
g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
}
}
@@ -190,7 +190,7 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
}
- if (i.Contains(objects[player_index].ai_data.dest)) {
+ if (i.Contains(objects[player_index].ai_data._dest)) {
g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
}
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 668d4f7022c..b13a3d482af 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -134,7 +134,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
// Set the timer target for the first time
//s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
- s.ai_data.walk._timer.Target(sc_default.fly.delay_max);
+ s.ai_data._walk._timer.Target(sc_default.fly.delay_max);
fly.push_back(s);
}
Commit: 5d119e97b4ab12c479442cff9c0d3f137b3335f8
https://github.com/scummvm/scummvm/commit/5d119e97b4ab12c479442cff9c0d3f137b3335f8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make SpriteConstant/FlyerConstant struct follow code formatting conventions
Changed paths:
engines/crab/ai/SpriteConstant.cpp
engines/crab/ai/SpriteConstant.h
engines/crab/ai/spriteai.cpp
engines/crab/animation/sprite.cpp
engines/crab/level/level_load.cpp
diff --git a/engines/crab/ai/SpriteConstant.cpp b/engines/crab/ai/SpriteConstant.cpp
index c05b6917845..5dc879fad38 100644
--- a/engines/crab/ai/SpriteConstant.cpp
+++ b/engines/crab/ai/SpriteConstant.cpp
@@ -34,39 +34,39 @@ namespace Crab {
using namespace pyrodactyl::ai;
-FlyerConstant::FlyerConstant() : start(10, 40), vel(8.0f, 0.0f) {
- delay_min = 5000;
- delay_max = 20000;
+FlyerConstant::FlyerConstant() : _start(10, 40), _vel(8.0f, 0.0f) {
+ _delayMin = 5000;
+ _delayMax = 20000;
}
-void FlyerConstant::Load(rapidxml::xml_node<char> *node) {
+void FlyerConstant::load(rapidxml::xml_node<char> *node) {
if (NodeValid("start", node))
- start.Load(node->first_node("start"));
+ _start.Load(node->first_node("start"));
if (NodeValid("vel", node))
- vel.Load(node->first_node("vel"));
+ _vel.Load(node->first_node("vel"));
if (NodeValid("delay", node)) {
auto n = node->first_node("delay");
- LoadNum(delay_min, "min", n);
- LoadNum(delay_max, "max", n);
+ LoadNum(_delayMin, "min", n);
+ LoadNum(_delayMax, "max", n);
}
}
-SpriteConstant::SpriteConstant() : walk_vel_mod(0.9f, 0.63f) {
- plane_w = 20;
- tweening = 0.2f;
+SpriteConstant::SpriteConstant() : _walkVelMod(0.9f, 0.63f) {
+ _planeW = 20;
+ _tweening = 0.2f;
}
-void SpriteConstant::Load(rapidxml::xml_node<char> *node) {
- LoadNum(plane_w, "plane_width", node);
- LoadNum(tweening, "tweening", node);
+void SpriteConstant::load(rapidxml::xml_node<char> *node) {
+ LoadNum(_planeW, "plane_width", node);
+ LoadNum(_tweening, "tweening", node);
- if (NodeValid("walk_vel_mod", node))
- walk_vel_mod.Load(node->first_node("walk_vel_mod"));
+ if (NodeValid("_walkVelMod", node))
+ _walkVelMod.Load(node->first_node("_walkVelMod"));
if (NodeValid("fly", node))
- fly.Load(node->first_node("fly"));
+ _fly.load(node->first_node("fly"));
}
} // End of namespace Crab
diff --git a/engines/crab/ai/SpriteConstant.h b/engines/crab/ai/SpriteConstant.h
index 154068b1d53..12db230d7ca 100644
--- a/engines/crab/ai/SpriteConstant.h
+++ b/engines/crab/ai/SpriteConstant.h
@@ -41,36 +41,36 @@ namespace ai {
// These parameters control aspects of sprites flying across the screen
struct FlyerConstant {
// How far does a flier sprite start from the camera (an offset, not the whole value)
- Vector2i start;
+ Vector2i _start;
// The value of the delay for fliers
- uint32 delay_min, delay_max;
+ uint32 _delayMin, _delayMax;
// The velocity of fliers
- Vector2f vel;
+ Vector2f _vel;
FlyerConstant();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
// These values are used in various sprite related tasks
struct SpriteConstant {
// Plane width decides the maximum difference in sprite Y values that is considered on the same plane
- int plane_w;
+ int _planeW;
// Tweening constant controls the acceleration curve of every sprite
- float tweening;
+ float _tweening;
// The modifiers of x and y movement speeds
- Vector2f walk_vel_mod;
+ Vector2f _walkVelMod;
// Data for flying sprites
- FlyerConstant fly;
+ FlyerConstant _fly;
SpriteConstant();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
} // End of namespace ai
} // End of namespace pyrodactyl
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 9a2c3bd7659..ede2bd83561 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -97,17 +97,17 @@ bool Sprite::MoveToLoc(Vector2i &dest, const float &velocity, const SpriteConsta
// X axis
if (b.x + b.w < dest.x)
- XVel(velocity * sc.walk_vel_mod.x);
+ XVel(velocity * sc._walkVelMod.x);
else if (b.x > dest.x)
- XVel(-velocity * sc.walk_vel_mod.x);
+ XVel(-velocity * sc._walkVelMod.x);
else
XVel(0.0f);
// Y axis
if (b.y + b.h < dest.y)
- YVel(velocity * sc.walk_vel_mod.y);
+ YVel(velocity * sc._walkVelMod.y);
else if (b.y > dest.y)
- YVel(-velocity * sc.walk_vel_mod.y);
+ YVel(-velocity * sc._walkVelMod.y);
else
YVel(0.0f);
@@ -128,13 +128,13 @@ bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &velocity, const S
float deltaTime = 1.0f / (float)g_engine->_screenSettings->fps;
// Project how far we will travel next frame.
- Vector2f velVec = Vector2f(sc.walk_vel_mod.x * velocity * deltaTime, sc.walk_vel_mod.y * velocity * deltaTime);
+ Vector2f velVec = Vector2f(sc._walkVelMod.x * velocity * deltaTime, sc._walkVelMod.y * velocity * deltaTime);
if (vecTo.Magnitude() > velVec.Magnitude()) {
vecTo.Normalize();
- XVel(vecTo.x * sc.walk_vel_mod.x * velocity);
- YVel(vecTo.y * sc.walk_vel_mod.y * velocity);
+ XVel(vecTo.x * sc._walkVelMod.x * velocity);
+ YVel(vecTo.y * sc._walkVelMod.y * velocity);
} else {
XVel(0.0f);
YVel(0.0f);
@@ -262,7 +262,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
ai_data._walk._enabled = false;
// Start the timer, set a semi-random time
- ai_data._walk._timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
+ ai_data._walk._timer.Target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
ai_data._walk._timer.Start();
}
}
@@ -273,7 +273,7 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
ai_data._walk._enabled = false;
// Start the timer, set a semi-random time
- ai_data._walk._timer.Target(sc.fly.delay_min + (g_engine->getRandomNumber(sc.fly.delay_max)));
+ ai_data._walk._timer.Target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
ai_data._walk._timer.Start();
}
}
@@ -292,22 +292,22 @@ void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
// Decide if the sprite flies from the left or right of the camera
if (g_engine->getRandomNumber(1)) {
// Fly in from the right
- X(camera.x + camera.w + sc.fly.start.x);
- XVel(-1.0f * sc.fly.vel.x);
+ X(camera.x + camera.w + sc._fly._start.x);
+ XVel(-1.0f * sc._fly._vel.x);
// Sprite needs to face left
dir = DIRECTION_LEFT;
} else {
// Fly in from the left
- X(camera.x - W() - sc.fly.start.x);
- XVel(sc.fly.vel.x);
+ X(camera.x - W() - sc._fly._start.x);
+ XVel(sc._fly._vel.x);
// Sprite needs to face right
dir = DIRECTION_RIGHT;
}
- Y(camera.y + sc.fly.start.y + (g_engine->getRandomNumber(camera.h - (2 * sc.fly.start.y))));
- YVel(sc.fly.vel.y);
+ Y(camera.y + sc._fly._start.y + (g_engine->getRandomNumber(camera.h - (2 * sc._fly._start.y))));
+ YVel(sc._fly._vel.y);
// Set state to flying
ai_data._walk._enabled = true;
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 59c5ef982e7..9e7ce2342b0 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -104,17 +104,17 @@ void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
// Purpose: Move along x and y axis
//------------------------------------------------------------------------
void Sprite::Move(const SpriteConstant &sc) {
- if (target.x == 0.0f && (vel.x > -sc.tweening && vel.x < sc.tweening))
+ if (target.x == 0.0f && (vel.x > -sc._tweening && vel.x < sc._tweening))
vel.x = 0.0f;
else {
- vel.x += (target.x - vel.x) * sc.tweening;
+ vel.x += (target.x - vel.x) * sc._tweening;
pos.x += vel.x;
}
- if (target.y == 0.0f && (vel.y > -sc.tweening && vel.y < sc.tweening))
+ if (target.y == 0.0f && (vel.y > -sc._tweening && vel.y < sc._tweening))
vel.y = 0.0f;
else {
- vel.y += (target.y - vel.y) * sc.tweening;
+ vel.y += (target.y - vel.y) * sc._tweening;
pos.y += vel.y;
}
}
@@ -353,17 +353,17 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// X axis
if (g_engine->_mouse->motion.x > x + w)
- XVel(player_speed * sc.walk_vel_mod.x);
+ XVel(player_speed * sc._walkVelMod.x);
else if (g_engine->_mouse->motion.x < x)
- XVel(-player_speed * sc.walk_vel_mod.x);
+ XVel(-player_speed * sc._walkVelMod.x);
else
XVel(0.0f);
// Y axis
if (g_engine->_mouse->motion.y > y + h)
- YVel(player_speed * sc.walk_vel_mod.y);
+ YVel(player_speed * sc._walkVelMod.y);
else if (g_engine->_mouse->motion.y < y)
- YVel(-player_speed * sc.walk_vel_mod.y);
+ YVel(-player_speed * sc._walkVelMod.y);
else
YVel(0.0f);
} else // Keyboard movement
@@ -372,20 +372,20 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// X axis
if (g_engine->_inputManager->State(IG_LEFT)) {
ai_data._dest._active = false;
- XVel(-player_speed * sc.walk_vel_mod.x);
+ XVel(-player_speed * sc._walkVelMod.x);
} else if (g_engine->_inputManager->State(IG_RIGHT)) {
ai_data._dest._active = false;
- XVel(player_speed * sc.walk_vel_mod.x);
+ XVel(player_speed * sc._walkVelMod.x);
} else if (!ai_data._dest._active)
XVel(0.0f);
// Y axis
if (g_engine->_inputManager->State(IG_UP)) {
ai_data._dest._active = false;
- YVel(-player_speed * sc.walk_vel_mod.y);
+ YVel(-player_speed * sc._walkVelMod.y);
} else if (g_engine->_inputManager->State(IG_DOWN)) {
ai_data._dest._active = false;
- YVel(player_speed * sc.walk_vel_mod.y);
+ YVel(player_speed * sc._walkVelMod.y);
} else if (!ai_data._dest._active)
YVel(0.0f);
@@ -419,17 +419,17 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// X axis
if (g_engine->_mouse->motion.x > x + w)
- XVel(player_speed * sc.walk_vel_mod.x);
+ XVel(player_speed * sc._walkVelMod.x);
else if (g_engine->_mouse->motion.x < x)
- XVel(-player_speed * sc.walk_vel_mod.x);
+ XVel(-player_speed * sc._walkVelMod.x);
else
XVel(0.0f);
// Y axis
if (g_engine->_mouse->motion.y > y + h)
- YVel(player_speed * sc.walk_vel_mod.y);
+ YVel(player_speed * sc._walkVelMod.y);
else if (g_engine->_mouse->motion.y < y)
- YVel(-player_speed * sc.walk_vel_mod.y);
+ YVel(-player_speed * sc._walkVelMod.y);
else
YVel(0.0f);
} else // Keyboard movement
@@ -438,20 +438,20 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// X axis
if (g_engine->_inputManager->State(IG_LEFT)) {
ai_data._dest._active = false;
- XVel(-player_speed * sc.walk_vel_mod.x);
+ XVel(-player_speed * sc._walkVelMod.x);
} else if (g_engine->_inputManager->State(IG_RIGHT)) {
ai_data._dest._active = false;
- XVel(player_speed * sc.walk_vel_mod.x);
+ XVel(player_speed * sc._walkVelMod.x);
} else if (!ai_data._dest._active)
XVel(0.0f);
// Y axis
if (g_engine->_inputManager->State(IG_UP)) {
ai_data._dest._active = false;
- YVel(-player_speed * sc.walk_vel_mod.y);
+ YVel(-player_speed * sc._walkVelMod.y);
} else if (g_engine->_inputManager->State(IG_DOWN)) {
ai_data._dest._active = false;
- YVel(player_speed * sc.walk_vel_mod.y);
+ YVel(player_speed * sc._walkVelMod.y);
} else if (!ai_data._dest._active)
YVel(0.0f);
}
@@ -525,10 +525,10 @@ bool Sprite::FightCollide(Rect hitbox, Rect enemy_bounds, Range &range, const Sp
Rect actual_range = RangeRect(bounds, range);
// The second part is a sanity check so the stray hitbox of a sprite 1000 pixels below does not cause damage
- if (hitbox.Collide(actual_range) && abs(bounds.y + bounds.h - enemy_bounds.y - enemy_bounds.h) < sc.plane_w)
+ if (hitbox.Collide(actual_range) && abs(bounds.y + bounds.h - enemy_bounds.y - enemy_bounds.h) < sc._planeW)
return true;
} else {
- if (hitbox.Collide(bounds) && abs(bounds.y + bounds.h - enemy_bounds.y - enemy_bounds.h) < sc.plane_w)
+ if (hitbox.Collide(bounds) && abs(bounds.y + bounds.h - enemy_bounds.y - enemy_bounds.h) < sc._planeW)
return true;
}
@@ -625,7 +625,7 @@ bool Sprite::DamageValid(Sprite &s, const SpriteConstant &sc) {
// Get the y coordinates where these sprites are standing
float Y = pos.y + clip.h, SY = s.pos.y + s.clip.h;
- if (abs(Y - SY) < sc.plane_w)
+ if (abs(Y - SY) < sc._planeW)
return true;
return false;
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index b13a3d482af..7aa828c5ae9 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -134,7 +134,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
// Set the timer target for the first time
//s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
- s.ai_data._walk._timer.Target(sc_default.fly.delay_max);
+ s.ai_data._walk._timer.Target(sc_default._fly._delayMax);
fly.push_back(s);
}
@@ -204,7 +204,7 @@ void Level::LoadConst(const Common::String &filename) {
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.doc()->first_node("constant");
if (NodeValid(node))
- sc_default.Load(node);
+ sc_default.load(node);
}
}
Commit: e307d304fc3dbdfc3fe9a16ad41409faabb560c2
https://github.com/scummvm/scummvm/commit/e307d304fc3dbdfc3fe9a16ad41409faabb560c2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Animation class follow code formatting conventions
Changed paths:
engines/crab/animation/animation.cpp
engines/crab/animation/animation.h
engines/crab/event/gameeventmanager.cpp
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index 23805047bc1..f2ca200b01b 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -36,30 +36,30 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
Animation::Animation(rapidxml::xml_node<char> *node) {
- LoadNum(length, "length", node);
+ LoadNum(_length, "length", node);
for (auto n = node->first_node("frame"); n != NULL; n = n->next_sibling("frame"))
- frame.push_back(n);
+ _frame.push_back(n);
}
-void Animation::Draw() {
- uint32 timestamp = timer.Ticks();
- for (auto i = frame.begin(); i != frame.end(); ++i)
+void Animation::draw() {
+ uint32 timestamp = _timer.Ticks();
+ for (auto i = _frame.begin(); i != _frame.end(); ++i)
i->Draw(timestamp);
}
-bool Animation::InternalEvents(DrawType &game_draw) {
- uint32 timestamp = timer.Ticks();
- for (auto i = frame.begin(); i != frame.end(); ++i) {
+bool Animation::internalEvents(DrawType &gameDraw) {
+ uint32 timestamp = _timer.Ticks();
+ for (auto i = _frame.begin(); i != _frame.end(); ++i) {
DrawType result = i->InternalEvents(timestamp);
// if (result != DRAW_SAME)
- game_draw = result;
+ gameDraw = result;
}
- return timer.Ticks() >= length;
+ return _timer.Ticks() >= _length;
}
-void Animation::Reset() {
- for (auto i = frame.begin(); i != frame.end(); ++i)
+void Animation::reset() {
+ for (auto i = _frame.begin(); i != _frame.end(); ++i)
i->Reset();
}
diff --git a/engines/crab/animation/animation.h b/engines/crab/animation/animation.h
index 73bc1164d12..9cb78eee051 100644
--- a/engines/crab/animation/animation.h
+++ b/engines/crab/animation/animation.h
@@ -42,25 +42,28 @@ namespace pyrodactyl {
namespace anim {
class Animation {
// All the frames are updated simultaneously rather than sequentially
- Common::Array<AnimationFrame> frame;
+ Common::Array<AnimationFrame> _frame;
// Length of the entire animation in milliseconds
- uint32 length;
+ uint32 _length;
// Keep track of the time
- Timer timer;
+ Timer _timer;
public:
- Animation() { length = 0; }
+ Animation() {
+ _length = 0;
+ }
+
Animation(rapidxml::xml_node<char> *node);
- void Draw();
- void Reset();
+ void draw();
+ void reset();
- bool InternalEvents(DrawType &game_draw);
- void Start() {
- Reset();
- timer.Start();
+ bool internalEvents(DrawType &gameDraw);
+ void start() {
+ reset();
+ _timer.Start();
}
};
} // End of namespace anim
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 2fa3847ba65..4425e90d12e 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -280,7 +280,7 @@ void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult
using namespace pyrodactyl::anim;
DrawType draw_val = DRAW_SAME;
- if (g_engine->_eventStore->anim[cur_event->special].InternalEvents(draw_val))
+ if (g_engine->_eventStore->anim[cur_event->special].internalEvents(draw_val))
event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
@@ -319,7 +319,7 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_ANIM:
- g_engine->_eventStore->anim[cur_event->special].Draw();
+ g_engine->_eventStore->anim[cur_event->special].draw();
break;
case EVENT_DIALOG:
g_engine->_imageManager->DimScreen();
@@ -373,7 +373,7 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
switch (cur_event->type) {
case EVENT_ANIM:
- g_engine->_eventStore->anim[cur_event->special].Start();
+ g_engine->_eventStore->anim[cur_event->special].start();
break;
case EVENT_REPLY:
reply.Cache(info, g_engine->_eventStore->con[cur_event->special]);
Commit: 115c13571cbf61410e082edbda984c7cf68b1a95
https://github.com/scummvm/scummvm/commit/115c13571cbf61410e082edbda984c7cf68b1a95
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make AnimationEffect class follow code formatting conventions
Changed paths:
engines/crab/animation/AnimationEffect.h
engines/crab/animation/AnimationFrame.cpp
diff --git a/engines/crab/animation/AnimationEffect.h b/engines/crab/animation/AnimationEffect.h
index 9f93b54c493..e65960329c4 100644
--- a/engines/crab/animation/AnimationEffect.h
+++ b/engines/crab/animation/AnimationEffect.h
@@ -39,55 +39,59 @@ namespace Crab {
namespace pyrodactyl {
namespace anim {
// Types of fade effects
-enum FadeType { FADE_NONE,
- FADE_IN,
- FADE_OUT };
+enum FadeType {
+ FADE_NONE,
+ FADE_IN,
+ FADE_OUT
+};
// Sometimes we need to stop drawing the game for proper fade effects
// Use DRAW_STOP to stop drawing the game until DRAW_START is called. DRAW_SAME doesn't change anything
-enum DrawType { DRAW_SAME,
- DRAW_STOP,
- DRAW_START };
+enum DrawType {
+ DRAW_SAME,
+ DRAW_STOP,
+ DRAW_START
+};
struct AnimationEffect {
// What sort of effect do we apply to the image
- FadeType type;
+ FadeType _type;
// The duration of the effect relative to the start of this animation
- uint32 start, finish;
+ uint32 _start, _finish;
// Warning: the only way to start drawing the game again is having another animation event with DRAW_START
- DrawType draw_game;
+ DrawType _drawGame;
AnimationEffect() {
- type = FADE_NONE;
- draw_game = DRAW_SAME;
- start = 0;
- finish = 0;
+ _type = FADE_NONE;
+ _drawGame = DRAW_SAME;
+ _start = 0;
+ _finish = 0;
}
AnimationEffect(rapidxml::xml_node<char> *node) {
if (NodeValid("effect", node)) {
rapidxml::xml_node<char> *effnode = node->first_node("effect");
- LoadNum(start, "start", effnode);
- LoadNum(finish, "finish", effnode);
+ LoadNum(_start, "start", effnode);
+ LoadNum(_finish, "finish", effnode);
Common::String str;
LoadStr(str, "type", effnode);
if (str == "fade_in")
- type = FADE_IN;
+ _type = FADE_IN;
else if (str == "fade_out")
- type = FADE_OUT;
+ _type = FADE_OUT;
else
- type = FADE_NONE;
+ _type = FADE_NONE;
LoadStr(str, "game_draw", effnode);
if (str == "start")
- draw_game = DRAW_START;
+ _drawGame = DRAW_START;
else if (str == "stop")
- draw_game = DRAW_STOP;
+ _drawGame = DRAW_STOP;
else
- draw_game = DRAW_SAME;
+ _drawGame = DRAW_SAME;
}
}
};
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index 2a7a72ce2c6..f67ac468b2b 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -50,7 +50,7 @@ AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : eff(node) {
}
void AnimationFrame::Reset() {
- switch (eff.type) {
+ switch (eff._type) {
case FADE_IN:
col.a = 0;
break;
@@ -83,20 +83,20 @@ void AnimationFrame::Draw(const uint32 ×tamp) {
DrawType AnimationFrame::InternalEvents(const uint32 ×tamp) {
// Vary alpha according to the effect values in the variation time frame
- if (timestamp >= eff.start && timestamp <= eff.finish) {
+ if (timestamp >= eff._start && timestamp <= eff._finish) {
// These equations courtesy of linear algebra
- switch (eff.type) {
+ switch (eff._type) {
case FADE_IN:
- col.a = (255 * (timestamp - eff.start)) / (eff.finish - eff.start);
+ col.a = (255 * (timestamp - eff._start)) / (eff._finish - eff._start);
break;
case FADE_OUT:
- col.a = (255 * (eff.finish - timestamp)) / (eff.finish - eff.start);
+ col.a = (255 * (eff._finish - timestamp)) / (eff._finish - eff._start);
break;
default:
break;
}
- return eff.draw_game;
+ return eff._drawGame;
}
return DRAW_SAME;
Commit: ed4055b00d1adb85a81b9c853674f52e545d7373
https://github.com/scummvm/scummvm/commit/ed4055b00d1adb85a81b9c853674f52e545d7373
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make AnimationFrame class follow code formatting conventions
Changed paths:
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/AnimationFrame.h
engines/crab/animation/animation.cpp
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index f67ac468b2b..2a716d35427 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -36,34 +36,34 @@ namespace Crab {
using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
-AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : eff(node) {
+AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : _eff(node) {
Vector2i::Load(node);
- LoadImgKey(img, "img", node);
- LoadNum(start, "start", node);
- LoadNum(finish, "finish", node);
+ LoadImgKey(_img, "img", node);
+ LoadNum(_start, "start", node);
+ LoadNum(_finish, "finish", node);
//LoadColor(col, node);
if (NodeValid("text", node, false))
- text.Load(node->first_node("text"));
+ _text.Load(node->first_node("text"));
- Reset();
+ reset();
}
-void AnimationFrame::Reset() {
- switch (eff._type) {
+void AnimationFrame::reset() {
+ switch (_eff._type) {
case FADE_IN:
- col.a = 0;
+ _col.a = 0;
break;
case FADE_OUT:
- col.a = 255;
+ _col.a = 255;
break;
default:
- col.a = 255;
+ _col.a = 255;
break;
}
}
-void AnimationFrame::Draw(const uint32 ×tamp) {
+void AnimationFrame::draw(const uint32 ×tamp) {
warning("STUB: AnimationFrame::Draw()");
#if 0
@@ -80,23 +80,23 @@ void AnimationFrame::Draw(const uint32 ×tamp) {
#endif
}
-DrawType AnimationFrame::InternalEvents(const uint32 ×tamp) {
+DrawType AnimationFrame::internalEvents(const uint32 ×tamp) {
// Vary alpha according to the effect values in the variation time frame
- if (timestamp >= eff._start && timestamp <= eff._finish) {
+ if (timestamp >= _eff._start && timestamp <= _eff._finish) {
// These equations courtesy of linear algebra
- switch (eff._type) {
+ switch (_eff._type) {
case FADE_IN:
- col.a = (255 * (timestamp - eff._start)) / (eff._finish - eff._start);
+ _col.a = (255 * (timestamp - _eff._start)) / (_eff._finish - _eff._start);
break;
case FADE_OUT:
- col.a = (255 * (eff._finish - timestamp)) / (eff._finish - eff._start);
+ _col.a = (255 * (_eff._finish - timestamp)) / (_eff._finish - _eff._start);
break;
default:
break;
}
- return eff._drawGame;
+ return _eff._drawGame;
}
return DRAW_SAME;
diff --git a/engines/crab/animation/AnimationFrame.h b/engines/crab/animation/AnimationFrame.h
index 081be4245ee..ffe6e8ad99c 100644
--- a/engines/crab/animation/AnimationFrame.h
+++ b/engines/crab/animation/AnimationFrame.h
@@ -52,34 +52,35 @@ struct SDL_Color {
struct AnimationFrame : public Vector2i {
// The image drawn in this frame
- ImageKey img;
+ ImageKey _img;
// This is the time in we draw the frame milliseconds relative to the start of the entire animation
- uint32 start, finish;
+ uint32 _start, _finish;
// The effect applied to the image
- AnimationEffect eff;
+ AnimationEffect _eff;
// In case we want to display any words during the animation
- pyrodactyl::ui::HoverInfo text;
+ pyrodactyl::ui::HoverInfo _text;
// The color drawn on the screen
- SDL_Color col;
+ SDL_Color _col;
AnimationFrame() {
- img = 0;
- start = 0;
- finish = 0;
- col.r = 0;
- col.g = 0;
- col.b = 0;
- col.a = 255;
+ _img = 0;
+ _start = 0;
+ _finish = 0;
+ _col.r = 0;
+ _col.g = 0;
+ _col.b = 0;
+ _col.a = 255;
}
+
AnimationFrame(rapidxml::xml_node<char> *node);
- void Reset();
- void Draw(const uint32 ×tamp);
- DrawType InternalEvents(const uint32 ×tamp);
+ void reset();
+ void draw(const uint32 ×tamp);
+ DrawType internalEvents(const uint32 ×tamp);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index f2ca200b01b..0fa79f93f89 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -44,13 +44,13 @@ Animation::Animation(rapidxml::xml_node<char> *node) {
void Animation::draw() {
uint32 timestamp = _timer.Ticks();
for (auto i = _frame.begin(); i != _frame.end(); ++i)
- i->Draw(timestamp);
+ i->draw(timestamp);
}
bool Animation::internalEvents(DrawType &gameDraw) {
uint32 timestamp = _timer.Ticks();
for (auto i = _frame.begin(); i != _frame.end(); ++i) {
- DrawType result = i->InternalEvents(timestamp);
+ DrawType result = i->internalEvents(timestamp);
// if (result != DRAW_SAME)
gameDraw = result;
}
@@ -60,7 +60,7 @@ bool Animation::internalEvents(DrawType &gameDraw) {
void Animation::reset() {
for (auto i = _frame.begin(); i != _frame.end(); ++i)
- i->Reset();
+ i->reset();
}
} // End of namespace Crab
Commit: d1bc64ac73a6595807d97a77adf2fa4780fbbd22
https://github.com/scummvm/scummvm/commit/d1bc64ac73a6595807d97a77adf2fa4780fbbd22
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make AnimFrame/AnimationFrames follow code formatting conventions
Changed paths:
engines/crab/animation/animframe.cpp
engines/crab/animation/animframe.h
engines/crab/animation/animset.cpp
engines/crab/animation/fightanim.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
engines/crab/animation/walkframes.cpp
engines/crab/animation/walkframes.h
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index f6b21fcd8b4..cbecad3e991 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -34,76 +34,76 @@ namespace Crab {
using namespace pyrodactyl::anim;
-void AnimFrame::Load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
- clip.Load(node);
+void AnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
+ _clip.Load(node);
if (rep == 0)
- LoadNum(repeat, "repeat", node);
+ LoadNum(_repeat, "repeat", node);
else
- repeat = rep;
+ _repeat = rep;
if (AX == 0.0f && AY == 0.0f) {
if (NodeValid("anchor", node, false))
- anchor.Load(node->first_node("anchor"));
+ _anchor.Load(node->first_node("anchor"));
} else {
- anchor.x = AX;
- anchor.y = AY;
+ _anchor.x = AX;
+ _anchor.y = AY;
}
if (VBOX.w == 0 || VBOX.h == 0) {
if (NodeValid("box_v", node))
- box_v.Load(node->first_node("box_v"));
+ _boxV.Load(node->first_node("box_v"));
} else
- box_v = VBOX;
+ _boxV = VBOX;
}
-void AnimationFrames::Load(rapidxml::xml_node<char> *node) {
- LoadTextureFlipType(flip, node);
+void AnimationFrames::load(rapidxml::xml_node<char> *node) {
+ LoadTextureFlipType(_flip, node);
- if (!LoadNum(repeat, "repeat", node, false))
- repeat = 0;
+ if (!LoadNum(_repeat, "repeat", node, false))
+ _repeat = 0;
- LoadBool(random, "random", node, false);
+ LoadBool(_random, "random", node, false);
if (NodeValid("anchor", node, false))
- anchor.Load(node->first_node("anchor"));
+ _anchor.Load(node->first_node("anchor"));
if (NodeValid("box_v", node))
- box_v.Load(node->first_node("box_v"));
+ _boxV.Load(node->first_node("box_v"));
if (NodeValid("shadow", node)) {
- shadow.Load(node->first_node("shadow"));
- shadow.valid = true;
+ _shadow.Load(node->first_node("shadow"));
+ _shadow.valid = true;
}
if (NodeValid("frames", node)) {
- frame.clear();
+ _frame.clear();
rapidxml::xml_node<char> *framenode = node->first_node("frames");
for (auto n = framenode->first_node("frame"); n != NULL; n = n->next_sibling("frame")) {
AnimFrame af;
- af.Load(n, box_v, repeat, anchor.x, anchor.y);
- frame.push_back(af);
+ af.load(n, _boxV, _repeat, _anchor.x, _anchor.y);
+ _frame.push_back(af);
}
}
if (random)
- current_clip = g_engine->getRandomNumber(frame.size() - 1);
+ _currentClip = g_engine->getRandomNumber(_frame.size() - 1);
else
- current_clip = 0;
+ _currentClip = 0;
}
-bool AnimationFrames::UpdateClip() {
- if (current_clip < frame.size()) {
- current_clip = (current_clip + 1) % frame.size();
+bool AnimationFrames::updateClip() {
+ if (_currentClip < _frame.size()) {
+ _currentClip = (_currentClip + 1) % _frame.size();
return true;
} else
- current_clip = 0;
+ _currentClip = 0;
return false;
}
-const AnimFrame &AnimationFrames::CurrentFrame() {
- return frame[current_clip];
+const AnimFrame &AnimationFrames::currentFrame() {
+ return _frame[_currentClip];
}
} // End of namespace Crab
diff --git a/engines/crab/animation/animframe.h b/engines/crab/animation/animframe.h
index 8851671ec63..6be0b030695 100644
--- a/engines/crab/animation/animframe.h
+++ b/engines/crab/animation/animframe.h
@@ -42,65 +42,69 @@ namespace pyrodactyl {
namespace anim {
struct AnimFrame {
// Portion of sprite to show
- Rect clip;
+ Rect _clip;
// The duration for which the frame must be repeated on screen
- uint32 repeat;
+ uint32 _repeat;
// The anchor point of the frame
- Vector2i anchor;
+ Vector2i _anchor;
// The vulnerable hit box for this frame
- Rect box_v;
+ Rect _boxV;
- AnimFrame() { repeat = 0; }
+ AnimFrame() {
+ _repeat = 0;
+ }
- void Load(rapidxml::xml_node<char> *node, const Rect &VBOX,
+ void load(rapidxml::xml_node<char> *node, const Rect &VBOX,
const uint32 &REP = 0, const int &AX = 0, const int &AY = 0);
};
class AnimationFrames {
// The global vulnerable hit box for all the frames
// If the W or H of this is 0, then use individual frame values
- Rect box_v;
+ Rect _boxV;
public:
// The frames for the animation
- Common::Array<AnimFrame> frame;
+ Common::Array<AnimFrame> _frame;
- // The current clip
- unsigned int current_clip;
+ // The currentClip
+ unsigned int _currentClip;
// Should we flip the images in the frame rectangle?
- TextureFlipType flip;
+ TextureFlipType _flip;
// The global repeat value for all the frames
// If this is 0, then use individual frame values
- uint32 repeat;
+ uint32 _repeat;
// The global anchor value for all the frames
// If this is 0, then use individual frame values
- Vector2i anchor;
+ Vector2i _anchor;
// true if animation starts at a random frame
// used for idle animations so that every sprite doesn't animate in sync
- bool random;
+ bool _random;
// Does this set of animation frames need a specific shadow offset?
- ShadowOffset shadow;
+ ShadowOffset _shadow;
AnimationFrames() {
- Reset();
- flip = FLIP_NONE;
- repeat = 0;
- random = false;
+ reset();
+ _flip = FLIP_NONE;
+ _repeat = 0;
+ _random = false;
+ }
+ void reset() {
+ _currentClip = 0;
}
- void Reset() { current_clip = 0; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
- bool UpdateClip();
- const AnimFrame &CurrentFrame();
+ bool updateClip();
+ const AnimFrame ¤tFrame();
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 011e899d343..32de733875f 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -72,7 +72,7 @@ const ShadowOffset &AnimSet::Shadow(const Direction &dir) {
int AnimSet::AnchorX(const Direction &dir) {
FightAnimFrame faf;
if (fight.CurFrame(faf, dir))
- return faf.anchor.x;
+ return faf._anchor.x;
return walk.AnchorX(dir);
}
@@ -80,7 +80,7 @@ int AnimSet::AnchorX(const Direction &dir) {
int AnimSet::AnchorY(const Direction &dir) {
FightAnimFrame faf;
if (fight.CurFrame(faf, dir))
- return faf.anchor.y;
+ return faf._anchor.y;
return walk.AnchorY(dir);
}
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index f36ef2f4cb3..4471a63d3b7 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -38,7 +38,7 @@ using namespace pyrodactyl::anim;
// Purpose: Load a single frame of a fighting move
//------------------------------------------------------------------------
void FightAnimFrame::Load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
- AnimFrame::Load(node, VBOX, rep, AX, AY);
+ AnimFrame::load(node, VBOX, rep, AX, AY);
if (NodeValid("box_d", node, false))
box_d.Load(node->first_node("box_d"));
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index cc391b8440d..eac34ef61ea 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -107,7 +107,7 @@ FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
if (frame_cur < frame_total && frame_cur < move[cur].frames[d].frame.size()) {
// Has the current frame finished playing?
// OR Is this the first frame of the move?
- if (timer.Ticks() >= move[cur].frames[d].frame[frame_cur].repeat || start) {
+ if (timer.Ticks() >= move[cur].frames[d].frame[frame_cur]._repeat || start) {
frame_cur++;
timer.Start();
start = false;
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 9e7ce2342b0..ea477612059 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -556,8 +556,8 @@ void Sprite::UpdateFrame(const pyrodactyl::people::PersonState &pst, const bool
void Sprite::AssignFrame() {
FightAnimFrame faf;
if (anim_set.fight.CurFrame(faf, dir)) {
- clip = faf.clip;
- BoxV(faf.box_v);
+ clip = faf._clip;
+ BoxV(faf._boxV);
BoxD(faf.box_d);
pos.x += faf.delta.x;
diff --git a/engines/crab/animation/walkframes.cpp b/engines/crab/animation/walkframes.cpp
index 3d1bd1b0119..6994c1e4563 100644
--- a/engines/crab/animation/walkframes.cpp
+++ b/engines/crab/animation/walkframes.cpp
@@ -57,16 +57,16 @@ void WalkFrames::Load(rapidxml::xml_node<char> *node) {
// Purpose: Used for walking inside levels
//------------------------------------------------------------------------
bool WalkFrames::UpdateClip(Direction d, bool reset) {
- if (timer.Ticks() > set[cur].frames[d].CurrentFrame().repeat || reset) {
+ if (timer.Ticks() > set[cur].frames[d].currentFrame()._repeat || reset) {
timer.Start();
- return set[cur].frames[d].UpdateClip();
+ return set[cur].frames[d].updateClip();
}
return false;
}
void WalkFrames::ResetClip(Direction d) {
- set[cur].frames[d].Reset();
+ set[cur].frames[d].reset();
timer.Start();
}
@@ -77,19 +77,19 @@ void WalkFrames::UpdateClip(WalkAnimType type, Direction d) {
if (!timer.Started())
timer.Start();
- if (timer.Ticks() > set[type].frames[d].CurrentFrame().repeat) {
- set[type].frames[d].UpdateClip();
+ if (timer.Ticks() > set[type].frames[d].currentFrame()._repeat) {
+ set[type].frames[d].updateClip();
timer.Start();
}
}
Rect WalkFrames::DialogClip(const PersonState &state) {
if (state == PST_FIGHT)
- return set[WT_FIGHT].frames[DIRECTION_DOWN].CurrentFrame().clip;
+ return set[WT_FIGHT].frames[DIRECTION_DOWN].currentFrame()._clip;
else if (state == PST_KO)
- return set[WT_KO].frames[DIRECTION_DOWN].CurrentFrame().clip;
+ return set[WT_KO].frames[DIRECTION_DOWN].currentFrame()._clip;
- return set[WT_STAND].frames[DIRECTION_DOWN].CurrentFrame().clip;
+ return set[WT_STAND].frames[DIRECTION_DOWN].currentFrame()._clip;
}
void WalkFrames::UpdateClip(const PersonState &state) {
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index 0b4d4eb9ec2..6840c253362 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -52,10 +52,10 @@ class WalkFrames {
AnimationFrames frames[DIRECTION_TOTAL];
void Load(rapidxml::xml_node<char> *node) {
- frames[DIRECTION_DOWN].Load(node->first_node("down"));
- frames[DIRECTION_UP].Load(node->first_node("up"));
- frames[DIRECTION_LEFT].Load(node->first_node("left"));
- frames[DIRECTION_RIGHT].Load(node->first_node("right"));
+ frames[DIRECTION_DOWN].load(node->first_node("down"));
+ frames[DIRECTION_UP].load(node->first_node("up"));
+ frames[DIRECTION_LEFT].load(node->first_node("left"));
+ frames[DIRECTION_RIGHT].load(node->first_node("right"));
}
};
@@ -87,14 +87,14 @@ public:
WalkAnimType Type() { return cur; }
bool Type(const Vector2f &vel, Direction &dir, const pyrodactyl::people::PersonState &pst, const bool &first_x);
- const Rect &Clip(Direction d) { return set[cur].frames[d].CurrentFrame().clip; }
- const Rect &BoxV(Direction d) { return set[cur].frames[d].CurrentFrame().box_v; }
- const TextureFlipType &Flip(Direction d) { return set[cur].frames[d].flip; }
+ const Rect &Clip(Direction d) { return set[cur].frames[d].currentFrame()._clip; }
+ const Rect &BoxV(Direction d) { return set[cur].frames[d].currentFrame()._boxV; }
+ const TextureFlipType &Flip(Direction d) { return set[cur].frames[d]._flip; }
- const ShadowOffset &Shadow(Direction d) { return set[cur].frames[d].shadow; }
+ const ShadowOffset &Shadow(Direction d) { return set[cur].frames[d]._shadow; }
- int AnchorX(Direction d) { return set[cur].frames[d].CurrentFrame().anchor.x; }
- int AnchorY(Direction d) { return set[cur].frames[d].CurrentFrame().anchor.y; }
+ int AnchorX(Direction d) { return set[cur].frames[d].currentFrame()._anchor.x; }
+ int AnchorY(Direction d) { return set[cur].frames[d].currentFrame()._anchor.y; }
// Dialog box related
Rect DialogClip(const pyrodactyl::people::PersonState &state);
Commit: 7b7b73709a84dcbebd7d4e0e3f895638cef8b54f
https://github.com/scummvm/scummvm/commit/7b7b73709a84dcbebd7d4e0e3f895638cef8b54f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make AnimSet follow code formatting conventions
Changed paths:
engines/crab/animation/animset.cpp
engines/crab/animation/animset.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 32de733875f..a70222287c7 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -34,55 +34,55 @@ namespace Crab {
using namespace pyrodactyl::anim;
-void AnimSet::Load(const Common::String &filename) {
+void AnimSet::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node();
if (NodeValid(node)) {
- fight.Load(node);
- walk.Load(node);
+ _fight.Load(node);
+ _walk.Load(node);
if (NodeValid("bounds", node))
- bounds.Load(node->first_node("bounds"));
+ _bounds.Load(node->first_node("bounds"));
if (NodeValid("shadow", node))
- shadow.Load(node->first_node("shadow"));
+ _shadow.Load(node->first_node("shadow"));
if (NodeValid("focus", node))
- focus.Load(node->first_node("focus"));
+ _focus.Load(node->first_node("focus"));
}
}
}
-TextureFlipType AnimSet::Flip(const Direction &dir) {
+TextureFlipType AnimSet::flip(const Direction &dir) {
TextureFlipType ret;
- if (fight.Flip(ret, dir))
+ if (_fight.Flip(ret, dir))
return ret;
- return walk.Flip(dir);
+ return _walk.Flip(dir);
}
-const ShadowOffset &AnimSet::Shadow(const Direction &dir) {
- if (fight.ValidMove())
- return fight.Shadow(dir);
+const ShadowOffset &AnimSet::shadow(const Direction &dir) {
+ if (_fight.ValidMove())
+ return _fight.Shadow(dir);
- return walk.Shadow(dir);
+ return _walk.Shadow(dir);
}
-int AnimSet::AnchorX(const Direction &dir) {
+int AnimSet::anchorX(const Direction &dir) {
FightAnimFrame faf;
- if (fight.CurFrame(faf, dir))
+ if (_fight.CurFrame(faf, dir))
return faf._anchor.x;
- return walk.AnchorX(dir);
+ return _walk.AnchorX(dir);
}
-int AnimSet::AnchorY(const Direction &dir) {
+int AnimSet::anchorY(const Direction &dir) {
FightAnimFrame faf;
- if (fight.CurFrame(faf, dir))
+ if (_fight.CurFrame(faf, dir))
return faf._anchor.y;
- return walk.AnchorY(dir);
+ return _walk.AnchorY(dir);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/animset.h b/engines/crab/animation/animset.h
index 5ccf3075f29..d12d181f795 100644
--- a/engines/crab/animation/animset.h
+++ b/engines/crab/animation/animset.h
@@ -43,29 +43,29 @@ namespace anim {
// Container for all the possible animations an object can have
struct AnimSet {
// The frames relevant to fighting moves
- FightMoves fight;
+ FightMoves _fight;
// The frames relevant to walking animations
- WalkFrames walk;
+ WalkFrames _walk;
// The bounding box of the character used for level collision
- Rect bounds;
+ Rect _bounds;
// The sprite shadow
- ShadowData shadow;
+ ShadowData _shadow;
// The camera focus point
- Vector2i focus;
+ Vector2i _focus;
AnimSet() {}
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
- TextureFlipType Flip(const Direction &dir);
- const ShadowOffset &Shadow(const Direction &dir);
+ TextureFlipType flip(const Direction &dir);
+ const ShadowOffset &shadow(const Direction &dir);
- int AnchorX(const Direction &dir);
- int AnchorY(const Direction &dir);
+ int anchorX(const Direction &dir);
+ int anchorY(const Direction &dir);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index ea477612059..9a2047e2196 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -81,13 +81,13 @@ void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
LoadNum(index, "moveset", node);
if (index < animations.size())
- anim_set.Load(animations[index]);
+ anim_set.load(animations[index]);
- anim_set.fight.ListAttackMoves(ai_data._fight._attack);
+ anim_set._fight.ListAttackMoves(ai_data._fight._attack);
LoadDirection(dir, node);
- clip = anim_set.walk.Clip(dir);
- box_v = anim_set.walk.BoxV(dir);
+ clip = anim_set._walk.Clip(dir);
+ box_v = anim_set._walk.BoxV(dir);
if (NodeValid("visible", node, false))
visible.Load(node->first_node("visible"));
@@ -132,15 +132,15 @@ void Sprite::ResolveCollide() {
} else {
Direction d = bounds.ResolveY(i->data);
if (d == DIRECTION_UP)
- pos.y -= i->data.y + i->data.h - anim_set.bounds.y + anim_set.AnchorY(dir) + 1;
+ pos.y -= i->data.y + i->data.h - anim_set._bounds.y + anim_set.anchorY(dir) + 1;
else if (d == DIRECTION_DOWN)
- pos.y -= i->data.y - bounds.h - anim_set.bounds.y + anim_set.AnchorY(dir) - 1;
+ pos.y -= i->data.y - bounds.h - anim_set._bounds.y + anim_set.anchorY(dir) - 1;
d = bounds.ResolveX(i->data);
if (d == DIRECTION_LEFT)
- pos.x -= i->data.x + i->data.w - anim_set.bounds.x + anim_set.AnchorX(dir) + 1;
+ pos.x -= i->data.x + i->data.w - anim_set._bounds.x + anim_set.anchorX(dir) + 1;
else if (d == DIRECTION_RIGHT)
- pos.x -= i->data.x - bounds.w - anim_set.bounds.x + anim_set.AnchorX(dir) - 1;
+ pos.x -= i->data.x - bounds.w - anim_set._bounds.x + anim_set.anchorX(dir) - 1;
}
}
@@ -156,17 +156,17 @@ void Sprite::ResolveInside(Rect collider) {
Direction d = bounds.ResolveX(collider);
if (d == DIRECTION_RIGHT)
- pos.x = collider.x - anim_set.bounds.x + anim_set.AnchorX(dir) + 1;
+ pos.x = collider.x - anim_set._bounds.x + anim_set.anchorX(dir) + 1;
else if (d == DIRECTION_LEFT)
- pos.x = collider.x + collider.w - anim_set.bounds.x - bounds.w + anim_set.AnchorX(dir) - 1;
+ pos.x = collider.x + collider.w - anim_set._bounds.x - bounds.w + anim_set.anchorX(dir) - 1;
bounds = BoundRect();
d = bounds.ResolveY(collider);
if (d == DIRECTION_DOWN)
- pos.y = collider.y - anim_set.bounds.y + anim_set.AnchorY(dir) + 1;
+ pos.y = collider.y - anim_set._bounds.y + anim_set.anchorY(dir) + 1;
else if (d == DIRECTION_UP)
- pos.y = collider.y + collider.h - anim_set.bounds.y - bounds.h + anim_set.AnchorY(dir) - 1;
+ pos.y = collider.y + collider.h - anim_set._bounds.y - bounds.h + anim_set.anchorY(dir) - 1;
}
//------------------------------------------------------------------------
@@ -178,10 +178,10 @@ void Sprite::ResolveInside(Rect collider) {
// Used for walking and level geometry collision
Rect Sprite::BoundRect() {
Rect rect;
- rect.x = pos.x + anim_set.bounds.x - anim_set.AnchorX(dir);
- rect.y = pos.y + anim_set.bounds.y - anim_set.AnchorY(dir);
- rect.w = anim_set.bounds.w;
- rect.h = anim_set.bounds.h;
+ rect.x = pos.x + anim_set._bounds.x - anim_set.anchorX(dir);
+ rect.y = pos.y + anim_set._bounds.y - anim_set.anchorY(dir);
+ rect.w = anim_set._bounds.w;
+ rect.h = anim_set._bounds.h;
return rect;
}
@@ -208,8 +208,8 @@ Rect Sprite::BoxD() {
// Used for drawing object notifications over stuff
Rect Sprite::PosRect() {
Rect rect;
- rect.x = pos.x - anim_set.AnchorX(dir);
- rect.y = pos.y - anim_set.AnchorY(dir);
+ rect.x = pos.x - anim_set.anchorX(dir);
+ rect.y = pos.y - anim_set.anchorY(dir);
rect.w = clip.w;
rect.h = clip.h;
return rect;
@@ -230,8 +230,8 @@ Rect Sprite::RangeRect(const Rect &bounds, const Range &range) {
// Used for focusing the camera on the sprite
Vector2i Sprite::CamFocus() {
Vector2i v;
- v.x = pos.x + anim_set.focus.x;
- v.y = pos.y + anim_set.focus.y;
+ v.x = pos.x + anim_set._focus.x;
+ v.y = pos.y + anim_set._focus.y;
return v;
}
@@ -243,23 +243,23 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
- int x = pos.x - camera.x - anim_set.AnchorX(dir), y = pos.y - camera.y - anim_set.AnchorY(dir);
+ int x = pos.x - camera.x - anim_set.anchorX(dir), y = pos.y - camera.y - anim_set.anchorY(dir);
// Draw the shadow image relative to the bottom center of the sprite
- ShadowOffset sh = anim_set.Shadow(dir);
+ ShadowOffset sh = anim_set.shadow(dir);
if (sh.valid) {
// Draw using custom offset
- g_engine->_imageManager->Draw(x + clip.w / 2 - anim_set.shadow.size.x + sh.x,
- y + clip.h - anim_set.shadow.size.y + sh.y,
- anim_set.shadow.img);
+ g_engine->_imageManager->Draw(x + clip.w / 2 - anim_set._shadow.size.x + sh.x,
+ y + clip.h - anim_set._shadow.size.y + sh.y,
+ anim_set._shadow.img);
} else {
// Draw using default offset
- g_engine->_imageManager->Draw(x + clip.w / 2 - anim_set.shadow.size.x + anim_set.shadow.offset.x,
- y + clip.h - anim_set.shadow.size.y + anim_set.shadow.offset.y,
- anim_set.shadow.img);
+ g_engine->_imageManager->Draw(x + clip.w / 2 - anim_set._shadow.size.x + anim_set._shadow.offset.x,
+ y + clip.h - anim_set._shadow.size.y + anim_set._shadow.offset.y,
+ anim_set._shadow.img);
}
- g_engine->_imageManager->Draw(x, y, image, &clip, anim_set.Flip(dir));
+ g_engine->_imageManager->Draw(x, y, image, &clip, anim_set.flip(dir));
img_eff.Draw(x, y);
if (GameDebug) {
@@ -271,7 +271,7 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
vul.Draw(-camera.x, -camera.y, 0, 0, 255);
FightMove fm;
- if (anim_set.fight.NextMove(fm)) {
+ if (anim_set._fight.NextMove(fm)) {
Rect actual_range;
actual_range.x = bounds.x + fm.ai.range.val[dir].x;
actual_range.y = bounds.y + fm.ai.range.val[dir].y;
@@ -325,8 +325,8 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
void Sprite::DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
// This is different from draw because we draw the popup centered over the head
- int x = pos.x - camera.x - anim_set.AnchorX(dir) + (anim_set.bounds.w / 2);
- int y = pos.y - camera.y - anim_set.AnchorY(dir);
+ int x = pos.x - camera.x - anim_set.anchorX(dir) + (anim_set._bounds.w / 2);
+ int y = pos.y - camera.y - anim_set.anchorY(dir);
popup.Draw(x, y, pop, camera);
}
@@ -345,7 +345,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
if (!ai_data._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
- int x = pos.x - camera.x - anim_set.AnchorX(dir), y = pos.y - camera.y - anim_set.AnchorY(dir);
+ int x = pos.x - camera.x - anim_set.anchorX(dir), y = pos.y - camera.y - anim_set.anchorY(dir);
// Just use the bound rectangle dimensions
Rect b = BoundRect();
@@ -411,7 +411,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
if (!ai_data._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
- int x = pos.x - camera.x - anim_set.AnchorX(dir), y = pos.y - camera.y - anim_set.AnchorY(dir);
+ int x = pos.x - camera.x - anim_set.anchorX(dir), y = pos.y - camera.y - anim_set.anchorY(dir);
// Just use the bound rectangle dimensions
Rect b = BoundRect();
@@ -485,18 +485,18 @@ void Sprite::Walk(const pyrodactyl::people::PersonState &pst) {
first_x = false;
}
- bool reset = anim_set.walk.Type(vel, dir, pst, first_x);
+ bool reset = anim_set._walk.Type(vel, dir, pst, first_x);
if (reset)
- anim_set.walk.ResetClip(dir);
+ anim_set._walk.ResetClip(dir);
Walk(reset);
}
void Sprite::Walk(const bool &reset) {
- if (anim_set.walk.UpdateClip(dir, reset)) {
- clip = anim_set.walk.Clip(dir);
- box_v = anim_set.walk.BoxV(dir);
+ if (anim_set._walk.UpdateClip(dir, reset)) {
+ clip = anim_set._walk.Clip(dir);
+ box_v = anim_set._walk.BoxV(dir);
}
}
@@ -539,7 +539,7 @@ bool Sprite::FightCollide(Rect hitbox, Rect enemy_bounds, Range &range, const Sp
// Purpose: Update the frame info of the sprite
//------------------------------------------------------------------------
void Sprite::UpdateFrame(const pyrodactyl::people::PersonState &pst, const bool &repeat) {
- FrameUpdateResult res = anim_set.fight.UpdateFrame(dir);
+ FrameUpdateResult res = anim_set._fight.UpdateFrame(dir);
if (res == FUR_SUCCESS) {
AssignFrame();
} else if (res == FUR_FAIL) {
@@ -549,13 +549,13 @@ void Sprite::UpdateFrame(const pyrodactyl::people::PersonState &pst, const bool
if (repeat == false)
ResetFrame(pst);
else
- anim_set.fight.FrameIndex(0);
+ anim_set._fight.FrameIndex(0);
}
}
void Sprite::AssignFrame() {
FightAnimFrame faf;
- if (anim_set.fight.CurFrame(faf, dir)) {
+ if (anim_set._fight.CurFrame(faf, dir)) {
clip = faf._clip;
BoxV(faf._boxV);
BoxD(faf.box_d);
@@ -576,7 +576,7 @@ void Sprite::UpdateMove(const FightAnimationType &combo) {
ForceUpdateMove(combo);
else {
FightAnimFrame faf;
- if (anim_set.fight.CurFrame(faf, dir))
+ if (anim_set._fight.CurFrame(faf, dir))
if (faf.branch)
ForceUpdateMove(combo);
}
@@ -584,7 +584,7 @@ void Sprite::UpdateMove(const FightAnimationType &combo) {
}
void Sprite::ForceUpdateMove(const FightAnimationType &combo) {
- unsigned int index = anim_set.fight.FindMove(combo, input.state);
+ unsigned int index = anim_set._fight.FindMove(combo, input.state);
ForceUpdateMove(index);
}
@@ -597,9 +597,9 @@ void Sprite::UpdateMove(const unsigned int &index) {
}
void Sprite::ForceUpdateMove(const unsigned int &index) {
- if (anim_set.fight.ForceUpdate(index, input, dir)) {
+ if (anim_set._fight.ForceUpdate(index, input, dir)) {
// This sets the sprite input to the current move input
- anim_set.fight.CurCombo(input);
+ anim_set._fight.CurCombo(input);
Stop();
AssignFrame();
@@ -612,7 +612,7 @@ void Sprite::ForceUpdateMove(const unsigned int &index) {
void Sprite::ResetFrame(const pyrodactyl::people::PersonState &pst) {
input.Reset();
Walk(true);
- anim_set.fight.Reset();
+ anim_set._fight.Reset();
box_d.w = 0;
box_d.h = 0;
@@ -636,7 +636,7 @@ bool Sprite::DamageValid(Sprite &s, const SpriteConstant &sc) {
//------------------------------------------------------------------------
void Sprite::CalcProperties(Info &info) {
visible.Evaluate(info);
- anim_set.fight.Evaluate(info);
+ anim_set._fight.Evaluate(info);
}
//------------------------------------------------------------------------
@@ -664,7 +664,7 @@ void Sprite::TakeDamage(Info &info, Sprite &s) {
using namespace pyrodactyl::music;
FightMove f;
- if (s.anim_set.fight.CurMove(f) && info.PersonValid(s.ID()) && info.PersonValid(id)) {
+ if (s.anim_set._fight.CurMove(f) && info.PersonValid(s.ID()) && info.PersonValid(id)) {
int dmg = -1 * (f.eff._dmg + info.PersonGet(s.ID()).stat.val[STAT_ATTACK].cur - info.PersonGet(id).stat.val[STAT_DEFENSE].cur);
if (dmg >= 0)
dmg = -1;
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 88615493987..20f050ac75f 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -164,8 +164,8 @@ public:
int H() { return clip.h; }
const ImageKey &Img() { return image; }
- Rect DialogClip(const pyrodactyl::people::PersonState &state) { return anim_set.walk.DialogClip(state); }
- void DialogUpdateClip(const pyrodactyl::people::PersonState &state) { anim_set.walk.UpdateClip(state); }
+ Rect DialogClip(const pyrodactyl::people::PersonState &state) { return anim_set._walk.DialogClip(state); }
+ void DialogUpdateClip(const pyrodactyl::people::PersonState &state) { anim_set._walk.UpdateClip(state); }
bool PopupShow() { return popup.Show(); }
@@ -178,7 +178,7 @@ public:
double DistSq(const Sprite &s);
void EffectImg(bool vis) { img_eff.visible = vis; }
- bool LastFrame() { return anim_set.fight.LastFrame(); }
+ bool LastFrame() { return anim_set._fight.LastFrame(); }
bool TakingDamage(Sprite &sp, const pyrodactyl::ai::SpriteConstant &sc);
void TakeDamage(pyrodactyl::event::Info &info, Sprite &s);
Commit: 82224719a37625391f3337adfdb04dd4775a0bbf
https://github.com/scummvm/scummvm/commit/82224719a37625391f3337adfdb04dd4775a0bbf
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make FightAnimFrame(s) follow code formatting conventions
Changed paths:
engines/crab/animation/fightanim.cpp
engines/crab/animation/fightanim.h
engines/crab/animation/fightmove.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fightmoves.h
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index 4471a63d3b7..f962e06c523 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -37,48 +37,48 @@ using namespace pyrodactyl::anim;
//------------------------------------------------------------------------
// Purpose: Load a single frame of a fighting move
//------------------------------------------------------------------------
-void FightAnimFrame::Load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
+void FightAnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
AnimFrame::load(node, VBOX, rep, AX, AY);
if (NodeValid("box_d", node, false))
- box_d.Load(node->first_node("box_d"));
+ _boxD.Load(node->first_node("box_d"));
if (NodeValid("shift", node, false))
- delta.Load(node->first_node("shift"));
+ _delta.Load(node->first_node("shift"));
- if (!LoadNum(state, "state", node, false))
- state = 0;
+ if (!LoadNum(_state, "state", node, false))
+ _state = 0;
- LoadBool(branch, "branch", node, false);
+ LoadBool(_branch, "branch", node, false);
}
//------------------------------------------------------------------------
// Purpose: Load a fighting move
//------------------------------------------------------------------------
-void FightAnimFrames::Load(rapidxml::xml_node<char> *node) {
- LoadTextureFlipType(flip, node);
+void FightAnimFrames::load(rapidxml::xml_node<char> *node) {
+ LoadTextureFlipType(_flip, node);
- if (!LoadNum(repeat, "repeat", node, false))
- repeat = 0;
+ if (!LoadNum(_repeat, "repeat", node, false))
+ _repeat = 0;
if (NodeValid("anchor", node, false))
- anchor.Load(node->first_node("anchor"));
+ _anchor.Load(node->first_node("anchor"));
if (NodeValid("box_v", node))
- box_v.Load(node->first_node("box_v"));
+ _boxV.Load(node->first_node("box_v"));
if (NodeValid("shadow", node)) {
- shadow.Load(node->first_node("shadow"));
- shadow.valid = true;
+ _shadow.Load(node->first_node("shadow"));
+ _shadow.valid = true;
}
if (NodeValid("frames", node)) {
- frame.clear();
+ _frame.clear();
rapidxml::xml_node<char> *framenode = node->first_node("frames");
for (auto n = framenode->first_node("frame"); n != NULL; n = n->next_sibling("frame")) {
FightAnimFrame faf;
- faf.Load(n, box_v, repeat, anchor.x, anchor.y);
- frame.push_back(faf);
+ faf.load(n, _boxV, _repeat, _anchor.x, _anchor.y);
+ _frame.push_back(faf);
}
}
}
diff --git a/engines/crab/animation/fightanim.h b/engines/crab/animation/fightanim.h
index a7f5ac57b00..de719a2b341 100644
--- a/engines/crab/animation/fightanim.h
+++ b/engines/crab/animation/fightanim.h
@@ -46,24 +46,24 @@ namespace anim {
// A single frame of a fighting move
struct FightAnimFrame : public AnimFrame {
// The hit box of the player WITH RESPECT TO the sprite bounding box
- //_v is the vulnerable hit box, _d is the damage hit box
- Rect box_d;
+ //boxV is the vulnerable hit box, boxD is the damage hit box
+ Rect _boxD;
// The displacement in the position caused by the frame
- Vector2i delta;
+ Vector2i _delta;
// The sprite state for the duration of the frame
- unsigned int state;
+ unsigned int _state;
// Can we cancel/branch to another move from this frame?
- bool branch;
+ bool _branch;
FightAnimFrame() {
- state = 0;
- branch = false;
+ _state = 0;
+ _branch = false;
}
- void Load(rapidxml::xml_node<char> *node, const Rect &VBOX,
+ void load(rapidxml::xml_node<char> *node, const Rect &VBOX,
const uint32 &REP = 0, const int &AX = 0, const int &AY = 0);
};
@@ -71,37 +71,39 @@ struct FightAnimFrame : public AnimFrame {
class FightAnimFrames {
// The global vulnerable hit box for all the frames
// If the W or H of this is 0, then use individual frame values
- Rect box_v;
+ Rect _boxV;
public:
// The individual frames for each direction
- Common::Array<FightAnimFrame> frame;
+ Common::Array<FightAnimFrame> _frame;
- // The current clip
- unsigned int current_clip;
+ // The currentClip
+ unsigned int _currentClip;
// Should we flip the images in the frame rectangle?
- TextureFlipType flip;
+ TextureFlipType _flip;
// The amount of time in milliseconds each animation frame needs to be on screen
// If this is zero then use the value in each individual frame
- uint32 repeat;
+ uint32 _repeat;
// The global anchor value for all the frames
// If this is 0, then use individual frame values
- Vector2i anchor;
+ Vector2i _anchor;
// Does this set of animation frames need a specific shadow offset?
- ShadowOffset shadow;
+ ShadowOffset _shadow;
FightAnimFrames() {
- Reset();
- flip = FLIP_NONE;
- repeat = 0;
+ reset();
+ _flip = FLIP_NONE;
+ _repeat = 0;
+ }
+ void reset() {
+ _currentClip = 0;
}
- void Reset() { current_clip = 0; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/fightmove.cpp b/engines/crab/animation/fightmove.cpp
index dcde8ed4b5c..a06723b340a 100644
--- a/engines/crab/animation/fightmove.cpp
+++ b/engines/crab/animation/fightmove.cpp
@@ -35,10 +35,10 @@ namespace Crab {
using namespace pyrodactyl::anim;
void FightMove::Load(rapidxml::xml_node<char> *node) {
- frames[DIRECTION_DOWN].Load(node->first_node("down"));
- frames[DIRECTION_UP].Load(node->first_node("up"));
- frames[DIRECTION_LEFT].Load(node->first_node("left"));
- frames[DIRECTION_RIGHT].Load(node->first_node("right"));
+ frames[DIRECTION_DOWN].load(node->first_node("down"));
+ frames[DIRECTION_UP].load(node->first_node("up"));
+ frames[DIRECTION_LEFT].load(node->first_node("left"));
+ frames[DIRECTION_RIGHT].load(node->first_node("right"));
if (NodeValid("input", node))
input.Load(node->first_node("input"));
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index eac34ef61ea..39d268cb2d7 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -88,8 +88,8 @@ bool FightMoves::CurFrame(FightAnimFrame &faf, const Direction &d) {
// Check validity of current move
if (cur >= 0 && (unsigned int)cur < move.size()) {
// Check validity of current frame
- if (frame_cur < frame_total && frame_cur < move[cur].frames[d].frame.size()) {
- faf = move[cur].frames[d].frame[frame_cur];
+ if (frame_cur < frame_total && frame_cur < move[cur].frames[d]._frame.size()) {
+ faf = move[cur].frames[d]._frame[frame_cur];
return true;
}
}
@@ -104,10 +104,10 @@ FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
// Check validity of current move
if (cur >= 0 && (unsigned int)cur < move.size()) {
// Check validity of current frame
- if (frame_cur < frame_total && frame_cur < move[cur].frames[d].frame.size()) {
+ if (frame_cur < frame_total && frame_cur < move[cur].frames[d]._frame.size()) {
// Has the current frame finished playing?
// OR Is this the first frame of the move?
- if (timer.Ticks() >= move[cur].frames[d].frame[frame_cur]._repeat || start) {
+ if (timer.Ticks() >= move[cur].frames[d]._frame[frame_cur]._repeat || start) {
frame_cur++;
timer.Start();
start = false;
@@ -158,10 +158,10 @@ bool FightMoves::ForceUpdate(const unsigned int &index, pyrodactyl::input::Fight
if ((unsigned int)cur < move.size()) {
if (move[cur].unlock.Result()) {
- frame_total = move[cur].frames[d].frame.size();
+ frame_total = move[cur].frames[d]._frame.size();
if (frame_total > 0) {
input = move[cur].input;
- input.state = move[cur].frames[d].frame[0].state;
+ input.state = move[cur].frames[d]._frame[0]._state;
} else
input.Reset();
@@ -191,7 +191,7 @@ void FightMoves::Evaluate(pyrodactyl::event::Info &info) {
bool FightMoves::Flip(TextureFlipType &flip, Direction d) {
// Check validity of current move
if (ValidMove()) {
- flip = move[cur].frames[d].flip;
+ flip = move[cur].frames[d]._flip;
return true;
}
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index 686fe593ab8..03935ff0ce6 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -94,7 +94,7 @@ public:
bool Empty() { return move.empty(); }
bool Flip(TextureFlipType &flip, Direction d);
- const ShadowOffset &Shadow(Direction d) { return move[cur].frames[d].shadow; }
+ const ShadowOffset &Shadow(Direction d) { return move[cur].frames[d]._shadow; }
void Next(int val) { next = val; }
int Next() { return next; }
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 9a2047e2196..beb026e6c46 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -558,12 +558,12 @@ void Sprite::AssignFrame() {
if (anim_set._fight.CurFrame(faf, dir)) {
clip = faf._clip;
BoxV(faf._boxV);
- BoxD(faf.box_d);
+ BoxD(faf._boxD);
- pos.x += faf.delta.x;
- pos.y += faf.delta.y;
+ pos.x += faf._delta.x;
+ pos.y += faf._delta.y;
- input.state = faf.state;
+ input.state = faf._state;
}
}
@@ -577,7 +577,7 @@ void Sprite::UpdateMove(const FightAnimationType &combo) {
else {
FightAnimFrame faf;
if (anim_set._fight.CurFrame(faf, dir))
- if (faf.branch)
+ if (faf._branch)
ForceUpdateMove(combo);
}
}
Commit: 0e9fa535d491c31100ed173acdcf211ea40a7a44
https://github.com/scummvm/scummvm/commit/0e9fa535d491c31100ed173acdcf211ea40a7a44
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make loaders.[h, cpp] follow code formatting conventions
Changed paths:
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/LoadingScreen.cpp
engines/crab/Polygon.cpp
engines/crab/Rectangle.cpp
engines/crab/ScreenSettings.cpp
engines/crab/Shape.cpp
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TileInfo.h
engines/crab/ai/SpriteConstant.cpp
engines/crab/ai/moveeffect.cpp
engines/crab/ai/movement.cpp
engines/crab/ai/movement.h
engines/crab/animation/AnimationEffect.h
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/PopUp.cpp
engines/crab/animation/animation.cpp
engines/crab/animation/animframe.cpp
engines/crab/animation/animset.cpp
engines/crab/animation/fightanim.cpp
engines/crab/animation/fightmove.cpp
engines/crab/animation/fm_ai_data.h
engines/crab/animation/imageeffect.cpp
engines/crab/animation/range.h
engines/crab/animation/shadow.h
engines/crab/animation/sprite.cpp
engines/crab/animation/walkframes.cpp
engines/crab/app.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/changeval.h
engines/crab/event/conversationdata.cpp
engines/crab/event/effect.cpp
engines/crab/event/eventstore.cpp
engines/crab/event/gameevent.cpp
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/quest.cpp
engines/crab/event/trigger.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
engines/crab/input/cursor.cpp
engines/crab/input/fightinput.cpp
engines/crab/input/hotkey.cpp
engines/crab/input/input.cpp
engines/crab/input/inputval.cpp
engines/crab/input/inputval.h
engines/crab/item/Item.cpp
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemSlot.cpp
engines/crab/item/StatPreview.cpp
engines/crab/level/LevelExit.cpp
engines/crab/level/MusicArea.cpp
engines/crab/level/Stairs.cpp
engines/crab/level/level_load.cpp
engines/crab/level/level_objects.cpp
engines/crab/level/talknotify.cpp
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/mainmenu.cpp
engines/crab/music/MusicManager.cpp
engines/crab/music/musicparam.h
engines/crab/people/opinion.cpp
engines/crab/people/person.cpp
engines/crab/people/trait.cpp
engines/crab/stat/Stat.cpp
engines/crab/stat/StatDrawHelper.cpp
engines/crab/stat/bonus.h
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.cpp
engines/crab/timer.cpp
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/Caption.cpp
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ClipButton.cpp
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/FileData.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/HoverInfo.cpp
engines/crab/ui/ImageData.cpp
engines/crab/ui/Inventory.cpp
engines/crab/ui/ItemDesc.h
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapData.cpp
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/ModMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/PageMenu.h
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/RadioButton.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/StateButton.cpp
engines/crab/ui/StateButton.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/element.cpp
engines/crab/ui/emotion.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/ui/mapbutton.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/slider.cpp
engines/crab/ui/textarea.cpp
engines/crab/ui/textdata.cpp
engines/crab/vectors.h
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index f47275582a7..9de914ca2bd 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -78,7 +78,7 @@ void FilePaths::LoadLevel(const Common::String &filename) {
l.Load(n);
Common::String id;
- LoadStr(id, "id", n);
+ loadStr(id, "id", n);
level[id] = l;
}
@@ -90,59 +90,59 @@ void FilePaths::Load(const Common::String &filename) {
if (settings.ready()) {
rapidxml::xml_node<char> *node = settings.doc()->first_node("paths");
- if (NodeValid(node) && !loaded) {
- if (NodeValid("icon", node)) {
+ if (nodeValid(node) && !loaded) {
+ if (nodeValid("icon", node)) {
rapidxml::xml_node<char> *iconode = node->first_node("icon");
icon = iconode->value();
}
- if (NodeValid("common", node)) {
+ if (nodeValid("common", node)) {
rapidxml::xml_node<char> *commonnode = node->first_node("common");
common = commonnode->value();
}
- if (NodeValid("font", node)) {
+ if (nodeValid("font", node)) {
rapidxml::xml_node<char> *fontnode = node->first_node("font");
font = fontnode->value();
}
- if (NodeValid("shader", node)) {
+ if (nodeValid("shader", node)) {
rapidxml::xml_node<char> *shadnode = node->first_node("shader");
shaders = shadnode->value();
}
- if (NodeValid("color", node)) {
+ if (nodeValid("color", node)) {
rapidxml::xml_node<char> *colnode = node->first_node("color");
colors = colnode->value();
}
- if (NodeValid("mod", node)) {
+ if (nodeValid("mod", node)) {
rapidxml::xml_node<char> *modnode = node->first_node("mod");
- LoadStr(mod_path, "path", modnode);
- LoadStr(mod_ext, "ext", modnode);
- LoadStr(mod_cur, "cur", modnode);
+ loadStr(mod_path, "path", modnode);
+ loadStr(mod_ext, "ext", modnode);
+ loadStr(mod_cur, "cur", modnode);
}
- if (NodeValid("main_menu", node)) {
+ if (nodeValid("main_menu", node)) {
rapidxml::xml_node<char> *menunode = node->first_node("main_menu");
- LoadStr(mainmenu_l, "l", menunode);
- LoadStr(mainmenu_r, "r", menunode);
+ loadStr(mainmenu_l, "l", menunode);
+ loadStr(mainmenu_r, "r", menunode);
current_r = mainmenu_r;
}
- if (NodeValid("sound", node)) {
+ if (nodeValid("sound", node)) {
rapidxml::xml_node<char> *soundnode = node->first_node("sound");
- LoadStr(sound_effect, "effect", soundnode);
- LoadStr(sound_music, "music", soundnode);
+ loadStr(sound_effect, "effect", soundnode);
+ loadStr(sound_music, "music", soundnode);
}
- if (NodeValid("save", node)) {
+ if (nodeValid("save", node)) {
rapidxml::xml_node<char> *savenode = node->first_node("save");
- LoadStr(save_dir, "dir", savenode);
- LoadStr(save_ext, "ext", savenode);
+ loadStr(save_dir, "dir", savenode);
+ loadStr(save_ext, "ext", savenode);
Common::String custom_path;
- if (LoadStr(custom_path, "custom", savenode)) {
+ if (loadStr(custom_path, "custom", savenode)) {
#if 0
using namespace boost::filesystem;
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 8bb357c85d4..8145ce7774c 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -48,9 +48,9 @@ struct LevelPath {
LevelPath() : layout(""), asset(""), name("") {}
void Load(rapidxml::xml_node<char> *node) {
- LoadStr(name, "name", node);
- LoadStr(layout, "layout", node);
- LoadStr(asset, "res", node);
+ loadStr(name, "name", node);
+ loadStr(layout, "layout", node);
+ loadStr(asset, "res", node);
}
};
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 2322064bd2b..33e4049caac 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -38,14 +38,14 @@ void LoadingScreen::Load() {
XMLDoc doc(filename);
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.doc()->first_node("loading");
- if (NodeValid(node)) {
- if (NodeValid("screens", node)) {
+ if (nodeValid(node)) {
+ if (nodeValid("screens", node)) {
rapidxml::xml_node<char> *scrnode = node->first_node("screens");
for (auto n = scrnode->first_node("screen"); n != NULL; n = n->next_sibling("screen"))
screen.push_back(n);
}
- if (NodeValid("text", node))
+ if (nodeValid("text", node))
text.Load(node->first_node("text"), "img");
}
}
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 53a7430276a..d8a8d604df0 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -71,7 +71,7 @@ void Polygon2D::Load(rapidxml::xml_node<char> *node, Rect &bounds) {
rapidxml::xml_node<char> *polynode = node->first_node("polygon");
if (polynode != NULL) {
Common::String points, x, y;
- LoadStr(points, "points", polynode);
+ loadStr(points, "points", polynode);
bool comma = false;
for (auto i = points.begin(); i != points.end(); ++i) {
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index ba6ff4ec3e1..ad9cf7ea621 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -34,7 +34,7 @@ namespace Crab {
bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const Common::String &x_name, const Common::String &y_name,
const Common::String &w_name, const Common::String &h_name) {
- return LoadNum(x, x_name, node, echo) && LoadNum(y, y_name, node, echo) && LoadNum(w, w_name, node, echo) && LoadNum(h, h_name, node, echo);
+ return loadNum(x, x_name, node, echo) && loadNum(y, y_name, node, echo) && loadNum(w, w_name, node, echo) && loadNum(h, h_name, node, echo);
}
bool Rect::Collide(Rect box) {
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index a49e9bb6d00..bc200d8d1f2 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -40,18 +40,18 @@ Graphics::Surface *gRendererSurface = nullptr;
//SDL_Window *gWindow = nullptr;
void ScreenSettings::Load(rapidxml::xml_node<char> *node) {
- LoadNum(cur.w, "w", node);
- LoadNum(cur.h, "h", node);
- LoadNum(fps, "fps", node);
- LoadNum(gamma, "gamma", node);
- LoadNum(text_speed, "text_speed", node);
-
- LoadBool(vsync, "vsync", node);
- LoadBool(border, "border", node);
- LoadBool(fullscreen, "fullscreen", node);
- LoadBool(save_on_exit, "save_on_exit", node);
- LoadBool(mouse_trap, "mouse_trap", node);
- LoadBool(quality, "quality", node);
+ loadNum(cur.w, "w", node);
+ loadNum(cur.h, "h", node);
+ loadNum(fps, "fps", node);
+ loadNum(gamma, "gamma", node);
+ loadNum(text_speed, "text_speed", node);
+
+ loadBool(vsync, "vsync", node);
+ loadBool(border, "border", node);
+ loadBool(fullscreen, "fullscreen", node);
+ loadBool(save_on_exit, "save_on_exit", node);
+ loadBool(mouse_trap, "mouse_trap", node);
+ loadBool(quality, "quality", node);
SetVideoFlags();
CreateBackup();
@@ -154,12 +154,12 @@ void ScreenSettings::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node
child->append_attribute(doc.allocate_attribute("gamma", gStrPool->FGet(gamma)));
child->append_attribute(doc.allocate_attribute("text_speed", gStrPool->FGet(text_speed)));
- SaveBool(vsync, "vsync", doc, child);
- SaveBool(border, "border", doc, child);
- SaveBool(fullscreen, "fullscreen", doc, child);
- SaveBool(save_on_exit, "save_on_exit", doc, child);
- SaveBool(quality, "quality", doc, child);
- SaveBool(mouse_trap, "mouse_trap", doc, child);
+ saveBool(vsync, "vsync", doc, child);
+ saveBool(border, "border", doc, child);
+ saveBool(fullscreen, "fullscreen", doc, child);
+ saveBool(save_on_exit, "save_on_exit", doc, child);
+ saveBool(quality, "quality", doc, child);
+ saveBool(mouse_trap, "mouse_trap", doc, child);
root->append_node(child);
CreateBackup();
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index c6e81184f5b..f47d6bc46eb 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -33,12 +33,12 @@
namespace Crab {
void Shape::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- if (NodeValid("polygon", node, echo)) {
+ if (nodeValid("polygon", node, echo)) {
type = SHAPE_POLYGON;
poly.Load(node, rect);
} else {
rect.Load(node, echo, "x", "y", "width", "height");
- if (NodeValid("ellipse", node, echo))
+ if (nodeValid("ellipse", node, echo))
type = SHAPE_ELLIPSE;
else
type = SHAPE_RECT;
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 3ebbe5cacb9..84198560ba6 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -35,15 +35,15 @@ namespace Crab {
using namespace TMX;
bool Layer::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node))
- return LoadStr(name, "name", node) && LoadNum(w, "width", node) && LoadNum(h, "height", node);
+ if (nodeValid(node))
+ return loadStr(name, "name", node) && loadNum(w, "width", node) && loadNum(h, "height", node);
return false;
}
bool MapLayer::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
if (Layer::Load(node)) {
- if (NodeValid("image", node, false)) {
+ if (nodeValid("image", node, false)) {
type = LAYER_IMAGE;
rapidxml::xml_node<char> *imgnode = node->first_node("image");
@@ -69,10 +69,10 @@ bool MapLayer::Load(const Common::String &path, rapidxml::xml_node<char> *node)
// load properties associated with the layer, such as:
// Is it a prop layer or not? If yes, the prop dimensions
// The rate of scrolling of the layer, used for parallax scrolling
- if (NodeValid("properties", node, false)) {
+ if (nodeValid("properties", node, false)) {
Common::String n, v;
for (auto p = node->first_node("properties")->first_node("property"); p != NULL; p = p->next_sibling("property")) {
- if (LoadStr(n, "name", p) && LoadStr(v, "value", p)) {
+ if (loadStr(n, "name", p) && loadStr(v, "value", p)) {
if (n == "prop" && v == "true")
type = LAYER_PROP;
else if (n == "autohide" && v == "true")
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index ed601c90932..1948f0b75f3 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -65,23 +65,23 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
XMLDoc conf((path + filename));
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("map");
- if (NodeValid(node)) {
- LoadNum(tile_rows, "width", node);
- LoadNum(tile_cols, "height", node);
- LoadNum(tile_size.x, "tilewidth", node);
- LoadNum(tile_size.y, "tileheight", node);
+ if (nodeValid(node)) {
+ loadNum(tile_rows, "width", node);
+ loadNum(tile_cols, "height", node);
+ loadNum(tile_size.x, "tilewidth", node);
+ loadNum(tile_size.y, "tileheight", node);
// Pathfinding info load
path_size.x = 0;
path_size.y = 0;
- LoadNum(path_size.x, "pathwidth", node);
- LoadNum(path_size.y, "pathheight", node);
+ loadNum(path_size.x, "pathwidth", node);
+ loadNum(path_size.y, "pathheight", node);
// Load costs...Not sure if this is right. (SZ)
- LoadNum(movementCosts.open, "opencost", node);
- LoadNum(movementCosts.no_walk, "nowalkcost", node);
- LoadNum(movementCosts.stairs, "stairscost", node);
+ loadNum(movementCosts.open, "opencost", node);
+ loadNum(movementCosts.no_walk, "nowalkcost", node);
+ loadNum(movementCosts.stairs, "stairscost", node);
// if(path_size.x == 0)
// path_size.x = tile_size.x;
@@ -129,7 +129,7 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
} else if (name == "objectgroup") // Is this an object layer
{
Common::String group_name;
- LoadStr(group_name, "name", groupnode);
+ loadStr(group_name, "name", groupnode);
if (group_name == "exit") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
pyrodactyl::level::Exit le(n);
@@ -151,7 +151,7 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
s.Load(n);
unsigned int pos = area_trig.size();
- LoadNum(pos, "name", n);
+ loadNum(pos, "name", n);
if (area_trig.size() <= pos)
area_trig.resize(pos + 1);
@@ -196,7 +196,7 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
// if (linenode != NULL)
// {
// Common::String points, x, y;
-// LoadStr(points, "points", linenode);
+// loadStr(points, "points", linenode);
//
// path.resize(pos + 1);
// bool comma = false;
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index fb07cca77e2..c4ec2f7d230 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -37,19 +37,19 @@ namespace Crab {
using namespace TMX;
void TileSet::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- LoadNum(first_gid, "firstgid", node);
- LoadStr(name, "name", node);
- LoadNum(tile_w, "tilewidth", node);
- LoadNum(tile_h, "tileheight", node);
+ if (nodeValid(node)) {
+ loadNum(first_gid, "firstgid", node);
+ loadStr(name, "name", node);
+ loadNum(tile_w, "tilewidth", node);
+ loadNum(tile_h, "tileheight", node);
clip.w = tile_w;
clip.h = tile_h;
- if (NodeValid("image", node)) {
+ if (nodeValid("image", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("image");
Common::String filename;
- LoadStr(filename, "source", imgnode);
+ loadStr(filename, "source", imgnode);
loc = path + filename;
img.Load(loc);
diff --git a/engines/crab/TMX/TileInfo.h b/engines/crab/TMX/TileInfo.h
index cb573ab00d5..0997aa87416 100644
--- a/engines/crab/TMX/TileInfo.h
+++ b/engines/crab/TMX/TileInfo.h
@@ -58,7 +58,7 @@ struct TileInfo {
TileInfo(rapidxml::xml_node<char> *node) {
// Load the gid of the tile
- if (!LoadNum(gid, "gid", node))
+ if (!loadNum(gid, "gid", node))
gid = 0;
bool horizontal = (gid & FlippedHorizontallyFlag) != 0;
diff --git a/engines/crab/ai/SpriteConstant.cpp b/engines/crab/ai/SpriteConstant.cpp
index 5dc879fad38..2e1d28a0999 100644
--- a/engines/crab/ai/SpriteConstant.cpp
+++ b/engines/crab/ai/SpriteConstant.cpp
@@ -40,16 +40,16 @@ FlyerConstant::FlyerConstant() : _start(10, 40), _vel(8.0f, 0.0f) {
}
void FlyerConstant::load(rapidxml::xml_node<char> *node) {
- if (NodeValid("start", node))
+ if (nodeValid("start", node))
_start.Load(node->first_node("start"));
- if (NodeValid("vel", node))
+ if (nodeValid("vel", node))
_vel.Load(node->first_node("vel"));
- if (NodeValid("delay", node)) {
+ if (nodeValid("delay", node)) {
auto n = node->first_node("delay");
- LoadNum(_delayMin, "min", n);
- LoadNum(_delayMax, "max", n);
+ loadNum(_delayMin, "min", n);
+ loadNum(_delayMax, "max", n);
}
}
@@ -59,13 +59,13 @@ SpriteConstant::SpriteConstant() : _walkVelMod(0.9f, 0.63f) {
}
void SpriteConstant::load(rapidxml::xml_node<char> *node) {
- LoadNum(_planeW, "plane_width", node);
- LoadNum(_tweening, "tweening", node);
+ loadNum(_planeW, "plane_width", node);
+ loadNum(_tweening, "tweening", node);
- if (NodeValid("_walkVelMod", node))
+ if (nodeValid("_walkVelMod", node))
_walkVelMod.Load(node->first_node("_walkVelMod"));
- if (NodeValid("fly", node))
+ if (nodeValid("fly", node))
_fly.load(node->first_node("fly"));
}
diff --git a/engines/crab/ai/moveeffect.cpp b/engines/crab/ai/moveeffect.cpp
index 017b87e6359..c2a9668da67 100644
--- a/engines/crab/ai/moveeffect.cpp
+++ b/engines/crab/ai/moveeffect.cpp
@@ -44,21 +44,21 @@ FightMoveEffect::FightMoveEffect() {
}
void FightMoveEffect::load(rapidxml::xml_node<char> *node) {
- LoadNum(_stun, "stun", node);
- LoadNum(_dmg, "damage", node);
- LoadNum(_hurt, "hurt", node);
- LoadNum(_death, "death", node);
+ loadNum(_stun, "stun", node);
+ loadNum(_dmg, "damage", node);
+ loadNum(_hurt, "hurt", node);
+ loadNum(_death, "death", node);
- if (NodeValid("image", node, false))
+ if (nodeValid("image", node, false))
_img.Load(node->first_node("image"));
- if (NodeValid("sound", node)) {
+ if (nodeValid("sound", node)) {
rapidxml::xml_node<char> *soundnode = node->first_node("sound");
- if (!LoadNum(_activate, "activate", soundnode, false))
+ if (!loadNum(_activate, "activate", soundnode, false))
_activate = -1;
- if (!LoadNum(_activate, "hit", soundnode, false))
+ if (!loadNum(_activate, "hit", soundnode, false))
_activate = -1;
}
}
diff --git a/engines/crab/ai/movement.cpp b/engines/crab/ai/movement.cpp
index d5af38b9f79..690ce4934f2 100644
--- a/engines/crab/ai/movement.cpp
+++ b/engines/crab/ai/movement.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::ai;
//------------------------------------------------------------------------
void MovementSet::load(rapidxml::xml_node<char> *node) {
_enabled = true;
- LoadBool(_repeat, "repeat", node);
+ loadBool(_repeat, "repeat", node);
for (auto n = node->first_node("walk"); n != NULL; n = n->next_sibling("walk"))
_path.push_back(n);
}
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index c730bc952d2..b5730d619a2 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -50,7 +50,7 @@ struct MovementSet {
Movement(rapidxml::xml_node<char> *node) {
_target.Load(node);
- LoadNum(_delay, "delay", node);
+ loadNum(_delay, "delay", node);
}
};
diff --git a/engines/crab/animation/AnimationEffect.h b/engines/crab/animation/AnimationEffect.h
index e65960329c4..561b847963a 100644
--- a/engines/crab/animation/AnimationEffect.h
+++ b/engines/crab/animation/AnimationEffect.h
@@ -71,13 +71,13 @@ struct AnimationEffect {
}
AnimationEffect(rapidxml::xml_node<char> *node) {
- if (NodeValid("effect", node)) {
+ if (nodeValid("effect", node)) {
rapidxml::xml_node<char> *effnode = node->first_node("effect");
- LoadNum(_start, "start", effnode);
- LoadNum(_finish, "finish", effnode);
+ loadNum(_start, "start", effnode);
+ loadNum(_finish, "finish", effnode);
Common::String str;
- LoadStr(str, "type", effnode);
+ loadStr(str, "type", effnode);
if (str == "fade_in")
_type = FADE_IN;
else if (str == "fade_out")
@@ -85,7 +85,7 @@ struct AnimationEffect {
else
_type = FADE_NONE;
- LoadStr(str, "game_draw", effnode);
+ loadStr(str, "game_draw", effnode);
if (str == "start")
_drawGame = DRAW_START;
else if (str == "stop")
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index 2a716d35427..481041c1f6c 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -38,12 +38,12 @@ using namespace pyrodactyl::anim;
AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : _eff(node) {
Vector2i::Load(node);
- LoadImgKey(_img, "img", node);
- LoadNum(_start, "start", node);
- LoadNum(_finish, "finish", node);
- //LoadColor(col, node);
+ loadImgKey(_img, "img", node);
+ loadNum(_start, "start", node);
+ loadNum(_finish, "finish", node);
+ //loadColor(col, node);
- if (NodeValid("text", node, false))
+ if (nodeValid("text", node, false))
_text.Load(node->first_node("text"));
reset();
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index f4931400883..d449245deaa 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -41,11 +41,11 @@ using namespace pyrodactyl::event;
void PopUp::Load(rapidxml::xml_node<char> *node) {
duration.Load(node, "duration", false);
delay.Load(node, "delay");
- LoadStr(text, "text", node);
- LoadNum(next, "next", node);
+ loadStr(text, "text", node);
+ loadNum(next, "next", node);
bool end = false;
- LoadBool(end, "end", node, false);
+ loadBool(end, "end", node, false);
if (end)
next = -1;
@@ -60,7 +60,7 @@ void PopUp::Load(rapidxml::xml_node<char> *node) {
}
void PopUpCollection::Load(rapidxml::xml_node<char> *node) {
- LoadBool(loop, "loop", node);
+ loadBool(loop, "loop", node);
for (auto n = node->first_node("dialog"); n != NULL; n = n->next_sibling("dialog"))
element.push_back(n);
}
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index 0fa79f93f89..719e9fb9722 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -36,7 +36,7 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
Animation::Animation(rapidxml::xml_node<char> *node) {
- LoadNum(_length, "length", node);
+ loadNum(_length, "length", node);
for (auto n = node->first_node("frame"); n != NULL; n = n->next_sibling("frame"))
_frame.push_back(n);
}
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index cbecad3e991..cad1594b06a 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -38,12 +38,12 @@ void AnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uin
_clip.Load(node);
if (rep == 0)
- LoadNum(_repeat, "repeat", node);
+ loadNum(_repeat, "repeat", node);
else
_repeat = rep;
if (AX == 0.0f && AY == 0.0f) {
- if (NodeValid("anchor", node, false))
+ if (nodeValid("anchor", node, false))
_anchor.Load(node->first_node("anchor"));
} else {
_anchor.x = AX;
@@ -51,32 +51,32 @@ void AnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uin
}
if (VBOX.w == 0 || VBOX.h == 0) {
- if (NodeValid("box_v", node))
+ if (nodeValid("box_v", node))
_boxV.Load(node->first_node("box_v"));
} else
_boxV = VBOX;
}
void AnimationFrames::load(rapidxml::xml_node<char> *node) {
- LoadTextureFlipType(_flip, node);
+ loadTextureFlipType(_flip, node);
- if (!LoadNum(_repeat, "repeat", node, false))
+ if (!loadNum(_repeat, "repeat", node, false))
_repeat = 0;
- LoadBool(_random, "random", node, false);
+ loadBool(_random, "random", node, false);
- if (NodeValid("anchor", node, false))
+ if (nodeValid("anchor", node, false))
_anchor.Load(node->first_node("anchor"));
- if (NodeValid("box_v", node))
+ if (nodeValid("box_v", node))
_boxV.Load(node->first_node("box_v"));
- if (NodeValid("shadow", node)) {
+ if (nodeValid("shadow", node)) {
_shadow.Load(node->first_node("shadow"));
_shadow.valid = true;
}
- if (NodeValid("frames", node)) {
+ if (nodeValid("frames", node)) {
_frame.clear();
rapidxml::xml_node<char> *framenode = node->first_node("frames");
for (auto n = framenode->first_node("frame"); n != NULL; n = n->next_sibling("frame")) {
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index a70222287c7..6e02d0b864b 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -38,17 +38,17 @@ void AnimSet::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node();
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
_fight.Load(node);
_walk.Load(node);
- if (NodeValid("bounds", node))
+ if (nodeValid("bounds", node))
_bounds.Load(node->first_node("bounds"));
- if (NodeValid("shadow", node))
+ if (nodeValid("shadow", node))
_shadow.Load(node->first_node("shadow"));
- if (NodeValid("focus", node))
+ if (nodeValid("focus", node))
_focus.Load(node->first_node("focus"));
}
}
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index f962e06c523..d3884357a0d 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -40,39 +40,39 @@ using namespace pyrodactyl::anim;
void FightAnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
AnimFrame::load(node, VBOX, rep, AX, AY);
- if (NodeValid("box_d", node, false))
+ if (nodeValid("box_d", node, false))
_boxD.Load(node->first_node("box_d"));
- if (NodeValid("shift", node, false))
+ if (nodeValid("shift", node, false))
_delta.Load(node->first_node("shift"));
- if (!LoadNum(_state, "state", node, false))
+ if (!loadNum(_state, "state", node, false))
_state = 0;
- LoadBool(_branch, "branch", node, false);
+ loadBool(_branch, "branch", node, false);
}
//------------------------------------------------------------------------
// Purpose: Load a fighting move
//------------------------------------------------------------------------
void FightAnimFrames::load(rapidxml::xml_node<char> *node) {
- LoadTextureFlipType(_flip, node);
+ loadTextureFlipType(_flip, node);
- if (!LoadNum(_repeat, "repeat", node, false))
+ if (!loadNum(_repeat, "repeat", node, false))
_repeat = 0;
- if (NodeValid("anchor", node, false))
+ if (nodeValid("anchor", node, false))
_anchor.Load(node->first_node("anchor"));
- if (NodeValid("box_v", node))
+ if (nodeValid("box_v", node))
_boxV.Load(node->first_node("box_v"));
- if (NodeValid("shadow", node)) {
+ if (nodeValid("shadow", node)) {
_shadow.Load(node->first_node("shadow"));
_shadow.valid = true;
}
- if (NodeValid("frames", node)) {
+ if (nodeValid("frames", node)) {
_frame.clear();
rapidxml::xml_node<char> *framenode = node->first_node("frames");
for (auto n = framenode->first_node("frame"); n != NULL; n = n->next_sibling("frame")) {
diff --git a/engines/crab/animation/fightmove.cpp b/engines/crab/animation/fightmove.cpp
index a06723b340a..66cc10de2f8 100644
--- a/engines/crab/animation/fightmove.cpp
+++ b/engines/crab/animation/fightmove.cpp
@@ -40,16 +40,16 @@ void FightMove::Load(rapidxml::xml_node<char> *node) {
frames[DIRECTION_LEFT].load(node->first_node("left"));
frames[DIRECTION_RIGHT].load(node->first_node("right"));
- if (NodeValid("input", node))
+ if (nodeValid("input", node))
input.Load(node->first_node("input"));
- if (NodeValid("unlock", node, false))
+ if (nodeValid("unlock", node, false))
unlock.Load(node->first_node("unlock"));
- if (NodeValid("effect", node))
+ if (nodeValid("effect", node))
eff.load(node->first_node("effect"));
- if (NodeValid("ai", node, false))
+ if (nodeValid("ai", node, false))
ai.Load(node->first_node("ai"));
}
diff --git a/engines/crab/animation/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
index 1564bdb01e3..d608526521d 100644
--- a/engines/crab/animation/fm_ai_data.h
+++ b/engines/crab/animation/fm_ai_data.h
@@ -60,13 +60,13 @@ struct FightMoveAIData {
}
void Load(rapidxml::xml_node<char> *node) {
- if (!LoadNum(delay, "delay", node, false))
+ if (!loadNum(delay, "delay", node, false))
delay = 0;
range.Load(node->first_node("range"));
Common::String str;
- LoadStr(str, "type", node, false);
+ loadStr(str, "type", node, false);
if (str == "attack")
type = MOVE_ATTACK;
else if (str == "defend")
diff --git a/engines/crab/animation/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
index 8c768a70b14..76fc4d872f5 100644
--- a/engines/crab/animation/imageeffect.cpp
+++ b/engines/crab/animation/imageeffect.cpp
@@ -36,8 +36,8 @@ namespace Crab {
using namespace pyrodactyl::anim;
void ImageEffect::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node, false)) {
- if (LoadImgKey(img, "img", node) && LoadXY(x, y, node))
+ if (nodeValid(node, false)) {
+ if (loadImgKey(img, "img", node) && loadXY(x, y, node))
visible = true;
}
}
diff --git a/engines/crab/animation/range.h b/engines/crab/animation/range.h
index f0d39416501..263e1cfc4c8 100644
--- a/engines/crab/animation/range.h
+++ b/engines/crab/animation/range.h
@@ -45,7 +45,7 @@ struct Range {
Range() { valid = false; }
void Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node, false)) {
+ if (nodeValid(node, false)) {
val[DIRECTION_DOWN].Load(node->first_node("down"));
val[DIRECTION_UP].Load(node->first_node("up"));
val[DIRECTION_LEFT].Load(node->first_node("left"));
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index 94cd30df014..2535a1e0820 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -52,7 +52,7 @@ struct ShadowData {
ShadowData() : size(1, 1) { img = 0; }
void Load(rapidxml::xml_node<char> *node) {
- LoadImgKey(img, "img", node);
+ loadImgKey(img, "img", node);
offset.Load(node);
using namespace pyrodactyl::image;
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index beb026e6c46..ae482c12b39 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -56,21 +56,21 @@ Sprite::Sprite() : img_size(1, 1), vel_mod(1.0f, 1.0f) {
void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations) {
using namespace pyrodactyl::image;
- if (NodeValid(node)) {
- LoadStr(id, "id", node);
+ if (nodeValid(node)) {
+ loadStr(id, "id", node);
// The amount by which the sprite x,y should be multiplied
int multiply = 1;
- LoadNum(multiply, "multiply", node, false);
+ loadNum(multiply, "multiply", node, false);
- LoadNum(pos.x, "x", node);
- LoadNum(pos.y, "y", node);
+ loadNum(pos.x, "x", node);
+ loadNum(pos.y, "y", node);
pos.x *= multiply;
pos.y *= multiply;
- LoadImgKey(image, "img", node);
- LoadNum(layer, "layer", node, false);
+ loadImgKey(image, "img", node);
+ loadNum(layer, "layer", node, false);
Image dat;
g_engine->_imageManager->GetTexture(image, dat);
@@ -78,24 +78,24 @@ void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
img_size.y = dat.H();
unsigned int index = 0;
- LoadNum(index, "moveset", node);
+ loadNum(index, "moveset", node);
if (index < animations.size())
anim_set.load(animations[index]);
anim_set._fight.ListAttackMoves(ai_data._fight._attack);
- LoadDirection(dir, node);
+ loadDirection(dir, node);
clip = anim_set._walk.Clip(dir);
box_v = anim_set._walk.BoxV(dir);
- if (NodeValid("visible", node, false))
+ if (nodeValid("visible", node, false))
visible.Load(node->first_node("visible"));
- if (NodeValid("movement", node, false))
+ if (nodeValid("movement", node, false))
ai_data._walk.load(node->first_node("movement"));
- if (NodeValid("popup", node, false))
+ if (nodeValid("popup", node, false))
popup.Load(node->first_node("popup"));
}
}
@@ -739,8 +739,8 @@ void Sprite::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
// Purpose: Load all sprite positions from save file
//------------------------------------------------------------------------
void Sprite::LoadState(rapidxml::xml_node<char> *node) {
- LoadNum(pos.x, "x", node);
- LoadNum(pos.y, "y", node);
+ loadNum(pos.x, "x", node);
+ loadNum(pos.y, "y", node);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/walkframes.cpp b/engines/crab/animation/walkframes.cpp
index 6994c1e4563..cf70869e886 100644
--- a/engines/crab/animation/walkframes.cpp
+++ b/engines/crab/animation/walkframes.cpp
@@ -40,16 +40,16 @@ using namespace pyrodactyl::people;
// Purpose: Loader Function
//------------------------------------------------------------------------
void WalkFrames::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("stand", node))
+ if (nodeValid("stand", node))
set[WT_STAND].Load(node->first_node("stand"));
- if (NodeValid("walk", node))
+ if (nodeValid("walk", node))
set[WT_WALK].Load(node->first_node("walk"));
- if (NodeValid("fight", node))
+ if (nodeValid("fight", node))
set[WT_FIGHT].Load(node->first_node("fight"));
- if (NodeValid("ko", node))
+ if (nodeValid("ko", node))
set[WT_KO].Load(node->first_node("ko"));
}
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 2b618490709..e5ed60bf186 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -305,12 +305,12 @@ void App::LoadSettings(const Common::String &filename) {
XMLDoc settings(filename);
if (settings.ready()) {
rapidxml::xml_node<char> *node = settings.doc()->first_node("settings");
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
// Load the version
- LoadNum(g_engine->_screenSettings->version, "version", node);
+ loadNum(g_engine->_screenSettings->version, "version", node);
// Load screen settings
- if (NodeValid("screen", node))
+ if (nodeValid("screen", node))
g_engine->_screenSettings->Load(node->first_node("screen"));
// Start the sound subsystem
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index b2454019239..d2960c73a3b 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -50,7 +50,7 @@ using namespace pyrodactyl::event;
// Purpose: Load from xml
//------------------------------------------------------------------------
void Info::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("people", node)) {
+ if (nodeValid("people", node)) {
rapidxml::xml_node<char> *pnode = node->first_node("people");
stem.Load(pnode->first_attribute("templates")->value());
@@ -58,9 +58,9 @@ void Info::Load(rapidxml::xml_node<char> *node) {
XMLDoc conf(pnode->first_attribute("list")->value());
if (conf.ready()) {
rapidxml::xml_node<char> *cnode = conf.doc()->first_node("characters");
- if (NodeValid(cnode)) {
- LoadNum(OPINION_MIN, "op_min", cnode);
- LoadNum(OPINION_MAX, "op_max", cnode);
+ if (nodeValid(cnode)) {
+ loadNum(OPINION_MIN, "op_min", cnode);
+ loadNum(OPINION_MAX, "op_max", cnode);
for (auto n = cnode->first_node("group"); n != NULL; n = n->next_sibling("group"))
LoadPeople(n->value());
@@ -68,10 +68,10 @@ void Info::Load(rapidxml::xml_node<char> *node) {
}
}
- if (NodeValid("objective", node))
+ if (nodeValid("objective", node))
journal.Load(node->first_node("objective")->first_attribute("layout")->value());
- if (NodeValid("inventory", node)) {
+ if (nodeValid("inventory", node)) {
rapidxml::xml_node<char> *inode = node->first_node("inventory");
inv.Load(inode->first_attribute("layout")->value());
}
@@ -84,10 +84,10 @@ void Info::LoadPeople(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("people");
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
Common::String str;
- LoadStr(str, "id", n);
+ loadStr(str, "id", n);
people[str].Load(n, stem);
}
}
@@ -346,10 +346,10 @@ void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
rapidxml::xml_node<char> *child_unr = doc.allocate_node(rapidxml::node_element, "unread");
- SaveBool(unread.inventory, "inventory", doc, child_unr);
- SaveBool(unread.journal, "journal", doc, child_unr);
- SaveBool(unread.trait, "trait", doc, child_unr);
- SaveBool(unread.map, "map", doc, child_unr);
+ saveBool(unread.inventory, "inventory", doc, child_unr);
+ saveBool(unread.journal, "journal", doc, child_unr);
+ saveBool(unread.trait, "trait", doc, child_unr);
+ saveBool(unread.map, "map", doc, child_unr);
root->append_node(child_unr);
@@ -372,23 +372,23 @@ void Info::LoadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object")) {
Common::String id;
- LoadStr(id, "id", p);
+ loadStr(id, "id", p);
people[id].LoadState(p);
}
- if (NodeValid("unread", node)) {
+ if (nodeValid("unread", node)) {
rapidxml::xml_node<char> *unrnode = node->first_node("unread");
- LoadBool(unread.inventory, "inventory", unrnode);
- LoadBool(unread.journal, "journal", unrnode);
- LoadBool(unread.trait, "trait", unrnode);
- LoadBool(unread.map, "map", unrnode);
+ loadBool(unread.inventory, "inventory", unrnode);
+ loadBool(unread.journal, "journal", unrnode);
+ loadBool(unread.trait, "trait", unrnode);
+ loadBool(unread.map, "map", unrnode);
}
- if (NodeValid("img", node))
- LoadNum(player_img, "index", node->first_node("img"));
+ if (nodeValid("img", node))
+ loadNum(player_img, "index", node->first_node("img"));
- if (NodeValid("money", node))
- LoadStr(money_var, "var", node->first_node("money"));
+ if (nodeValid("money", node))
+ loadStr(money_var, "var", node->first_node("money"));
journal.LoadState(node);
inv.LoadState(node);
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 213d56eb4ab..4d89d8b382e 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -195,7 +195,7 @@ public:
void IronMan(const bool &val) { ironman = val; }
void LoadIronMan(rapidxml::xml_node<char> *node) {
Common::String str;
- LoadStr(str, "diff", node);
+ loadStr(str, "diff", node);
ironman = (str == "Iron Man");
}
diff --git a/engines/crab/event/changeval.h b/engines/crab/event/changeval.h
index 5e1e25e6b0b..8ea59559b43 100644
--- a/engines/crab/event/changeval.h
+++ b/engines/crab/event/changeval.h
@@ -56,10 +56,10 @@ struct ChangeVal {
void Load(rapidxml::xml_node<char> *node) {
using namespace pyrodactyl::people;
- LoadStr(id, "id", node);
- LoadNum(val[OPI_LIKE], "like", node);
- LoadNum(val[OPI_RESPECT], "respect", node);
- LoadNum(val[OPI_FEAR], "fear", node);
+ loadStr(id, "id", node);
+ loadNum(val[OPI_LIKE], "like", node);
+ loadNum(val[OPI_RESPECT], "respect", node);
+ loadNum(val[OPI_FEAR], "fear", node);
}
};
} // End of namespace event
diff --git a/engines/crab/event/conversationdata.cpp b/engines/crab/event/conversationdata.cpp
index d6ee875cc5d..cafe9c47479 100644
--- a/engines/crab/event/conversationdata.cpp
+++ b/engines/crab/event/conversationdata.cpp
@@ -35,14 +35,14 @@ namespace Crab {
using namespace pyrodactyl::event;
void ReplyChoice::Load(rapidxml::xml_node<char> *node) {
- LoadStr(text, "text", node);
- LoadNum(tone, "tone", node);
- LoadNum(nextid, "next", node);
+ loadStr(text, "text", node);
+ loadNum(tone, "tone", node);
+ loadNum(nextid, "next", node);
- if (NodeValid("unlock", node, false))
+ if (nodeValid("unlock", node, false))
unlock.Load(node->first_node("unlock"));
- if (NodeValid("change", node, false))
+ if (nodeValid("change", node, false))
for (auto n = node->first_node("change"); n != NULL; n = n->next_sibling("change"))
change.push_back(n);
}
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index ec610b3cbda..680a24411dd 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::music;
void Effect::Load(rapidxml::xml_node<char> *node) {
Common::String ty;
- LoadStr(ty, "type", node);
+ loadStr(ty, "type", node);
// Should we throw a warning about missing fields? Depends on the type of effect
bool echo_op = true, echo_sub = true, echo_val = true;
@@ -101,9 +101,9 @@ void Effect::Load(rapidxml::xml_node<char> *node) {
} else
type = EFF_VAR;
- LoadStr(subject, "subject", node, echo_sub);
- LoadStr(operation, "operation", node, echo_op);
- LoadStr(val, "val", node, echo_val);
+ loadStr(subject, "subject", node, echo_sub);
+ loadStr(operation, "operation", node, echo_op);
+ loadStr(val, "val", node, echo_val);
}
void Effect::ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType opType) {
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 3dfddee0c90..def3393257a 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -36,7 +36,7 @@ using namespace pyrodactyl::event;
void GameEventStore::AddConv(rapidxml::xml_node<char> *node, unsigned int &index) {
ConversationData c;
- if (NodeValid("talk", node))
+ if (nodeValid("talk", node))
c.Load(node->first_node("talk"));
index = con.size();
@@ -55,28 +55,28 @@ void GameEventStore::Load(const Common::String &filename) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("store");
- if (NodeValid("animations", node)) {
+ if (nodeValid("animations", node)) {
rapidxml::xml_node<char> *animnode = node->first_node("animations");
for (auto n = animnode->first_node("anim"); n != NULL; n = n->next_sibling("anim"))
anim.push_back(n);
}
- if (NodeValid("tones", node)) {
+ if (nodeValid("tones", node)) {
rapidxml::xml_node<char> *tonenode = node->first_node("tones");
for (auto n = tonenode->first_node("tone"); n != NULL; n = n->next_sibling("tone")) {
ToneData dat;
- LoadStr(dat.text, "text", n);
+ loadStr(dat.text, "text", n);
tone.push_back(dat);
}
}
- if (NodeValid("images", node)) {
+ if (nodeValid("images", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("images");
for (auto n = imgnode->first_node("img"); n != NULL; n = n->next_sibling("img"))
img.push_back(n);
}
- if (NodeValid("traits", node)) {
+ if (nodeValid("traits", node)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
for (auto n = traitnode->first_node("trait"); n != NULL; n = n->next_sibling("trait"))
trait.push_back(n);
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index d514b6c763a..b50a74171e6 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -46,12 +46,12 @@ void GameEvent::Load(rapidxml::xml_node<char> *node) {
if (!LoadEventID(id, "id", node))
id = 0;
- LoadStr(title, "title", node);
- LoadStr(dialog, "dialog", node);
- LoadEnum(state, "state", node, false);
+ loadStr(title, "title", node);
+ loadStr(dialog, "dialog", node);
+ loadEnum(state, "state", node, false);
Common::String Type;
- LoadStr(Type, "type", node);
+ loadStr(Type, "type", node);
if (Type == "dlg") {
type = EVENT_DIALOG;
@@ -61,7 +61,7 @@ void GameEvent::Load(rapidxml::xml_node<char> *node) {
g_engine->_eventStore->AddConv(node, special);
} else if (Type == "animation") {
type = EVENT_ANIM;
- LoadNum(special, "anim", node);
+ loadNum(special, "anim", node);
} else if (Type == "silent") {
type = EVENT_SILENT;
special = 0;
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index 88c8ab43289..ea782b1b132 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -45,7 +45,7 @@ namespace Crab {
typedef unsigned int EventID;
// Just map loading function to number load
-#define LoadEventID LoadNum
+#define LoadEventID loadNum
namespace pyrodactyl {
namespace event {
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 4425e90d12e..12b666e30b7 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -51,19 +51,19 @@ void Manager::Init() {
// Purpose: Load this
//------------------------------------------------------------------------
void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
XMLDoc conf(node->first_attribute("list")->value());
if (conf.ready()) {
rapidxml::xml_node<char> *lnode = conf.doc()->first_node("event_list");
for (rapidxml::xml_node<char> *loc = lnode->first_node("loc"); loc != NULL; loc = loc->next_sibling("loc")) {
Common::String loc_name;
- LoadStr(loc_name, "name", loc);
+ loadStr(loc_name, "name", loc);
for (auto n = loc->first_node("file"); n != NULL; n = n->next_sibling("file")) {
unsigned int id;
Common::String path;
- LoadNum(id, "name", n);
- LoadStr(path, "path", n);
+ loadNum(id, "name", n);
+ loadStr(path, "path", n);
event_map[loc_name].AddSeq(id, path);
}
}
@@ -74,14 +74,14 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
conf.load(node->first_attribute("layout")->value());
if (conf.ready()) {
rapidxml::xml_node<char> *layout = conf.doc()->first_node("layout");
- if (NodeValid(layout)) {
- if (NodeValid("character", layout))
+ if (nodeValid(layout)) {
+ if (nodeValid("character", layout))
oh.Load(layout->first_node("character"));
- if (NodeValid("popup", layout))
+ if (nodeValid("popup", layout))
popup.Load(layout->first_node("popup"));
- if (NodeValid("intro", layout))
+ if (nodeValid("intro", layout))
intro.Load(layout->first_node("intro"));
}
}
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index 40ff9cb8e05..1fe55a3d198 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -41,9 +41,9 @@ Quest::Quest(const Common::String &Title, const Common::String &Text, const bool
}
void Quest::LoadState(rapidxml::xml_node<char> *node) {
- LoadStr(title, "title", node);
- LoadBool(unread, "unread", node);
- LoadBool(marker, "marker", node);
+ loadStr(title, "title", node);
+ loadBool(unread, "unread", node);
+ loadBool(marker, "marker", node);
for (rapidxml::xml_node<char> *n = node->first_node("info"); n != NULL; n = n->next_sibling("info"))
text.push_back(n->value());
@@ -53,8 +53,8 @@ void Quest::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *r
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "quest");
child->append_attribute(doc.allocate_attribute("title", title.c_str()));
- SaveBool(unread, "unread", doc, child);
- SaveBool(marker, "marker", doc, child);
+ saveBool(unread, "unread", doc, child);
+ saveBool(marker, "marker", doc, child);
for (auto i = text.begin(); i != text.end(); ++i) {
rapidxml::xml_node<char> *grandchild = doc.allocate_node(rapidxml::node_element, "info");
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 67e4cfd204c..cfc2f04e1e3 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -36,7 +36,7 @@ using namespace pyrodactyl::event;
void Trigger::Load(rapidxml::xml_node<char> *node) {
Common::String ty;
- LoadStr(ty, "type", node);
+ loadStr(ty, "type", node);
// Should we throw a warning about missing fields? Depends on the type of trigger
bool echo_op = true, echo_tar = false, echo_sub = true;
@@ -66,19 +66,19 @@ void Trigger::Load(rapidxml::xml_node<char> *node) {
} else
type = TRIG_VAR;
- LoadStr(target, "target", node, echo_tar);
- LoadStr(subject, "subject", node, echo_sub);
- LoadStr(operation, "operation", node, echo_op);
- LoadStr(val, "val", node);
+ loadStr(target, "target", node, echo_tar);
+ loadStr(subject, "subject", node, echo_sub);
+ loadStr(operation, "operation", node, echo_op);
+ loadStr(val, "val", node);
Common::String str;
- LoadStr(str, "rel", node, false);
+ loadStr(str, "rel", node, false);
if (str == "or")
rel = OP_OR;
else
rel = OP_AND;
- LoadStr(str, "prefix", node, false);
+ loadStr(str, "prefix", node, false);
if (str == "!")
negate = true;
else
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 378cda3d10b..475f9983217 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -71,41 +71,41 @@ void Game::Init(const Common::String &filename) {
info.Load(node);
Common::String path;
- if (NodeValid("level", node)) {
- LoadStr(path, "list", node->first_node("level"));
+ if (nodeValid("level", node)) {
+ loadStr(path, "list", node->first_node("level"));
g_engine->_filePath->LoadLevel(path);
}
- if (NodeValid("hud", node)) {
- LoadStr(path, "layout", node->first_node("hud"));
+ if (nodeValid("hud", node)) {
+ loadStr(path, "layout", node->first_node("hud"));
hud.Load(path, level.talk_notify, level.dest_marker);
}
- if (NodeValid("sprite", node)) {
- LoadStr(path, "animation", node->first_node("sprite"));
+ if (nodeValid("sprite", node)) {
+ loadStr(path, "animation", node->first_node("sprite"));
level.LoadMoves(path);
- LoadStr(path, "constant", node->first_node("sprite"));
+ loadStr(path, "constant", node->first_node("sprite"));
level.LoadConst(path);
}
- if (NodeValid("event", node)) {
+ if (nodeValid("event", node)) {
gem.Load(node->first_node("event"), pop_default);
- LoadStr(path, "store", node->first_node("event"));
+ loadStr(path, "store", node->first_node("event"));
g_engine->_eventStore->Load(path);
}
- if (NodeValid("map", node)) {
- LoadStr(path, "layout", node->first_node("map"));
+ if (nodeValid("map", node)) {
+ loadStr(path, "layout", node->first_node("map"));
map.Load(path, info);
}
- if (NodeValid("save", node))
+ if (nodeValid("save", node))
savefile.Load(node->first_node("save"));
- if (NodeValid("debug", node)) {
- LoadStr(path, "layout", node->first_node("debug"));
+ if (nodeValid("debug", node)) {
+ loadStr(path, "layout", node->first_node("debug"));
debug_console.Load(path);
}
}
@@ -680,33 +680,33 @@ void Game::LoadState(Common::SeekableReadStream *stream) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("save");
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
info.LoadIronMan(node);
- LoadStr(savefile.ironman, "file", node);
+ loadStr(savefile.ironman, "file", node);
hud.pause.UpdateMode(info.IronMan());
- if (NodeValid("events", node))
+ if (nodeValid("events", node))
gem.LoadState(node->first_node("events"));
- if (NodeValid("info", node))
+ if (nodeValid("info", node))
info.LoadState(node->first_node("info"));
- if (NodeValid("map", node))
+ if (nodeValid("map", node))
map.LoadState(node->first_node("map"));
PlayerImg();
Common::String loc;
- LoadStr(loc, "loc_id", node);
+ loadStr(loc, "loc_id", node);
LoadLevel(loc);
- if (NodeValid("level", node))
+ if (nodeValid("level", node))
level.LoadState(node->first_node("level"));
gem.per.Cache(info, level.PlayerID(), level);
Common::String playtime;
- LoadStr(playtime, "time", node);
+ loadStr(playtime, "time", node);
clock.Start(playtime);
}
}
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 9d143689ed8..3d00d5f7aff 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -93,10 +93,10 @@ private:
SaveFile() : auto_1("AutoSave 1"), auto_2("AutoSave 2"), auto_quit("AutoSave"), quick("Quick Save") { auto_slot = false; }
void Load(rapidxml::xml_node<char> *node) {
- LoadStr(auto_1, "auto_1", node);
- LoadStr(auto_2, "auto_2", node);
- LoadStr(auto_quit, "quit", node);
- LoadStr(quick, "quick", node);
+ loadStr(auto_1, "auto_1", node);
+ loadStr(auto_2, "auto_2", node);
+ loadStr(auto_quit, "quit", node);
+ loadStr(quick, "quick", node);
}
} savefile;
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 084fbf3b085..951c5a7ec7a 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -53,7 +53,7 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
rapidxml::xml_node<char> *node = image_list.doc()->first_node("res");
for (auto n = node->first_node("image"); n != NULL; n = n->next_sibling("image")) {
ImageKey key;
- if (LoadImgKey(key, "name", n)) {
+ if (loadImgKey(key, "name", n)) {
// Load different images depending on image quality setting
// Check if there is a low quality image specified for the asset id
// if yes, load it - if no, just load the higher quality one
@@ -62,10 +62,10 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
Common::String path;
if (!g_engine->_screenSettings->quality)
- valid = LoadStr(path, "path_low", n, false);
+ valid = loadStr(path, "path_low", n, false);
if (!valid)
- valid = LoadStr(path, "path", n, false);
+ valid = loadStr(path, "path", n, false);
if (valid)
map[mapid][key].Load(path);
@@ -77,7 +77,7 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
}
}
- if (NodeValid("mouse", node, false)) {
+ if (nodeValid("mouse", node, false)) {
using namespace pyrodactyl::input;
g_engine->_mouse->Quit();
g_engine->_mouse->Load(node->first_node("mouse"));
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index 4fe7057ef15..5ef97fec6f3 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -48,8 +48,8 @@ namespace Crab {
// We use this object as the key for all image assets
typedef unsigned int ImageKey;
-// Since we use unsigned int as a key for images, our LoadImgKey function is LoadNum
-#define LoadImgKey LoadNum
+// Since we use unsigned int as a key for images, our loadImgKey function is loadNum
+#define loadImgKey loadNum
namespace pyrodactyl {
namespace image {
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 95989e01fc6..32cdedf2982 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -59,18 +59,18 @@ void Cursor::Reset() {
// Purpose: Reset all values
//------------------------------------------------------------------------
void Cursor::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("normal", node)) {
+ if (nodeValid("normal", node)) {
rapidxml::xml_node<char> *nornode = node->first_node("normal");
img.Load(nornode, "img");
img_s.Load(nornode, "img_s");
}
- if (NodeValid("hover", node)) {
+ if (nodeValid("hover", node)) {
rapidxml::xml_node<char> *hovnode = node->first_node("hover");
img_hover.Load(hovnode, "img");
img_hover_s.Load(hovnode, "img_s");
- if (NodeValid("offset", hovnode))
+ if (nodeValid("offset", hovnode))
hover_offset.Load(hovnode->first_node("offset"));
}
}
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index fd4b12097d8..22b3f5abc15 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -36,8 +36,8 @@ namespace Crab {
using namespace pyrodactyl::input;
void FightInput::Load(rapidxml::xml_node<char> *node) {
- LoadEnum(type, "type", node);
- LoadNum(state, "state", node);
+ loadEnum(type, "type", node);
+ loadNum(state, "state", node);
}
FightAnimationType FightInput::HandleEvents(const Common::Event &Event) {
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index 54c494c6de8..13ca5ce0784 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace pyrodactyl::input;
void HotKey::Load(rapidxml::xml_node<char> *node) {
- LoadEnum(input, "input", node);
+ loadEnum(input, "input", node);
name = g_engine->_inputManager->GetAssociatedKey(input);
}
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 19c15d1d03d..305e161d49d 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -157,8 +157,8 @@ void InputManager::Load(const Common::String &filename) {
XMLDoc control_list(filename);
if (control_list.ready()) {
rapidxml::xml_node<char> *node = control_list.doc()->first_node("controls");
- if (NodeValid(node)) {
- LoadNum(version, "version", node);
+ if (nodeValid(node)) {
+ loadNum(version, "version", node);
int i = 0;
for (auto n = node->first_node(); n != NULL && i < IT_TOTAL; n = n->next_sibling(), ++i)
diff --git a/engines/crab/input/inputval.cpp b/engines/crab/input/inputval.cpp
index 7bfa99a1ce3..e15b5e6e4ee 100644
--- a/engines/crab/input/inputval.cpp
+++ b/engines/crab/input/inputval.cpp
@@ -52,12 +52,12 @@ void InputVal::LoadState(rapidxml::xml_node<char> *node) {
warning("STUB: InputVal::LoadState()");
#if 0
- LoadStr(name, "name", node);
- LoadEnum(key, "key", node);
- LoadEnum(alt, "alt", node);
- LoadEnum(c_bu, "bu", node);
+ loadStr(name, "name", node);
+ loadEnum(key, "key", node);
+ loadEnum(alt, "alt", node);
+ loadEnum(c_bu, "bu", node);
- if (NodeValid("axis", node, false))
+ if (nodeValid("axis", node, false))
c_ax.LoadState(node->first_node("axis"));
#endif
}
diff --git a/engines/crab/input/inputval.h b/engines/crab/input/inputval.h
index 9f32fc81d05..9222bd89f8c 100644
--- a/engines/crab/input/inputval.h
+++ b/engines/crab/input/inputval.h
@@ -79,9 +79,9 @@ public:
}
void LoadState(rapidxml::xml_node<char> *node) {
- //LoadEnum(id, "id", node);
- LoadNum(val, "val", node);
- LoadBool(greater, "greater", node);
+ //loadEnum(id, "id", node);
+ loadNum(val, "val", node);
+ loadBool(greater, "greater", node);
}
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
@@ -91,7 +91,7 @@ public:
//child->append_attribute(doc.allocate_attribute("id", gStrPool->Get(id)));
child->append_attribute(doc.allocate_attribute("val", gStrPool->Get(val)));
- SaveBool(greater, "greater", doc, child);
+ saveBool(greater, "greater", doc, child);
root->append_node(child);
}
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 634b31242f0..04bf0b3b1ce 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -42,12 +42,12 @@ using namespace pyrodactyl::people;
// Purpose: Load
//------------------------------------------------------------------------
void Item::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- LoadStr(id, "id", node);
- LoadStr(name, "name", node);
- LoadStr(type, "type", node);
- LoadStr(desc, "desc", node);
- LoadImgKey(img, "img", node);
+ if (nodeValid(node)) {
+ loadStr(id, "id", node);
+ loadStr(name, "name", node);
+ loadStr(type, "type", node);
+ loadStr(desc, "desc", node);
+ loadImgKey(img, "img", node);
bonus.clear();
for (auto n = node->first_node("bonus"); n != NULL; n = n->next_sibling("bonus")) {
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index c22de43f0fa..5b912d5b104 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -40,22 +40,22 @@ using namespace pyrodactyl::ui;
// Purpose: Load the reference information
//------------------------------------------------------------------------
void ItemCollection::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("info", node))
+ if (nodeValid("info", node))
item_info.Load(node->first_node("info"));
- if (NodeValid("ref", node))
+ if (nodeValid("ref", node))
ref.Load(node->first_node("ref"));
- if (NodeValid("inc", node))
+ if (nodeValid("inc", node))
inc.Load(node->first_node("inc"));
- if (NodeValid("dim", node)) {
+ if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
- LoadNum(rows, "rows", dimnode);
- LoadNum(cols, "cols", dimnode);
+ loadNum(rows, "rows", dimnode);
+ loadNum(cols, "cols", dimnode);
}
- LoadBool(usekeyboard, "keyboard", node);
+ loadBool(usekeyboard, "keyboard", node);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index b7bc140b59e..e7d5ffa26c5 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -48,7 +48,7 @@ void ItemSlot::Load(rapidxml::xml_node<char> *node) {
if (node->first_attribute("slot") == NULL)
no_type = true;
else {
- LoadStr(item_type, "slot", node);
+ loadStr(item_type, "slot", node);
no_type = false;
}
@@ -82,7 +82,7 @@ void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
child = doc.allocate_node(rapidxml::node_element, "storage");
item.SaveState(doc, child);
- SaveBool(unread, "unread", doc, child);
+ saveBool(unread, "unread", doc, child);
root->append_node(child);
}
@@ -92,7 +92,7 @@ void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
//------------------------------------------------------------------------
void ItemSlot::LoadState(rapidxml::xml_node<char> *node) {
item.Load(node);
- LoadBool(unread, "unread", node);
+ loadBool(unread, "unread", node);
if (item.id == "")
empty = true;
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index 3676a58cb1f..a3d41dabe40 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -36,20 +36,20 @@ namespace Crab {
using namespace pyrodactyl::item;
void StatPreview::Load(rapidxml::xml_node<char> *node) {
- LoadBool(enabled, "enabled", node);
+ loadBool(enabled, "enabled", node);
- if (NodeValid("stat", node)) {
+ if (nodeValid("stat", node)) {
rapidxml::xml_node<char> *snode = node->first_node("stat");
stat.Load(snode);
- LoadNum(inc_s.x, "w", snode);
- LoadNum(inc_s.y, "h", snode);
+ loadNum(inc_s.x, "w", snode);
+ loadNum(inc_s.y, "h", snode);
}
- if (NodeValid("unit", node)) {
+ if (nodeValid("unit", node)) {
rapidxml::xml_node<char> *snode = node->first_node("unit");
unit.Load(snode);
- LoadNum(inc_u.x, "w", snode);
- LoadNum(inc_u.y, "h", snode);
+ loadNum(inc_u.x, "w", snode);
+ loadNum(inc_u.y, "h", snode);
}
}
diff --git a/engines/crab/level/LevelExit.cpp b/engines/crab/level/LevelExit.cpp
index 9a531b11216..ce0f3606ffe 100644
--- a/engines/crab/level/LevelExit.cpp
+++ b/engines/crab/level/LevelExit.cpp
@@ -36,18 +36,18 @@ using namespace pyrodactyl::level;
void Exit::Load(rapidxml::xml_node<char> *node) {
dim.Load(node);
- LoadStr(name, "name", node);
+ loadStr(name, "name", node);
- if (NodeValid("properties", node)) {
+ if (nodeValid("properties", node)) {
rapidxml::xml_node<char> *propertynode = node->first_node("properties");
for (auto n = propertynode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
Common::String node_name;
- LoadStr(node_name, "name", n);
+ loadStr(node_name, "name", n);
if (node_name == "entry_x") {
- if (!LoadNum(entry.x, "value", n))
+ if (!loadNum(entry.x, "value", n))
entry.x = -1;
} else if (node_name == "entry_y") {
- if (!LoadNum(entry.y, "value", n))
+ if (!loadNum(entry.y, "value", n))
entry.y = -1;
}
}
diff --git a/engines/crab/level/MusicArea.cpp b/engines/crab/level/MusicArea.cpp
index 381e694a588..a7e0431aa25 100644
--- a/engines/crab/level/MusicArea.cpp
+++ b/engines/crab/level/MusicArea.cpp
@@ -37,17 +37,17 @@ using namespace pyrodactyl::level;
void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo) {
Shape::Load(node, echo);
- if (NodeValid("properties", node, echo)) {
+ if (nodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
Common::String name;
- if (LoadStr(name, "name", n, echo)) {
+ if (loadStr(name, "name", n, echo)) {
if (name == "music")
- LoadBool(track, "value", n, echo);
+ loadBool(track, "value", n, echo);
else if (name == "id")
- LoadNum(id, "value", n, echo);
+ loadNum(id, "value", n, echo);
else if (name == "loops")
- LoadNum(loops, "value", n, echo);
+ loadNum(loops, "value", n, echo);
}
}
}
diff --git a/engines/crab/level/Stairs.cpp b/engines/crab/level/Stairs.cpp
index 8c440d26465..ce808e00de9 100644
--- a/engines/crab/level/Stairs.cpp
+++ b/engines/crab/level/Stairs.cpp
@@ -37,15 +37,15 @@ using namespace pyrodactyl::level;
void Stairs::Load(rapidxml::xml_node<char> *node, const bool &echo) {
Shape::Load(node, echo);
- if (NodeValid("properties", node, echo)) {
+ if (nodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
Common::String name;
- if (LoadStr(name, "name", n, echo)) {
+ if (loadStr(name, "name", n, echo)) {
if (name == "x")
- LoadNum(modifier.x, "value", n, echo);
+ loadNum(modifier.x, "value", n, echo);
else if (name == "y")
- LoadNum(modifier.y, "value", n, echo);
+ loadNum(modifier.y, "value", n, echo);
}
}
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 7aa828c5ae9..e818b538a8e 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -56,27 +56,27 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("level");
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
Common::String vis;
- LoadStr(vis, "map", node, false);
+ loadStr(vis, "map", node, false);
if (vis == "false")
showmap.Set(false);
else
showmap.Set(true);
- if (NodeValid("preview", node))
- LoadStr(preview_path, "path", node->first_node("preview"));
+ if (nodeValid("preview", node))
+ loadStr(preview_path, "path", node->first_node("preview"));
- if (NodeValid("music", node)) {
- LoadNum(music.id, "id", node->first_node("music"));
+ if (nodeValid("music", node)) {
+ loadNum(music.id, "id", node->first_node("music"));
g_engine->_musicManager->PlayMusic(music.id);
}
- if (NodeValid("map", node)) {
+ if (nodeValid("map", node)) {
rapidxml::xml_node<char> *mapnode = node->first_node("map");
Common::String path, tmxfile;
- LoadStr(path, "path", mapnode);
- LoadStr(tmxfile, "file", mapnode);
+ loadStr(path, "path", mapnode);
+ loadStr(tmxfile, "file", mapnode);
terrain.Load(path, tmxfile);
@@ -85,17 +85,17 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
terrain.grid = &pathfindingGrid;
- if (NodeValid("loc", mapnode))
+ if (nodeValid("loc", mapnode))
map_loc.Load(mapnode->first_node("loc"));
- if (NodeValid("clip", mapnode)) {
+ if (nodeValid("clip", mapnode)) {
rapidxml::xml_node<char> *clipnode = mapnode->first_node("clip");
- LoadNum(map_clip.id, "id", clipnode);
+ loadNum(map_clip.id, "id", clipnode);
map_clip.rect.Load(clipnode);
}
}
- if (NodeValid("sprites", node)) {
+ if (nodeValid("sprites", node)) {
rapidxml::xml_node<char> *spritenode = node->first_node("sprites");
int count = 0;
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling(), ++count) {
@@ -115,7 +115,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
}
}
- if (NodeValid("background", node)) {
+ if (nodeValid("background", node)) {
rapidxml::xml_node<char> *spritenode = node->first_node("background");
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling()) {
Sprite s;
@@ -126,7 +126,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
Common::sort(background.begin(), background.end(), CompSpriteLayer);
}
- if (NodeValid("fly", node)) {
+ if (nodeValid("fly", node)) {
rapidxml::xml_node<char> *spritenode = node->first_node("fly");
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling()) {
Sprite s;
@@ -140,17 +140,17 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
}
}
- if (NodeValid("movement", node)) {
+ if (nodeValid("movement", node)) {
rapidxml::xml_node<char> *movnode = node->first_node("movement");
for (auto n = movnode->first_node("set"); n != NULL; n = n->next_sibling("set"))
move_set.push_back(n);
}
- if (NodeValid("popup", node, false))
+ if (nodeValid("popup", node, false))
pop.Load(node->first_node("popup"));
game_over.Clear();
- if (NodeValid("game_over", node, false))
+ if (nodeValid("game_over", node, false))
game_over.Load(node->first_node("game_over"));
else if (player_index < objects.size()) {
// The default lose condition is the death of the player
@@ -181,17 +181,17 @@ void Level::LoadMoves(const Common::String &filename) {
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set")) {
unsigned int pos = anim_set.size();
- LoadNum(pos, "id", n);
+ loadNum(pos, "id", n);
if (pos >= anim_set.size())
anim_set.resize(pos + 1);
// See if there is an alternate moveset for low quality setting
// If no, just load the regular one
if (!g_engine->_screenSettings->quality) {
- if (!LoadStr(anim_set[pos], "path_low", n))
- LoadStr(anim_set[pos], "path", n);
+ if (!loadStr(anim_set[pos], "path_low", n))
+ loadStr(anim_set[pos], "path", n);
} else
- LoadStr(anim_set[pos], "path", n);
+ loadStr(anim_set[pos], "path", n);
}
}
}
@@ -203,7 +203,7 @@ void Level::LoadConst(const Common::String &filename) {
XMLDoc doc(filename);
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.doc()->first_node("constant");
- if (NodeValid(node))
+ if (nodeValid(node))
sc_default.load(node);
}
}
@@ -225,7 +225,7 @@ void Level::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *r
// Purpose: Load all sprite positions from save file
//------------------------------------------------------------------------
void Level::LoadState(rapidxml::xml_node<char> *node) {
- LoadNum(player_index, "player_index", node);
+ loadNum(player_index, "player_index", node);
auto i = objects.begin();
for (auto *n = node->first_node("sprite"); n != NULL && i != objects.end(); n = n->next_sibling("sprite"), ++i)
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index 19d3ad71489..f8dcaea0cef 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::level;
void PlayerDestMarker::Load(rapidxml::xml_node<char> *node) {
- LoadImgKey(img, "dest", node);
+ loadImgKey(img, "dest", node);
size.x = g_engine->_imageManager->GetTexture(img).W();
size.y = g_engine->_imageManager->GetTexture(img).H();
}
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index c2789969674..c7cd3823f6c 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -38,9 +38,9 @@ using namespace pyrodactyl::image;
void TalkNotify::Load(rapidxml::xml_node<char> *node) {
offset.Load(node);
- LoadNum(font, "font", node);
- LoadAlign(align, node);
- LoadNum(col, "col", node);
+ loadNum(font, "font", node);
+ loadAlign(align, node);
+ loadNum(col, "col", node);
}
void TalkNotify::Draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s, const Rect &camera) {
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 0d42877a863..589ca4e28eb 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -32,7 +32,7 @@
namespace Crab {
-bool NodeValid(rapidxml::xml_node<char> *node, const bool &echo) {
+bool nodeValid(rapidxml::xml_node<char> *node, const bool &echo) {
if (node == NULL) {
/*if (echo)
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", "node not found", NULL);*/
@@ -43,15 +43,15 @@ bool NodeValid(rapidxml::xml_node<char> *node, const bool &echo) {
return true;
}
-bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node, const bool &echo) {
- if (parent_node == NULL) {
+bool nodeValid(const Common::String &name, rapidxml::xml_node<char> *parentNode, const bool &echo) {
+ if (parentNode == NULL) {
/*if (echo)
{
Common::String error_msg = "parent node of " + name + " not found \n";
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
}*/
return false;
- } else if (parent_node->first_node(name.c_str()) == NULL) {
+ } else if (parentNode->first_node(name.c_str()) == NULL) {
/*if (echo)
{
Common::String error_msg = "child node " + name + " of parent node " + parent_node->name() + " not found \n";
@@ -63,7 +63,7 @@ bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node
return true;
}
-bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo) {
+bool loadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo) {
if (node->first_attribute(name.c_str()) != NULL)
val = node->first_attribute(name.c_str())->value();
else {
@@ -80,23 +80,21 @@ bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node
#if 0
-bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
+bool loadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
const Common::String &x_name, const Common::String &y_name, const Common::String &w_name, const Common::String &h_name)
{
- if (LoadNum(rect.x, x_name, node, echo) && LoadNum(rect.y, y_name, node, echo)
- && LoadNum(rect.w, w_name, node, echo) && LoadNum(rect.h, h_name, node, echo))
+ if (loadNum(rect.x, x_name, node, echo) && loadNum(rect.y, y_name, node, echo)
+ && loadNum(rect.w, w_name, node, echo) && loadNum(rect.h, h_name, node, echo))
return true;
return false;
}
#endif
-bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo,
- const Common::String &r_name, const Common::String &g_name, const Common::String &b_name)
-{
+bool loadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo,
+ const Common::String &rName, const Common::String &gName, const Common::String &bName) {
int r = 0, g = 0, b = 0;
- if (LoadNum(r, r_name, node, echo) && LoadNum(g, g_name, node, echo) && LoadNum(b, b_name, node, echo))
- {
+ if (loadNum(r, rName, node, echo) && loadNum(g, gName, node, echo) && loadNum(b, bName, node, echo)) {
col.r = r;
col.g = g;
col.b = b;
@@ -106,13 +104,13 @@ bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo,
return false;
}
-bool LoadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo) {
- return LoadNum(col, "color", node, echo);
+bool loadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo) {
+ return loadNum(col, "color", node, echo);
}
-bool LoadBool(bool &var, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo) {
+bool loadBool(bool &var, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo) {
Common::String str;
- if (LoadStr(str, name, node, echo)) {
+ if (loadStr(str, name, node, echo)) {
if (str == "true")
var = true;
else
@@ -124,17 +122,17 @@ bool LoadBool(bool &var, const Common::String &name, rapidxml::xml_node<char> *n
return false;
}
-void SaveBool(const bool &var, const char *name, rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void saveBool(const bool &var, const char *name, rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
if (var)
root->append_attribute(doc.allocate_attribute(name, "true"));
else
root->append_attribute(doc.allocate_attribute(name, "false"));
}
-bool LoadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *node, const bool &echo) {
+bool loadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *node, const bool &echo) {
using namespace pyrodactyl::stat;
Common::String str;
- if (LoadStr(str, "type", node, echo)) {
+ if (loadStr(str, "type", node, echo)) {
if (str == STATNAME_HEALTH)
type = STAT_HEALTH;
else if (str == STATNAME_ATTACK)
@@ -153,9 +151,9 @@ bool LoadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *no
return false;
}
-bool LoadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo, const Common::String &name) {
+bool loadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo, const Common::String &name) {
int num = 0;
- if (LoadNum(num, name, node, echo)) {
+ if (loadNum(num, name, node, echo)) {
align = static_cast<Align>(num);
return true;
}
@@ -163,9 +161,9 @@ bool LoadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo, c
return false;
}
-bool LoadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &echo, const Common::String &name) {
+bool loadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &echo, const Common::String &name) {
Common::String str;
- if (LoadStr(str, name, node, echo)) {
+ if (loadStr(str, name, node, echo)) {
if (str == "left")
dir = DIRECTION_LEFT;
else if (str == "right")
@@ -181,9 +179,9 @@ bool LoadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &e
return false;
}
-bool LoadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node, const bool &echo) {
+bool loadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node, const bool &echo) {
Common::String str;
- if (LoadStr(str, "flip", node, echo)) {
+ if (loadStr(str, "flip", node, echo)) {
if (str == "x")
flip = FLIP_X;
else if (str == "y")
@@ -199,14 +197,14 @@ bool LoadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node,
return false;
}
-unsigned int Version(const Common::String &filename) {
+unsigned int version(const Common::String &filename) {
unsigned int version = 0;
XMLDoc doc(filename);
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.doc()->first_node();
- if (NodeValid(node))
- LoadNum(version, "version", node);
+ if (nodeValid(node))
+ loadNum(version, "version", node);
}
return version;
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 27e06a28e61..c9f6f43aaaa 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -40,16 +40,16 @@ namespace Crab {
// Function to check if node is valid
// return true for valid, false otherwise
-bool NodeValid(rapidxml::xml_node<char> *node, const bool &echo = true);
-bool NodeValid(const Common::String &name, rapidxml::xml_node<char> *parent_node, const bool &echo = true);
+bool nodeValid(rapidxml::xml_node<char> *node, const bool &echo = true);
+bool nodeValid(const Common::String &name, rapidxml::xml_node<char> *parentNode, const bool &echo = true);
// Functions to load attributes from xml files
// return true on success, false on failure
-bool LoadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
+bool loadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
// Used for loading numerical types
template<typename T>
-bool LoadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
+bool loadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
if (node->first_attribute(name.c_str()) != NULL)
val = StringToNumber<T>(node->first_attribute(name.c_str())->value());
else {
@@ -66,7 +66,7 @@ bool LoadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node,
// Used for loading enumerator types that are integers
template<typename T>
-bool LoadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
+bool loadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
if (node->first_attribute(name.c_str()) != NULL)
val = static_cast<T>(StringToNumber<int>(node->first_attribute(name.c_str())->value()));
else {
@@ -97,47 +97,47 @@ struct SDL_Color {
};
//Load Color
-bool LoadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo = true,
+bool loadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo = true,
const Common::String &r_name = "r", const Common::String &g_name = "g", const Common::String &b_name = "b");
//Shortcut to load integer color index to a number
-bool LoadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo = true);
+bool loadColor(int &col, rapidxml::xml_node<char> *node, const bool &echo = true);
// Load two dimensional coordinates
template<typename T>
-bool LoadXY(T &x, T &y, rapidxml::xml_node<char> *node, const bool &echo = true) {
- bool result = LoadNum(x, "x", node, echo);
- result = LoadNum(y, "y", node, echo) && result;
+bool loadXY(T &x, T &y, rapidxml::xml_node<char> *node, const bool &echo = true) {
+ bool result = loadNum(x, "x", node, echo);
+ result = loadNum(y, "y", node, echo) && result;
return result;
}
// Load three dimensional coordinates
template<typename T>
-bool LoadXYZ(T &x, T &y, T &z, rapidxml::xml_node<char> *node, const bool &echo = true) {
- bool result = LoadNum(x, "x", node, echo);
- result = LoadNum(y, "y", node, echo) && result;
- result = LoadNum(z, "z", node, echo) && result;
+bool loadXYZ(T &x, T &y, T &z, rapidxml::xml_node<char> *node, const bool &echo = true) {
+ bool result = loadNum(x, "x", node, echo);
+ result = loadNum(y, "y", node, echo) && result;
+ result = loadNum(z, "z", node, echo) && result;
return result;
}
// Load Boolean variable
-bool LoadBool(bool &var, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
+bool loadBool(bool &var, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true);
// Write Boolean variable to file
-void SaveBool(const bool &var, const char *name, rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+void saveBool(const bool &var, const char *name, rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
// Functions to load various type of objects
-bool LoadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *node, const bool &echo = true);
+bool loadStatType(pyrodactyl::stat::StatType &type, rapidxml::xml_node<char> *node, const bool &echo = true);
-bool LoadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &name = "align");
-bool LoadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &name = "dir");
+bool loadAlign(Align &align, rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &name = "align");
+bool loadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &name = "dir");
-bool LoadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node, const bool &echo = true);
+bool loadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node, const bool &echo = true);
// Check the version of a file
-unsigned int Version(const Common::String &filename);
+unsigned int version(const Common::String &filename);
} // End of namespace Crab
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 4b7a8169445..7f474d64da1 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -46,7 +46,7 @@ MainMenu::MainMenu() {
XMLDoc conf(g_engine->_filePath->mainmenu_l);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("main_menu");
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
me_main.Load(node->first_node("main"));
logo.Load(node->first_node("logo"));
@@ -64,7 +64,7 @@ MainMenu::MainMenu() {
XMLDoc loadconf(node->first_node("load")->first_attribute("path")->value());
if (loadconf.ready()) {
rapidxml::xml_node<char> *loadnode = loadconf.doc()->first_node("load_menu");
- if (NodeValid(loadnode))
+ if (nodeValid(loadnode))
g_engine->_loadMenu->Load(loadnode);
}
}
@@ -73,18 +73,18 @@ MainMenu::MainMenu() {
XMLDoc helpconf(node->first_node("help")->first_attribute("path")->value());
if (helpconf.ready()) {
rapidxml::xml_node<char> *hnode = helpconf.doc()->first_node("help");
- if (NodeValid(hnode))
+ if (nodeValid(hnode))
g_engine->_helpScreen->Load(hnode);
}
}
- if (NodeValid("scene", node)) {
+ if (nodeValid("scene", node)) {
rapidxml::xml_node<char> *snode = node->first_node("scene");
- if (NodeValid("bg", snode))
+ if (nodeValid("bg", snode))
bg.Load(snode->first_node("bg"));
- if (NodeValid("lights", snode)) {
+ if (nodeValid("lights", snode)) {
rapidxml::xml_node<char> *lnode = snode->first_node("lights");
for (rapidxml::xml_node<char> *n = lnode->first_node("img"); n != NULL; n = n->next_sibling("img"))
@@ -92,50 +92,50 @@ MainMenu::MainMenu() {
}
}
- if (NodeValid("difficulty", node)) {
+ if (nodeValid("difficulty", node)) {
rapidxml::xml_node<char> *dinode = node->first_node("difficulty");
- if (NodeValid("bg", dinode))
+ if (nodeValid("bg", dinode))
diff.bg.Load(dinode->first_node("bg"));
- if (NodeValid("menu", dinode))
+ if (nodeValid("menu", dinode))
diff.menu.Load(dinode->first_node("menu"));
- if (NodeValid("heading", dinode))
+ if (nodeValid("heading", dinode))
diff.heading.Load(dinode->first_node("heading"));
}
- if (NodeValid("prompt", node)) {
+ if (nodeValid("prompt", node)) {
rapidxml::xml_node<char> *prnode = node->first_node("prompt");
save.Load(prnode);
- if (NodeValid("warning", prnode))
+ if (nodeValid("warning", prnode))
warning.Load(prnode->first_node("warning"));
- if (NodeValid("bg", prnode))
+ if (nodeValid("bg", prnode))
bg_save.Load(prnode->first_node("bg"));
- if (NodeValid("accept", prnode))
+ if (nodeValid("accept", prnode))
accept.Load(prnode->first_node("accept"));
- if (NodeValid("cancel", prnode))
+ if (nodeValid("cancel", prnode))
cancel.Load(prnode->first_node("cancel"));
}
- if (NodeValid("music", node)) {
- LoadNum(music_key.normal, "normal", node->first_node("music"));
- LoadNum(music_key.credits, "credits", node->first_node("music"));
+ if (nodeValid("music", node)) {
+ loadNum(music_key.normal, "normal", node->first_node("music"));
+ loadNum(music_key.credits, "credits", node->first_node("music"));
}
#ifdef UNREST_DEMO
- if (NodeValid("demo", node)) {
+ if (nodeValid("demo", node)) {
rapidxml::xml_node<char> *denode = node->first_node("demo");
- if (NodeValid("steam", denode))
+ if (nodeValid("steam", denode))
steam.Load(denode->first_node("steam"));
- if (NodeValid("direct", denode))
+ if (nodeValid("direct", denode))
direct.Load(denode->first_node("direct"));
}
#endif
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 6d59311ffb7..6c73e1042b3 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -109,13 +109,13 @@ bool MusicManager::Load(rapidxml::xml_node<char> *node) {
// Initialize music parameters
int volume_mus = 100, volume_eff = 100;
- if (NodeValid("sound", node)) {
+ if (nodeValid("sound", node)) {
rapidxml::xml_node<char> *volnode = node->first_node("sound");
- LoadNum(volume_mus, "music", volnode);
- LoadNum(volume_eff, "effects", volnode);
- LoadNum(freq, "frequency", volnode);
- LoadNum(channels, "channels", volnode);
- LoadNum(chunksize, "chunk_size", volnode);
+ loadNum(volume_mus, "music", volnode);
+ loadNum(volume_eff, "effects", volnode);
+ loadNum(freq, "frequency", volnode);
+ loadNum(channels, "channels", volnode);
+ loadNum(chunksize, "chunk_size", volnode);
}
// Start up audio
@@ -138,10 +138,10 @@ bool MusicManager::Load(rapidxml::xml_node<char> *node) {
XMLDoc track_list(g_engine->_filePath->sound_effect);
if (track_list.ready()) {
rapidxml::xml_node<char> *tnode = track_list.doc()->first_node("effects");
- if (NodeValid(tnode)) {
- LoadNum(notify, "notify", tnode);
- LoadNum(rep_inc, "rep_inc", tnode);
- LoadNum(rep_dec, "rep_dec", tnode);
+ if (nodeValid(tnode)) {
+ loadNum(notify, "notify", tnode);
+ loadNum(rep_inc, "rep_inc", tnode);
+ loadNum(rep_dec, "rep_dec", tnode);
for (auto n = tnode->first_node(); n != NULL; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index 8a6337e96be..89340f9f4b0 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -68,8 +68,8 @@ struct MusicData {
void Load(rapidxml::xml_node<char> *node) {
#if 0
- LoadNum(id, "id", node);
- LoadNum(fade_in_duration, "fade_in", node);
+ loadNum(id, "id", node);
+ loadNum(fade_in_duration, "fade_in", node);
if (track != nullptr)
Mix_FreeMusic(track);
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index d6509b841d1..4e383e6e8cf 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -48,9 +48,9 @@ Opinion::Opinion() {
}
void Opinion::Load(rapidxml::xml_node<char> *node) {
- LoadNum(val[OPI_LIKE], "like", node);
- LoadNum(val[OPI_FEAR], "fear", node);
- LoadNum(val[OPI_RESPECT], "respect", node);
+ loadNum(val[OPI_LIKE], "like", node);
+ loadNum(val[OPI_FEAR], "fear", node);
+ loadNum(val[OPI_RESPECT], "respect", node);
}
void Opinion::Change(const OpinionType &type, const int &change) {
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 021815edeec..fd3e8f31c19 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -43,48 +43,48 @@ Person::Person() {
}
void Person::Load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem) {
- if (NodeValid(node)) {
- LoadStr(id, "id", node);
- LoadStr(name, "name", node);
- // LoadImgKey(pic, "img", node);
+ if (nodeValid(node)) {
+ loadStr(id, "id", node);
+ loadStr(name, "name", node);
+ // loadImgKey(pic, "img", node);
- if (NodeValid("opinion", node))
+ if (nodeValid("opinion", node))
opinion.Load(node->first_node("opinion"));
if (node->first_attribute("type") != NULL) {
Common::String t;
- LoadStr(t, "type", node);
+ loadStr(t, "type", node);
type = StringToPersonType(t);
} else
type = PE_NEUTRAL;
if (node->first_attribute("state") != NULL) {
Common::String s;
- LoadStr(s, "state", node);
+ loadStr(s, "state", node);
state = StringToPersonState(s);
} else
state = PST_NORMAL;
if (node->first_attribute("journal_name") != NULL) {
- LoadStr(journal_name, "journal_name", node);
+ loadStr(journal_name, "journal_name", node);
alt_journal_name = true;
} else
alt_journal_name = false;
- if (NodeValid("stats", node)) {
+ if (nodeValid("stats", node)) {
rapidxml::xml_node<char> *statnode = node->first_node("stats");
if (statnode->first_attribute("template") == NULL) {
stat.Load(statnode);
} else {
int index = 0;
- LoadNum(index, "template", statnode);
+ loadNum(index, "template", statnode);
if (index >= 0 && (unsigned int)index < stem.collection.size())
for (int i = 0; i < STAT_TOTAL; i++)
stat.val[i] = stem.collection[index].val[i];
}
}
- if (NodeValid("traits", node, false)) {
+ if (nodeValid("traits", node, false)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
for (auto n = traitnode->first_node("trait"); n != NULL; n = n->next_sibling("trait"))
trait.push_back(n);
@@ -130,17 +130,17 @@ void Person::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
}
void Person::LoadState(rapidxml::xml_node<char> *node) {
- LoadStr(id, "id", node);
- LoadStr(name, "name", node);
- LoadEnum(state, "state", node);
+ loadStr(id, "id", node);
+ loadStr(name, "name", node);
+ loadEnum(state, "state", node);
- if (NodeValid("opinion", node))
+ if (nodeValid("opinion", node))
opinion.Load(node->first_node("opinion"));
- if (NodeValid("stats", node))
+ if (nodeValid("stats", node))
stat.Load(node->first_node("stats"));
- if (NodeValid("traits", node, false)) {
+ if (nodeValid("traits", node, false)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
trait.clear();
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index c6fc86df8cb..0f5ca3462bc 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -38,13 +38,13 @@ using namespace pyrodactyl::people;
// Purpose: Load
//------------------------------------------------------------------------
void Trait::Load(rapidxml::xml_node<char> *node) {
- LoadStr(id_str, "id", node);
+ loadStr(id_str, "id", node);
id = StringToNumber<int>(id_str);
- LoadStr(name, "name", node);
- LoadStr(desc, "desc", node);
- LoadImgKey(img, "img", node);
- LoadBool(unread, "unread", node);
+ loadStr(name, "name", node);
+ loadStr(desc, "desc", node);
+ loadImgKey(img, "img", node);
+ loadBool(unread, "unread", node);
}
void Trait::Clear() {
@@ -66,7 +66,7 @@ void Trait::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *r
child->append_attribute(doc.allocate_attribute("desc", desc.c_str()));
child->append_attribute(doc.allocate_attribute("img", gStrPool->Get(img)));
- SaveBool(unread, "unread", doc, child);
+ saveBool(unread, "unread", doc, child);
root->append_node(child);
}
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index 4770b50df00..ccaae98a52c 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -70,10 +70,10 @@ const char *StatTypeToString(const StatType &val) {
using namespace pyrodactyl::stat;
void Stat::Load(rapidxml::xml_node<char> *node) {
- LoadNum(cur, "cur", node);
- LoadNum(def, "def", node);
- LoadNum(min, "min", node);
- LoadNum(max, "max", node);
+ loadNum(cur, "cur", node);
+ loadNum(def, "def", node);
+ loadNum(min, "min", node);
+ loadNum(max, "max", node);
}
void StatGroup::Load(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index db14f060a2a..3526dee4678 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -38,16 +38,16 @@ using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
void StatInfo::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- LoadBool(active, "active", node);
+ if (nodeValid(node)) {
+ loadBool(active, "active", node);
desc.Load(node->first_node("info"));
- LoadStr(text, "text", node->first_node("info"));
+ loadStr(text, "text", node->first_node("info"));
- if (NodeValid("value", node)) {
+ if (nodeValid("value", node)) {
rapidxml::xml_node<char> *valuenode = node->first_node("value");
dim.Load(valuenode);
- LoadImgKey(full, "full", valuenode);
- LoadImgKey(empty, "empty", valuenode);
+ loadImgKey(full, "full", valuenode);
+ loadImgKey(empty, "empty", valuenode);
}
}
}
@@ -66,7 +66,7 @@ void StatInfo::Draw(const int &val, const int &max) {
}
void StatDrawHelper::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
info[STAT_HEALTH].Load(node->first_node(STATNAME_HEALTH));
info[STAT_ATTACK].Load(node->first_node(STATNAME_ATTACK));
info[STAT_DEFENSE].Load(node->first_node(STATNAME_DEFENSE));
diff --git a/engines/crab/stat/bonus.h b/engines/crab/stat/bonus.h
index 4a0a35d332d..64d59eec7d5 100644
--- a/engines/crab/stat/bonus.h
+++ b/engines/crab/stat/bonus.h
@@ -44,8 +44,8 @@ struct Bonus {
int val;
void Load(rapidxml::xml_node<char> *node) {
- LoadStatType(type, node);
- LoadNum(val, "val", node);
+ loadStatType(type, node);
+ loadNum(val, "val", node);
}
};
} // End of namespace stat
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index c694be695e8..b9a8da085ae 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -48,11 +48,11 @@ void TextManager::Init() {
if (font_list.ready()) {
rapidxml::xml_node<char> *node = font_list.doc()->first_node("fonts");
- LoadNum(cache_size, "cache_size", node);
+ loadNum(cache_size, "cache_size", node);
cache.resize(cache_size);
oldest = 0;
- if (NodeValid(node->first_node("padding")))
+ if (nodeValid(node->first_node("padding")))
pad_bg.Load(node->first_node("padding"));
for (auto n = node->first_node("font"); n != NULL; n = n->next_sibling("font")) {
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 63e74c5f3b3..6b45435ded6 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -42,8 +42,8 @@ namespace Crab {
// We use this object as the key for all fonts
typedef unsigned int FontKey;
-// Since we use unsigned int as a key for images, our LoadImgKey function is LoadNum
-#define LoadFontKey LoadNum
+// Since we use unsigned int as a key for images, our loadImgKey function is loadNum
+#define LoadFontKey loadNum
namespace pyrodactyl {
namespace text {
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index b53b9898516..cef75c37e7f 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -41,7 +41,7 @@ void ColorPool::Load(const Common::String &filename) {
rapidxml::xml_node<char> *node = col_list.doc()->first_node("colors");
for (rapidxml::xml_node<char> *n = node->first_node("color"); n != NULL; n = n->next_sibling("color")) {
SDL_Color c;
- LoadColor(c, n);
+ loadColor(c, n);
pool.push_back(c);
}
}
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index c3db78abc79..f322abc51cb 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -48,7 +48,7 @@ Timer::Timer() {
}
void Timer::Load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo) {
- target_valid = LoadNum(target_ticks, name, node, echo);
+ target_valid = loadNum(target_ticks, name, node, echo);
}
void Timer::Start() {
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 42c9685bfe5..de4536431e8 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -39,11 +39,11 @@ using namespace pyrodactyl::image;
void AlphaImage::Load(rapidxml::xml_node<char> *node, const bool &echo) {
pos.Load(node, echo);
- LoadImgKey(img, "img", node, echo);
+ loadImgKey(img, "img", node, echo);
- LoadNum(alpha.min, "min", node);
- LoadNum(alpha.max, "max", node);
- LoadNum(alpha.change, "inc", node);
+ loadNum(alpha.min, "min", node);
+ loadNum(alpha.max, "max", node);
+ loadNum(alpha.change, "inc", node);
alpha.cur = alpha.max; //alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
}
diff --git a/engines/crab/ui/Caption.cpp b/engines/crab/ui/Caption.cpp
index 42ac991bc55..92341fff3cc 100644
--- a/engines/crab/ui/Caption.cpp
+++ b/engines/crab/ui/Caption.cpp
@@ -44,8 +44,8 @@ void Caption::Init(const Caption &c, const int &XOffset, const int &YOffset) {
void Caption::Load(rapidxml::xml_node<char> *node, Rect *parent) {
if (TextData::Load(node, parent, false)) {
- LoadStr(text, "text", node);
- LoadNum(col_s, "color_s", node, false);
+ loadStr(text, "text", node);
+ loadNum(col_s, "color_s", node, false);
enabled = true;
}
}
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 1a2dc94dcad..84458cabae0 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -35,13 +35,13 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
void ChapterIntro::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("dialog", node))
+ if (nodeValid("dialog", node))
dialog.Load(node->first_node("dialog"));
- if (NodeValid("image", node))
+ if (nodeValid("image", node))
pos.Load(node->first_node("image"));
- if (NodeValid("trait", node))
+ if (nodeValid("trait", node))
traits.Load(node->first_node("trait"));
}
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index c49a7d17bfe..11e38f40e46 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::image;
void ClipButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
Button::Load(node, echo);
- if (NodeValid("clip", node, false))
+ if (nodeValid("clip", node, false))
clip.Load(node->first_node("clip"));
else {
clip.x = 0;
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index a1220bf399e..d28ee92401e 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -48,51 +48,51 @@ void CreditScreen::Load(const Common::String &filename) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("credits");
- if (NodeValid("bg", node))
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("h", node))
+ if (nodeValid("h", node))
heading.Load(node->first_node("h"));
- if (NodeValid("p", node))
+ if (nodeValid("p", node))
paragraph.Load(node->first_node("p"));
- if (NodeValid("logo", node))
+ if (nodeValid("logo", node))
logo.Load(node->first_node("logo"));
- if (NodeValid("website", node))
+ if (nodeValid("website", node))
website.Load(node->first_node("website"), false);
- if (NodeValid("twitter", node))
+ if (nodeValid("twitter", node))
twitter.Load(node->first_node("twitter"), false);
- if (NodeValid("twitter", node))
+ if (nodeValid("twitter", node))
back.Load(node->first_node("back"));
- if (NodeValid("fast", node)) {
+ if (nodeValid("fast", node)) {
rapidxml::xml_node<char> *fnode = node->first_node("fast");
fast.Load(fnode);
- LoadNum(speed.fast, "val", fnode);
+ loadNum(speed.fast, "val", fnode);
}
- if (NodeValid("slow", node)) {
+ if (nodeValid("slow", node)) {
rapidxml::xml_node<char> *snode = node->first_node("slow");
slow.Load(snode);
- LoadNum(speed.slow, "val", snode);
+ loadNum(speed.slow, "val", snode);
}
- if (NodeValid("reverse", node)) {
+ if (nodeValid("reverse", node)) {
rapidxml::xml_node<char> *rnode = node->first_node("reverse");
reverse.Load(rnode);
- LoadNum(speed.reverse, "val", rnode);
+ loadNum(speed.reverse, "val", rnode);
}
speed.cur = speed.slow;
- if (NodeValid("pause", node))
+ if (nodeValid("pause", node))
pause.Load(node->first_node("pause"));
- if (NodeValid("text", node)) {
+ if (nodeValid("text", node)) {
rapidxml::xml_node<char> *tnode = node->first_node("text");
for (rapidxml::xml_node<char> *n = tnode->first_node(); n != NULL; n = n->next_sibling()) {
CreditText t;
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 0bc26c9a063..0edab272145 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -78,10 +78,10 @@ class CreditScreen {
}
void Load(rapidxml::xml_node<char> *node) {
- LoadNum(inc, "inc", node);
- LoadNum(color, "color", node);
+ loadNum(inc, "inc", node);
+ loadNum(color, "color", node);
LoadFontKey(font, "font", node);
- LoadAlign(align, node);
+ loadAlign(align, node);
}
} heading, paragraph;
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index b03baeda0d6..b9ea9661709 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -38,26 +38,26 @@ void DebugConsole::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("debug");
- if (NodeValid(node)) {
- if (NodeValid("menu", node))
+ if (nodeValid(node)) {
+ if (nodeValid("menu", node))
menu.Load(node->first_node("menu"));
- if (NodeValid("variable", node)) {
+ if (nodeValid("variable", node)) {
rapidxml::xml_node<char> *varnode = node->first_node("variable");
- if (NodeValid("bg", varnode))
+ if (nodeValid("bg", varnode))
bg.Load(varnode->first_node("bg"));
- if (NodeValid("check", varnode))
+ if (nodeValid("check", varnode))
check.Load(varnode->first_node("check"));
- if (NodeValid("back", varnode))
+ if (nodeValid("back", varnode))
back.Load(varnode->first_node("back"));
- if (NodeValid("value", varnode))
+ if (nodeValid("value", varnode))
value.Load(varnode->first_node("value"));
- if (NodeValid("text", varnode))
+ if (nodeValid("text", varnode))
text_field.Load(varnode->first_node("text"));
}
}
diff --git a/engines/crab/ui/FileData.cpp b/engines/crab/ui/FileData.cpp
index 4b2e257915b..ee04c8133de 100644
--- a/engines/crab/ui/FileData.cpp
+++ b/engines/crab/ui/FileData.cpp
@@ -56,13 +56,13 @@ SaveFileData::SaveFileData(const Common::String &file) {
XMLDoc conf(data);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("save");
- if (NodeValid(node)) {
- LoadStr(diff, "diff", node);
- LoadStr(loc_id, "loc_id", node);
- LoadStr(loc_name, "loc_name", node);
- LoadStr(char_name, "char_name", node);
- LoadStr(time, "time", node);
- LoadStr(preview, "preview", node);
+ if (nodeValid(node)) {
+ loadStr(diff, "diff", node);
+ loadStr(loc_id, "loc_id", node);
+ loadStr(loc_name, "loc_name", node);
+ loadStr(char_name, "char_name", node);
+ loadStr(time, "time", node);
+ loadStr(preview, "preview", node);
blank = false;
}
}
@@ -76,12 +76,12 @@ ModFileData::ModFileData(const Common::String &file) {
XMLDoc conf(filepath.string());
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("config");
- if (NodeValid(node)) {
- LoadStr(author, "author", node);
- LoadStr(version, "version", node);
- LoadStr(info, "info", node);
- LoadStr(website, "website", node);
- LoadStr(preview, "preview", node);
+ if (nodeValid(node)) {
+ loadStr(author, "author", node);
+ loadStr(version, "version", node);
+ loadStr(info, "info", node);
+ loadStr(website, "website", node);
+ loadStr(preview, "preview", node);
}
}
}
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 72440531d91..5348b57f4ad 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -158,19 +158,19 @@ public:
}
void Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("bg", node))
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("menu", node))
+ if (nodeValid("menu", node))
menu.Load(node->first_node("menu"));
- if (NodeValid("preview", node)) {
+ if (nodeValid("preview", node)) {
auto prnode = node->first_node("preview");
img.pos.Load(prnode);
- LoadStr(img.no_preview_path, "path", prnode);
+ loadStr(img.no_preview_path, "path", prnode);
}
- if (NodeValid("offset", node)) {
+ if (nodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
// Stuff displayed on the slot button
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index 0982d562731..a7e0d354473 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -37,17 +37,17 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
void GameOverMenu::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- if (NodeValid("bg", node))
+ if (nodeValid(node)) {
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("title", node)) {
+ if (nodeValid("title", node)) {
rapidxml::xml_node<char> *tinode = node->first_node("title");
title.Load(tinode);
for (auto n = tinode->first_node("quote"); n != NULL; n = n->next_sibling("quote")) {
Common::String str;
- LoadStr(str, "text", n);
+ loadStr(str, "text", n);
quote.push_back(str);
}
}
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 3f9b7f2f578..7c97337b6ba 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -41,26 +41,26 @@ using namespace pyrodactyl::music;
// Purpose: Load components from file
//------------------------------------------------------------------------
void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("volume", node)) {
+ if (nodeValid("volume", node)) {
rapidxml::xml_node<char> *musnode = node->first_node("volume");
- if (NodeValid("desc", musnode))
+ if (nodeValid("desc", musnode))
notice_volume.Load(musnode->first_node("desc"));
- // if (NodeValid("music", musnode))
+ // if (nodeValid("music", musnode))
// vol_music.Load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolMusic());
- // if (NodeValid("effects", musnode))
+ // if (nodeValid("effects", musnode))
// vol_effects.Load(musnode->first_node("effects"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolEffects());
}
- if (NodeValid("mouse_trap", node))
+ if (nodeValid("mouse_trap", node))
mouse_trap.Load(node->first_node("mouse_trap"));
- if (NodeValid("save_on_exit", node))
+ if (nodeValid("save_on_exit", node))
save_on_exit.Load(node->first_node("save_on_exit"));
- if (NodeValid("text_speed", node))
+ if (nodeValid("text_speed", node))
text_speed.Load(node->first_node("text_speed"));
// Sync popup text value with actual value
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 60ea00bcc26..5e51f0bdc07 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -39,27 +39,27 @@ using namespace pyrodactyl::ui;
// Purpose: Load components from file
//------------------------------------------------------------------------
void GfxSettingMenu::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("resolution", node))
+ if (nodeValid("resolution", node))
resolution.Load(node->first_node("resolution"));
- if (NodeValid("fullscreen", node))
+ if (nodeValid("fullscreen", node))
fullscreen.Load(node->first_node("fullscreen"));
- if (NodeValid("vsync", node))
+ if (nodeValid("vsync", node))
vsync.Load(node->first_node("vsync"));
- if (NodeValid("border", node))
+ if (nodeValid("border", node))
border.Load(node->first_node("border"));
- if (NodeValid("quality", node)) {
+ if (nodeValid("quality", node)) {
rapidxml::xml_node<char> *qnode = node->first_node("quality");
quality.Load(qnode);
- if (NodeValid("message", qnode))
+ if (nodeValid("message", qnode))
notice_quality.Load(qnode->first_node("message"), &quality);
}
- if (NodeValid("brightness", node))
+ if (nodeValid("brightness", node))
brightness.Load(node->first_node("brightness"), 0, 100, g_engine->_screenSettings->gamma * 100);
}
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 0398d8bf044..811c0c31020 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -36,14 +36,14 @@ namespace Crab {
using namespace pyrodactyl::ui;
void HealthIndicator::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- LoadXY(x, y, node);
+ if (nodeValid(node)) {
+ loadXY(x, y, node);
for (auto n = node->first_node("img"); n != NULL; n = n->next_sibling("img")) {
HealthImage hi;
- LoadImgKey(hi.normal, "normal", n);
- LoadImgKey(hi.glow, "glow", n);
- LoadNum(hi.val, "val", n);
+ loadImgKey(hi.normal, "normal", n);
+ loadImgKey(hi.glow, "glow", n);
+ loadNum(hi.val, "val", n);
img.push_back(hi);
}
diff --git a/engines/crab/ui/HoverInfo.cpp b/engines/crab/ui/HoverInfo.cpp
index 9b9ab6211b5..6c4e4ef3554 100644
--- a/engines/crab/ui/HoverInfo.cpp
+++ b/engines/crab/ui/HoverInfo.cpp
@@ -44,7 +44,7 @@ void HoverInfo::Init(const HoverInfo &hInfo, const int &XOffset, const int &YOff
void HoverInfo::Load(rapidxml::xml_node<char> *node, Rect *parent) {
if (TextData::Load(node, parent, false)) {
- LoadStr(text, "text", node);
+ loadStr(text, "text", node);
enabled = true;
}
}
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index c21797160c2..5f21a8e58ac 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -37,10 +37,10 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- LoadImgKey(key, "img", node, echo);
- LoadBool(crop, "crop", node, false);
+ loadImgKey(key, "img", node, echo);
+ loadBool(crop, "crop", node, false);
- if (NodeValid("clip", node, false))
+ if (nodeValid("clip", node, false))
clip.Load(node->first_node("clip"));
Element::Load(node, key, echo);
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index b189fcd8e9e..95596e330af 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -44,16 +44,16 @@ void Inventory::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("inventory");
- if (NodeValid(node)) {
- if (NodeValid("bg", node))
+ if (nodeValid(node)) {
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
collection.Load(node->first_node("items"));
- /*if (NodeValid("stats", node))
+ /*if (nodeValid("stats", node))
helper.Load(node->first_node("stats"));*/
- if (NodeValid("money", node))
+ if (nodeValid("money", node))
money.Load(node->first_node("money"));
}
}
@@ -121,7 +121,7 @@ void Inventory::HandleEvents(const Common::String &char_id, const SDL_Event &Eve
// Purpose: Load and save items
//------------------------------------------------------------------------
void Inventory::LoadState(rapidxml::xml_node<char> *node) {
- if (NodeValid("items", node))
+ if (nodeValid("items", node))
collection.LoadState(node->first_node("items"));
}
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index adba91a2ffd..303971892e7 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -51,10 +51,10 @@ public:
~ItemDesc() {}
void Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("name", node))
+ if (nodeValid("name", node))
name.Load(node->first_node("name"));
- if (NodeValid("desc", node))
+ if (nodeValid("desc", node))
desc.Load(node->first_node("desc"));
}
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index e90e07e6e7f..5c3a9559b8b 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -39,29 +39,29 @@ using namespace pyrodactyl::text;
using namespace pyrodactyl::input;
void KeyBindMenu::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- if (NodeValid("menu", node)) {
+ if (nodeValid(node)) {
+ if (nodeValid("menu", node)) {
rapidxml::xml_node<char> *menode = node->first_node("menu");
- if (NodeValid("primary", menode))
+ if (nodeValid("primary", menode))
prim.Load(menode->first_node("primary"));
- if (NodeValid("alt", menode))
+ if (nodeValid("alt", menode))
alt.Load(menode->first_node("alt"));
- if (NodeValid("prompt", menode))
+ if (nodeValid("prompt", menode))
prompt.Load(menode->first_node("prompt"));
- if (NodeValid("inc", menode))
+ if (nodeValid("inc", menode))
inc.Load(menode->first_node("inc"));
- if (NodeValid("dim", menode))
+ if (nodeValid("dim", menode))
dim.Load(menode->first_node("dim"));
- if (NodeValid("divide", menode))
+ if (nodeValid("divide", menode))
divide.Load(menode->first_node("divide"));
- if (NodeValid("desc", menode))
+ if (nodeValid("desc", menode))
desc.Load(menode->first_node("desc"));
}
@@ -69,7 +69,7 @@ void KeyBindMenu::Load(rapidxml::xml_node<char> *node) {
InitMenu(CON_GAME);
InitMenu(CON_UI);
- if (NodeValid("controls", node))
+ if (nodeValid("controls", node))
sel_controls.Load(node->first_node("controls"));
}
}
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 7d8e7f9112a..56ea87fe36d 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -83,9 +83,9 @@ class KeyBindMenu {
}
void Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- LoadStr(text, "text", node);
- LoadNum(col, "color", node);
+ if (nodeValid(node)) {
+ loadStr(text, "text", node);
+ loadNum(col, "color", node);
}
}
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index 3c2eab38302..15fd5d346a3 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -35,8 +35,8 @@ namespace Crab {
using namespace pyrodactyl::ui;
void MapData::Load(rapidxml::xml_node<char> *node) {
- LoadStr(path_bg, "bg", node);
- LoadStr(path_overlay, "overlay", node);
+ loadStr(path_bg, "bg", node);
+ loadStr(path_overlay, "overlay", node);
}
void MapData::DestAdd(const Common::String &name, const int &x, const int &y) {
@@ -66,7 +66,7 @@ void MapData::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
void MapData::LoadState(rapidxml::xml_node<char> *node) {
reveal.clear();
- if (NodeValid("clip", node)) {
+ if (nodeValid("clip", node)) {
rapidxml::xml_node<char> *clipnode = node->first_node("clip");
for (rapidxml::xml_node<char> *n = clipnode->first_node("rect"); n != NULL; n = n->next_sibling("rect")) {
Rect r;
@@ -76,11 +76,11 @@ void MapData::LoadState(rapidxml::xml_node<char> *node) {
}
dest.clear();
- if (NodeValid("dest", node)) {
+ if (nodeValid("dest", node)) {
rapidxml::xml_node<char> *destnode = node->first_node("dest");
for (rapidxml::xml_node<char> *n = destnode->first_node("pos"); n != NULL; n = n->next_sibling("pos")) {
MarkerData md;
- LoadStr(md.name, "name", n);
+ loadStr(md.name, "name", n);
md.pos.Load(n);
dest.push_back(md);
}
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 0a29d214eb2..0ce71f2a8a0 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -38,19 +38,19 @@ using namespace pyrodactyl::ui;
// Purpose: Load
//------------------------------------------------------------------------
void MapMarkerMenu::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("ref", node))
+ if (nodeValid("ref", node))
ref.Load(node->first_node("ref"));
- if (NodeValid("player", node))
+ if (nodeValid("player", node))
player.Load(node->first_node("player"));
- if (NodeValid("offset", node)) {
+ if (nodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
- if (NodeValid("marker", offnode))
+ if (nodeValid("marker", offnode))
offset.marker.Load(offnode->first_node("marker"));
- if (NodeValid("player", offnode))
+ if (nodeValid("player", offnode))
offset.player.Load(offnode->first_node("player"));
}
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 512a4d29997..ef7eb69a713 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -39,19 +39,19 @@ void ModMenu::Load(const Common::String &filename) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("mod_menu");
- if (NodeValid("bg", node))
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("menu", node))
+ if (nodeValid("menu", node))
menu.Load(node->first_node("menu"));
- if (NodeValid("preview", node)) {
+ if (nodeValid("preview", node)) {
auto prnode = node->first_node("preview");
img.pos.Load(prnode);
- LoadStr(img.no_preview_path, "path", prnode);
+ loadStr(img.no_preview_path, "path", prnode);
}
- if (NodeValid("offset", node)) {
+ if (nodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
// Stuff displayed on the slot button
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index be01e39526f..702f83467c0 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -41,54 +41,54 @@ void OptionMenu::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("option");
- if (NodeValid(node)) {
- if (NodeValid("bg", node))
+ if (nodeValid(node)) {
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("state", node)) {
+ if (nodeValid("state", node)) {
menu.Load(node->first_node("state"));
if (!menu.element.empty())
menu.element[0].State(true);
}
- if (NodeValid("keybind", node))
+ if (nodeValid("keybind", node))
keybind.Load(node->first_node("keybind"));
- if (NodeValid("controller", node))
+ if (nodeValid("controller", node))
conbind.Load(node->first_node("controller"));
- if (NodeValid("graphics", node))
+ if (nodeValid("graphics", node))
gfx.Load(node->first_node("graphics"));
- if (NodeValid("general", node))
+ if (nodeValid("general", node))
general.Load(node->first_node("general"));
- if (NodeValid("change", node)) {
+ if (nodeValid("change", node)) {
rapidxml::xml_node<char> *chanode = node->first_node("change");
- if (NodeValid("accept", chanode))
+ if (nodeValid("accept", chanode))
accept.Load(chanode->first_node("accept"));
- if (NodeValid("cancel", chanode))
+ if (nodeValid("cancel", chanode))
cancel.Load(chanode->first_node("cancel"));
- if (NodeValid("message", chanode))
+ if (nodeValid("message", chanode))
notice_res.Load(chanode->first_node("message"));
- if (NodeValid("width", chanode))
+ if (nodeValid("width", chanode))
prompt_w.Load(chanode->first_node("width"));
- if (NodeValid("height", chanode))
+ if (nodeValid("height", chanode))
prompt_h.Load(chanode->first_node("height"));
- if (NodeValid("countdown", chanode)) {
+ if (nodeValid("countdown", chanode)) {
rapidxml::xml_node<char> *counode = chanode->first_node("countdown");
countdown.Load(counode);
timer.Load(counode, "time");
}
- if (NodeValid("bg", chanode))
+ if (nodeValid("bg", chanode))
questionbox.Load(chanode->first_node("bg"));
}
}
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 990a38227b9..6e86299544d 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
void OptionSelect::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
option.data.Load(node);
prev.Load(node->first_node("prev"));
next.Load(node->first_node("next"));
@@ -46,11 +46,11 @@ void OptionSelect::Load(rapidxml::xml_node<char> *node) {
option.text.clear();
for (auto n = node->first_node("option"); n != NULL; n = n->next_sibling("option")) {
Common::String s;
- LoadStr(s, "name", n);
+ loadStr(s, "name", n);
option.text.push_back(s);
}
- LoadBool(usekeyboard, "keyboard", node, false);
+ loadBool(usekeyboard, "keyboard", node, false);
}
}
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 636af7afb0c..12a7f4405c2 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -141,30 +141,30 @@ public:
void Load(rapidxml::xml_node<char> *node) {
using namespace pyrodactyl::input;
- if (NodeValid(node)) {
- if (NodeValid("prev", node)) {
+ if (nodeValid(node)) {
+ if (nodeValid("prev", node)) {
prev.Load(node->first_node("prev"));
prev.hotkey.Set(IU_PREV);
}
- if (NodeValid("next", node)) {
+ if (nodeValid("next", node)) {
next.Load(node->first_node("next"));
next.hotkey.Set(IU_NEXT);
}
- if (NodeValid("reference", node))
+ if (nodeValid("reference", node))
ref.Load(node->first_node("reference"));
- if (NodeValid("inc", node))
+ if (nodeValid("inc", node))
inc.Load(node->first_node("inc"));
- if (NodeValid("status", node))
+ if (nodeValid("status", node))
status.Load(node->first_node("status"));
- if (NodeValid("dim", node)) {
+ if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
- LoadNum(rows, "rows", dimnode);
- LoadNum(cols, "cols", dimnode);
+ loadNum(rows, "rows", dimnode);
+ loadNum(cols, "cols", dimnode);
elements_per_page = rows * cols;
}
}
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index 4f1150c8a0f..217fe7958eb 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
- if (NodeValid("line", node))
+ if (nodeValid("line", node))
line.Load(node->first_node("line"));
return TextData::Load(node, parent, echo);
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 863518d79fb..ca067b3e6ba 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -39,7 +39,7 @@ void PauseMenu::Load(rapidxml::xml_node<char> *node) {
menu.Load(node->first_node("menu"));
save.Load(node->first_node("save"));
- if (NodeValid("bg", node))
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
}
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 40808afc8b8..57d61ac31ef 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -38,34 +38,34 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
void PersonHandler::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("dialog", node))
+ if (nodeValid("dialog", node))
dlbox.Load(node->first_node("dialog"));
- if (NodeValid("opinion", node)) {
+ if (nodeValid("opinion", node)) {
rapidxml::xml_node<char> *opnode = node->first_node("opinion");
- if (NodeValid("friendship", opnode))
+ if (nodeValid("friendship", opnode))
opinion[OPI_LIKE].Load(opnode->first_node("friendship"));
- if (NodeValid("respect", opnode))
+ if (nodeValid("respect", opnode))
opinion[OPI_RESPECT].Load(opnode->first_node("respect"));
- if (NodeValid("fear", opnode))
+ if (nodeValid("fear", opnode))
opinion[OPI_FEAR].Load(opnode->first_node("fear"));
}
- if (NodeValid("image", node)) {
+ if (nodeValid("image", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("image");
img.Load(imgnode);
- if (NodeValid("sprite_align", imgnode))
+ if (nodeValid("sprite_align", imgnode))
sprite_align.Load(imgnode->first_node("sprite_align"));
}
- if (NodeValid("name", node))
+ if (nodeValid("name", node))
name.Load(node->first_node("name"));
- if (NodeValid("journal", node))
+ if (nodeValid("journal", node))
jb.Load(node->first_node("journal"));
}
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index 9aed1e2e215..1261ad742a7 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -58,8 +58,8 @@ class PersonHandler {
}
void Load(rapidxml::xml_node<char> *node, const bool &echo = true) {
- LoadAlign(x, node, echo, "align_x");
- LoadAlign(y, node, echo, "align_y");
+ loadAlign(x, node, echo, "align_x");
+ loadAlign(y, node, echo, "align_y");
}
} sprite_align;
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index e12933ed8b5..e67dd84f977 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -41,17 +41,17 @@ void PersonScreen::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("character");
- if (NodeValid(node)) {
- if (NodeValid("bg", node))
+ if (nodeValid(node)) {
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("name", node))
+ if (nodeValid("name", node))
name.Load(node->first_node("name"));
- if (NodeValid("img", node))
+ if (nodeValid("img", node))
img.Load(node->first_node("img"));
- if (NodeValid("menu", node))
+ if (nodeValid("menu", node))
menu.Load(node->first_node("menu"));
}
}
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index 4b9f03459bc..130f8fa11ba 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -37,16 +37,16 @@ using namespace pyrodactyl::image;
void ProgressBar::Load(rapidxml::xml_node<char> *node) {
ClipButton::Load(node);
- LoadNum(notify_rate, "notify", node);
+ loadNum(notify_rate, "notify", node);
- if (NodeValid("effect", node)) {
+ if (nodeValid("effect", node)) {
rapidxml::xml_node<char> *effnode = node->first_node("effect");
- LoadImgKey(inc, "inc", effnode);
- LoadImgKey(dec, "dec", effnode);
+ loadImgKey(inc, "inc", effnode);
+ loadImgKey(dec, "dec", effnode);
offset.Load(effnode);
}
- if (NodeValid("desc", node)) {
+ if (nodeValid("desc", node)) {
rapidxml::xml_node<char> *descnode = node->first_node("desc");
for (rapidxml::xml_node<char> *n = descnode->first_node("above"); n != NULL; n = n->next_sibling("above"))
ct.push_back(n);
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index b8d077c0e31..c2dc6368557 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -77,10 +77,10 @@ class ProgressBar : public ClipButton {
CaptionText() { val = 0; }
CaptionText(rapidxml::xml_node<char> *node) {
- if (!LoadNum(val, "val", node))
+ if (!loadNum(val, "val", node))
val = 0;
- if (!LoadStr(text, "text", node))
+ if (!loadStr(text, "text", node))
text = "";
}
};
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index b8353a37951..61dfa34fa35 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -39,28 +39,28 @@ using namespace pyrodactyl::input;
void QuestText::Load(rapidxml::xml_node<char> *node) {
ParagraphData::Load(node);
- LoadNum(col_s, "color_s", node);
+ loadNum(col_s, "color_s", node);
- if (NodeValid("line", node))
- LoadNum(lines_per_page, "page", node->first_node("line"));
+ if (nodeValid("line", node))
+ loadNum(lines_per_page, "page", node->first_node("line"));
- if (NodeValid("inc", node))
+ if (nodeValid("inc", node))
inc.Load(node->first_node("inc"));
- if (NodeValid("img", node))
+ if (nodeValid("img", node))
img.Load(node->first_node("img"));
- if (NodeValid("prev", node)) {
+ if (nodeValid("prev", node)) {
prev.Load(node->first_node("prev"));
prev.hotkey.Set(IU_PAGE_PREV);
}
- if (NodeValid("next", node)) {
+ if (nodeValid("next", node)) {
next.Load(node->first_node("next"));
next.hotkey.Set(IU_PAGE_NEXT);
}
- if (NodeValid("status", node))
+ if (nodeValid("status", node))
status.Load(node->first_node("status"));
}
diff --git a/engines/crab/ui/RadioButton.h b/engines/crab/ui/RadioButton.h
index d4507b670fc..17a2d70412a 100644
--- a/engines/crab/ui/RadioButton.h
+++ b/engines/crab/ui/RadioButton.h
@@ -47,7 +47,7 @@ public:
void Load(rapidxml::xml_node<char> *node) {
ToggleButton::Load(node);
- LoadNum(val, "val", node);
+ loadNum(val, "val", node);
}
};
} // End of namespace ui
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index fbdd77315bd..fe5092aa75e 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -50,10 +50,10 @@ public:
~RadioButtonMenu() {}
void Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("desc", node))
+ if (nodeValid("desc", node))
desc.Load(node->first_node("desc"));
- if (NodeValid("menu", node))
+ if (nodeValid("menu", node))
Menu::Load(node->first_node("menu"));
}
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 31038542efb..8bf3cbacf4d 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -41,16 +41,16 @@ void ReplyButton::Load(rapidxml::xml_node<char> *node) {
Button::Load(node);
orig = *this;
- if (NodeValid("text", node)) {
+ if (nodeValid("text", node)) {
rapidxml::xml_node<char> *tenode = node->first_node("text");
- LoadColor(col_b, tenode->first_node("col_b"));
- LoadColor(col_s, tenode->first_node("col_s"));
- LoadColor(col_h, tenode->first_node("col_h"));
- LoadNum(font, "font", tenode);
- LoadAlign(align, tenode);
+ loadColor(col_b, tenode->first_node("col_b"));
+ loadColor(col_s, tenode->first_node("col_s"));
+ loadColor(col_h, tenode->first_node("col_h"));
+ loadNum(font, "font", tenode);
+ loadAlign(align, tenode);
- if (NodeValid("line_size", tenode))
+ if (nodeValid("line_size", tenode))
line_size.Load(tenode->first_node("line_size"));
}
}
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 9649f20c274..2bc7055ca90 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -44,17 +44,17 @@ void ReplyMenu::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("conversation");
- if (NodeValid(node)) {
- if (NodeValid("tone", node))
+ if (nodeValid(node)) {
+ if (nodeValid("tone", node))
tone.Load(node->first_node("tone"));
- if (NodeValid("reply", node)) {
+ if (nodeValid("reply", node)) {
rapidxml::xml_node<char> *replynode = node->first_node("reply");
Menu<ReplyButton>::Load(replynode->first_node("menu"));
tone.value.resize(element.size());
bg.Load(replynode->first_node("bg"));
- LoadNum(spacing, "spacing", replynode);
+ loadNum(spacing, "spacing", replynode);
}
}
}
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 1a0c60ee9e0..e31f3a1e33f 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -45,21 +45,21 @@ void ResolutionMenu::Load(rapidxml::xml_node<char> *node) {
info.Load(node->first_node("info"));
def_info = info.text;
- if (NodeValid("reference", node))
+ if (nodeValid("reference", node))
ref.Load(node->first_node("reference"));
- if (NodeValid("inc", node)) {
+ if (nodeValid("inc", node)) {
inc.Load(node->first_node("inc"));
- LoadNum(columns, "columns", node->first_node("inc"));
+ loadNum(columns, "columns", node->first_node("inc"));
}
- if (NodeValid("options", node)) {
+ if (nodeValid("options", node)) {
int count_slot = 0;
rapidxml::xml_node<char> *resnode = node->first_node("options");
for (auto n = resnode->first_node("res"); n != NULL; n = n->next_sibling("res"), count_slot++) {
Dimension d;
- LoadNum(d.w, "x", n);
- LoadNum(d.h, "y", n);
+ loadNum(d.w, "x", n);
+ loadNum(d.h, "y", n);
if (g_engine->_screenSettings->ValidDimension(d)) {
dim.push_back(d);
@@ -75,7 +75,7 @@ void ResolutionMenu::Load(rapidxml::xml_node<char> *node) {
SetInfo();
- LoadBool(use_keyboard, "keyboard", node, false);
+ loadBool(use_keyboard, "keyboard", node, false);
AssignPaths();
}
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index a74c64147ec..ec7b2ab43f2 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -36,7 +36,7 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::input;
void GameSaveMenu::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("name", node))
+ if (nodeValid("name", node))
ta_name.Load(node->first_node("name"));
FileMenu<SaveFileData>::Load(node);
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index b94481eb81d..0e3240a4b34 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -40,14 +40,14 @@ using namespace pyrodactyl::image;
void SectionHeader::Load(rapidxml::xml_node<char> *node) {
if (TextData::Load(node, NULL, false)) {
- LoadStr(text, "text", node);
+ loadStr(text, "text", node);
text.insertChar(' ', 0);
text += " ";
- LoadImgKey(img, "img", node);
+ loadImgKey(img, "img", node);
- LoadBool(draw_l, "left", node);
- LoadBool(draw_r, "right", node);
+ loadBool(draw_l, "left", node);
+ loadBool(draw_r, "right", node);
Graphics::ManagedSurface *surf = g_engine->_textManager->RenderTextBlended(font, text, col);
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 2ff5f37408a..4b80f9e246c 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -36,19 +36,19 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
void SlideShow::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- if (NodeValid("pos", node))
+ if (nodeValid(node)) {
+ if (nodeValid("pos", node))
pos.Load(node->first_node("pos"));
- if (NodeValid("bg", node))
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("prev", node)) {
+ if (nodeValid("prev", node)) {
prev.Load(node->first_node("prev"));
prev.hotkey.Set(IU_PREV);
}
- if (NodeValid("next", node)) {
+ if (nodeValid("next", node)) {
next.Load(node->first_node("next"));
next.hotkey.Set(IU_NEXT);
}
@@ -56,13 +56,13 @@ void SlideShow::Load(rapidxml::xml_node<char> *node) {
path.clear();
for (auto n = node->first_node("slide"); n != NULL; n = n->next_sibling("slide")) {
Common::String p;
- LoadStr(p, "path", n);
+ loadStr(p, "path", n);
path.push_back(p);
}
index = 0;
- LoadBool(usekeyboard, "keyboard", node, false);
+ loadBool(usekeyboard, "keyboard", node, false);
}
}
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index f6d5f01f05c..11127550955 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -50,12 +50,12 @@ void StateButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
col_normal.col = caption.col;
col_normal.col_s = caption.col_s;
- if (NodeValid("select", node, false)) {
+ if (nodeValid("select", node, false)) {
rapidxml::xml_node<char> *selnode = node->first_node("select");
img_set.select.Load(selnode, echo);
- LoadNum(col_select.col, "color", selnode);
- LoadNum(col_select.col_s, "color_s", selnode);
+ loadNum(col_select.col, "color", selnode);
+ loadNum(col_select.col_s, "color_s", selnode);
} else {
img_set.select = img;
col_select.col = caption.col;
diff --git a/engines/crab/ui/StateButton.h b/engines/crab/ui/StateButton.h
index 6732b779939..493f9df33ed 100644
--- a/engines/crab/ui/StateButton.h
+++ b/engines/crab/ui/StateButton.h
@@ -43,10 +43,10 @@ struct StateButtonImage {
StateButtonImage() {}
StateButtonImage(rapidxml::xml_node<char> *node) {
- if (NodeValid("normal", node))
+ if (nodeValid("normal", node))
normal.Load(node->first_node("normal"));
- if (NodeValid("select", node, false))
+ if (nodeValid("select", node, false))
select.Load(node->first_node("select"));
else
select = normal;
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 54ffb175f9a..1c075436e47 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -38,10 +38,10 @@ using namespace pyrodactyl::image;
void ToggleButton::Load(rapidxml::xml_node<char> *node) {
Button::Load(node);
- LoadImgKey(on, "on", node);
- LoadImgKey(off, "off", node);
+ loadImgKey(on, "on", node);
+ loadImgKey(off, "off", node);
- if (NodeValid("offset", node))
+ if (nodeValid("offset", node))
offset.Load(node->first_node("offset"));
}
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index 2f3d30e9075..9465f19ae4c 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -45,7 +45,7 @@ void TraitButton::Init(const TraitButton &ref, const int &XOffset, const int &YO
void TraitButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
StateButton::Load(node, echo);
- if (NodeValid("offset", node))
+ if (nodeValid("offset", node))
offset.Load(node->first_node("offset"), echo);
}
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index a0ed9b51795..2cd2d08eb52 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -36,20 +36,20 @@ namespace Crab {
using namespace pyrodactyl::ui;
void TraitMenu::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("dim", node)) {
+ if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
- LoadNum(rows, "rows", dimnode);
- LoadNum(cols, "cols", dimnode);
+ loadNum(rows, "rows", dimnode);
+ loadNum(cols, "cols", dimnode);
size = rows * cols;
}
- if (NodeValid("ref", node))
+ if (nodeValid("ref", node))
ref.Load(node->first_node("ref"));
- if (NodeValid("inc", node))
+ if (nodeValid("inc", node))
inc.Load(node->first_node("inc"));
- if (NodeValid("desc", node))
+ if (nodeValid("desc", node))
desc.Load(node->first_node("desc"));
for (unsigned int i = 0; i < size; ++i) {
@@ -59,7 +59,7 @@ void TraitMenu::Load(rapidxml::xml_node<char> *node) {
}
bool usekey = false;
- LoadBool(usekey, "keyboard", node);
+ loadBool(usekey, "keyboard", node);
menu.UseKeyboard(usekey);
menu.AssignPaths();
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 2a56ba21754..c4a06c8b998 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -61,10 +61,10 @@ void Button::Load(rapidxml::xml_node<char> *node, const bool &echo) {
img.Load(node, echo);
Element::Load(node, img.normal, echo);
- LoadNum(se_click, "click", node, echo);
- LoadNum(se_hover, "hover", node, echo);
+ loadNum(se_click, "click", node, echo);
+ loadNum(se_hover, "hover", node, echo);
- if (NodeValid("hotkey", node, false))
+ if (nodeValid("hotkey", node, false))
hotkey.Load(node->first_node("hotkey"));
tooltip.Load(node->first_node("tooltip"), this);
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index c5c9b8dae90..f772e3b3ef8 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -65,10 +65,10 @@ struct ButtonImage {
}
void Load(rapidxml::xml_node<char> *node, const bool &echo = true) {
- if (NodeValid(node)) {
- LoadImgKey(normal, "img_b", node, echo);
- LoadImgKey(select, "img_s", node, echo);
- LoadImgKey(hover, "img_h", node, echo);
+ if (nodeValid(node)) {
+ loadImgKey(normal, "img_b", node, echo);
+ loadImgKey(select, "img_s", node, echo);
+ loadImgKey(hover, "img_h", node, echo);
}
}
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index fc40f1768e5..0fb9e5817bf 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -46,14 +46,14 @@ using namespace pyrodactyl::input;
// Purpose: Load stuff
//------------------------------------------------------------------------
void GameDialogBox::Load(rapidxml::xml_node<char> *node) {
- LoadImgKey(bg, "bg", node);
- LoadImgKey(bg_p, "bg_p", node);
+ loadImgKey(bg, "bg", node);
+ loadImgKey(bg_p, "bg_p", node);
pos.Load(node, bg);
- if (NodeValid("text", node))
+ if (nodeValid("text", node))
text.Load(node->first_node("text"), &pos);
- if (NodeValid("button", node))
+ if (nodeValid("button", node))
button.Load(node->first_node("button"));
}
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 171695221da..e9440b099b8 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -54,8 +54,8 @@ void Element::Init(const int &X, const int &Y, const Align &align_x, const Align
void Element::BasicLoad(rapidxml::xml_node<char> *node, const bool &echo) {
raw.Load(node, echo);
- LoadAlign(align.x, node, echo, "align_x");
- LoadAlign(align.y, node, echo, "align_y");
+ loadAlign(align.x, node, echo, "align_x");
+ loadAlign(align.y, node, echo, "align_y");
}
void Element::Load(rapidxml::xml_node<char> *node, ImageKey img, const bool &echo) {
@@ -64,20 +64,20 @@ void Element::Load(rapidxml::xml_node<char> *node, ImageKey img, const bool &ech
if (node->first_attribute("w") == NULL)
w = g_engine->_imageManager->GetTexture(img).W();
else
- LoadNum(w, "w", node);
+ loadNum(w, "w", node);
if (node->first_attribute("h") == NULL)
h = g_engine->_imageManager->GetTexture(img).H();
else
- LoadNum(h, "h", node);
+ loadNum(h, "h", node);
SetUI();
}
void Element::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
BasicLoad(node, echo);
- LoadNum(w, "w", node, false);
- LoadNum(h, "h", node, false);
+ loadNum(w, "w", node, false);
+ loadNum(h, "h", node, false);
SetUI(parent);
}
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index c48242e06ee..4de537a7544 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -36,7 +36,7 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
void EmotionIndicator::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid("text", node))
+ if (nodeValid("text", node))
text.Load(node->first_node("text"));
}
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 2f37d1efdb8..5e2e84f3657 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -44,11 +44,11 @@ void HUD::Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("hud");
- if (NodeValid(node)) {
- if (NodeValid("bg", node))
+ if (nodeValid(node)) {
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("tray", node))
+ if (nodeValid("tray", node))
menu.Load(node->first_node("tray"));
pause.Load(node->first_node("pause"));
@@ -56,16 +56,16 @@ void HUD::Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
back.Load(node->first_node("back"));
// health.Load(node->first_node("health"));
- if (NodeValid("notify", node)) {
+ if (nodeValid("notify", node)) {
rapidxml::xml_node<char> *notifynode = node->first_node("notify");
- LoadImgKey(g_engine->_imageManager->notify, "img", notifynode);
+ loadImgKey(g_engine->_imageManager->notify, "img", notifynode);
tn.Load(notifynode);
pdm.Load(notifynode);
- if (NodeValid("anim", notifynode)) {
+ if (nodeValid("anim", notifynode)) {
rapidxml::xml_node<char> *animnode = notifynode->first_node("anim");
- LoadImgKey(notify_anim, "img", animnode);
+ loadImgKey(notify_anim, "img", animnode);
clip.Load(animnode);
timer.Load(animnode, "delay");
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 11209d60068..a73376de201 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -43,17 +43,17 @@ void Journal::Load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("objectives");
- if (NodeValid(node)) {
- if (NodeValid("bg", node))
+ if (nodeValid(node)) {
+ if (nodeValid("bg", node))
bg.Load(node->first_node("bg"));
- if (NodeValid("map", node))
+ if (nodeValid("map", node))
bu_map.Load(node->first_node("map"));
- if (NodeValid("category", node))
+ if (nodeValid("category", node))
category.Load(node->first_node("category"));
- if (NodeValid("quest_list", node))
+ if (nodeValid("quest_list", node))
ref.Load(node->first_node("quest_list"));
category.UseKeyboard(true);
@@ -278,7 +278,7 @@ void Journal::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
void Journal::LoadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *n = node->first_node("journal"); n != NULL; n = n->next_sibling("journal")) {
Common::String id;
- LoadStr(id, "id", n);
+ loadStr(id, "id", n);
Init(id);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 17f6a8b1bdd..32506aab2bf 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -44,39 +44,39 @@ void Map::Load(const Common::String &filename, pyrodactyl::event::Info &info) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("map");
- if (NodeValid(node)) {
- if (NodeValid("img", node)) {
+ if (nodeValid(node)) {
+ if (nodeValid("img", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("img");
- LoadNum(speed, "speed", imgnode);
+ loadNum(speed, "speed", imgnode);
for (auto n = imgnode->first_node("map"); n != NULL; n = n->next_sibling("map"))
map.push_back(n);
}
- if (NodeValid("fg", node))
+ if (nodeValid("fg", node))
fg.Load(node->first_node("fg"));
- if (NodeValid("dim", node)) {
- LoadNum(camera.w, "x", node->first_node("dim"));
- LoadNum(camera.h, "y", node->first_node("dim"));
+ if (nodeValid("dim", node)) {
+ loadNum(camera.w, "x", node->first_node("dim"));
+ loadNum(camera.h, "y", node->first_node("dim"));
}
- if (NodeValid("pos", node))
+ if (nodeValid("pos", node))
pos.Load(node->first_node("pos"));
- if (NodeValid("scroll", node))
+ if (nodeValid("scroll", node))
scroll.Load(node->first_node("scroll"));
- if (NodeValid("marker", node))
+ if (nodeValid("marker", node))
marker.Load(node->first_node("marker"));
- if (NodeValid("title", node))
+ if (nodeValid("title", node))
title.Load(node->first_node("title"));
- if (NodeValid("locations", node))
+ if (nodeValid("locations", node))
travel.Load(node->first_node("locations"));
- if (NodeValid("overlay", node))
+ if (nodeValid("overlay", node))
bu_overlay.Load(node->first_node("overlay"));
}
}
@@ -472,7 +472,7 @@ void Map::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *roo
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "map");
child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(cur)));
- SaveBool(overlay, "overlay", doc, child);
+ saveBool(overlay, "overlay", doc, child);
for (auto r = map.begin(); r != map.end(); ++r) {
rapidxml::xml_node<char> *child_data = doc.allocate_node(rapidxml::node_element, "data");
@@ -484,12 +484,12 @@ void Map::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *roo
}
void Map::LoadState(rapidxml::xml_node<char> *node) {
- if (NodeValid("map", node)) {
+ if (nodeValid("map", node)) {
rapidxml::xml_node<char> *mapnode = node->first_node("map");
- LoadBool(overlay, "overlay", mapnode);
+ loadBool(overlay, "overlay", mapnode);
int val = cur;
- LoadNum(val, "cur", mapnode);
+ loadNum(val, "cur", mapnode);
auto r = map.begin();
for (rapidxml::xml_node<char> *n = mapnode->first_node("data"); n != NULL && r != map.end(); n = n->next_sibling("data"), ++r)
diff --git a/engines/crab/ui/mapbutton.h b/engines/crab/ui/mapbutton.h
index fa28c3d301e..6cd2caa8ee3 100644
--- a/engines/crab/ui/mapbutton.h
+++ b/engines/crab/ui/mapbutton.h
@@ -53,8 +53,8 @@ public:
void Load(rapidxml::xml_node<char> *node) {
Button::Load(node);
- LoadStr(loc, "id", node);
- if (NodeValid("unlock", node, false))
+ loadStr(loc, "id", node);
+ if (nodeValid("unlock", node, false))
unlock.Load(node->first_node("unlock"));
}
};
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 1eb34f8cec6..02c5bf440dd 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -239,14 +239,14 @@ public:
// Purpose: Load the menu from a file
//------------------------------------------------------------------------
void Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
T b;
b.Load(n);
element.push_back(b);
}
- LoadBool(use_keyboard, "keyboard", node, false);
+ loadBool(use_keyboard, "keyboard", node, false);
AssignPaths();
}
}
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index f3e4de403fb..a9efdc7fdfb 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -51,31 +51,31 @@ QuestMenu::QuestMenu() {
// Purpose: Load layout from file
//------------------------------------------------------------------------
void QuestMenu::Load(rapidxml::xml_node<char> *node) {
- if (NodeValid(node)) {
- if (NodeValid("menu", node))
+ if (nodeValid(node)) {
+ if (nodeValid("menu", node))
menu.Load(node->first_node("menu"));
- if (NodeValid("tab", node)) {
+ if (nodeValid("tab", node)) {
rapidxml::xml_node<char> *tabnode = node->first_node("tab");
- LoadNum(font, "font", tabnode);
- LoadAlign(align, tabnode);
+ loadNum(font, "font", tabnode);
+ loadAlign(align, tabnode);
off_title.Load(tabnode);
off_unread.Load(tabnode->first_node("unread"));
- if (NodeValid("normal", tabnode)) {
+ if (nodeValid("normal", tabnode)) {
rapidxml::xml_node<char> *nornode = tabnode->first_node("normal");
img_n.Load(nornode);
- //LoadColor(col_n, nornode);
+ //loadColor(col_n, nornode);
}
- if (NodeValid("select", tabnode)) {
+ if (nodeValid("select", tabnode)) {
rapidxml::xml_node<char> *selnode = tabnode->first_node("select");
img_s.Load(selnode);
- //LoadColor(col_s, selnode);
+ //loadColor(col_s, selnode);
}
}
- if (NodeValid("text", node))
+ if (nodeValid("text", node))
text.Load(node->first_node("text"));
}
}
@@ -246,7 +246,7 @@ void QuestMenu::Select(const int &quest_index) {
void QuestMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- SaveBool(unread, "unread", doc, child);
+ saveBool(unread, "unread", doc, child);
for (auto q = quest.begin(); q != quest.end(); ++q)
q->SaveState(doc, child);
@@ -258,7 +258,7 @@ void QuestMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char
// Purpose: Load state from file
//------------------------------------------------------------------------
void QuestMenu::LoadState(rapidxml::xml_node<char> *node) {
- LoadBool(unread, "unread", node);
+ loadBool(unread, "unread", node);
quest.clear();
for (auto n = node->first_node("quest"); n != NULL; n = n->next_sibling("quest")) {
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index cdf424595c9..1a8f7dfe52d 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -38,7 +38,7 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
void Slider::Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val) {
- if (NodeValid(node)) {
+ if (nodeValid(node)) {
knob.Load(node->first_node("knob"), false);
bar.Load(node->first_node("bar"));
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 4bfd551c1d7..20f00840615 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -43,14 +43,14 @@ using namespace pyrodactyl::input;
void TextArea::Load(rapidxml::xml_node<char> *node) {
if (TextData::Load(node)) {
- LoadStr(text, "text", node);
- LoadNum(size, "size", node);
+ loadStr(text, "text", node);
+ loadNum(size, "size", node);
- LoadNum(se_entry, "entry", node);
- LoadNum(se_erase, "erase", node);
- LoadNum(se_accept, "accept", node);
+ loadNum(se_entry, "entry", node);
+ loadNum(se_erase, "erase", node);
+ loadNum(se_accept, "accept", node);
- if (NodeValid("caption", node))
+ if (nodeValid("caption", node))
title.Load(node->first_node("caption"), this);
}
}
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index 92099e24b88..c0751502817 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -37,12 +37,12 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
bool TextData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
- if (NodeValid(node, echo)) {
+ if (nodeValid(node, echo)) {
Element::Load(node, parent, echo);
LoadFontKey(font, "font", node);
- LoadNum(col, "color", node);
- LoadAlign(align, node, false);
- LoadBool(background, "background", node, false);
+ loadNum(col, "color", node);
+ loadAlign(align, node, false);
+ loadBool(background, "background", node, false);
return true;
}
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index cdcb1af80a3..39f21c83a72 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -52,7 +52,7 @@ public:
}
bool Load(rapidxml::xml_node<char> *node, const bool &echo = true) {
- return LoadNum(x, "x", node, echo) && LoadNum(y, "y", node, echo);
+ return loadNum(x, "x", node, echo) && loadNum(y, "y", node, echo);
}
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
@@ -110,7 +110,7 @@ public:
y = Y;
z = Z;
}
- bool Load(rapidxml::xml_node<char> *node) { return LoadXYZ<T>(x, y, z, node); }
+ bool Load(rapidxml::xml_node<char> *node) { return loadXYZ<T>(x, y, z, node); }
// operators
void operator+=(const Vector3D &v) {
Commit: 47076f5d3961bff69d41b79b8c3a0608d23e21e0
https://github.com/scummvm/scummvm/commit/47076f5d3961bff69d41b79b8c3a0608d23e21e0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make FightMove struct follow code formatting conventions
Changed paths:
engines/crab/animation/fightmove.cpp
engines/crab/animation/fightmove.h
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/fightmove.cpp b/engines/crab/animation/fightmove.cpp
index 66cc10de2f8..53a4dbe7ff5 100644
--- a/engines/crab/animation/fightmove.cpp
+++ b/engines/crab/animation/fightmove.cpp
@@ -34,23 +34,23 @@ namespace Crab {
using namespace pyrodactyl::anim;
-void FightMove::Load(rapidxml::xml_node<char> *node) {
- frames[DIRECTION_DOWN].load(node->first_node("down"));
- frames[DIRECTION_UP].load(node->first_node("up"));
- frames[DIRECTION_LEFT].load(node->first_node("left"));
- frames[DIRECTION_RIGHT].load(node->first_node("right"));
+void FightMove::load(rapidxml::xml_node<char> *node) {
+ _frames[DIRECTION_DOWN].load(node->first_node("down"));
+ _frames[DIRECTION_UP].load(node->first_node("up"));
+ _frames[DIRECTION_LEFT].load(node->first_node("left"));
+ _frames[DIRECTION_RIGHT].load(node->first_node("right"));
if (nodeValid("input", node))
- input.Load(node->first_node("input"));
+ _input.Load(node->first_node("input"));
if (nodeValid("unlock", node, false))
- unlock.Load(node->first_node("unlock"));
+ _unlock.Load(node->first_node("unlock"));
if (nodeValid("effect", node))
- eff.load(node->first_node("effect"));
+ _eff.load(node->first_node("effect"));
if (nodeValid("ai", node, false))
- ai.Load(node->first_node("ai"));
+ _ai.Load(node->first_node("ai"));
}
} // End of namespace Crab
diff --git a/engines/crab/animation/fightmove.h b/engines/crab/animation/fightmove.h
index 4e33b26d186..4a503cc33c3 100644
--- a/engines/crab/animation/fightmove.h
+++ b/engines/crab/animation/fightmove.h
@@ -41,24 +41,24 @@ namespace anim {
// All info for a single fighting move in all four directions
struct FightMove {
// Frames for all four directions
- FightAnimFrames frames[DIRECTION_TOTAL];
+ FightAnimFrames _frames[DIRECTION_TOTAL];
// The input required
- pyrodactyl::input::FightInput input;
+ pyrodactyl::input::FightInput _input;
// The conditions to unlock this move for player use
- pyrodactyl::event::TriggerSet unlock;
+ pyrodactyl::event::TriggerSet _unlock;
// The effects of this move - hurt animation, sound effect and so on
- FightMoveEffect eff;
+ FightMoveEffect _eff;
// The data needed by an AI sprite to execute this move
- FightMoveAIData ai;
+ FightMoveAIData _ai;
FightMove() {}
~FightMove() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 39d268cb2d7..f12818e8e86 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -55,7 +55,7 @@ FightMoves::FightMoves() {
void FightMoves::Load(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("move"); n != NULL; n = n->next_sibling("move")) {
FightMove fm;
- fm.Load(n);
+ fm.load(n);
move.push_back(fm);
}
}
@@ -88,8 +88,8 @@ bool FightMoves::CurFrame(FightAnimFrame &faf, const Direction &d) {
// Check validity of current move
if (cur >= 0 && (unsigned int)cur < move.size()) {
// Check validity of current frame
- if (frame_cur < frame_total && frame_cur < move[cur].frames[d]._frame.size()) {
- faf = move[cur].frames[d]._frame[frame_cur];
+ if (frame_cur < frame_total && frame_cur < move[cur]._frames[d]._frame.size()) {
+ faf = move[cur]._frames[d]._frame[frame_cur];
return true;
}
}
@@ -104,10 +104,10 @@ FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
// Check validity of current move
if (cur >= 0 && (unsigned int)cur < move.size()) {
// Check validity of current frame
- if (frame_cur < frame_total && frame_cur < move[cur].frames[d]._frame.size()) {
+ if (frame_cur < frame_total && frame_cur < move[cur]._frames[d]._frame.size()) {
// Has the current frame finished playing?
// OR Is this the first frame of the move?
- if (timer.Ticks() >= move[cur].frames[d]._frame[frame_cur]._repeat || start) {
+ if (timer.Ticks() >= move[cur]._frames[d]._frame[frame_cur]._repeat || start) {
frame_cur++;
timer.Start();
start = false;
@@ -127,12 +127,12 @@ FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
unsigned int FightMoves::FindMove(const pyrodactyl::input::FightAnimationType &type, const int &state) {
unsigned int pos = 0;
for (auto i = move.begin(); i != move.end(); ++i, ++pos)
- if (i->input.type == type && i->input.state == (unsigned int)state)
+ if (i->_input.type == type && i->_input.state == (unsigned int)state)
return pos;
pos = 0;
for (auto i = move.begin(); i != move.end(); ++i, ++pos)
- if (i->input.type == type && i->input.state == SPRITE_STATE_OVERRIDE)
+ if (i->_input.type == type && i->_input.state == SPRITE_STATE_OVERRIDE)
return pos;
return SPRITE_STATE_OVERRIDE;
@@ -145,7 +145,7 @@ void FightMoves::ListAttackMoves(Common::Array<unsigned int> &list) {
list.clear();
unsigned int pos = 0;
for (auto i = move.begin(); i != move.end(); ++i, ++pos)
- if (i->ai.type == MOVE_ATTACK)
+ if (i->_ai.type == MOVE_ATTACK)
list.push_back(pos);
}
@@ -157,17 +157,17 @@ bool FightMoves::ForceUpdate(const unsigned int &index, pyrodactyl::input::Fight
cur = index;
if ((unsigned int)cur < move.size()) {
- if (move[cur].unlock.Result()) {
- frame_total = move[cur].frames[d]._frame.size();
+ if (move[cur]._unlock.Result()) {
+ frame_total = move[cur]._frames[d]._frame.size();
if (frame_total > 0) {
- input = move[cur].input;
- input.state = move[cur].frames[d]._frame[0]._state;
+ input = move[cur]._input;
+ input.state = move[cur]._frames[d]._frame[0]._state;
} else
input.Reset();
timer.Start();
start = true;
- g_engine->_musicManager->PlayEffect(move[cur].eff._activate, 0);
+ g_engine->_musicManager->PlayEffect(move[cur]._eff._activate, 0);
return true;
}
}
@@ -182,7 +182,7 @@ bool FightMoves::ForceUpdate(const unsigned int &index, pyrodactyl::input::Fight
//------------------------------------------------------------------------
void FightMoves::Evaluate(pyrodactyl::event::Info &info) {
for (auto i = move.begin(); i != move.end(); ++i)
- i->unlock.Evaluate(info);
+ i->_unlock.Evaluate(info);
}
//------------------------------------------------------------------------
@@ -191,7 +191,7 @@ void FightMoves::Evaluate(pyrodactyl::event::Info &info) {
bool FightMoves::Flip(TextureFlipType &flip, Direction d) {
// Check validity of current move
if (ValidMove()) {
- flip = move[cur].frames[d]._flip;
+ flip = move[cur]._frames[d]._flip;
return true;
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index ae482c12b39..d00135ac34a 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -665,7 +665,7 @@ void Sprite::TakeDamage(Info &info, Sprite &s) {
FightMove f;
if (s.anim_set._fight.CurMove(f) && info.PersonValid(s.ID()) && info.PersonValid(id)) {
- int dmg = -1 * (f.eff._dmg + info.PersonGet(s.ID()).stat.val[STAT_ATTACK].cur - info.PersonGet(id).stat.val[STAT_DEFENSE].cur);
+ int dmg = -1 * (f._eff._dmg + info.PersonGet(s.ID()).stat.val[STAT_ATTACK].cur - info.PersonGet(id).stat.val[STAT_DEFENSE].cur);
if (dmg >= 0)
dmg = -1;
@@ -675,13 +675,13 @@ void Sprite::TakeDamage(Info &info, Sprite &s) {
info.StatGet(id, STAT_HEALTH, health);
// Play death animation if dead, hurt animation otherwise
- if (health <= 0 && f.eff._death != -1)
- ForceUpdateMove(f.eff._death);
- else if (f.eff._hurt != -1)
- ForceUpdateMove(f.eff._hurt);
+ if (health <= 0 && f._eff._death != -1)
+ ForceUpdateMove(f._eff._death);
+ else if (f._eff._hurt != -1)
+ ForceUpdateMove(f._eff._hurt);
- g_engine->_musicManager->PlayEffect(f.eff._hit, 0);
- img_eff = f.eff._img;
+ g_engine->_musicManager->PlayEffect(f._eff._hit, 0);
+ img_eff = f._eff._img;
}
Stop();
Commit: 4b10b353c98653038eb859ba49ec3cfee089aae4
https://github.com/scummvm/scummvm/commit/4b10b353c98653038eb859ba49ec3cfee089aae4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make FightMoves class follow code formatting conventions
Changed paths:
engines/crab/animation/animset.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fightmoves.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 6e02d0b864b..4aa21b0827f 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -39,7 +39,7 @@ void AnimSet::load(const Common::String &filename) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node();
if (nodeValid(node)) {
- _fight.Load(node);
+ _fight.load(node);
_walk.Load(node);
if (nodeValid("bounds", node))
@@ -56,22 +56,22 @@ void AnimSet::load(const Common::String &filename) {
TextureFlipType AnimSet::flip(const Direction &dir) {
TextureFlipType ret;
- if (_fight.Flip(ret, dir))
+ if (_fight.flip(ret, dir))
return ret;
return _walk.Flip(dir);
}
const ShadowOffset &AnimSet::shadow(const Direction &dir) {
- if (_fight.ValidMove())
- return _fight.Shadow(dir);
+ if (_fight.validMove())
+ return _fight.shadow(dir);
return _walk.Shadow(dir);
}
int AnimSet::anchorX(const Direction &dir) {
FightAnimFrame faf;
- if (_fight.CurFrame(faf, dir))
+ if (_fight.curFrame(faf, dir))
return faf._anchor.x;
return _walk.AnchorX(dir);
@@ -79,7 +79,7 @@ int AnimSet::anchorX(const Direction &dir) {
int AnimSet::anchorY(const Direction &dir) {
FightAnimFrame faf;
- if (_fight.CurFrame(faf, dir))
+ if (_fight.curFrame(faf, dir))
return faf._anchor.y;
return _walk.AnchorY(dir);
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index f12818e8e86..95c1ef3dd36 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -38,43 +38,43 @@ using namespace pyrodactyl::anim;
// Purpose: Constructor
//------------------------------------------------------------------------
FightMoves::FightMoves() {
- cur = -1;
- next = -1;
- start = false;
+ _cur = -1;
+ _next = -1;
+ _start = false;
- frame_cur = 0;
- frame_total = 0;
+ _frameCur = 0;
+ _frameTotal = 0;
- move.clear();
- timer.Start();
+ _move.clear();
+ _timer.Start();
}
//------------------------------------------------------------------------
// Purpose: Load from file
//------------------------------------------------------------------------
-void FightMoves::Load(rapidxml::xml_node<char> *node) {
+void FightMoves::load(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("move"); n != NULL; n = n->next_sibling("move")) {
FightMove fm;
fm.load(n);
- move.push_back(fm);
+ _move.push_back(fm);
}
}
//------------------------------------------------------------------------
// Purpose: Return current or next move
//------------------------------------------------------------------------
-bool FightMoves::CurMove(FightMove &fm) {
- if (cur >= 0 && (unsigned int)cur < move.size()) {
- fm = move[cur];
+bool FightMoves::curMove(FightMove &fm) {
+ if (_cur >= 0 && (unsigned int)_cur < _move.size()) {
+ fm = _move[_cur];
return true;
}
return false;
}
-bool FightMoves::NextMove(FightMove &fm) {
- if (next >= 0 && (unsigned int)next < move.size()) {
- fm = move[next];
+bool FightMoves::nextMove(FightMove &fm) {
+ if (_next >= 0 && (unsigned int)_next < _move.size()) {
+ fm = _move[_next];
return true;
}
@@ -84,12 +84,12 @@ bool FightMoves::NextMove(FightMove &fm) {
//------------------------------------------------------------------------
// Purpose: Get the current frame of the sprite
//------------------------------------------------------------------------
-bool FightMoves::CurFrame(FightAnimFrame &faf, const Direction &d) {
+bool FightMoves::curFrame(FightAnimFrame &faf, const Direction &d) {
// Check validity of current move
- if (cur >= 0 && (unsigned int)cur < move.size()) {
+ if (_cur >= 0 && (unsigned int)_cur < _move.size()) {
// Check validity of current frame
- if (frame_cur < frame_total && frame_cur < move[cur]._frames[d]._frame.size()) {
- faf = move[cur]._frames[d]._frame[frame_cur];
+ if (_frameCur < _frameTotal && _frameCur < _move[_cur]._frames[d]._frame.size()) {
+ faf = _move[_cur]._frames[d]._frame[_frameCur];
return true;
}
}
@@ -100,17 +100,17 @@ bool FightMoves::CurFrame(FightAnimFrame &faf, const Direction &d) {
//------------------------------------------------------------------------
// Purpose: Update frame
//------------------------------------------------------------------------
-FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
+FrameUpdateResult FightMoves::updateFrame(const Direction &d) {
// Check validity of current move
- if (cur >= 0 && (unsigned int)cur < move.size()) {
+ if (_cur >= 0 && (unsigned int)_cur < _move.size()) {
// Check validity of current frame
- if (frame_cur < frame_total && frame_cur < move[cur]._frames[d]._frame.size()) {
+ if (_frameCur < _frameTotal && _frameCur < _move[_cur]._frames[d]._frame.size()) {
// Has the current frame finished playing?
// OR Is this the first frame of the move?
- if (timer.Ticks() >= move[cur]._frames[d]._frame[frame_cur]._repeat || start) {
- frame_cur++;
- timer.Start();
- start = false;
+ if (_timer.Ticks() >= _move[_cur]._frames[d]._frame[_frameCur]._repeat || _start) {
+ _frameCur++;
+ _timer.Start();
+ _start = false;
return FUR_SUCCESS;
} else
@@ -124,14 +124,14 @@ FrameUpdateResult FightMoves::UpdateFrame(const Direction &d) {
//------------------------------------------------------------------------
// Purpose: Find a move corresponding to the input and sprite state
//------------------------------------------------------------------------
-unsigned int FightMoves::FindMove(const pyrodactyl::input::FightAnimationType &type, const int &state) {
+unsigned int FightMoves::findMove(const pyrodactyl::input::FightAnimationType &type, const int &state) {
unsigned int pos = 0;
- for (auto i = move.begin(); i != move.end(); ++i, ++pos)
+ for (auto i = _move.begin(); i != _move.end(); ++i, ++pos)
if (i->_input.type == type && i->_input.state == (unsigned int)state)
return pos;
pos = 0;
- for (auto i = move.begin(); i != move.end(); ++i, ++pos)
+ for (auto i = _move.begin(); i != _move.end(); ++i, ++pos)
if (i->_input.type == type && i->_input.state == SPRITE_STATE_OVERRIDE)
return pos;
@@ -141,10 +141,10 @@ unsigned int FightMoves::FindMove(const pyrodactyl::input::FightAnimationType &t
//------------------------------------------------------------------------
// Purpose: Function for AI
//------------------------------------------------------------------------
-void FightMoves::ListAttackMoves(Common::Array<unsigned int> &list) {
+void FightMoves::listAttackMoves(Common::Array<unsigned int> &list) {
list.clear();
unsigned int pos = 0;
- for (auto i = move.begin(); i != move.end(); ++i, ++pos)
+ for (auto i = _move.begin(); i != _move.end(); ++i, ++pos)
if (i->_ai.type == MOVE_ATTACK)
list.push_back(pos);
}
@@ -152,46 +152,46 @@ void FightMoves::ListAttackMoves(Common::Array<unsigned int> &list) {
//------------------------------------------------------------------------
// Purpose: Force update to a new move
//------------------------------------------------------------------------
-bool FightMoves::ForceUpdate(const unsigned int &index, pyrodactyl::input::FightInput &input, const Direction &d) {
- frame_cur = 0;
- cur = index;
+bool FightMoves::forceUpdate(const unsigned int &index, pyrodactyl::input::FightInput &input, const Direction &d) {
+ _frameCur = 0;
+ _cur = index;
- if ((unsigned int)cur < move.size()) {
- if (move[cur]._unlock.Result()) {
- frame_total = move[cur]._frames[d]._frame.size();
- if (frame_total > 0) {
- input = move[cur]._input;
- input.state = move[cur]._frames[d]._frame[0]._state;
+ if ((unsigned int)_cur < _move.size()) {
+ if (_move[_cur]._unlock.Result()) {
+ _frameTotal = _move[_cur]._frames[d]._frame.size();
+ if (_frameTotal > 0) {
+ input = _move[_cur]._input;
+ input.state = _move[_cur]._frames[d]._frame[0]._state;
} else
input.Reset();
- timer.Start();
- start = true;
- g_engine->_musicManager->PlayEffect(move[cur]._eff._activate, 0);
+ _timer.Start();
+ _start = true;
+ g_engine->_musicManager->PlayEffect(_move[_cur]._eff._activate, 0);
return true;
}
}
- cur = 0;
- frame_total = 0;
+ _cur = 0;
+ _frameTotal = 0;
return false;
}
//------------------------------------------------------------------------
// Purpose: Set unlock status
//------------------------------------------------------------------------
-void FightMoves::Evaluate(pyrodactyl::event::Info &info) {
- for (auto i = move.begin(); i != move.end(); ++i)
+void FightMoves::evaluate(pyrodactyl::event::Info &info) {
+ for (auto i = _move.begin(); i != _move.end(); ++i)
i->_unlock.Evaluate(info);
}
//------------------------------------------------------------------------
// Purpose: Find which style to flip the texture in
//------------------------------------------------------------------------
-bool FightMoves::Flip(TextureFlipType &flip, Direction d) {
+bool FightMoves::flip(TextureFlipType &flip, Direction d) {
// Check validity of current move
- if (ValidMove()) {
- flip = move[cur]._frames[d]._flip;
+ if (validMove()) {
+ flip = _move[_cur]._frames[d]._flip;
return true;
}
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index 03935ff0ce6..938fbbf26f2 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -40,66 +40,92 @@ namespace Crab {
namespace pyrodactyl {
namespace anim {
-enum FrameUpdateResult { FUR_FAIL,
- FUR_WAIT,
- FUR_SUCCESS };
+enum FrameUpdateResult {
+ FUR_FAIL,
+ FUR_WAIT,
+ FUR_SUCCESS
+};
// This state value indicates that the move should execute regardless of actual sprite state
const unsigned int SPRITE_STATE_OVERRIDE = std::numeric_limits<unsigned int>::max();
class FightMoves {
// The fighting moves of a sprite
- Common::Array<FightMove> move;
+ Common::Array<FightMove> _move;
// The currently selected move
- int cur;
+ int _cur;
// For AI - the move about to be executed
- int next;
+ int _next;
// The timer used for playing animations
- Timer timer;
+ Timer _timer;
// We need to instantly show the new frame for a move that has started
- bool start;
+ bool _start;
// The current frame and total frames
- unsigned int frame_cur, frame_total;
+ unsigned int _frameCur, _frameTotal;
public:
FightMoves();
+
~FightMoves() {}
- void Reset() { cur = -1; }
- void Load(rapidxml::xml_node<char> *node);
+ void reset() {
+ _cur = -1;
+ }
+
+ void load(rapidxml::xml_node<char> *node);
+
+ bool curMove(FightMove &fm);
+ bool nextMove(FightMove &fm);
+
+ FrameUpdateResult updateFrame(const Direction &d);
+ bool curFrame(FightAnimFrame &faf, const Direction &d);
+
+ unsigned int findMove(const pyrodactyl::input::FightAnimationType &type, const int &state);
+
+ void listAttackMoves(Common::Array<unsigned int> &list);
- bool CurMove(FightMove &fm);
- bool NextMove(FightMove &fm);
+ bool forceUpdate(const unsigned int &index, pyrodactyl::input::FightInput &input, const Direction &d);
- FrameUpdateResult UpdateFrame(const Direction &d);
- bool CurFrame(FightAnimFrame &faf, const Direction &d);
+ bool lastFrame() {
+ return _frameCur >= _frameTotal;
+ }
- unsigned int FindMove(const pyrodactyl::input::FightAnimationType &type, const int &state);
+ void frameIndex(unsigned int val) {
+ _frameCur = val;
+ }
- void ListAttackMoves(Common::Array<unsigned int> &list);
+ void curCombo(pyrodactyl::input::FightInput &input) {
+ input = _move[_cur]._input;
+ }
- bool ForceUpdate(const unsigned int &index, pyrodactyl::input::FightInput &input, const Direction &d);
+ bool validMove() {
+ return _cur >= 0 && (unsigned int)_cur < _move.size();
+ }
- bool LastFrame() { return frame_cur >= frame_total; }
- void FrameIndex(unsigned int val) { frame_cur = val; }
+ bool empty() {
+ return _move.empty();
+ }
- void CurCombo(pyrodactyl::input::FightInput &input) { input = move[cur].input; }
+ bool flip(TextureFlipType &flip, Direction d);
- bool ValidMove() { return cur >= 0 && (unsigned int)cur < move.size(); }
- bool Empty() { return move.empty(); }
+ const ShadowOffset &shadow(Direction d) {
+ return _move[_cur]._frames[d]._shadow;
+ }
- bool Flip(TextureFlipType &flip, Direction d);
- const ShadowOffset &Shadow(Direction d) { return move[cur].frames[d]._shadow; }
+ void next(int val) {
+ _next = val;
+ }
- void Next(int val) { next = val; }
- int Next() { return next; }
+ int next() {
+ return _next;
+ }
- void Evaluate(pyrodactyl::event::Info &info);
+ void evaluate(pyrodactyl::event::Info &info);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index d00135ac34a..4981563d830 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -83,7 +83,7 @@ void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
if (index < animations.size())
anim_set.load(animations[index]);
- anim_set._fight.ListAttackMoves(ai_data._fight._attack);
+ anim_set._fight.listAttackMoves(ai_data._fight._attack);
loadDirection(dir, node);
clip = anim_set._walk.Clip(dir);
@@ -271,12 +271,12 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
vul.Draw(-camera.x, -camera.y, 0, 0, 255);
FightMove fm;
- if (anim_set._fight.NextMove(fm)) {
+ if (anim_set._fight.nextMove(fm)) {
Rect actual_range;
- actual_range.x = bounds.x + fm.ai.range.val[dir].x;
- actual_range.y = bounds.y + fm.ai.range.val[dir].y;
- actual_range.w = fm.ai.range.val[dir].w;
- actual_range.h = fm.ai.range.val[dir].h;
+ actual_range.x = bounds.x + fm._ai.range.val[dir].x;
+ actual_range.y = bounds.y + fm._ai.range.val[dir].y;
+ actual_range.w = fm._ai.range.val[dir].w;
+ actual_range.h = fm._ai.range.val[dir].h;
actual_range.Draw(-camera.x, -camera.y, 255, 0, 255);
}
@@ -539,7 +539,7 @@ bool Sprite::FightCollide(Rect hitbox, Rect enemy_bounds, Range &range, const Sp
// Purpose: Update the frame info of the sprite
//------------------------------------------------------------------------
void Sprite::UpdateFrame(const pyrodactyl::people::PersonState &pst, const bool &repeat) {
- FrameUpdateResult res = anim_set._fight.UpdateFrame(dir);
+ FrameUpdateResult res = anim_set._fight.updateFrame(dir);
if (res == FUR_SUCCESS) {
AssignFrame();
} else if (res == FUR_FAIL) {
@@ -549,13 +549,13 @@ void Sprite::UpdateFrame(const pyrodactyl::people::PersonState &pst, const bool
if (repeat == false)
ResetFrame(pst);
else
- anim_set._fight.FrameIndex(0);
+ anim_set._fight.frameIndex(0);
}
}
void Sprite::AssignFrame() {
FightAnimFrame faf;
- if (anim_set._fight.CurFrame(faf, dir)) {
+ if (anim_set._fight.curFrame(faf, dir)) {
clip = faf._clip;
BoxV(faf._boxV);
BoxD(faf._boxD);
@@ -576,7 +576,7 @@ void Sprite::UpdateMove(const FightAnimationType &combo) {
ForceUpdateMove(combo);
else {
FightAnimFrame faf;
- if (anim_set._fight.CurFrame(faf, dir))
+ if (anim_set._fight.curFrame(faf, dir))
if (faf._branch)
ForceUpdateMove(combo);
}
@@ -584,7 +584,7 @@ void Sprite::UpdateMove(const FightAnimationType &combo) {
}
void Sprite::ForceUpdateMove(const FightAnimationType &combo) {
- unsigned int index = anim_set._fight.FindMove(combo, input.state);
+ unsigned int index = anim_set._fight.findMove(combo, input.state);
ForceUpdateMove(index);
}
@@ -597,9 +597,9 @@ void Sprite::UpdateMove(const unsigned int &index) {
}
void Sprite::ForceUpdateMove(const unsigned int &index) {
- if (anim_set._fight.ForceUpdate(index, input, dir)) {
+ if (anim_set._fight.forceUpdate(index, input, dir)) {
// This sets the sprite input to the current move input
- anim_set._fight.CurCombo(input);
+ anim_set._fight.curCombo(input);
Stop();
AssignFrame();
@@ -612,7 +612,7 @@ void Sprite::ForceUpdateMove(const unsigned int &index) {
void Sprite::ResetFrame(const pyrodactyl::people::PersonState &pst) {
input.Reset();
Walk(true);
- anim_set._fight.Reset();
+ anim_set._fight.reset();
box_d.w = 0;
box_d.h = 0;
@@ -636,7 +636,7 @@ bool Sprite::DamageValid(Sprite &s, const SpriteConstant &sc) {
//------------------------------------------------------------------------
void Sprite::CalcProperties(Info &info) {
visible.Evaluate(info);
- anim_set._fight.Evaluate(info);
+ anim_set._fight.evaluate(info);
}
//------------------------------------------------------------------------
@@ -664,7 +664,7 @@ void Sprite::TakeDamage(Info &info, Sprite &s) {
using namespace pyrodactyl::music;
FightMove f;
- if (s.anim_set._fight.CurMove(f) && info.PersonValid(s.ID()) && info.PersonValid(id)) {
+ if (s.anim_set._fight.curMove(f) && info.PersonValid(s.ID()) && info.PersonValid(id)) {
int dmg = -1 * (f._eff._dmg + info.PersonGet(s.ID()).stat.val[STAT_ATTACK].cur - info.PersonGet(id).stat.val[STAT_DEFENSE].cur);
if (dmg >= 0)
dmg = -1;
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 20f050ac75f..64aa40125d7 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -178,7 +178,7 @@ public:
double DistSq(const Sprite &s);
void EffectImg(bool vis) { img_eff.visible = vis; }
- bool LastFrame() { return anim_set._fight.LastFrame(); }
+ bool LastFrame() { return anim_set._fight.lastFrame(); }
bool TakingDamage(Sprite &sp, const pyrodactyl::ai::SpriteConstant &sc);
void TakeDamage(pyrodactyl::event::Info &info, Sprite &s);
Commit: 89d019d4714bb5686ed7841868ff12b27ef2297c
https://github.com/scummvm/scummvm/commit/89d019d4714bb5686ed7841868ff12b27ef2297c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make FightMoveAIData struct follow code formatting conventions
Changed paths:
engines/crab/animation/fightmove.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fm_ai_data.h
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/fightmove.cpp b/engines/crab/animation/fightmove.cpp
index 53a4dbe7ff5..98979335303 100644
--- a/engines/crab/animation/fightmove.cpp
+++ b/engines/crab/animation/fightmove.cpp
@@ -50,7 +50,7 @@ void FightMove::load(rapidxml::xml_node<char> *node) {
_eff.load(node->first_node("effect"));
if (nodeValid("ai", node, false))
- _ai.Load(node->first_node("ai"));
+ _ai.load(node->first_node("ai"));
}
} // End of namespace Crab
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 95c1ef3dd36..25fe664577d 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -145,7 +145,7 @@ void FightMoves::listAttackMoves(Common::Array<unsigned int> &list) {
list.clear();
unsigned int pos = 0;
for (auto i = _move.begin(); i != _move.end(); ++i, ++pos)
- if (i->_ai.type == MOVE_ATTACK)
+ if (i->_ai._type == MOVE_ATTACK)
list.push_back(pos);
}
diff --git a/engines/crab/animation/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
index d608526521d..783c10604b6 100644
--- a/engines/crab/animation/fm_ai_data.h
+++ b/engines/crab/animation/fm_ai_data.h
@@ -46,33 +46,33 @@ enum AIMoveType {
struct FightMoveAIData {
// Can this move be used by AI to attack
- AIMoveType type;
+ AIMoveType _type;
// The range of the move
- Range range;
+ Range _range;
// The AI delays executing the move by this long
- unsigned int delay;
+ unsigned int _delay;
FightMoveAIData() {
- type = MOVE_NONE;
- delay = 0;
+ _type = MOVE_NONE;
+ _delay = 0;
}
- void Load(rapidxml::xml_node<char> *node) {
- if (!loadNum(delay, "delay", node, false))
- delay = 0;
+ void load(rapidxml::xml_node<char> *node) {
+ if (!loadNum(_delay, "delay", node, false))
+ _delay = 0;
- range.Load(node->first_node("range"));
+ _range.Load(node->first_node("range"));
Common::String str;
loadStr(str, "type", node, false);
if (str == "attack")
- type = MOVE_ATTACK;
+ _type = MOVE_ATTACK;
else if (str == "defend")
- type = MOVE_DEFEND;
+ _type = MOVE_DEFEND;
else
- type = MOVE_NONE;
+ _type = MOVE_NONE;
}
};
} // End of namespace anim
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 4981563d830..9affba1be0c 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -273,10 +273,10 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
FightMove fm;
if (anim_set._fight.nextMove(fm)) {
Rect actual_range;
- actual_range.x = bounds.x + fm._ai.range.val[dir].x;
- actual_range.y = bounds.y + fm._ai.range.val[dir].y;
- actual_range.w = fm._ai.range.val[dir].w;
- actual_range.h = fm._ai.range.val[dir].h;
+ actual_range.x = bounds.x + fm._ai._range.val[dir].x;
+ actual_range.y = bounds.y + fm._ai._range.val[dir].y;
+ actual_range.w = fm._ai._range.val[dir].w;
+ actual_range.h = fm._ai._range.val[dir].h;
actual_range.Draw(-camera.x, -camera.y, 255, 0, 255);
}
Commit: 4f9038ca38c9b3bb397d614340af4f6a1f8e46f2
https://github.com/scummvm/scummvm/commit/4f9038ca38c9b3bb397d614340af4f6a1f8e46f2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make ImageEffect struct follow code formatting conventions
Changed paths:
engines/crab/animation/imageeffect.cpp
engines/crab/animation/imageeffect.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
diff --git a/engines/crab/animation/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
index 76fc4d872f5..59947dea43c 100644
--- a/engines/crab/animation/imageeffect.cpp
+++ b/engines/crab/animation/imageeffect.cpp
@@ -35,16 +35,16 @@ namespace Crab {
using namespace pyrodactyl::anim;
-void ImageEffect::Load(rapidxml::xml_node<char> *node) {
+void ImageEffect::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node, false)) {
- if (loadImgKey(img, "img", node) && loadXY(x, y, node))
- visible = true;
+ if (loadImgKey(_img, "img", node) && loadXY(x, y, node))
+ _visible = true;
}
}
-void ImageEffect::Draw(const int &XOffset, const int &YOffset) {
- if (visible)
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img);
+void ImageEffect::draw(const int &xOffset, const int &yOffset) {
+ if (_visible)
+ g_engine->_imageManager->Draw(x + xOffset, y + yOffset, _img);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/imageeffect.h b/engines/crab/animation/imageeffect.h
index ca9cb873f4e..8521903e560 100644
--- a/engines/crab/animation/imageeffect.h
+++ b/engines/crab/animation/imageeffect.h
@@ -39,16 +39,16 @@ namespace Crab {
namespace pyrodactyl {
namespace anim {
struct ImageEffect : public Vector2i {
- ImageKey img;
- bool visible;
+ ImageKey _img;
+ bool _visible;
ImageEffect() {
- visible = false;
- img = 0;
+ _visible = false;
+ _img = 0;
}
- void Load(rapidxml::xml_node<char> *node);
- void Draw(const int &XOffset, const int &YOffset);
+ void load(rapidxml::xml_node<char> *node);
+ void draw(const int &xOffset, const int &yOffset);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 9affba1be0c..2ebec657204 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -260,7 +260,7 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
}
g_engine->_imageManager->Draw(x, y, image, &clip, anim_set.flip(dir));
- img_eff.Draw(x, y);
+ img_eff.draw(x, y);
if (GameDebug) {
// Nice boxes for the frames and box_v, box_d
@@ -475,7 +475,7 @@ void Sprite::SetDestPathfinding(const Vector2i &dest, bool reachable) {
// Purpose: Walking animation
//------------------------------------------------------------------------
void Sprite::Walk(const pyrodactyl::people::PersonState &pst) {
- img_eff.visible = false;
+ img_eff._visible = false;
bool first_x = true;
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 64aa40125d7..14ffd381f91 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -177,7 +177,7 @@ public:
Vector2i CamFocus();
double DistSq(const Sprite &s);
- void EffectImg(bool vis) { img_eff.visible = vis; }
+ void EffectImg(bool vis) { img_eff._visible = vis; }
bool LastFrame() { return anim_set._fight.lastFrame(); }
bool TakingDamage(Sprite &sp, const pyrodactyl::ai::SpriteConstant &sc);
Commit: b6eecaa9d1e787350cdc7e77e78d14bff79b945d
https://github.com/scummvm/scummvm/commit/b6eecaa9d1e787350cdc7e77e78d14bff79b945d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename Load() to load() across CRAB codebase
Changed paths:
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/Shape.cpp
engines/crab/Shape.h
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/ai/SpriteConstant.cpp
engines/crab/ai/moveeffect.cpp
engines/crab/ai/movement.h
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/animframe.cpp
engines/crab/animation/animset.cpp
engines/crab/animation/fightanim.cpp
engines/crab/animation/fightmove.cpp
engines/crab/animation/fm_ai_data.h
engines/crab/animation/range.h
engines/crab/animation/shadow.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/animation/walkframes.cpp
engines/crab/animation/walkframes.h
engines/crab/app.cpp
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/changeval.h
engines/crab/event/conversationdata.cpp
engines/crab/event/conversationdata.h
engines/crab/event/effect.cpp
engines/crab/event/effect.h
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/gameevent.cpp
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/event/trigger.cpp
engines/crab/event/trigger.h
engines/crab/event/triggerset.cpp
engines/crab/event/triggerset.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/image/Image.cpp
engines/crab/image/Image.h
engines/crab/image/ImageManager.cpp
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
engines/crab/input/fightinput.cpp
engines/crab/input/fightinput.h
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/item/Item.cpp
engines/crab/item/Item.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/item/StatPreview.cpp
engines/crab/item/StatPreview.h
engines/crab/level/LevelExit.cpp
engines/crab/level/LevelExit.h
engines/crab/level/MusicArea.cpp
engines/crab/level/MusicArea.h
engines/crab/level/Stairs.cpp
engines/crab/level/Stairs.h
engines/crab/level/level.h
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/level/level_objects.cpp
engines/crab/level/level_objects.h
engines/crab/level/talknotify.cpp
engines/crab/level/talknotify.h
engines/crab/mainmenu.cpp
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
engines/crab/music/musicparam.h
engines/crab/people/opinion.cpp
engines/crab/people/opinion.h
engines/crab/people/person.cpp
engines/crab/people/person.h
engines/crab/people/trait.cpp
engines/crab/people/trait.h
engines/crab/splash.cpp
engines/crab/stat/Stat.cpp
engines/crab/stat/Stat.h
engines/crab/stat/StatDrawHelper.cpp
engines/crab/stat/StatDrawHelper.h
engines/crab/stat/StatTemplate.cpp
engines/crab/stat/StatTemplate.h
engines/crab/stat/bonus.h
engines/crab/text/TextManager.cpp
engines/crab/text/color.cpp
engines/crab/text/color.h
engines/crab/timer.cpp
engines/crab/timer.h
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/AlphaImage.h
engines/crab/ui/Caption.cpp
engines/crab/ui/Caption.h
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/ClipButton.cpp
engines/crab/ui/ClipButton.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/HealthIndicator.h
engines/crab/ui/HoverInfo.cpp
engines/crab/ui/HoverInfo.h
engines/crab/ui/ImageData.cpp
engines/crab/ui/ImageData.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/ItemDesc.h
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapData.cpp
engines/crab/ui/MapData.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/ParagraphData.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButton.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SectionHeader.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/StateButton.cpp
engines/crab/ui/StateButton.h
engines/crab/ui/TextData.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitButton.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/element.cpp
engines/crab/ui/element.h
engines/crab/ui/emotion.cpp
engines/crab/ui/emotion.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/mapbutton.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
engines/crab/ui/textdata.cpp
engines/crab/vectors.h
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index 9de914ca2bd..140c3ce948c 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -75,7 +75,7 @@ void FilePaths::LoadLevel(const Common::String &filename) {
for (rapidxml::xml_node<char> *n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
LevelPath l;
- l.Load(n);
+ l.load(n);
Common::String id;
loadStr(id, "id", n);
@@ -85,7 +85,7 @@ void FilePaths::LoadLevel(const Common::String &filename) {
}
}
-void FilePaths::Load(const Common::String &filename) {
+void FilePaths::load(const Common::String &filename) {
XMLDoc settings(filename);
if (settings.ready()) {
rapidxml::xml_node<char> *node = settings.doc()->first_node("paths");
@@ -151,7 +151,7 @@ void FilePaths::Load(const Common::String &filename) {
appdata = custom_path;
}
#endif
- warning("In FilePaths::Load(), customPath : %s", custom_path.c_str());
+ warning("In FilePaths::load(), customPath : %s", custom_path.c_str());
}
}
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 8145ce7774c..6895d141071 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -47,7 +47,7 @@ struct LevelPath {
LevelPath() : layout(""), asset(""), name("") {}
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
loadStr(name, "name", node);
loadStr(layout, "layout", node);
loadStr(asset, "res", node);
@@ -93,7 +93,7 @@ struct FilePaths {
bool loaded;
FilePaths();
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void LoadLevel(const Common::String &filename);
};
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 33e4049caac..9b00cdf392e 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -33,7 +33,7 @@
namespace Crab {
-void LoadingScreen::Load() {
+void LoadingScreen::load() {
const Common::String &filename = "res/layout/loading.xml";
XMLDoc doc(filename);
if (doc.ready()) {
@@ -46,7 +46,7 @@ void LoadingScreen::Load() {
}
if (nodeValid("text", node))
- text.Load(node->first_node("text"), "img");
+ text.load(node->first_node("text"), "img");
}
}
}
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 64d01a5fdc7..1ef6d274396 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -43,7 +43,7 @@ class LoadingScreen {
// The background image
pyrodactyl::image::Image bg;
- Screen(rapidxml::xml_node<char> *node) { bg.Load(node, "bg"); }
+ Screen(rapidxml::xml_node<char> *node) { bg.load(node, "bg"); }
void Delete() { bg.Delete(); }
void Draw() { bg.Draw((g_engine->_screenSettings->cur.w - bg.W()) / 2, (g_engine->_screenSettings->cur.h - bg.H()) / 2); }
};
@@ -65,7 +65,7 @@ public:
cur = g_engine->getRandomNumber(screen.size() - 1);
}
- void Load();
+ void load();
void Draw();
void Dim();
void Quit();
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index d8a8d604df0..349de03c7cd 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -58,9 +58,9 @@ void Polygon2D::AddPoint(const Vector2f &ref, const Common::String &x, const Com
point.push_back(p);
}
-void Polygon2D::Load(rapidxml::xml_node<char> *node, Rect &bounds) {
+void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
Vector2f ref;
- ref.Load(node);
+ ref.load(node);
// Converting a polygon to an axis aligned bounding box is easy - just record the minimum and maximum values of x and y
// for the vertices of the polygon, then minimum = top left corner, max - min = dimensions
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index 6a658952ef4..b2403031082 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -65,10 +65,10 @@ public:
Common::Array<Vector2f> edge;
Polygon2D() {}
- Polygon2D(rapidxml::xml_node<char> *node, Rect &bounds) { Load(node, bounds); }
+ Polygon2D(rapidxml::xml_node<char> *node, Rect &bounds) { load(node, bounds); }
// Returns the approximate axis aligned bounding box of the polygon
- void Load(rapidxml::xml_node<char> *node, Rect &bounds);
+ void load(rapidxml::xml_node<char> *node, Rect &bounds);
void SetEdge();
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index ad9cf7ea621..1e088fe5d28 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -32,7 +32,7 @@
namespace Crab {
-bool Rect::Load(rapidxml::xml_node<char> *node, const bool &echo, const Common::String &x_name, const Common::String &y_name,
+bool Rect::load(rapidxml::xml_node<char> *node, const bool &echo, const Common::String &x_name, const Common::String &y_name,
const Common::String &w_name, const Common::String &h_name) {
return loadNum(x, x_name, node, echo) && loadNum(y, y_name, node, echo) && loadNum(w, w_name, node, echo) && loadNum(h, h_name, node, echo);
}
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index 0535827f15d..fb452aa7a48 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -54,7 +54,7 @@ struct Rect {
h = H;
}
- bool Load(rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &x_name = "x",
+ bool load(rapidxml::xml_node<char> *node, const bool &echo = true, const Common::String &x_name = "x",
const Common::String &y_name = "y", const Common::String &w_name = "w", const Common::String &h_name = "h");
// Is this rectangle colliding with another rectangle?
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index bc200d8d1f2..11477683a76 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -39,7 +39,7 @@ Graphics::Surface *gRendererSurface = nullptr;
// Our global window object
//SDL_Window *gWindow = nullptr;
-void ScreenSettings::Load(rapidxml::xml_node<char> *node) {
+void ScreenSettings::load(rapidxml::xml_node<char> *node) {
loadNum(cur.w, "w", node);
loadNum(cur.h, "h", node);
loadNum(fps, "fps", node);
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index a3656d3cc43..cd604a03a03 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -147,7 +147,7 @@ public:
void SetGamma() { }//SDL_SetWindowBrightness(gWindow, gamma); }
void SetMouseTrap();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index f47d6bc46eb..94dc43f235b 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -32,12 +32,12 @@
namespace Crab {
-void Shape::Load(rapidxml::xml_node<char> *node, const bool &echo) {
+void Shape::load(rapidxml::xml_node<char> *node, const bool &echo) {
if (nodeValid("polygon", node, echo)) {
type = SHAPE_POLYGON;
- poly.Load(node, rect);
+ poly.load(node, rect);
} else {
- rect.Load(node, echo, "x", "y", "width", "height");
+ rect.load(node, echo, "x", "y", "width", "height");
if (nodeValid("ellipse", node, echo))
type = SHAPE_ELLIPSE;
else
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index 0ed692d937e..b6ce77d768a 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -72,7 +72,7 @@ public:
Shape() { type = SHAPE_RECT; }
~Shape() {}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
CollisionData Collide(Rect box);
bool Contains(const Vector2i &pos);
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 84198560ba6..aee124eb404 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -34,21 +34,21 @@ namespace Crab {
using namespace TMX;
-bool Layer::Load(rapidxml::xml_node<char> *node) {
+bool Layer::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node))
return loadStr(name, "name", node) && loadNum(w, "width", node) && loadNum(h, "height", node);
return false;
}
-bool MapLayer::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
- if (Layer::Load(node)) {
+bool MapLayer::load(const Common::String &path, rapidxml::xml_node<char> *node) {
+ if (Layer::load(node)) {
if (nodeValid("image", node, false)) {
type = LAYER_IMAGE;
rapidxml::xml_node<char> *imgnode = node->first_node("image");
if (imgnode->first_attribute("source") != NULL)
- img.Load((path + imgnode->first_attribute("source")->value()));
+ img.load((path + imgnode->first_attribute("source")->value()));
} else {
type = LAYER_NORMAL;
int i = 0;
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index 52c95070e24..9e4d5f0d804 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -74,7 +74,7 @@ public:
w = 0;
h = 0;
}
- bool Load(rapidxml::xml_node<char> *node);
+ bool load(rapidxml::xml_node<char> *node);
};
// Currently we just use one general purpose layer object instead of multiple inherited classes and stuff
@@ -105,7 +105,7 @@ public:
type = LAYER_NORMAL;
collide = false;
}
- bool Load(const Common::String &path, rapidxml::xml_node<char> *node);
+ bool load(const Common::String &path, rapidxml::xml_node<char> *node);
};
} // End of namespace TMX
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 1948f0b75f3..fb49fca3109 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -61,7 +61,7 @@ TMXMap::TMXMap() {
// Purpose: Load stuff via a .tmx file set to xml storage (no compression)
//------------------------------------------------------------------------
-void TMXMap::Load(const Common::String &path, Common::String filename) {
+void TMXMap::load(const Common::String &path, Common::String filename) {
XMLDoc conf((path + filename));
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("map");
@@ -99,7 +99,7 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
path_rows = (int)ceil((float)w / (float)path_size.x + .5f); // Adding .5 before casting in order to round up (SZ)
path_cols = (int)ceil((float)h / (float)path_size.y + .5f);
- g_engine->_imageManager->tileset.Load(path, node);
+ g_engine->_imageManager->tileset.load(path, node);
// Reset the layer at which sprites are drawn
sprite_layer = 0;
@@ -114,7 +114,7 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
if (name == "layer" || name == "imagelayer") // Is this a tile or an image layer
{
MapLayer l;
- l.Load(path, groupnode);
+ l.load(path, groupnode);
l.pos.x *= tile_size.x;
l.pos.y *= tile_size.y;
l.pos.w *= tile_size.x;
@@ -138,17 +138,17 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
} else if (group_name == "walk") {
auto n = groupnode->first_node("object");
if (n != NULL)
- area_walk.Load(n, true, "x", "y", "width", "height");
+ area_walk.load(n, true, "x", "y", "width", "height");
} else if (group_name == "no_walk") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
Shape s;
- s.Load(n);
+ s.load(n);
area_nowalk.push_back(s);
}
} else if (group_name == "trigger") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
Shape s;
- s.Load(n);
+ s.load(n);
unsigned int pos = area_trig.size();
loadNum(pos, "name", n);
@@ -161,13 +161,13 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
} else if (group_name == "stairs") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
pyrodactyl::level::Stairs s;
- s.Load(n);
+ s.load(n);
area_stairs.push_back(s);
}
} else if (group_name == "music") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
pyrodactyl::level::MusicArea ma;
- ma.Load(n);
+ ma.load(n);
area_music.push_back(ma);
}
} else if (group_name == "sprites")
@@ -190,7 +190,7 @@ void TMXMap::Load(const Common::String &path, Common::String filename) {
// for (auto n = node->first_node("object"); n != NULL; n = n->next_sibling("object"), ++pos)
// {
// Vector2i start;
-// start.Load(n);
+// start.load(n);
//
// rapidxml::xml_node<char> *linenode = n->first_node("polyline");
// if (linenode != NULL)
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 402797cac69..0988a899636 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -106,7 +106,7 @@ public:
~TMXMap() {}
void Reset();
- void Load(const Common::String &path, Common::String filename);
+ void load(const Common::String &path, Common::String filename);
void DrawDebug(const Rect &camera);
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index c4ec2f7d230..c74a1de36f1 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace TMX;
-void TileSet::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
+void TileSet::load(const Common::String &path, rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
loadNum(first_gid, "firstgid", node);
loadStr(name, "name", node);
@@ -52,7 +52,7 @@ void TileSet::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
loadStr(filename, "source", imgnode);
loc = path + filename;
- img.Load(loc);
+ img.load(loc);
total_rows = img.H() / tile_h;
total_cols = img.W() / tile_w;
warning("Total rows : %d Total cols: %d gid: %d", total_rows, total_cols, first_gid);
@@ -72,11 +72,11 @@ void TileSetGroup::Reset() {
tileset.clear();
}
-void TileSetGroup::Load(const Common::String &path, rapidxml::xml_node<char> *node) {
+void TileSetGroup::load(const Common::String &path, rapidxml::xml_node<char> *node) {
Reset();
for (auto n = node->first_node("tileset"); n != NULL; n = n->next_sibling("tileset")) {
TileSet t;
- t.Load(path, n);
+ t.load(path, n);
tileset.push_back(t);
}
}
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 1fbf59437ed..4d6871fb41c 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -73,10 +73,10 @@ struct TileSet {
TileSet() { Init(); }
TileSet(const Common::String &path, rapidxml::xml_node<char> *node) {
Init();
- Load(path, node);
+ load(path, node);
}
- void Load(const Common::String &path, rapidxml::xml_node<char> *node);
+ void load(const Common::String &path, rapidxml::xml_node<char> *node);
void Draw(const Vector2i &pos, const TileInfo &tile);
void PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf);
};
@@ -95,7 +95,7 @@ public:
void Reset();
- void Load(const Common::String &path, rapidxml::xml_node<char> *node);
+ void load(const Common::String &path, rapidxml::xml_node<char> *node);
void Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img);
void PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf);
void ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
diff --git a/engines/crab/ai/SpriteConstant.cpp b/engines/crab/ai/SpriteConstant.cpp
index 2e1d28a0999..45313cca4ea 100644
--- a/engines/crab/ai/SpriteConstant.cpp
+++ b/engines/crab/ai/SpriteConstant.cpp
@@ -41,10 +41,10 @@ FlyerConstant::FlyerConstant() : _start(10, 40), _vel(8.0f, 0.0f) {
void FlyerConstant::load(rapidxml::xml_node<char> *node) {
if (nodeValid("start", node))
- _start.Load(node->first_node("start"));
+ _start.load(node->first_node("start"));
if (nodeValid("vel", node))
- _vel.Load(node->first_node("vel"));
+ _vel.load(node->first_node("vel"));
if (nodeValid("delay", node)) {
auto n = node->first_node("delay");
@@ -63,7 +63,7 @@ void SpriteConstant::load(rapidxml::xml_node<char> *node) {
loadNum(_tweening, "tweening", node);
if (nodeValid("_walkVelMod", node))
- _walkVelMod.Load(node->first_node("_walkVelMod"));
+ _walkVelMod.load(node->first_node("_walkVelMod"));
if (nodeValid("fly", node))
_fly.load(node->first_node("fly"));
diff --git a/engines/crab/ai/moveeffect.cpp b/engines/crab/ai/moveeffect.cpp
index c2a9668da67..128ce24ef34 100644
--- a/engines/crab/ai/moveeffect.cpp
+++ b/engines/crab/ai/moveeffect.cpp
@@ -50,7 +50,7 @@ void FightMoveEffect::load(rapidxml::xml_node<char> *node) {
loadNum(_death, "death", node);
if (nodeValid("image", node, false))
- _img.Load(node->first_node("image"));
+ _img.load(node->first_node("image"));
if (nodeValid("sound", node)) {
rapidxml::xml_node<char> *soundnode = node->first_node("sound");
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index b5730d619a2..d838449468e 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -49,7 +49,7 @@ struct MovementSet {
uint32 _delay;
Movement(rapidxml::xml_node<char> *node) {
- _target.Load(node);
+ _target.load(node);
loadNum(_delay, "delay", node);
}
};
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index 481041c1f6c..30837b44182 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -37,14 +37,14 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::anim;
AnimationFrame::AnimationFrame(rapidxml::xml_node<char> *node) : _eff(node) {
- Vector2i::Load(node);
+ Vector2i::load(node);
loadImgKey(_img, "img", node);
loadNum(_start, "start", node);
loadNum(_finish, "finish", node);
//loadColor(col, node);
if (nodeValid("text", node, false))
- _text.Load(node->first_node("text"));
+ _text.load(node->first_node("text"));
reset();
}
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index d449245deaa..825adde1931 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -38,9 +38,9 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Load from xml
//------------------------------------------------------------------------
-void PopUp::Load(rapidxml::xml_node<char> *node) {
- duration.Load(node, "duration", false);
- delay.Load(node, "delay");
+void PopUp::load(rapidxml::xml_node<char> *node) {
+ duration.load(node, "duration", false);
+ delay.load(node, "delay");
loadStr(text, "text", node);
loadNum(next, "next", node);
@@ -49,17 +49,17 @@ void PopUp::Load(rapidxml::xml_node<char> *node) {
if (end)
next = -1;
- visible.Load(node);
+ visible.load(node);
effect.clear();
for (rapidxml::xml_node<char> *n = node->first_node("effect"); n != NULL; n = n->next_sibling("effect")) {
Effect e;
- e.Load(n);
+ e.load(n);
effect.push_back(e);
}
}
-void PopUpCollection::Load(rapidxml::xml_node<char> *node) {
+void PopUpCollection::load(rapidxml::xml_node<char> *node) {
loadBool(loop, "loop", node);
for (auto n = node->first_node("dialog"); n != NULL; n = n->next_sibling("dialog"))
element.push_back(n);
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index 46b7677eef9..e380c20cba5 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -72,7 +72,7 @@ struct PopUp {
next = -1;
Reset();
}
- PopUp(rapidxml::xml_node<char> *node) : PopUp() { Load(node); }
+ PopUp(rapidxml::xml_node<char> *node) : PopUp() { load(node); }
void Reset() {
show = false;
@@ -81,7 +81,7 @@ struct PopUp {
duration.Stop();
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
// return true if we should proceed to next event, false otherwise
@@ -113,7 +113,7 @@ struct PopUpCollection {
return false;
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index cad1594b06a..fa63e35bfa4 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::anim;
void AnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uint32 &rep, const int &AX, const int &AY) {
- _clip.Load(node);
+ _clip.load(node);
if (rep == 0)
loadNum(_repeat, "repeat", node);
@@ -44,7 +44,7 @@ void AnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uin
if (AX == 0.0f && AY == 0.0f) {
if (nodeValid("anchor", node, false))
- _anchor.Load(node->first_node("anchor"));
+ _anchor.load(node->first_node("anchor"));
} else {
_anchor.x = AX;
_anchor.y = AY;
@@ -52,7 +52,7 @@ void AnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, const uin
if (VBOX.w == 0 || VBOX.h == 0) {
if (nodeValid("box_v", node))
- _boxV.Load(node->first_node("box_v"));
+ _boxV.load(node->first_node("box_v"));
} else
_boxV = VBOX;
}
@@ -66,13 +66,13 @@ void AnimationFrames::load(rapidxml::xml_node<char> *node) {
loadBool(_random, "random", node, false);
if (nodeValid("anchor", node, false))
- _anchor.Load(node->first_node("anchor"));
+ _anchor.load(node->first_node("anchor"));
if (nodeValid("box_v", node))
- _boxV.Load(node->first_node("box_v"));
+ _boxV.load(node->first_node("box_v"));
if (nodeValid("shadow", node)) {
- _shadow.Load(node->first_node("shadow"));
+ _shadow.load(node->first_node("shadow"));
_shadow.valid = true;
}
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 4aa21b0827f..8b9b9242afe 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -40,16 +40,16 @@ void AnimSet::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node();
if (nodeValid(node)) {
_fight.load(node);
- _walk.Load(node);
+ _walk.load(node);
if (nodeValid("bounds", node))
- _bounds.Load(node->first_node("bounds"));
+ _bounds.load(node->first_node("bounds"));
if (nodeValid("shadow", node))
- _shadow.Load(node->first_node("shadow"));
+ _shadow.load(node->first_node("shadow"));
if (nodeValid("focus", node))
- _focus.Load(node->first_node("focus"));
+ _focus.load(node->first_node("focus"));
}
}
}
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index d3884357a0d..8b60e536ccc 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -41,10 +41,10 @@ void FightAnimFrame::load(rapidxml::xml_node<char> *node, const Rect &VBOX, cons
AnimFrame::load(node, VBOX, rep, AX, AY);
if (nodeValid("box_d", node, false))
- _boxD.Load(node->first_node("box_d"));
+ _boxD.load(node->first_node("box_d"));
if (nodeValid("shift", node, false))
- _delta.Load(node->first_node("shift"));
+ _delta.load(node->first_node("shift"));
if (!loadNum(_state, "state", node, false))
_state = 0;
@@ -62,13 +62,13 @@ void FightAnimFrames::load(rapidxml::xml_node<char> *node) {
_repeat = 0;
if (nodeValid("anchor", node, false))
- _anchor.Load(node->first_node("anchor"));
+ _anchor.load(node->first_node("anchor"));
if (nodeValid("box_v", node))
- _boxV.Load(node->first_node("box_v"));
+ _boxV.load(node->first_node("box_v"));
if (nodeValid("shadow", node)) {
- _shadow.Load(node->first_node("shadow"));
+ _shadow.load(node->first_node("shadow"));
_shadow.valid = true;
}
diff --git a/engines/crab/animation/fightmove.cpp b/engines/crab/animation/fightmove.cpp
index 98979335303..a9d1860e865 100644
--- a/engines/crab/animation/fightmove.cpp
+++ b/engines/crab/animation/fightmove.cpp
@@ -41,10 +41,10 @@ void FightMove::load(rapidxml::xml_node<char> *node) {
_frames[DIRECTION_RIGHT].load(node->first_node("right"));
if (nodeValid("input", node))
- _input.Load(node->first_node("input"));
+ _input.load(node->first_node("input"));
if (nodeValid("unlock", node, false))
- _unlock.Load(node->first_node("unlock"));
+ _unlock.load(node->first_node("unlock"));
if (nodeValid("effect", node))
_eff.load(node->first_node("effect"));
diff --git a/engines/crab/animation/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
index 783c10604b6..299408e74d0 100644
--- a/engines/crab/animation/fm_ai_data.h
+++ b/engines/crab/animation/fm_ai_data.h
@@ -63,7 +63,7 @@ struct FightMoveAIData {
if (!loadNum(_delay, "delay", node, false))
_delay = 0;
- _range.Load(node->first_node("range"));
+ _range.load(node->first_node("range"));
Common::String str;
loadStr(str, "type", node, false);
diff --git a/engines/crab/animation/range.h b/engines/crab/animation/range.h
index 263e1cfc4c8..ea3d9785fc0 100644
--- a/engines/crab/animation/range.h
+++ b/engines/crab/animation/range.h
@@ -44,12 +44,12 @@ struct Range {
Range() { valid = false; }
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
if (nodeValid(node, false)) {
- val[DIRECTION_DOWN].Load(node->first_node("down"));
- val[DIRECTION_UP].Load(node->first_node("up"));
- val[DIRECTION_LEFT].Load(node->first_node("left"));
- val[DIRECTION_RIGHT].Load(node->first_node("right"));
+ val[DIRECTION_DOWN].load(node->first_node("down"));
+ val[DIRECTION_UP].load(node->first_node("up"));
+ val[DIRECTION_LEFT].load(node->first_node("left"));
+ val[DIRECTION_RIGHT].load(node->first_node("right"));
valid = true;
} else
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index 2535a1e0820..58c770954b3 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -51,9 +51,9 @@ struct ShadowData {
ShadowData() : size(1, 1) { img = 0; }
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
loadImgKey(img, "img", node);
- offset.Load(node);
+ offset.load(node);
using namespace pyrodactyl::image;
Image dat;
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 2ebec657204..fca50eaf475 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -53,7 +53,7 @@ Sprite::Sprite() : img_size(1, 1), vel_mod(1.0f, 1.0f) {
//------------------------------------------------------------------------
// Purpose: Load sprite from XML and animations from the index of all animation files
//------------------------------------------------------------------------
-void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations) {
+void Sprite::load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations) {
using namespace pyrodactyl::image;
if (nodeValid(node)) {
@@ -90,13 +90,13 @@ void Sprite::Load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
box_v = anim_set._walk.BoxV(dir);
if (nodeValid("visible", node, false))
- visible.Load(node->first_node("visible"));
+ visible.load(node->first_node("visible"));
if (nodeValid("movement", node, false))
ai_data._walk.load(node->first_node("movement"));
if (nodeValid("popup", node, false))
- popup.Load(node->first_node("popup"));
+ popup.load(node->first_node("popup"));
}
}
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 14ffd381f91..bfa202ceca1 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -184,7 +184,7 @@ public:
void TakeDamage(pyrodactyl::event::Info &info, Sprite &s);
void ExchangeDamage(pyrodactyl::event::Info &info, Sprite &s, const pyrodactyl::ai::SpriteConstant &sc);
- void Load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations);
+ void load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations);
void InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
diff --git a/engines/crab/animation/walkframes.cpp b/engines/crab/animation/walkframes.cpp
index cf70869e886..a98b4180fbf 100644
--- a/engines/crab/animation/walkframes.cpp
+++ b/engines/crab/animation/walkframes.cpp
@@ -39,18 +39,18 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Loader Function
//------------------------------------------------------------------------
-void WalkFrames::Load(rapidxml::xml_node<char> *node) {
+void WalkFrames::load(rapidxml::xml_node<char> *node) {
if (nodeValid("stand", node))
- set[WT_STAND].Load(node->first_node("stand"));
+ set[WT_STAND].load(node->first_node("stand"));
if (nodeValid("walk", node))
- set[WT_WALK].Load(node->first_node("walk"));
+ set[WT_WALK].load(node->first_node("walk"));
if (nodeValid("fight", node))
- set[WT_FIGHT].Load(node->first_node("fight"));
+ set[WT_FIGHT].load(node->first_node("fight"));
if (nodeValid("ko", node))
- set[WT_KO].Load(node->first_node("ko"));
+ set[WT_KO].load(node->first_node("ko"));
}
//------------------------------------------------------------------------
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index 6840c253362..952c17c496d 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -51,7 +51,7 @@ class WalkFrames {
struct WalkFrameSet {
AnimationFrames frames[DIRECTION_TOTAL];
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
frames[DIRECTION_DOWN].load(node->first_node("down"));
frames[DIRECTION_UP].load(node->first_node("up"));
frames[DIRECTION_LEFT].load(node->first_node("left"));
@@ -78,7 +78,7 @@ public:
}
~WalkFrames() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
bool UpdateClip(Direction d, bool reset);
void ResetClip(Direction d);
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index e5ed60bf186..694fe57933b 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -55,7 +55,7 @@ bool App::Init() {
#endif
// Load paths for important files
- g_engine->_filePath->Load("res/paths.xml");
+ g_engine->_filePath->load("res/paths.xml");
// Initialize Steam
// SteamAPI_Init();
@@ -98,7 +98,7 @@ bool App::Init() {
return false;
// Set the window icon
- SDL_Surface *icon = IMG_Load(g_engine->_filePath->icon.c_str());
+ SDL_Surface *icon = IMG_load(g_engine->_filePath->icon.c_str());
SDL_SetWindowIcon(gWindow, icon);
SDL_FreeSurface(icon);
@@ -311,11 +311,11 @@ void App::LoadSettings(const Common::String &filename) {
// Load screen settings
if (nodeValid("screen", node))
- g_engine->_screenSettings->Load(node->first_node("screen"));
+ g_engine->_screenSettings->load(node->first_node("screen"));
// Start the sound subsystem
#if 0
- g_engine->_musicManager->Load(node);
+ g_engine->_musicManager->load(node);
#endif
}
}
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index e71ac7c6b78..30364a4c8b2 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -41,7 +41,7 @@ void EventSeqGroup::EndSeq(const unsigned int &id) {
}
void EventSeqGroup::AddSeq(const unsigned int &id, Common::String &path) {
- seq[id].Load(path);
+ seq[id].load(path);
}
bool EventSeqGroup::EventInProgress(const unsigned int &id) {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 6d2b7a9e676..b0af2465929 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -38,7 +38,7 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void EventSequence::Load(const Common::String &filename) {
+void EventSequence::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("events");
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index e1fde6ed00b..f85dfff3d10 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -74,7 +74,7 @@ public:
void EventInProgress(bool val) { event_in_progress = val; }
// Load and save
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
void LoadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index d2960c73a3b..7cd2380fe69 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -49,11 +49,11 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Load from xml
//------------------------------------------------------------------------
-void Info::Load(rapidxml::xml_node<char> *node) {
+void Info::load(rapidxml::xml_node<char> *node) {
if (nodeValid("people", node)) {
rapidxml::xml_node<char> *pnode = node->first_node("people");
- stem.Load(pnode->first_attribute("templates")->value());
+ stem.load(pnode->first_attribute("templates")->value());
XMLDoc conf(pnode->first_attribute("list")->value());
if (conf.ready()) {
@@ -69,11 +69,11 @@ void Info::Load(rapidxml::xml_node<char> *node) {
}
if (nodeValid("objective", node))
- journal.Load(node->first_node("objective")->first_attribute("layout")->value());
+ journal.load(node->first_node("objective")->first_attribute("layout")->value());
if (nodeValid("inventory", node)) {
rapidxml::xml_node<char> *inode = node->first_node("inventory");
- inv.Load(inode->first_attribute("layout")->value());
+ inv.load(inode->first_attribute("layout")->value());
}
CurLocID(node->first_node("level")->first_attribute("start")->value());
@@ -88,7 +88,7 @@ void Info::LoadPeople(const Common::String &filename) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
Common::String str;
loadStr(str, "id", n);
- people[str].Load(n, stem);
+ people[str].load(n, stem);
}
}
}
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 4d89d8b382e..919ee850141 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -122,7 +122,7 @@ public:
player_img = 0;
TalkKeyDown = false;
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
// Person related stuff
void Type(const Common::String &id, const pyrodactyl::people::PersonType &val);
diff --git a/engines/crab/event/changeval.h b/engines/crab/event/changeval.h
index 8ea59559b43..430cb4c5646 100644
--- a/engines/crab/event/changeval.h
+++ b/engines/crab/event/changeval.h
@@ -52,9 +52,9 @@ struct ChangeVal {
val[OPI_FEAR] = 0;
}
- ChangeVal(rapidxml::xml_node<char> *node) : ChangeVal() { Load(node); }
+ ChangeVal(rapidxml::xml_node<char> *node) : ChangeVal() { load(node); }
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
using namespace pyrodactyl::people;
loadStr(id, "id", node);
loadNum(val[OPI_LIKE], "like", node);
diff --git a/engines/crab/event/conversationdata.cpp b/engines/crab/event/conversationdata.cpp
index cafe9c47479..841c48c7339 100644
--- a/engines/crab/event/conversationdata.cpp
+++ b/engines/crab/event/conversationdata.cpp
@@ -34,20 +34,20 @@ namespace Crab {
using namespace pyrodactyl::event;
-void ReplyChoice::Load(rapidxml::xml_node<char> *node) {
+void ReplyChoice::load(rapidxml::xml_node<char> *node) {
loadStr(text, "text", node);
loadNum(tone, "tone", node);
loadNum(nextid, "next", node);
if (nodeValid("unlock", node, false))
- unlock.Load(node->first_node("unlock"));
+ unlock.load(node->first_node("unlock"));
if (nodeValid("change", node, false))
for (auto n = node->first_node("change"); n != NULL; n = n->next_sibling("change"))
change.push_back(n);
}
-void ConversationData::Load(rapidxml::xml_node<char> *node) {
+void ConversationData::load(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("reply"); n != NULL; n = n->next_sibling("reply"))
reply.push_back(n);
}
diff --git a/engines/crab/event/conversationdata.h b/engines/crab/event/conversationdata.h
index 4b7ee970ab7..ed8e21afbe0 100644
--- a/engines/crab/event/conversationdata.h
+++ b/engines/crab/event/conversationdata.h
@@ -60,9 +60,9 @@ struct ReplyChoice {
tone = 0;
nextid = 0;
}
- ReplyChoice(rapidxml::xml_node<char> *node) : ReplyChoice() { Load(node); }
+ ReplyChoice(rapidxml::xml_node<char> *node) : ReplyChoice() { load(node); }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
struct ConversationData {
@@ -71,7 +71,7 @@ struct ConversationData {
ConversationData() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 680a24411dd..d8fe53ef425 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -37,7 +37,7 @@ namespace Crab {
using namespace pyrodactyl::event;
using namespace pyrodactyl::music;
-void Effect::Load(rapidxml::xml_node<char> *node) {
+void Effect::load(rapidxml::xml_node<char> *node) {
Common::String ty;
loadStr(ty, "type", node);
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index e36663d6d82..02a991f470a 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -106,7 +106,7 @@ struct Effect {
Effect() { type = EFF_VAR; }
~Effect() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
bool Execute(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq);
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index def3393257a..501127115b2 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -37,13 +37,13 @@ using namespace pyrodactyl::event;
void GameEventStore::AddConv(rapidxml::xml_node<char> *node, unsigned int &index) {
ConversationData c;
if (nodeValid("talk", node))
- c.Load(node->first_node("talk"));
+ c.load(node->first_node("talk"));
index = con.size();
con.push_back(c);
}
-void GameEventStore::Load(const Common::String &filename) {
+void GameEventStore::load(const Common::String &filename) {
// Request current user stats from Steam
// m_pSteamUserStats = SteamUserStats();
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 6c811854c21..728f89bea2f 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -77,7 +77,7 @@ struct GameEventStore {
con.clear();
anim.clear();
}
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void AddConv(rapidxml::xml_node<char> *node, unsigned int &index);
void SetAchievement(const int &id);
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index b50a74171e6..3dd14ced84f 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -42,7 +42,7 @@ GameEvent::GameEvent() {
state = PST_NORMAL;
}
-void GameEvent::Load(rapidxml::xml_node<char> *node) {
+void GameEvent::load(rapidxml::xml_node<char> *node) {
if (!LoadEventID(id, "id", node))
id = 0;
@@ -73,7 +73,7 @@ void GameEvent::Load(rapidxml::xml_node<char> *node) {
special = 0;
}
- trig.Load(node);
+ trig.load(node);
next.clear();
for (rapidxml::xml_node<char> *i = node->first_node("next"); i != NULL; i = i->next_sibling("next"))
@@ -83,7 +83,7 @@ void GameEvent::Load(rapidxml::xml_node<char> *node) {
effect.clear();
for (rapidxml::xml_node<char> *it = node->first_node("effect"); it != NULL; it = it->next_sibling("effect")) {
Effect e;
- e.Load(it);
+ e.load(it);
effect.push_back(e);
}
}
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index ea782b1b132..30cb023af8c 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -85,10 +85,10 @@ struct GameEvent {
Common::Array<EventID> next;
GameEvent();
- GameEvent(rapidxml::xml_node<char> *node) : GameEvent() { Load(node); }
+ GameEvent(rapidxml::xml_node<char> *node) : GameEvent() { load(node); }
~GameEvent() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 12b666e30b7..5f8e891d2f5 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -50,7 +50,7 @@ void Manager::Init() {
//------------------------------------------------------------------------
// Purpose: Load this
//------------------------------------------------------------------------
-void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
+void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
if (nodeValid(node)) {
XMLDoc conf(node->first_attribute("list")->value());
if (conf.ready()) {
@@ -76,19 +76,19 @@ void Manager::Load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
rapidxml::xml_node<char> *layout = conf.doc()->first_node("layout");
if (nodeValid(layout)) {
if (nodeValid("character", layout))
- oh.Load(layout->first_node("character"));
+ oh.load(layout->first_node("character"));
if (nodeValid("popup", layout))
- popup.Load(layout->first_node("popup"));
+ popup.load(layout->first_node("popup"));
if (nodeValid("intro", layout))
- intro.Load(layout->first_node("intro"));
+ intro.load(layout->first_node("intro"));
}
}
- reply.Load(node->first_attribute("conversation")->value());
+ reply.load(node->first_attribute("conversation")->value());
- per.Load(node->first_attribute("char")->value());
+ per.load(node->first_attribute("char")->value());
}
}
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 37275eaaa71..1629de3040a 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -88,7 +88,7 @@ public:
~Manager() {}
void Init();
- void Load(rapidxml::xml_node<char> *node, pyrodactyl::ui::ParagraphData &popup);
+ void load(rapidxml::xml_node<char> *node, pyrodactyl::ui::ParagraphData &popup);
void Draw(Info &info, pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level);
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index cfc2f04e1e3..041bc07d9c7 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::event;
-void Trigger::Load(rapidxml::xml_node<char> *node) {
+void Trigger::load(rapidxml::xml_node<char> *node) {
Common::String ty;
loadStr(ty, "type", node);
diff --git a/engines/crab/event/trigger.h b/engines/crab/event/trigger.h
index f1e4344ddbe..192d862784b 100644
--- a/engines/crab/event/trigger.h
+++ b/engines/crab/event/trigger.h
@@ -67,9 +67,9 @@ struct Trigger {
rel = OP_AND;
negate = false;
}
- Trigger(rapidxml::xml_node<char> *node) { Load(node); }
+ Trigger(rapidxml::xml_node<char> *node) { load(node); }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
bool Evaluate(pyrodactyl::event::Info &info);
bool Evaluate(int lhs, int rhs);
diff --git a/engines/crab/event/triggerset.cpp b/engines/crab/event/triggerset.cpp
index 5bc20ed27bf..00decbb6a7b 100644
--- a/engines/crab/event/triggerset.cpp
+++ b/engines/crab/event/triggerset.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::event;
-void TriggerSet::Load(rapidxml::xml_node<char> *node) {
+void TriggerSet::load(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *n = node->first_node("trigger"); n != NULL; n = n->next_sibling("trigger")) {
Trigger t(n);
statement.push_back(t);
diff --git a/engines/crab/event/triggerset.h b/engines/crab/event/triggerset.h
index d38c86e0e92..e2efe87f99b 100644
--- a/engines/crab/event/triggerset.h
+++ b/engines/crab/event/triggerset.h
@@ -49,7 +49,7 @@ class TriggerSet {
public:
TriggerSet() { result = true; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
bool Evaluate(pyrodactyl::event::Info &info);
void Add(const Trigger &t);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 475f9983217..7af72ec7a0f 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -68,7 +68,7 @@ void Game::Init(const Common::String &filename) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("config");
- info.Load(node);
+ info.load(node);
Common::String path;
if (nodeValid("level", node)) {
@@ -78,7 +78,7 @@ void Game::Init(const Common::String &filename) {
if (nodeValid("hud", node)) {
loadStr(path, "layout", node->first_node("hud"));
- hud.Load(path, level.talk_notify, level.dest_marker);
+ hud.load(path, level.talk_notify, level.dest_marker);
}
if (nodeValid("sprite", node)) {
@@ -90,23 +90,23 @@ void Game::Init(const Common::String &filename) {
}
if (nodeValid("event", node)) {
- gem.Load(node->first_node("event"), pop_default);
+ gem.load(node->first_node("event"), pop_default);
loadStr(path, "store", node->first_node("event"));
- g_engine->_eventStore->Load(path);
+ g_engine->_eventStore->load(path);
}
if (nodeValid("map", node)) {
loadStr(path, "layout", node->first_node("map"));
- map.Load(path, info);
+ map.load(path, info);
}
if (nodeValid("save", node))
- savefile.Load(node->first_node("save"));
+ savefile.load(node->first_node("save"));
if (nodeValid("debug", node)) {
loadStr(path, "layout", node->first_node("debug"));
- debug_console.Load(path);
+ debug_console.load(path);
}
}
@@ -126,7 +126,7 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
// Load the level itself
level.pop = pop_default;
- level.Load(g_engine->_filePath->level[id].layout, info, game_over, player_x, player_y);
+ level.load(g_engine->_filePath->level[id].layout, info, game_over, player_x, player_y);
// Set the current location
info.CurLocID(id);
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 3d00d5f7aff..5e572cea8ad 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -92,7 +92,7 @@ private:
SaveFile() : auto_1("AutoSave 1"), auto_2("AutoSave 2"), auto_quit("AutoSave"), quick("Quick Save") { auto_slot = false; }
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
loadStr(auto_1, "auto_1", node);
loadStr(auto_2, "auto_2", node);
loadStr(auto_quit, "quit", node);
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 8eafb6bd5f2..bd464f15d95 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::image;
//------------------------------------------------------------------------
// Purpose: Load a texture
//------------------------------------------------------------------------
-bool Image::Load(Graphics::Surface *surface) {
+bool Image::load(Graphics::Surface *surface) {
Delete();
texture->create(surface->w, surface->h, surface->format);
@@ -49,7 +49,7 @@ bool Image::Load(Graphics::Surface *surface) {
return true;
}
-bool Image::Load(Graphics::ManagedSurface *surface) {
+bool Image::load(Graphics::ManagedSurface *surface) {
Delete();
texture = new Graphics::ManagedSurface(*surface);
w = surface->w;
@@ -57,7 +57,7 @@ bool Image::Load(Graphics::ManagedSurface *surface) {
return true;
}
-bool Image::Load(const Common::String &path) {
+bool Image::load(const Common::String &path) {
// Get rid of preexisting texture
Delete();
@@ -73,21 +73,21 @@ bool Image::Load(const Common::String &path) {
file.close();
- warning("Image::Load() Image Texture(%s): w: %d h: %d", path.c_str(), w, h);
+ warning("Image::load() Image Texture(%s): w: %d h: %d", path.c_str(), w, h);
}
return texture != nullptr;
}
-bool Image::Load(rapidxml::xml_node<char> *node, const char *name) {
+bool Image::load(rapidxml::xml_node<char> *node, const char *name) {
if (node->first_attribute(name) != NULL)
- return Load(node->first_attribute(name)->value());
+ return load(node->first_attribute(name)->value());
return false;
}
-bool Image::Load(const Image &image, Rect *clip, const TextureFlipType &flip) {
+bool Image::load(const Image &image, Rect *clip, const TextureFlipType &flip) {
Delete();
Common::Rect srcRect(0, 0, w, h);
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index cafa9abf437..9fb66ef1d02 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -95,11 +95,11 @@ public:
}
// Load the image
- bool Load(const Common::String &path);
- bool Load(rapidxml::xml_node<char> *node, const char *name);
- bool Load(Graphics::Surface *surface);
- bool Load(Graphics::ManagedSurface *surface);
- bool Load(const Image &image, Rect *clip, const TextureFlipType &flip);
+ bool load(const Common::String &path);
+ bool load(rapidxml::xml_node<char> *node, const char *name);
+ bool load(Graphics::Surface *surface);
+ bool load(Graphics::ManagedSurface *surface);
+ bool load(const Image &image, Rect *clip, const TextureFlipType &flip);
// Draw the openGL texture
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 951c5a7ec7a..bc1fb9fa84b 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -68,7 +68,7 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
valid = loadStr(path, "path", n, false);
if (valid)
- map[mapid][key].Load(path);
+ map[mapid][key].load(path);
else
error("ImageManager::LoadMap : Unable to load image id %u from %s!", key, path.c_str());
#if 0
@@ -80,7 +80,7 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
if (nodeValid("mouse", node, false)) {
using namespace pyrodactyl::input;
g_engine->_mouse->Quit();
- g_engine->_mouse->Load(node->first_node("mouse"));
+ g_engine->_mouse->load(node->first_node("mouse"));
}
}
}
@@ -107,7 +107,7 @@ void ImageManager::AddTexture(const ImageKey &id, Graphics::Surface *surface, in
if (map[mapindex].contains(id))
FreeTexture(id, mapindex);
- map[mapindex][id].Load(surface);
+ map[mapindex][id].load(surface);
#if 0
SDL_FreeSurface(surface);
#endif
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 32cdedf2982..bcea8204f8c 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -58,20 +58,20 @@ void Cursor::Reset() {
//------------------------------------------------------------------------
// Purpose: Reset all values
//------------------------------------------------------------------------
-void Cursor::Load(rapidxml::xml_node<char> *node) {
+void Cursor::load(rapidxml::xml_node<char> *node) {
if (nodeValid("normal", node)) {
rapidxml::xml_node<char> *nornode = node->first_node("normal");
- img.Load(nornode, "img");
- img_s.Load(nornode, "img_s");
+ img.load(nornode, "img");
+ img_s.load(nornode, "img_s");
}
if (nodeValid("hover", node)) {
rapidxml::xml_node<char> *hovnode = node->first_node("hover");
- img_hover.Load(hovnode, "img");
- img_hover_s.Load(hovnode, "img_s");
+ img_hover.load(hovnode, "img");
+ img_hover_s.load(hovnode, "img_s");
if (nodeValid("offset", hovnode))
- hover_offset.Load(hovnode->first_node("offset"));
+ hover_offset.load(hovnode->first_node("offset"));
}
}
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index 455d74e40b3..f5ae8ec3255 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -82,7 +82,7 @@ public:
void Reset();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void HandleEvents(const Common::Event &event);
void Draw();
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index 22b3f5abc15..76067fc1061 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::input;
-void FightInput::Load(rapidxml::xml_node<char> *node) {
+void FightInput::load(rapidxml::xml_node<char> *node) {
loadEnum(type, "type", node);
loadNum(state, "state", node);
}
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 89c2e96978e..52c8cd4d72e 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -73,7 +73,7 @@ struct FightInput {
bool operator==(const FightInput &input) { return type == input.type && state == input.state; }
bool Idle() { return type == FA_IDLE; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
FightAnimationType HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index 13ca5ce0784..43f590bb993 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::input;
-void HotKey::Load(rapidxml::xml_node<char> *node) {
+void HotKey::load(rapidxml::xml_node<char> *node) {
loadEnum(input, "input", node);
name = g_engine->_inputManager->GetAssociatedKey(input);
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 6ba066a3ace..4ffea822bce 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -63,7 +63,7 @@ public:
const char *Name();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
bool HandleEvents(const Common::Event &Event);
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 305e161d49d..94fcceff871 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -109,7 +109,7 @@ const int InputManager::Equals(const InputType &val, const SDL_Event &Event) {
void InputManager::Init() {
const Common::String DEFAULT_FILENAME = "res/controls.xml";
- Load(DEFAULT_FILENAME);
+ load(DEFAULT_FILENAME);
//g_engine->getEventManager()->getKeymapper()->cleanupGameKeymaps();
@@ -134,15 +134,15 @@ void InputManager::Init() {
if (!is_regular_file(filename)) {
// The other file does not exist, just use the default file
- Load(DEFAULT_FILENAME);
+ load(DEFAULT_FILENAME);
} else {
// We are using the other file, check if it is up to date or not
if (Version(DEFAULT_FILENAME) > Version(filename)) {
// The game has been updated to a different control scheme, use the default file
- Load(DEFAULT_FILENAME);
+ load(DEFAULT_FILENAME);
} else {
// The version set by the player is fine, just use that
- Load(filename);
+ load(filename);
}
}
@@ -153,7 +153,7 @@ void InputManager::Init() {
//------------------------------------------------------------------------
// Purpose: Load key & controller binding settings from file
//------------------------------------------------------------------------
-void InputManager::Load(const Common::String &filename) {
+void InputManager::load(const Common::String &filename) {
XMLDoc control_list(filename);
if (control_list.ready()) {
rapidxml::xml_node<char> *node = control_list.doc()->first_node("controls");
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index ff697a6b38d..b74c45aff45 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -98,7 +98,7 @@ class InputManager {
InputVal backup[IT_TOTAL];
// Load key configuration from file
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
// The current version of the input scheme
unsigned int version;
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 04bf0b3b1ce..517c1cc5ba1 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void Item::Load(rapidxml::xml_node<char> *node) {
+void Item::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
loadStr(id, "id", node);
loadStr(name, "name", node);
@@ -52,7 +52,7 @@ void Item::Load(rapidxml::xml_node<char> *node) {
bonus.clear();
for (auto n = node->first_node("bonus"); n != NULL; n = n->next_sibling("bonus")) {
Bonus b;
- b.Load(n);
+ b.load(n);
bonus.push_back(b);
}
}
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index ae90e529563..6fd47ec26af 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -62,7 +62,7 @@ struct Item {
void Clear();
void StatChange(pyrodactyl::people::Person &obj, bool increase);
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const int &x, const int &y);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 5b912d5b104..9e0291f4a6a 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -39,15 +39,15 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
// Purpose: Load the reference information
//------------------------------------------------------------------------
-void ItemCollection::Load(rapidxml::xml_node<char> *node) {
+void ItemCollection::load(rapidxml::xml_node<char> *node) {
if (nodeValid("info", node))
- item_info.Load(node->first_node("info"));
+ item_info.load(node->first_node("info"));
if (nodeValid("ref", node))
- ref.Load(node->first_node("ref"));
+ ref.load(node->first_node("ref"));
if (nodeValid("inc", node))
- inc.Load(node->first_node("inc"));
+ inc.load(node->first_node("inc"));
if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index f03b0532ce0..cdbcde702c3 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -69,7 +69,7 @@ public:
}
~ItemCollection() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void HandleEvents(const Common::String &char_id, const Common::Event &Event);
#if 0
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index e7d5ffa26c5..d015e8cfcbe 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -42,8 +42,8 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void ItemSlot::Load(rapidxml::xml_node<char> *node) {
- StateButton::Load(node);
+void ItemSlot::load(rapidxml::xml_node<char> *node) {
+ StateButton::load(node);
if (node->first_attribute("slot") == NULL)
no_type = true;
@@ -91,7 +91,7 @@ void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
// Purpose: Load state from file
//------------------------------------------------------------------------
void ItemSlot::LoadState(rapidxml::xml_node<char> *node) {
- item.Load(node);
+ item.load(node);
loadBool(unread, "unread", node);
if (item.id == "")
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index 9fef8507f34..faf86fa214b 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -76,7 +76,7 @@ public:
~ItemSlot() {}
void Init(const ItemSlot &ref, const int &XOffset = 0, const int &YOffset = 0);
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw();
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index a3d41dabe40..bbf9fb9d355 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -35,19 +35,19 @@ namespace Crab {
using namespace pyrodactyl::item;
-void StatPreview::Load(rapidxml::xml_node<char> *node) {
+void StatPreview::load(rapidxml::xml_node<char> *node) {
loadBool(enabled, "enabled", node);
if (nodeValid("stat", node)) {
rapidxml::xml_node<char> *snode = node->first_node("stat");
- stat.Load(snode);
+ stat.load(snode);
loadNum(inc_s.x, "w", snode);
loadNum(inc_s.y, "h", snode);
}
if (nodeValid("unit", node)) {
rapidxml::xml_node<char> *snode = node->first_node("unit");
- unit.Load(snode);
+ unit.load(snode);
loadNum(inc_u.x, "w", snode);
loadNum(inc_u.y, "h", snode);
}
diff --git a/engines/crab/item/StatPreview.h b/engines/crab/item/StatPreview.h
index a847a2e4a4e..79dd0996c55 100644
--- a/engines/crab/item/StatPreview.h
+++ b/engines/crab/item/StatPreview.h
@@ -50,7 +50,7 @@ struct StatPreview {
StatPreview() { enabled = false; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper);
};
} // End of namespace item
diff --git a/engines/crab/level/LevelExit.cpp b/engines/crab/level/LevelExit.cpp
index ce0f3606ffe..7e2d5f09a36 100644
--- a/engines/crab/level/LevelExit.cpp
+++ b/engines/crab/level/LevelExit.cpp
@@ -34,8 +34,8 @@ namespace Crab {
using namespace pyrodactyl::level;
-void Exit::Load(rapidxml::xml_node<char> *node) {
- dim.Load(node);
+void Exit::load(rapidxml::xml_node<char> *node) {
+ dim.load(node);
loadStr(name, "name", node);
if (nodeValid("properties", node)) {
diff --git a/engines/crab/level/LevelExit.h b/engines/crab/level/LevelExit.h
index 8f0803f0fd9..a9cfb256b15 100644
--- a/engines/crab/level/LevelExit.h
+++ b/engines/crab/level/LevelExit.h
@@ -46,9 +46,9 @@ struct Exit {
Vector2i entry;
Exit() : entry(-1, -1) {}
- Exit(rapidxml::xml_node<char> *node) { Load(node); }
+ Exit(rapidxml::xml_node<char> *node) { load(node); }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
} // End of namespace level
} // End of namespace pyrodactyl
diff --git a/engines/crab/level/MusicArea.cpp b/engines/crab/level/MusicArea.cpp
index a7e0431aa25..99d69846340 100644
--- a/engines/crab/level/MusicArea.cpp
+++ b/engines/crab/level/MusicArea.cpp
@@ -34,8 +34,8 @@ namespace Crab {
using namespace pyrodactyl::level;
-void MusicArea::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- Shape::Load(node, echo);
+void MusicArea::load(rapidxml::xml_node<char> *node, const bool &echo) {
+ Shape::load(node, echo);
if (nodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
diff --git a/engines/crab/level/MusicArea.h b/engines/crab/level/MusicArea.h
index d64f15cbe18..445bf959179 100644
--- a/engines/crab/level/MusicArea.h
+++ b/engines/crab/level/MusicArea.h
@@ -62,7 +62,7 @@ public:
MusicArea() {}
~MusicArea() {}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
};
} // End of namespace level
} // End of namespace pyrodactyl
diff --git a/engines/crab/level/Stairs.cpp b/engines/crab/level/Stairs.cpp
index ce808e00de9..1a924d16dbd 100644
--- a/engines/crab/level/Stairs.cpp
+++ b/engines/crab/level/Stairs.cpp
@@ -34,8 +34,8 @@ namespace Crab {
using namespace pyrodactyl::level;
-void Stairs::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- Shape::Load(node, echo);
+void Stairs::load(rapidxml::xml_node<char> *node, const bool &echo) {
+ Shape::load(node, echo);
if (nodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
diff --git a/engines/crab/level/Stairs.h b/engines/crab/level/Stairs.h
index 3224d9a00e4..8daa65ca98e 100644
--- a/engines/crab/level/Stairs.h
+++ b/engines/crab/level/Stairs.h
@@ -46,7 +46,7 @@ public:
Stairs() : modifier(1.0f, 1.0f) {}
~Stairs() {}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
};
} // End of namespace level
} // End of namespace pyrodactyl
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index c299820c4c0..aa79fb44cc5 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -170,7 +170,7 @@ public:
void CalcProperties(pyrodactyl::event::Info &info);
// Loading function
- void Load(const Common::String &filename, pyrodactyl::event::Info &info, pyrodactyl::event::TriggerSet &game_over,
+ void load(const Common::String &filename, pyrodactyl::event::Info &info, pyrodactyl::event::TriggerSet &game_over,
const int &player_x = -1, const int &player_y = -1);
// One time load called first-time
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 0c3acb479ce..0b8dcb66467 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -56,7 +56,7 @@ void Level::PreDraw() {
if (layer_count <= terrain.sprite_layer)
PreDrawObjects(surf);
- img.Load(surf);
+ img.load(surf);
delete surf;
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index e818b538a8e..c549505e54e 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -50,7 +50,7 @@ bool CompSpriteLayer(const Sprite &a, const Sprite &b) {
//------------------------------------------------------------------------
// Purpose: Load the level
//------------------------------------------------------------------------
-void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
+void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
pyrodactyl::event::TriggerSet &game_over, const int &player_x, const int &player_y) {
Reset();
XMLDoc conf(filename);
@@ -78,7 +78,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
loadStr(path, "path", mapnode);
loadStr(tmxfile, "file", mapnode);
- terrain.Load(path, tmxfile);
+ terrain.load(path, tmxfile);
// Remember to load the terrain data before constructing the pathfinding grid
pathfindingGrid.SetupNodes(terrain);
@@ -86,12 +86,12 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
terrain.grid = &pathfindingGrid;
if (nodeValid("loc", mapnode))
- map_loc.Load(mapnode->first_node("loc"));
+ map_loc.load(mapnode->first_node("loc"));
if (nodeValid("clip", mapnode)) {
rapidxml::xml_node<char> *clipnode = mapnode->first_node("clip");
loadNum(map_clip.id, "id", clipnode);
- map_clip.rect.Load(clipnode);
+ map_clip.rect.load(clipnode);
}
}
@@ -100,7 +100,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
int count = 0;
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling(), ++count) {
Sprite s;
- s.Load(n, anim_set);
+ s.load(n, anim_set);
Common::String str = n->name();
if (str == "player") {
@@ -119,7 +119,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
rapidxml::xml_node<char> *spritenode = node->first_node("background");
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling()) {
Sprite s;
- s.Load(n, anim_set);
+ s.load(n, anim_set);
background.push_back(s);
}
@@ -130,7 +130,7 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
rapidxml::xml_node<char> *spritenode = node->first_node("fly");
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling()) {
Sprite s;
- s.Load(n, anim_set);
+ s.load(n, anim_set);
// Set the timer target for the first time
//s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
@@ -147,11 +147,11 @@ void Level::Load(const Common::String &filename, pyrodactyl::event::Info &info,
}
if (nodeValid("popup", node, false))
- pop.Load(node->first_node("popup"));
+ pop.load(node->first_node("popup"));
game_over.Clear();
if (nodeValid("game_over", node, false))
- game_over.Load(node->first_node("game_over"));
+ game_over.load(node->first_node("game_over"));
else if (player_index < objects.size()) {
// The default lose condition is the death of the player
using namespace pyrodactyl::event;
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index f8dcaea0cef..4cddc046da2 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace pyrodactyl::image;
using namespace pyrodactyl::level;
-void PlayerDestMarker::Load(rapidxml::xml_node<char> *node) {
+void PlayerDestMarker::load(rapidxml::xml_node<char> *node) {
loadImgKey(img, "dest", node);
size.x = g_engine->_imageManager->GetTexture(img).W();
size.y = g_engine->_imageManager->GetTexture(img).H();
diff --git a/engines/crab/level/level_objects.h b/engines/crab/level/level_objects.h
index ccf583d7958..8254612649e 100644
--- a/engines/crab/level/level_objects.h
+++ b/engines/crab/level/level_objects.h
@@ -57,7 +57,7 @@ struct PlayerDestMarker {
PlayerDestMarker() { img = 0; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const Vector2i &pos, const Rect &camera);
};
} // End of namespace level
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index c7cd3823f6c..630f77280d3 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -36,8 +36,8 @@ using namespace pyrodactyl::text;
using namespace pyrodactyl::level;
using namespace pyrodactyl::image;
-void TalkNotify::Load(rapidxml::xml_node<char> *node) {
- offset.Load(node);
+void TalkNotify::load(rapidxml::xml_node<char> *node) {
+ offset.load(node);
loadNum(font, "font", node);
loadAlign(align, node);
loadNum(col, "col", node);
diff --git a/engines/crab/level/talknotify.h b/engines/crab/level/talknotify.h
index 81d9446a36e..ab8d33f5510 100644
--- a/engines/crab/level/talknotify.h
+++ b/engines/crab/level/talknotify.h
@@ -54,7 +54,7 @@ public:
align = ALIGN_CENTER;
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s, const Rect &camera);
};
} // End of namespace level
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 7f474d64da1..761a519711f 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -47,25 +47,25 @@ MainMenu::MainMenu() {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("main_menu");
if (nodeValid(node)) {
- me_main.Load(node->first_node("main"));
- logo.Load(node->first_node("logo"));
+ me_main.load(node->first_node("main"));
+ logo.load(node->first_node("logo"));
- back.Load(node->first_node("back"));
+ back.load(node->first_node("back"));
if (!g_engine->_optionMenu->loaded) {
- g_engine->_optionMenu->Load(node->first_node("option")->first_attribute("path")->value());
+ g_engine->_optionMenu->load(node->first_node("option")->first_attribute("path")->value());
g_engine->_optionMenu->loaded = true;
}
- mod.Load(node->first_node("mod")->first_attribute("path")->value());
- credits.Load(node->first_node("credits")->first_attribute("path")->value());
+ mod.load(node->first_node("mod")->first_attribute("path")->value());
+ credits.load(node->first_node("credits")->first_attribute("path")->value());
{
XMLDoc loadconf(node->first_node("load")->first_attribute("path")->value());
if (loadconf.ready()) {
rapidxml::xml_node<char> *loadnode = loadconf.doc()->first_node("load_menu");
if (nodeValid(loadnode))
- g_engine->_loadMenu->Load(loadnode);
+ g_engine->_loadMenu->load(loadnode);
}
}
@@ -74,7 +74,7 @@ MainMenu::MainMenu() {
if (helpconf.ready()) {
rapidxml::xml_node<char> *hnode = helpconf.doc()->first_node("help");
if (nodeValid(hnode))
- g_engine->_helpScreen->Load(hnode);
+ g_engine->_helpScreen->load(hnode);
}
}
@@ -82,7 +82,7 @@ MainMenu::MainMenu() {
rapidxml::xml_node<char> *snode = node->first_node("scene");
if (nodeValid("bg", snode))
- bg.Load(snode->first_node("bg"));
+ bg.load(snode->first_node("bg"));
if (nodeValid("lights", snode)) {
rapidxml::xml_node<char> *lnode = snode->first_node("lights");
@@ -96,31 +96,31 @@ MainMenu::MainMenu() {
rapidxml::xml_node<char> *dinode = node->first_node("difficulty");
if (nodeValid("bg", dinode))
- diff.bg.Load(dinode->first_node("bg"));
+ diff.bg.load(dinode->first_node("bg"));
if (nodeValid("menu", dinode))
- diff.menu.Load(dinode->first_node("menu"));
+ diff.menu.load(dinode->first_node("menu"));
if (nodeValid("heading", dinode))
- diff.heading.Load(dinode->first_node("heading"));
+ diff.heading.load(dinode->first_node("heading"));
}
if (nodeValid("prompt", node)) {
rapidxml::xml_node<char> *prnode = node->first_node("prompt");
- save.Load(prnode);
+ save.load(prnode);
if (nodeValid("warning", prnode))
- warning.Load(prnode->first_node("warning"));
+ warning.load(prnode->first_node("warning"));
if (nodeValid("bg", prnode))
- bg_save.Load(prnode->first_node("bg"));
+ bg_save.load(prnode->first_node("bg"));
if (nodeValid("accept", prnode))
- accept.Load(prnode->first_node("accept"));
+ accept.load(prnode->first_node("accept"));
if (nodeValid("cancel", prnode))
- cancel.Load(prnode->first_node("cancel"));
+ cancel.load(prnode->first_node("cancel"));
}
if (nodeValid("music", node)) {
@@ -133,10 +133,10 @@ MainMenu::MainMenu() {
rapidxml::xml_node<char> *denode = node->first_node("demo");
if (nodeValid("steam", denode))
- steam.Load(denode->first_node("steam"));
+ steam.load(denode->first_node("steam"));
if (nodeValid("direct", denode))
- direct.Load(denode->first_node("direct"));
+ direct.load(denode->first_node("direct"));
}
#endif
}
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 6c73e1042b3..7a6b3661d19 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -73,7 +73,7 @@ void MusicManager::PlayMusic(const MusicKey &id) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *att = n->first_attribute("id");
if (att != NULL && id == StringToNumber<MusicKey>(att->value())) {
- bg.Load(n);
+ bg.load(n);
break;
}
}
@@ -102,8 +102,8 @@ void MusicManager::PlayEffect(const ChunkKey &id, const int &loops) {
//------------------------------------------------------------------------
// Purpose: Initialize the music subsystem (currently SDL_mixer) and load sound effects
//------------------------------------------------------------------------
-bool MusicManager::Load(rapidxml::xml_node<char> *node) {
- warning("STUB: MusicManager::Load()");
+bool MusicManager::load(rapidxml::xml_node<char> *node) {
+ warning("STUB: MusicManager::load()");
#if 0
// Initialize music parameters
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index c39e55b9314..cc67d9e1760 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -72,7 +72,7 @@ public:
}
~MusicManager() {}
- bool Load(rapidxml::xml_node<char> *node);
+ bool load(rapidxml::xml_node<char> *node);
void PlayMusic(const MusicKey &id);
void PlayEffect(const ChunkKey &id, const int &loops);
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index 89340f9f4b0..58bd8f810f5 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -66,7 +66,7 @@ struct MusicData {
fade_in_duration = 100;
}
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
#if 0
loadNum(id, "id", node);
loadNum(fade_in_duration, "fade_in", node);
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index 4e383e6e8cf..8a5af19bfde 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -47,7 +47,7 @@ Opinion::Opinion() {
val[OPI_RESPECT] = 0;
}
-void Opinion::Load(rapidxml::xml_node<char> *node) {
+void Opinion::load(rapidxml::xml_node<char> *node) {
loadNum(val[OPI_LIKE], "like", node);
loadNum(val[OPI_FEAR], "fear", node);
loadNum(val[OPI_RESPECT], "respect", node);
diff --git a/engines/crab/people/opinion.h b/engines/crab/people/opinion.h
index 14beda3bac3..4232889b7c0 100644
--- a/engines/crab/people/opinion.h
+++ b/engines/crab/people/opinion.h
@@ -62,7 +62,7 @@ struct Opinion {
void Set(const OpinionType &type, const int &val);
void Validate(const OpinionType &type);
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
} // End of namespace people
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index fd3e8f31c19..8b176b06e1a 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -42,14 +42,14 @@ Person::Person() {
trig.clear();
}
-void Person::Load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem) {
+void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem) {
if (nodeValid(node)) {
loadStr(id, "id", node);
loadStr(name, "name", node);
// loadImgKey(pic, "img", node);
if (nodeValid("opinion", node))
- opinion.Load(node->first_node("opinion"));
+ opinion.load(node->first_node("opinion"));
if (node->first_attribute("type") != NULL) {
Common::String t;
@@ -74,7 +74,7 @@ void Person::Load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
if (nodeValid("stats", node)) {
rapidxml::xml_node<char> *statnode = node->first_node("stats");
if (statnode->first_attribute("template") == NULL) {
- stat.Load(statnode);
+ stat.load(statnode);
} else {
int index = 0;
loadNum(index, "template", statnode);
@@ -135,10 +135,10 @@ void Person::LoadState(rapidxml::xml_node<char> *node) {
loadEnum(state, "state", node);
if (nodeValid("opinion", node))
- opinion.Load(node->first_node("opinion"));
+ opinion.load(node->first_node("opinion"));
if (nodeValid("stats", node))
- stat.Load(node->first_node("stats"));
+ stat.load(node->first_node("stats"));
if (nodeValid("traits", node, false)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index b2be3a30c5f..90ce9d03ebf 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -78,7 +78,7 @@ struct Person {
Common::Array<Trait> trait;
Person();
- void Load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem);
+ void load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem);
void Reset();
void Validate();
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 0f5ca3462bc..ad21d6772bd 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void Trait::Load(rapidxml::xml_node<char> *node) {
+void Trait::load(rapidxml::xml_node<char> *node) {
loadStr(id_str, "id", node);
id = StringToNumber<int>(id_str);
diff --git a/engines/crab/people/trait.h b/engines/crab/people/trait.h
index f518d9230d3..e88f76e5e21 100644
--- a/engines/crab/people/trait.h
+++ b/engines/crab/people/trait.h
@@ -62,11 +62,11 @@ struct Trait {
img = 0;
unread = true;
}
- Trait(rapidxml::xml_node<char> *node) { Load(node); }
+ Trait(rapidxml::xml_node<char> *node) { load(node); }
~Trait() {}
void Clear();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname);
};
} // End of namespace people
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 2dbd611aed2..2cf541fde0c 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -42,7 +42,7 @@ namespace Crab {
//------------------------------------------------------------------------
Splash::Splash() {
// Load the background
- background.Load("res/gfx/pyrodactyl.png");
+ background.load("res/gfx/pyrodactyl.png");
SetUI();
load_complete = false;
@@ -61,7 +61,7 @@ Splash::~Splash() {
//------------------------------------------------------------------------
void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
- g_engine->_loadingScreen->Load();
+ g_engine->_loadingScreen->load();
g_engine->_imageManager->Init();
g_engine->_textManager->Init();
load_complete = true;
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index ccaae98a52c..2eee693427f 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -69,20 +69,20 @@ const char *StatTypeToString(const StatType &val) {
using namespace pyrodactyl::stat;
-void Stat::Load(rapidxml::xml_node<char> *node) {
+void Stat::load(rapidxml::xml_node<char> *node) {
loadNum(cur, "cur", node);
loadNum(def, "def", node);
loadNum(min, "min", node);
loadNum(max, "max", node);
}
-void StatGroup::Load(rapidxml::xml_node<char> *node) {
- val[STAT_HEALTH].Load(node->first_node(STATNAME_HEALTH));
- val[STAT_ATTACK].Load(node->first_node(STATNAME_ATTACK));
- val[STAT_DEFENSE].Load(node->first_node(STATNAME_DEFENSE));
- val[STAT_SPEED].Load(node->first_node(STATNAME_SPEED));
- /*val[STAT_CHARISMA].Load(node->first_node(STATNAME_CHARISMA));
- val[STAT_INTELLIGENCE].Load(node->first_node(STATNAME_INTELLIGENCE));*/
+void StatGroup::load(rapidxml::xml_node<char> *node) {
+ val[STAT_HEALTH].load(node->first_node(STATNAME_HEALTH));
+ val[STAT_ATTACK].load(node->first_node(STATNAME_ATTACK));
+ val[STAT_DEFENSE].load(node->first_node(STATNAME_DEFENSE));
+ val[STAT_SPEED].load(node->first_node(STATNAME_SPEED));
+ /*val[STAT_CHARISMA].load(node->first_node(STATNAME_CHARISMA));
+ val[STAT_INTELLIGENCE].load(node->first_node(STATNAME_INTELLIGENCE));*/
}
void StatGroup::Change(const StatType &type, const int &change) {
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index 106989f4345..f40a934a551 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -53,7 +53,7 @@ struct Stat {
void Reset() { cur = def; }
void Validate();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name);
};
@@ -62,12 +62,12 @@ struct StatGroup {
Stat val[STAT_TOTAL];
StatGroup() {}
- StatGroup(rapidxml::xml_node<char> *node) { Load(node); }
+ StatGroup(rapidxml::xml_node<char> *node) { load(node); }
void Change(const pyrodactyl::stat::StatType &type, const int &change);
void Set(const pyrodactyl::stat::StatType &type, const int &val);
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
};
StatType StringToStatType(const Common::String &val);
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index 3526dee4678..f4a907d2962 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -37,15 +37,15 @@ using namespace pyrodactyl::text;
using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
-void StatInfo::Load(rapidxml::xml_node<char> *node) {
+void StatInfo::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
loadBool(active, "active", node);
- desc.Load(node->first_node("info"));
+ desc.load(node->first_node("info"));
loadStr(text, "text", node->first_node("info"));
if (nodeValid("value", node)) {
rapidxml::xml_node<char> *valuenode = node->first_node("value");
- dim.Load(valuenode);
+ dim.load(valuenode);
loadImgKey(full, "full", valuenode);
loadImgKey(empty, "empty", valuenode);
}
@@ -65,14 +65,14 @@ void StatInfo::Draw(const int &val, const int &max) {
}
}
-void StatDrawHelper::Load(rapidxml::xml_node<char> *node) {
+void StatDrawHelper::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- info[STAT_HEALTH].Load(node->first_node(STATNAME_HEALTH));
- info[STAT_ATTACK].Load(node->first_node(STATNAME_ATTACK));
- info[STAT_DEFENSE].Load(node->first_node(STATNAME_DEFENSE));
- info[STAT_SPEED].Load(node->first_node(STATNAME_SPEED));
- /*info[STAT_CHARISMA].Load(node->first_node(STATNAME_CHARISMA));
- info[STAT_INTELLIGENCE].Load(node->first_node(STATNAME_INTELLIGENCE));*/
+ info[STAT_HEALTH].load(node->first_node(STATNAME_HEALTH));
+ info[STAT_ATTACK].load(node->first_node(STATNAME_ATTACK));
+ info[STAT_DEFENSE].load(node->first_node(STATNAME_DEFENSE));
+ info[STAT_SPEED].load(node->first_node(STATNAME_SPEED));
+ /*info[STAT_CHARISMA].load(node->first_node(STATNAME_CHARISMA));
+ info[STAT_INTELLIGENCE].load(node->first_node(STATNAME_INTELLIGENCE));*/
}
}
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index 16da2a57014..f3e3aeb8701 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -54,7 +54,7 @@ struct StatInfo {
empty = 0;
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const int &val, const int &max);
};
@@ -65,7 +65,7 @@ public:
StatDrawHelper() {}
~StatDrawHelper() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void DrawInfo(const pyrodactyl::people::Person &obj);
const Common::String &Name(const StatType &type) { return info[type].text; }
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index ffe6f5b73fc..56749ad8c3d 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace pyrodactyl::stat;
-void StatTemplates::Load(const Common::String &filename) {
+void StatTemplates::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("templates");
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index 44bcf0e6f95..2a8504d530d 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -45,7 +45,7 @@ public:
StatTemplates(void) {}
~StatTemplates(void) {}
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
};
} // End of namespace stat
} // End of namespace pyrodactyl
diff --git a/engines/crab/stat/bonus.h b/engines/crab/stat/bonus.h
index 64d59eec7d5..bf033f58b23 100644
--- a/engines/crab/stat/bonus.h
+++ b/engines/crab/stat/bonus.h
@@ -43,7 +43,7 @@ struct Bonus {
StatType type;
int val;
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
loadStatType(type, node);
loadNum(val, "val", node);
}
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index b9a8da085ae..2c873f4eecf 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -53,7 +53,7 @@ void TextManager::Init() {
oldest = 0;
if (nodeValid(node->first_node("padding")))
- pad_bg.Load(node->first_node("padding"));
+ pad_bg.load(node->first_node("padding"));
for (auto n = node->first_node("font"); n != NULL; n = n->next_sibling("font")) {
rapidxml::xml_attribute<char> *id, *path, *size;
@@ -76,7 +76,7 @@ void TextManager::Init() {
}
}
- colpool.Load(g_engine->_filePath->colors);
+ colpool.load(g_engine->_filePath->colors);
}
void TextManager::Reset() {
@@ -163,7 +163,7 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
cache[pos].col = color;
cache[pos].font = fontk;
- cache[pos].img.Load(surf);
+ cache[pos].img.load(surf);
delete surf;
#if 0
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index cef75c37e7f..dff3d462f3c 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::text;
-void ColorPool::Load(const Common::String &filename) {
+void ColorPool::load(const Common::String &filename) {
pool.clear();
XMLDoc col_list(filename);
if (col_list.ready()) {
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index 5333bd1f29e..d3928e03d03 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -57,7 +57,7 @@ public:
}
SDL_Color &Get(const int &num);
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
};
} // End of namespace text
} // End of namespace pyrodactyl
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index f322abc51cb..888d6e586ec 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -47,7 +47,7 @@ Timer::Timer() {
started = false;
}
-void Timer::Load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo) {
+void Timer::load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo) {
target_valid = loadNum(target_ticks, name, node, echo);
}
diff --git a/engines/crab/timer.h b/engines/crab/timer.h
index 4c64ad81c2f..afb89053bf6 100644
--- a/engines/crab/timer.h
+++ b/engines/crab/timer.h
@@ -67,7 +67,7 @@ public:
target_ticks = val;
}
- void Load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo = true);
// The various clock actions
void Start();
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index de4536431e8..45bbddbd087 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -37,8 +37,8 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void AlphaImage::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- pos.Load(node, echo);
+void AlphaImage::load(rapidxml::xml_node<char> *node, const bool &echo) {
+ pos.load(node, echo);
loadImgKey(img, "img", node, echo);
loadNum(alpha.min, "min", node);
diff --git a/engines/crab/ui/AlphaImage.h b/engines/crab/ui/AlphaImage.h
index 393ef7bf685..735b260517a 100644
--- a/engines/crab/ui/AlphaImage.h
+++ b/engines/crab/ui/AlphaImage.h
@@ -68,11 +68,11 @@ class AlphaImage {
public:
AlphaImage() {}
- AlphaImage(rapidxml::xml_node<char> *node) { Load(node); }
+ AlphaImage(rapidxml::xml_node<char> *node) { load(node); }
~AlphaImage() {}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
void Draw(const int &XOffset = 0, const int &YOffset = 0);
diff --git a/engines/crab/ui/Caption.cpp b/engines/crab/ui/Caption.cpp
index 92341fff3cc..f4094463a85 100644
--- a/engines/crab/ui/Caption.cpp
+++ b/engines/crab/ui/Caption.cpp
@@ -42,8 +42,8 @@ void Caption::Init(const Caption &c, const int &XOffset, const int &YOffset) {
y += YOffset;
}
-void Caption::Load(rapidxml::xml_node<char> *node, Rect *parent) {
- if (TextData::Load(node, parent, false)) {
+void Caption::load(rapidxml::xml_node<char> *node, Rect *parent) {
+ if (TextData::load(node, parent, false)) {
loadStr(text, "text", node);
loadNum(col_s, "color_s", node, false);
enabled = true;
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index 0f8f1b1e873..8ba229fcf4a 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -54,7 +54,7 @@ public:
void Init(const Caption &c, const int &XOffset = 0, const int &YOffset = 0);
- void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
+ void load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
void Draw(bool selected, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 84458cabae0..c8bce321fd7 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -34,15 +34,15 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void ChapterIntro::Load(rapidxml::xml_node<char> *node) {
+void ChapterIntro::load(rapidxml::xml_node<char> *node) {
if (nodeValid("dialog", node))
- dialog.Load(node->first_node("dialog"));
+ dialog.load(node->first_node("dialog"));
if (nodeValid("image", node))
- pos.Load(node->first_node("image"));
+ pos.load(node->first_node("image"));
if (nodeValid("trait", node))
- traits.Load(node->first_node("trait"));
+ traits.load(node->first_node("trait"));
}
bool ChapterIntro::HandleEvents(Common::Event &Event) {
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index d7ec1ad5151..007f83abb90 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -56,7 +56,7 @@ public:
ChapterIntro() { show_traits = false; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
bool HandleEvents(Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index 11e38f40e46..9d1d3e70c5e 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -36,11 +36,11 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void ClipButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- Button::Load(node, echo);
+void ClipButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
+ Button::load(node, echo);
if (nodeValid("clip", node, false))
- clip.Load(node->first_node("clip"));
+ clip.load(node->first_node("clip"));
else {
clip.x = 0;
clip.y = 0;
diff --git a/engines/crab/ui/ClipButton.h b/engines/crab/ui/ClipButton.h
index 9280a7ec9cb..829c057e5d1 100644
--- a/engines/crab/ui/ClipButton.h
+++ b/engines/crab/ui/ClipButton.h
@@ -46,7 +46,7 @@ public:
ClipButton() {}
~ClipButton() {}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
void Draw(const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index d28ee92401e..23484b69cc0 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -43,54 +43,54 @@ void CreditScreen::Reset() {
speed.cur = speed.slow;
}
-void CreditScreen::Load(const Common::String &filename) {
+void CreditScreen::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("credits");
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("h", node))
- heading.Load(node->first_node("h"));
+ heading.load(node->first_node("h"));
if (nodeValid("p", node))
- paragraph.Load(node->first_node("p"));
+ paragraph.load(node->first_node("p"));
if (nodeValid("logo", node))
- logo.Load(node->first_node("logo"));
+ logo.load(node->first_node("logo"));
if (nodeValid("website", node))
- website.Load(node->first_node("website"), false);
+ website.load(node->first_node("website"), false);
if (nodeValid("twitter", node))
- twitter.Load(node->first_node("twitter"), false);
+ twitter.load(node->first_node("twitter"), false);
if (nodeValid("twitter", node))
- back.Load(node->first_node("back"));
+ back.load(node->first_node("back"));
if (nodeValid("fast", node)) {
rapidxml::xml_node<char> *fnode = node->first_node("fast");
- fast.Load(fnode);
+ fast.load(fnode);
loadNum(speed.fast, "val", fnode);
}
if (nodeValid("slow", node)) {
rapidxml::xml_node<char> *snode = node->first_node("slow");
- slow.Load(snode);
+ slow.load(snode);
loadNum(speed.slow, "val", snode);
}
if (nodeValid("reverse", node)) {
rapidxml::xml_node<char> *rnode = node->first_node("reverse");
- reverse.Load(rnode);
+ reverse.load(rnode);
loadNum(speed.reverse, "val", rnode);
}
speed.cur = speed.slow;
if (nodeValid("pause", node))
- pause.Load(node->first_node("pause"));
+ pause.load(node->first_node("pause"));
if (nodeValid("text", node)) {
rapidxml::xml_node<char> *tnode = node->first_node("text");
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 0edab272145..e25ce8112d8 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -77,7 +77,7 @@ class CreditScreen {
align = ALIGN_CENTER;
}
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
loadNum(inc, "inc", node);
loadNum(color, "color", node);
LoadFontKey(font, "font", node);
@@ -111,7 +111,7 @@ public:
CreditScreen() { Reset(); }
~CreditScreen() {}
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void Reset();
bool HandleEvents(Common::Event &Event);
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index b9ea9661709..7ac1d7646cd 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -34,31 +34,31 @@ namespace Crab {
using namespace pyrodactyl::ui;
-void DebugConsole::Load(const Common::String &filename) {
+void DebugConsole::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("debug");
if (nodeValid(node)) {
if (nodeValid("menu", node))
- menu.Load(node->first_node("menu"));
+ menu.load(node->first_node("menu"));
if (nodeValid("variable", node)) {
rapidxml::xml_node<char> *varnode = node->first_node("variable");
if (nodeValid("bg", varnode))
- bg.Load(varnode->first_node("bg"));
+ bg.load(varnode->first_node("bg"));
if (nodeValid("check", varnode))
- check.Load(varnode->first_node("check"));
+ check.load(varnode->first_node("check"));
if (nodeValid("back", varnode))
- back.Load(varnode->first_node("back"));
+ back.load(varnode->first_node("back"));
if (nodeValid("value", varnode))
- value.Load(varnode->first_node("value"));
+ value.load(varnode->first_node("value"));
if (nodeValid("text", varnode))
- text_field.Load(varnode->first_node("text"));
+ text_field.load(varnode->first_node("text"));
}
}
}
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index 76b527a5d19..c7498737e13 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -63,7 +63,7 @@ public:
// Only restrict input when we're in variable state
bool RestrictInput() { return (state == STATE_VAR || menu.HoverIndex() != -1); }
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void Draw(pyrodactyl::event::Info &info);
#if 0
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 5348b57f4ad..c61e8c318c2 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -157,16 +157,16 @@ public:
#endif
}
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("menu", node))
- menu.Load(node->first_node("menu"));
+ menu.load(node->first_node("menu"));
if (nodeValid("preview", node)) {
auto prnode = node->first_node("preview");
- img.pos.Load(prnode);
+ img.pos.load(prnode);
loadStr(img.no_preview_path, "path", prnode);
}
@@ -174,20 +174,20 @@ public:
rapidxml::xml_node<char> *offnode = node->first_node("offset");
// Stuff displayed on the slot button
- td_b[DATA_SAVENAME].Load(offnode->first_node("save_name"));
- td_b[DATA_LASTMODIFIED].Load(offnode->first_node("last_modified"));
+ td_b[DATA_SAVENAME].load(offnode->first_node("save_name"));
+ td_b[DATA_LASTMODIFIED].load(offnode->first_node("last_modified"));
// Stuff displayed when you hover over a slot button
- td_h[DATA_LOCNAME].Load(offnode->first_node("loc_name"));
- td_h[DATA_DIFFICULTY].Load(offnode->first_node("difficulty"));
- td_h[DATA_TIMEPLAYED].Load(offnode->first_node("time_played"));
- td_h[DATA_PLAYERNAME].Load(offnode->first_node("player_name"));
+ td_h[DATA_LOCNAME].load(offnode->first_node("loc_name"));
+ td_h[DATA_DIFFICULTY].load(offnode->first_node("difficulty"));
+ td_h[DATA_TIMEPLAYED].load(offnode->first_node("time_played"));
+ td_h[DATA_PLAYERNAME].load(offnode->first_node("player_name"));
// Titles for the stuff displayed when you hover over a slot button
- hov[DATA_LOCNAME].Load(offnode->first_node("loc_name_title"));
- hov[DATA_DIFFICULTY].Load(offnode->first_node("difficulty_title"));
- hov[DATA_TIMEPLAYED].Load(offnode->first_node("time_played_title"));
- hov[DATA_PLAYERNAME].Load(offnode->first_node("player_name_title"));
+ hov[DATA_LOCNAME].load(offnode->first_node("loc_name_title"));
+ hov[DATA_DIFFICULTY].load(offnode->first_node("difficulty_title"));
+ hov[DATA_TIMEPLAYED].load(offnode->first_node("time_played_title"));
+ hov[DATA_PLAYERNAME].load(offnode->first_node("player_name_title"));
}
extension = g_engine->_filePath->save_ext;
@@ -240,8 +240,8 @@ public:
if (!img.loaded || prev_hover != i) {
img.loaded = true;
prev_hover = i;
- if (!img.preview.Load(slot_info[i].preview))
- img.preview.Load(img.no_preview_path);
+ if (!img.preview.load(slot_info[i].preview))
+ img.preview.load(img.no_preview_path);
}
hover = true;
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index a7e0d354473..6b8903d3f80 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -36,14 +36,14 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void GameOverMenu::Load(rapidxml::xml_node<char> *node) {
+void GameOverMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("title", node)) {
rapidxml::xml_node<char> *tinode = node->first_node("title");
- title.Load(tinode);
+ title.load(tinode);
for (auto n = tinode->first_node("quote"); n != NULL; n = n->next_sibling("quote")) {
Common::String str;
@@ -52,7 +52,7 @@ void GameOverMenu::Load(rapidxml::xml_node<char> *node) {
}
}
- menu.Load(node->first_node("menu"));
+ menu.load(node->first_node("menu"));
}
}
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index bea787c8a68..52c9c8d69bd 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -67,7 +67,7 @@ public:
#endif
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
int HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 7c97337b6ba..32b908c3133 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -40,28 +40,28 @@ using namespace pyrodactyl::music;
//------------------------------------------------------------------------
// Purpose: Load components from file
//------------------------------------------------------------------------
-void GeneralSettingMenu::Load(rapidxml::xml_node<char> *node) {
+void GeneralSettingMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("volume", node)) {
rapidxml::xml_node<char> *musnode = node->first_node("volume");
if (nodeValid("desc", musnode))
- notice_volume.Load(musnode->first_node("desc"));
+ notice_volume.load(musnode->first_node("desc"));
// if (nodeValid("music", musnode))
- // vol_music.Load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolMusic());
+ // vol_music.load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolMusic());
// if (nodeValid("effects", musnode))
- // vol_effects.Load(musnode->first_node("effects"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolEffects());
+ // vol_effects.load(musnode->first_node("effects"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolEffects());
}
if (nodeValid("mouse_trap", node))
- mouse_trap.Load(node->first_node("mouse_trap"));
+ mouse_trap.load(node->first_node("mouse_trap"));
if (nodeValid("save_on_exit", node))
- save_on_exit.Load(node->first_node("save_on_exit"));
+ save_on_exit.load(node->first_node("save_on_exit"));
if (nodeValid("text_speed", node))
- text_speed.Load(node->first_node("text_speed"));
+ text_speed.load(node->first_node("text_speed"));
// Sync popup text value with actual value
for (auto &i : text_speed.element)
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index a62f638d08c..c888b4f4f2d 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -55,7 +55,7 @@ public:
GeneralSettingMenu() {}
~GeneralSettingMenu() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 5e51f0bdc07..970b7f16c94 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -38,29 +38,29 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
// Purpose: Load components from file
//------------------------------------------------------------------------
-void GfxSettingMenu::Load(rapidxml::xml_node<char> *node) {
+void GfxSettingMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("resolution", node))
- resolution.Load(node->first_node("resolution"));
+ resolution.load(node->first_node("resolution"));
if (nodeValid("fullscreen", node))
- fullscreen.Load(node->first_node("fullscreen"));
+ fullscreen.load(node->first_node("fullscreen"));
if (nodeValid("vsync", node))
- vsync.Load(node->first_node("vsync"));
+ vsync.load(node->first_node("vsync"));
if (nodeValid("border", node))
- border.Load(node->first_node("border"));
+ border.load(node->first_node("border"));
if (nodeValid("quality", node)) {
rapidxml::xml_node<char> *qnode = node->first_node("quality");
- quality.Load(qnode);
+ quality.load(qnode);
if (nodeValid("message", qnode))
- notice_quality.Load(qnode->first_node("message"), &quality);
+ notice_quality.load(qnode->first_node("message"), &quality);
}
if (nodeValid("brightness", node))
- brightness.Load(node->first_node("brightness"), 0, 100, g_engine->_screenSettings->gamma * 100);
+ brightness.load(node->first_node("brightness"), 0, 100, g_engine->_screenSettings->gamma * 100);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index c215bc283f5..99278335eb4 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -59,7 +59,7 @@ public:
GfxSettingMenu() {}
~GfxSettingMenu() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
int HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 811c0c31020..5b2aec22add 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
-void HealthIndicator::Load(rapidxml::xml_node<char> *node) {
+void HealthIndicator::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
loadXY(x, y, node);
diff --git a/engines/crab/ui/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
index 342bd9b1128..4b7e573dab8 100644
--- a/engines/crab/ui/HealthIndicator.h
+++ b/engines/crab/ui/HealthIndicator.h
@@ -60,7 +60,7 @@ public:
}
~HealthIndicator() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(int num);
};
} // End of namespace ui
diff --git a/engines/crab/ui/HoverInfo.cpp b/engines/crab/ui/HoverInfo.cpp
index 6c4e4ef3554..002a250803f 100644
--- a/engines/crab/ui/HoverInfo.cpp
+++ b/engines/crab/ui/HoverInfo.cpp
@@ -42,8 +42,8 @@ void HoverInfo::Init(const HoverInfo &hInfo, const int &XOffset, const int &YOff
y += YOffset;
}
-void HoverInfo::Load(rapidxml::xml_node<char> *node, Rect *parent) {
- if (TextData::Load(node, parent, false)) {
+void HoverInfo::load(rapidxml::xml_node<char> *node, Rect *parent) {
+ if (TextData::load(node, parent, false)) {
loadStr(text, "text", node);
enabled = true;
}
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index 8cbae3ad426..87c0cf7445d 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -49,7 +49,7 @@ public:
void Init(const HoverInfo &h, const int &XOffset = 0, const int &YOffset = 0);
- void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
+ void load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
void Draw(const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 5f21a8e58ac..950fe470bfd 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -36,14 +36,14 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void ImageData::Load(rapidxml::xml_node<char> *node, const bool &echo) {
+void ImageData::load(rapidxml::xml_node<char> *node, const bool &echo) {
loadImgKey(key, "img", node, echo);
loadBool(crop, "crop", node, false);
if (nodeValid("clip", node, false))
- clip.Load(node->first_node("clip"));
+ clip.load(node->first_node("clip"));
- Element::Load(node, key, echo);
+ Element::load(node, key, echo);
}
void ImageData::Draw(const int &XOffset, const int &YOffset) {
diff --git a/engines/crab/ui/ImageData.h b/engines/crab/ui/ImageData.h
index 60cd4551402..4d8c1be9d10 100644
--- a/engines/crab/ui/ImageData.h
+++ b/engines/crab/ui/ImageData.h
@@ -56,7 +56,7 @@ public:
}
~ImageData() {}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
void Draw(const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 95596e330af..867c4b566c3 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -40,21 +40,21 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load layout
//------------------------------------------------------------------------
-void Inventory::Load(const Common::String &filename) {
+void Inventory::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("inventory");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
- collection.Load(node->first_node("items"));
+ collection.load(node->first_node("items"));
/*if (nodeValid("stats", node))
- helper.Load(node->first_node("stats"));*/
+ helper.load(node->first_node("stats"));*/
if (nodeValid("money", node))
- money.Load(node->first_node("money"));
+ money.load(node->first_node("money"));
}
}
}
@@ -67,7 +67,7 @@ void Inventory::LoadItem(const Common::String &char_id, const Common::String &id
for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item")) {
Common::String str = n->first_attribute("id")->value();
if (id == str) {
- i.Load(n);
+ i.load(n);
AddItem(char_id, i);
break;
}
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index a7356a78116..59ad47aa6a2 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -69,7 +69,7 @@ public:
void DelItem(const Common::String &char_id, const Common::String &item_id);
bool HasItem(const Common::String &char_id, const Common::String &container, const Common::String &item_id);
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void Draw(pyrodactyl::people::Person &obj, const int &money_val);
void HandleEvents(const Common::String &char_id, const Common::Event &Event);
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index 303971892e7..713ce6a84c7 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -50,12 +50,12 @@ public:
ItemDesc() {}
~ItemDesc() {}
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
if (nodeValid("name", node))
- name.Load(node->first_node("name"));
+ name.load(node->first_node("name"));
if (nodeValid("desc", node))
- desc.Load(node->first_node("desc"));
+ desc.load(node->first_node("desc"));
}
void Draw(pyrodactyl::item::Item &item) {
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index 5c3a9559b8b..d6dce0072cf 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -38,31 +38,31 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
using namespace pyrodactyl::input;
-void KeyBindMenu::Load(rapidxml::xml_node<char> *node) {
+void KeyBindMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
if (nodeValid("menu", node)) {
rapidxml::xml_node<char> *menode = node->first_node("menu");
if (nodeValid("primary", menode))
- prim.Load(menode->first_node("primary"));
+ prim.load(menode->first_node("primary"));
if (nodeValid("alt", menode))
- alt.Load(menode->first_node("alt"));
+ alt.load(menode->first_node("alt"));
if (nodeValid("prompt", menode))
- prompt.Load(menode->first_node("prompt"));
+ prompt.load(menode->first_node("prompt"));
if (nodeValid("inc", menode))
- inc.Load(menode->first_node("inc"));
+ inc.load(menode->first_node("inc"));
if (nodeValid("dim", menode))
- dim.Load(menode->first_node("dim"));
+ dim.load(menode->first_node("dim"));
if (nodeValid("divide", menode))
- divide.Load(menode->first_node("divide"));
+ divide.load(menode->first_node("divide"));
if (nodeValid("desc", menode))
- desc.Load(menode->first_node("desc"));
+ desc.load(menode->first_node("desc"));
}
// Initialize the menus
@@ -70,7 +70,7 @@ void KeyBindMenu::Load(rapidxml::xml_node<char> *node) {
InitMenu(CON_UI);
if (nodeValid("controls", node))
- sel_controls.Load(node->first_node("controls"));
+ sel_controls.load(node->first_node("controls"));
}
}
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 56ea87fe36d..5e4800387f4 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -82,7 +82,7 @@ class KeyBindMenu {
col_prev = 0;
}
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
loadStr(text, "text", node);
loadNum(col, "color", node);
@@ -114,7 +114,7 @@ public:
#endif
bool DisableHotkeys() { return state != STATE_NORMAL; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index 15fd5d346a3..8369fc855af 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
-void MapData::Load(rapidxml::xml_node<char> *node) {
+void MapData::load(rapidxml::xml_node<char> *node) {
loadStr(path_bg, "bg", node);
loadStr(path_overlay, "overlay", node);
}
@@ -70,7 +70,7 @@ void MapData::LoadState(rapidxml::xml_node<char> *node) {
rapidxml::xml_node<char> *clipnode = node->first_node("clip");
for (rapidxml::xml_node<char> *n = clipnode->first_node("rect"); n != NULL; n = n->next_sibling("rect")) {
Rect r;
- r.Load(n);
+ r.load(n);
reveal.push_back(r);
}
}
@@ -81,7 +81,7 @@ void MapData::LoadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *n = destnode->first_node("pos"); n != NULL; n = n->next_sibling("pos")) {
MarkerData md;
loadStr(md.name, "name", n);
- md.pos.Load(n);
+ md.pos.load(n);
dest.push_back(md);
}
}
diff --git a/engines/crab/ui/MapData.h b/engines/crab/ui/MapData.h
index 4eed1306c73..94b0013090e 100644
--- a/engines/crab/ui/MapData.h
+++ b/engines/crab/ui/MapData.h
@@ -57,10 +57,10 @@ struct MapData {
Common::Array<MarkerData> dest;
MapData() {}
- MapData(rapidxml::xml_node<char> *node) { Load(node); }
+ MapData(rapidxml::xml_node<char> *node) { load(node); }
~MapData() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void DestAdd(const Common::String &name, const int &x, const int &y);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 0ce71f2a8a0..3e7f2b4bcc6 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -37,21 +37,21 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
// Purpose: Load
//------------------------------------------------------------------------
-void MapMarkerMenu::Load(rapidxml::xml_node<char> *node) {
+void MapMarkerMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("ref", node))
- ref.Load(node->first_node("ref"));
+ ref.load(node->first_node("ref"));
if (nodeValid("player", node))
- player.Load(node->first_node("player"));
+ player.load(node->first_node("player"));
if (nodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
if (nodeValid("marker", offnode))
- offset.marker.Load(offnode->first_node("marker"));
+ offset.marker.load(offnode->first_node("marker"));
if (nodeValid("player", offnode))
- offset.player.Load(offnode->first_node("player"));
+ offset.player.load(offnode->first_node("player"));
}
menu.UseKeyboard(true);
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 75dcc8a73e0..72e84399ebf 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -83,7 +83,7 @@ public:
}
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index ef7eb69a713..a930322c23f 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -34,20 +34,20 @@ namespace Crab {
using namespace pyrodactyl::ui;
-void ModMenu::Load(const Common::String &filename) {
+void ModMenu::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("mod_menu");
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("menu", node))
- menu.Load(node->first_node("menu"));
+ menu.load(node->first_node("menu"));
if (nodeValid("preview", node)) {
auto prnode = node->first_node("preview");
- img.pos.Load(prnode);
+ img.pos.load(prnode);
loadStr(img.no_preview_path, "path", prnode);
}
@@ -55,20 +55,20 @@ void ModMenu::Load(const Common::String &filename) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
// Stuff displayed on the slot button
- td_b[DATA_SAVENAME].Load(offnode->first_node("mod_name"));
- td_b[DATA_LASTMODIFIED].Load(offnode->first_node("last_modified"));
+ td_b[DATA_SAVENAME].load(offnode->first_node("mod_name"));
+ td_b[DATA_LASTMODIFIED].load(offnode->first_node("last_modified"));
// Stuff displayed when you hover over a slot button
- td_h[DATA_AUTHOR].Load(offnode->first_node("author"));
- td_h[DATA_VERSION].Load(offnode->first_node("version"));
- td_h[DATA_INFO].Load(offnode->first_node("info"));
- td_h[DATA_WEBSITE].Load(offnode->first_node("website"));
+ td_h[DATA_AUTHOR].load(offnode->first_node("author"));
+ td_h[DATA_VERSION].load(offnode->first_node("version"));
+ td_h[DATA_INFO].load(offnode->first_node("info"));
+ td_h[DATA_WEBSITE].load(offnode->first_node("website"));
// Titles for the stuff displayed when you hover over a slot button
- hov[DATA_AUTHOR].Load(offnode->first_node("author_title"));
- hov[DATA_VERSION].Load(offnode->first_node("info_title"));
- hov[DATA_INFO].Load(offnode->first_node("version_title"));
- hov[DATA_WEBSITE].Load(offnode->first_node("website_title"));
+ hov[DATA_AUTHOR].load(offnode->first_node("author_title"));
+ hov[DATA_VERSION].load(offnode->first_node("info_title"));
+ hov[DATA_INFO].load(offnode->first_node("version_title"));
+ hov[DATA_WEBSITE].load(offnode->first_node("website_title"));
}
extension = g_engine->_filePath->mod_ext;
@@ -114,8 +114,8 @@ void ModMenu::Draw() {
if (!img.loaded || prev_hover != i) {
img.loaded = true;
prev_hover = i;
- if (!img.preview.Load(slot_info[i].preview))
- img.preview.Load(img.no_preview_path);
+ if (!img.preview.load(slot_info[i].preview))
+ img.preview.load(img.no_preview_path);
}
hover = true;
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index 9d60fd69630..0969c679c60 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -43,7 +43,7 @@ public:
ModMenu() {}
~ModMenu() {}
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
bool HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 702f83467c0..9779b317674 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -37,59 +37,59 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::music;
-void OptionMenu::Load(const Common::String &filename) {
+void OptionMenu::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("option");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("state", node)) {
- menu.Load(node->first_node("state"));
+ menu.load(node->first_node("state"));
if (!menu.element.empty())
menu.element[0].State(true);
}
if (nodeValid("keybind", node))
- keybind.Load(node->first_node("keybind"));
+ keybind.load(node->first_node("keybind"));
if (nodeValid("controller", node))
- conbind.Load(node->first_node("controller"));
+ conbind.load(node->first_node("controller"));
if (nodeValid("graphics", node))
- gfx.Load(node->first_node("graphics"));
+ gfx.load(node->first_node("graphics"));
if (nodeValid("general", node))
- general.Load(node->first_node("general"));
+ general.load(node->first_node("general"));
if (nodeValid("change", node)) {
rapidxml::xml_node<char> *chanode = node->first_node("change");
if (nodeValid("accept", chanode))
- accept.Load(chanode->first_node("accept"));
+ accept.load(chanode->first_node("accept"));
if (nodeValid("cancel", chanode))
- cancel.Load(chanode->first_node("cancel"));
+ cancel.load(chanode->first_node("cancel"));
if (nodeValid("message", chanode))
- notice_res.Load(chanode->first_node("message"));
+ notice_res.load(chanode->first_node("message"));
if (nodeValid("width", chanode))
- prompt_w.Load(chanode->first_node("width"));
+ prompt_w.load(chanode->first_node("width"));
if (nodeValid("height", chanode))
- prompt_h.Load(chanode->first_node("height"));
+ prompt_h.load(chanode->first_node("height"));
if (nodeValid("countdown", chanode)) {
rapidxml::xml_node<char> *counode = chanode->first_node("countdown");
- countdown.Load(counode);
- timer.Load(counode, "time");
+ countdown.load(counode);
+ timer.load(counode, "time");
}
if (nodeValid("bg", chanode))
- questionbox.Load(chanode->first_node("bg"));
+ questionbox.load(chanode->first_node("bg"));
}
}
}
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index cb0589de028..1c30e7260ef 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -105,7 +105,7 @@ public:
void Reset();
bool DisableHotkeys() { return keybind.DisableHotkeys(); }
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void Draw(Button &back);
bool HandleEvents(Button &back, const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 6e86299544d..1915e583ac3 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -36,11 +36,11 @@ namespace Crab {
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
-void OptionSelect::Load(rapidxml::xml_node<char> *node) {
+void OptionSelect::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- option.data.Load(node);
- prev.Load(node->first_node("prev"));
- next.Load(node->first_node("next"));
+ option.data.load(node);
+ prev.load(node->first_node("prev"));
+ next.load(node->first_node("next"));
cur = 0;
option.text.clear();
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index d6c9a88070a..6b70c1d987b 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -61,7 +61,7 @@ public:
cur = 0;
usekeyboard = false;
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw();
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 12a7f4405c2..eb41f8adab9 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -139,27 +139,27 @@ public:
info += NumberToString(menu.size());
}
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
using namespace pyrodactyl::input;
if (nodeValid(node)) {
if (nodeValid("prev", node)) {
- prev.Load(node->first_node("prev"));
+ prev.load(node->first_node("prev"));
prev.hotkey.Set(IU_PREV);
}
if (nodeValid("next", node)) {
- next.Load(node->first_node("next"));
+ next.load(node->first_node("next"));
next.hotkey.Set(IU_NEXT);
}
if (nodeValid("reference", node))
- ref.Load(node->first_node("reference"));
+ ref.load(node->first_node("reference"));
if (nodeValid("inc", node))
- inc.Load(node->first_node("inc"));
+ inc.load(node->first_node("inc"));
if (nodeValid("status", node))
- status.Load(node->first_node("status"));
+ status.load(node->first_node("status"));
if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index 217fe7958eb..ccb3cf88c0a 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -35,11 +35,11 @@ namespace Crab {
using namespace pyrodactyl::ui;
-bool ParagraphData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
+bool ParagraphData::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
if (nodeValid("line", node))
- line.Load(node->first_node("line"));
+ line.load(node->first_node("line"));
- return TextData::Load(node, parent, echo);
+ return TextData::load(node, parent, echo);
}
void ParagraphData::Draw(const Common::String &val, const int &XOffset, const int &YOffset) {
diff --git a/engines/crab/ui/ParagraphData.h b/engines/crab/ui/ParagraphData.h
index 57a0f6aafc2..2d42f1d6144 100644
--- a/engines/crab/ui/ParagraphData.h
+++ b/engines/crab/ui/ParagraphData.h
@@ -45,7 +45,7 @@ public:
ParagraphData() : line(1, 1) {}
~ParagraphData() {}
- bool Load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
+ bool load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
void Draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
};
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index ca067b3e6ba..917a3804ddd 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -35,12 +35,12 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void PauseMenu::Load(rapidxml::xml_node<char> *node) {
- menu.Load(node->first_node("menu"));
- save.Load(node->first_node("save"));
+void PauseMenu::load(rapidxml::xml_node<char> *node) {
+ menu.load(node->first_node("menu"));
+ save.load(node->first_node("save"));
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
}
bool PauseMenu::Draw(Button &back) {
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index ea9adffb5f6..5257db2a653 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -83,7 +83,7 @@ public:
menu.element[PS_LOAD - 1].visible = !ironman;
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
PauseSignal HandleEvents(const Common::Event &Event, Button &back);
#if 0
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 57d61ac31ef..18c907ec606 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -37,36 +37,36 @@ using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
-void PersonHandler::Load(rapidxml::xml_node<char> *node) {
+void PersonHandler::load(rapidxml::xml_node<char> *node) {
if (nodeValid("dialog", node))
- dlbox.Load(node->first_node("dialog"));
+ dlbox.load(node->first_node("dialog"));
if (nodeValid("opinion", node)) {
rapidxml::xml_node<char> *opnode = node->first_node("opinion");
if (nodeValid("friendship", opnode))
- opinion[OPI_LIKE].Load(opnode->first_node("friendship"));
+ opinion[OPI_LIKE].load(opnode->first_node("friendship"));
if (nodeValid("respect", opnode))
- opinion[OPI_RESPECT].Load(opnode->first_node("respect"));
+ opinion[OPI_RESPECT].load(opnode->first_node("respect"));
if (nodeValid("fear", opnode))
- opinion[OPI_FEAR].Load(opnode->first_node("fear"));
+ opinion[OPI_FEAR].load(opnode->first_node("fear"));
}
if (nodeValid("image", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("image");
- img.Load(imgnode);
+ img.load(imgnode);
if (nodeValid("sprite_align", imgnode))
- sprite_align.Load(imgnode->first_node("sprite_align"));
+ sprite_align.load(imgnode->first_node("sprite_align"));
}
if (nodeValid("name", node))
- name.Load(node->first_node("name"));
+ name.load(node->first_node("name"));
if (nodeValid("journal", node))
- jb.Load(node->first_node("journal"));
+ jb.load(node->first_node("journal"));
}
void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index 1261ad742a7..e0efbdca660 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -57,7 +57,7 @@ class PersonHandler {
y = ALIGN_RIGHT;
}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true) {
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true) {
loadAlign(x, node, echo, "align_x");
loadAlign(y, node, echo, "align_y");
}
@@ -87,7 +87,7 @@ public:
void Reset(const Common::String &id);
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
// Handle events for the three opinion bars and journal - used in both dialog box and reply events
bool HandleCommonEvents(const Common::Event &Event);
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index e67dd84f977..aa94cc00217 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -37,22 +37,22 @@ using namespace pyrodactyl::event;
using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
-void PersonScreen::Load(const Common::String &filename) {
+void PersonScreen::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("character");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("name", node))
- name.Load(node->first_node("name"));
+ name.load(node->first_node("name"));
if (nodeValid("img", node))
- img.Load(node->first_node("img"));
+ img.load(node->first_node("img"));
if (nodeValid("menu", node))
- menu.Load(node->first_node("menu"));
+ menu.load(node->first_node("menu"));
}
}
}
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 0cc3fc197af..843925371ac 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -64,7 +64,7 @@ public:
PersonScreen() { cur_sp = nullptr; }
~PersonScreen() {}
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void Cache(pyrodactyl::event::Info &info, const Common::String &id, pyrodactyl::level::Level &level);
void HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event);
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index 130f8fa11ba..6571e1be1b5 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -35,15 +35,15 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void ProgressBar::Load(rapidxml::xml_node<char> *node) {
- ClipButton::Load(node);
+void ProgressBar::load(rapidxml::xml_node<char> *node) {
+ ClipButton::load(node);
loadNum(notify_rate, "notify", node);
if (nodeValid("effect", node)) {
rapidxml::xml_node<char> *effnode = node->first_node("effect");
loadImgKey(inc, "inc", effnode);
loadImgKey(dec, "dec", effnode);
- offset.Load(effnode);
+ offset.load(effnode);
}
if (nodeValid("desc", node)) {
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index c2dc6368557..30102af58f3 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -103,7 +103,7 @@ public:
changed = false;
type = NONE;
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const int &value, const int &max);
void Effect(const int &value, const int &prev);
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 61dfa34fa35..5684f4670b0 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -37,31 +37,31 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::input;
-void QuestText::Load(rapidxml::xml_node<char> *node) {
- ParagraphData::Load(node);
+void QuestText::load(rapidxml::xml_node<char> *node) {
+ ParagraphData::load(node);
loadNum(col_s, "color_s", node);
if (nodeValid("line", node))
loadNum(lines_per_page, "page", node->first_node("line"));
if (nodeValid("inc", node))
- inc.Load(node->first_node("inc"));
+ inc.load(node->first_node("inc"));
if (nodeValid("img", node))
- img.Load(node->first_node("img"));
+ img.load(node->first_node("img"));
if (nodeValid("prev", node)) {
- prev.Load(node->first_node("prev"));
+ prev.load(node->first_node("prev"));
prev.hotkey.Set(IU_PAGE_PREV);
}
if (nodeValid("next", node)) {
- next.Load(node->first_node("next"));
+ next.load(node->first_node("next"));
next.hotkey.Set(IU_PAGE_NEXT);
}
if (nodeValid("status", node))
- status.Load(node->first_node("status"));
+ status.load(node->first_node("status"));
}
void QuestText::Draw(pyrodactyl::event::Quest &q) {
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index d60c822f0a7..680e3bf173c 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -77,7 +77,7 @@ public:
lines_per_page = 10;
}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
// Reset the value of current page
void Reset() { current_page = 0; }
diff --git a/engines/crab/ui/RadioButton.h b/engines/crab/ui/RadioButton.h
index 17a2d70412a..13e6052af4b 100644
--- a/engines/crab/ui/RadioButton.h
+++ b/engines/crab/ui/RadioButton.h
@@ -45,8 +45,8 @@ public:
RadioButton() { val = 0.0f; }
~RadioButton() {}
- void Load(rapidxml::xml_node<char> *node) {
- ToggleButton::Load(node);
+ void load(rapidxml::xml_node<char> *node) {
+ ToggleButton::load(node);
loadNum(val, "val", node);
}
};
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index fe5092aa75e..27d4beca4c5 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -49,12 +49,12 @@ public:
RadioButtonMenu() { select = 0; }
~RadioButtonMenu() {}
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
if (nodeValid("desc", node))
- desc.Load(node->first_node("desc"));
+ desc.load(node->first_node("desc"));
if (nodeValid("menu", node))
- Menu::Load(node->first_node("menu"));
+ Menu::load(node->first_node("menu"));
}
void Draw(const int &XOffset = 0, const int &YOffset = 0) {
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 8bf3cbacf4d..19ef72fff94 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -37,8 +37,8 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
-void ReplyButton::Load(rapidxml::xml_node<char> *node) {
- Button::Load(node);
+void ReplyButton::load(rapidxml::xml_node<char> *node) {
+ Button::load(node);
orig = *this;
if (nodeValid("text", node)) {
@@ -51,7 +51,7 @@ void ReplyButton::Load(rapidxml::xml_node<char> *node) {
loadAlign(align, tenode);
if (nodeValid("line_size", tenode))
- line_size.Load(tenode->first_node("line_size"));
+ line_size.load(tenode->first_node("line_size"));
}
}
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index 3797a55ade8..2e6d4b43950 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -66,7 +66,7 @@ public:
}
~ReplyButton() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const int &XOffset = 0, const int &YOffset = 0);
// Used to calculate size and set the string
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 2bc7055ca90..dac7e2eaefd 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -40,20 +40,20 @@ using namespace pyrodactyl::music;
using namespace pyrodactyl::event;
using namespace pyrodactyl::people;
-void ReplyMenu::Load(const Common::String &filename) {
+void ReplyMenu::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("conversation");
if (nodeValid(node)) {
if (nodeValid("tone", node))
- tone.Load(node->first_node("tone"));
+ tone.load(node->first_node("tone"));
if (nodeValid("reply", node)) {
rapidxml::xml_node<char> *replynode = node->first_node("reply");
- Menu<ReplyButton>::Load(replynode->first_node("menu"));
+ Menu<ReplyButton>::load(replynode->first_node("menu"));
tone.value.resize(element.size());
- bg.Load(replynode->first_node("bg"));
+ bg.load(replynode->first_node("bg"));
loadNum(spacing, "spacing", replynode);
}
}
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index fcdedb4e831..2abcc31f66b 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -59,7 +59,7 @@ public:
ReplyMenu() { spacing = 20; }
~ReplyMenu() {}
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
int HandleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event);
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index e31f3a1e33f..12a0f5cefb0 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -37,19 +37,19 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
-void ResolutionMenu::Load(rapidxml::xml_node<char> *node) {
- cancel.Load(node->first_node("cancel"));
- change.Load(node->first_node("change"));
- custom.Load(node->first_node("custom"));
+void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
+ cancel.load(node->first_node("cancel"));
+ change.load(node->first_node("change"));
+ custom.load(node->first_node("custom"));
- info.Load(node->first_node("info"));
+ info.load(node->first_node("info"));
def_info = info.text;
if (nodeValid("reference", node))
- ref.Load(node->first_node("reference"));
+ ref.load(node->first_node("reference"));
if (nodeValid("inc", node)) {
- inc.Load(node->first_node("inc"));
+ inc.load(node->first_node("inc"));
loadNum(columns, "columns", node->first_node("inc"));
}
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index ed042410e64..838dc397fc9 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -68,7 +68,7 @@ public:
}
~ResolutionMenu(void) {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw();
// Return 1 if one of resolution buttons is pressed, 2 if custom button is pressed, 0 otherwise
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index ec7b2ab43f2..b92fec637e1 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -35,11 +35,11 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::input;
-void GameSaveMenu::Load(rapidxml::xml_node<char> *node) {
+void GameSaveMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("name", node))
- ta_name.Load(node->first_node("name"));
+ ta_name.load(node->first_node("name"));
- FileMenu<SaveFileData>::Load(node);
+ FileMenu<SaveFileData>::load(node);
}
void GameSaveMenu::AddButton(const Common::String &p, unsigned int &slot_index, unsigned int &menu_index) {
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 13360821980..699cca6b78c 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -63,7 +63,7 @@ public:
void ScanDir();
bool DisableHotkeys() { return state == STATE_NAME; }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
bool HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 0e3240a4b34..581ebe3077f 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -37,9 +37,9 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::image;
-void SectionHeader::Load(rapidxml::xml_node<char> *node) {
+void SectionHeader::load(rapidxml::xml_node<char> *node) {
- if (TextData::Load(node, NULL, false)) {
+ if (TextData::load(node, NULL, false)) {
loadStr(text, "text", node);
text.insertChar(' ', 0);
text += " ";
diff --git a/engines/crab/ui/SectionHeader.h b/engines/crab/ui/SectionHeader.h
index 567d6885c84..ec3c5756bf7 100644
--- a/engines/crab/ui/SectionHeader.h
+++ b/engines/crab/ui/SectionHeader.h
@@ -61,7 +61,7 @@ public:
}
~SectionHeader() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const int &XOffset = 0, const int &YOffset = 0);
void Draw(const Common::String &str, const int &XOffset = 0, const int &YOffset = 0);
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 4b80f9e246c..f26d8b470b3 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -35,21 +35,21 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
-void SlideShow::Load(rapidxml::xml_node<char> *node) {
+void SlideShow::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
if (nodeValid("pos", node))
- pos.Load(node->first_node("pos"));
+ pos.load(node->first_node("pos"));
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("prev", node)) {
- prev.Load(node->first_node("prev"));
+ prev.load(node->first_node("prev"));
prev.hotkey.Set(IU_PREV);
}
if (nodeValid("next", node)) {
- next.Load(node->first_node("next"));
+ next.load(node->first_node("next"));
next.hotkey.Set(IU_NEXT);
}
@@ -118,7 +118,7 @@ void SlideShow::Refresh() {
img.Delete();
if (index >= 0 && index < path.size())
- img.Load(path[index]);
+ img.load(path[index]);
#endif
}
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index cc54d90e861..ea21af345ea 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -69,7 +69,7 @@ public:
void Refresh();
void Clear() { img.Delete(); }
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index 11127550955..fcf258c8740 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -43,8 +43,8 @@ void StateButton::Init(const StateButton &ref, const int &XOffset, const int &YO
col_select = ref.col_select;
}
-void StateButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- Button::Load(node, echo);
+void StateButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
+ Button::load(node, echo);
img_set.normal = img;
col_normal.col = caption.col;
@@ -53,7 +53,7 @@ void StateButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
if (nodeValid("select", node, false)) {
rapidxml::xml_node<char> *selnode = node->first_node("select");
- img_set.select.Load(selnode, echo);
+ img_set.select.load(selnode, echo);
loadNum(col_select.col, "color", selnode);
loadNum(col_select.col_s, "color_s", selnode);
} else {
diff --git a/engines/crab/ui/StateButton.h b/engines/crab/ui/StateButton.h
index 493f9df33ed..9a3eb6675ee 100644
--- a/engines/crab/ui/StateButton.h
+++ b/engines/crab/ui/StateButton.h
@@ -44,10 +44,10 @@ struct StateButtonImage {
StateButtonImage() {}
StateButtonImage(rapidxml::xml_node<char> *node) {
if (nodeValid("normal", node))
- normal.Load(node->first_node("normal"));
+ normal.load(node->first_node("normal"));
if (nodeValid("select", node, false))
- select.Load(node->first_node("select"));
+ select.load(node->first_node("select"));
else
select = normal;
}
@@ -76,7 +76,7 @@ public:
~StateButton() {}
void Init(const StateButton &ref, const int &XOffset = 0, const int &YOffset = 0);
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
// The state of the button - false is original image, true is second image
void State(const bool val);
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index e8eba525e46..c3e300773d7 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -54,7 +54,7 @@ public:
}
~TextData(void) {}
- bool Load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
+ bool load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
// Plain drawing
void Draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 1c075436e47..1fdf92ed552 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -36,13 +36,13 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void ToggleButton::Load(rapidxml::xml_node<char> *node) {
- Button::Load(node);
+void ToggleButton::load(rapidxml::xml_node<char> *node) {
+ Button::load(node);
loadImgKey(on, "on", node);
loadImgKey(off, "off", node);
if (nodeValid("offset", node))
- offset.Load(node->first_node("offset"));
+ offset.load(node->first_node("offset"));
}
void ToggleButton::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index bf2f3092996..7d98e6274b2 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -58,7 +58,7 @@ public:
}
~ToggleButton() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
#if 0
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index 9465f19ae4c..4a19af5d4a0 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -42,11 +42,11 @@ void TraitButton::Init(const TraitButton &ref, const int &XOffset, const int &YO
offset = ref.offset;
}
-void TraitButton::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- StateButton::Load(node, echo);
+void TraitButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
+ StateButton::load(node, echo);
if (nodeValid("offset", node))
- offset.Load(node->first_node("offset"), echo);
+ offset.load(node->first_node("offset"), echo);
}
void TraitButton::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
diff --git a/engines/crab/ui/TraitButton.h b/engines/crab/ui/TraitButton.h
index 5f5fd7738a3..e8b897d0ce7 100644
--- a/engines/crab/ui/TraitButton.h
+++ b/engines/crab/ui/TraitButton.h
@@ -51,7 +51,7 @@ public:
~TraitButton() {}
void Init(const TraitButton &ref, const int &XOffset = 0, const int &YOffset = 0);
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 2cd2d08eb52..5300535ef56 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
-void TraitMenu::Load(rapidxml::xml_node<char> *node) {
+void TraitMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
loadNum(rows, "rows", dimnode);
@@ -44,13 +44,13 @@ void TraitMenu::Load(rapidxml::xml_node<char> *node) {
}
if (nodeValid("ref", node))
- ref.Load(node->first_node("ref"));
+ ref.load(node->first_node("ref"));
if (nodeValid("inc", node))
- inc.Load(node->first_node("inc"));
+ inc.load(node->first_node("inc"));
if (nodeValid("desc", node))
- desc.Load(node->first_node("desc"));
+ desc.load(node->first_node("desc"));
for (unsigned int i = 0; i < size; ++i) {
TraitButton b;
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index a98e1876aef..33e64cb9c9f 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -72,7 +72,7 @@ public:
void Reset() { select = -1; }
void Clear();
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const pyrodactyl::people::Person *obj);
void HandleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event);
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index c4a06c8b998..3743cc01464 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -57,18 +57,18 @@ Button::Button() {
//------------------------------------------------------------------------
// Purpose: Load a new Button from a file
//------------------------------------------------------------------------
-void Button::Load(rapidxml::xml_node<char> *node, const bool &echo) {
- img.Load(node, echo);
- Element::Load(node, img.normal, echo);
+void Button::load(rapidxml::xml_node<char> *node, const bool &echo) {
+ img.load(node, echo);
+ Element::load(node, img.normal, echo);
loadNum(se_click, "click", node, echo);
loadNum(se_hover, "hover", node, echo);
if (nodeValid("hotkey", node, false))
- hotkey.Load(node->first_node("hotkey"));
+ hotkey.load(node->first_node("hotkey"));
- tooltip.Load(node->first_node("tooltip"), this);
- caption.Load(node->first_node("caption"), this);
+ tooltip.load(node->first_node("tooltip"), this);
+ caption.load(node->first_node("caption"), this);
visible = true;
canmove = false;
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index f772e3b3ef8..cf4ed3d91ac 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -64,7 +64,7 @@ struct ButtonImage {
hover = 0;
}
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true) {
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true) {
if (nodeValid(node)) {
loadImgKey(normal, "img_b", node, echo);
loadImgKey(select, "img_s", node, echo);
@@ -109,7 +109,7 @@ public:
void Reset();
void SetUI(Rect *parent = NULL);
- void Load(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, const bool &echo = true);
void Init(const Button &ref, const int &XOffset = 0, const int &YOffset = 0);
void Img(Button &b) { img = b.img; }
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index 0fb9e5817bf..35d41017465 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -45,16 +45,16 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
// Purpose: Load stuff
//------------------------------------------------------------------------
-void GameDialogBox::Load(rapidxml::xml_node<char> *node) {
+void GameDialogBox::load(rapidxml::xml_node<char> *node) {
loadImgKey(bg, "bg", node);
loadImgKey(bg_p, "bg_p", node);
- pos.Load(node, bg);
+ pos.load(node, bg);
if (nodeValid("text", node))
- text.Load(node->first_node("text"), &pos);
+ text.load(node->first_node("text"), &pos);
if (nodeValid("button", node))
- button.Load(node->first_node("button"));
+ button.load(node->first_node("button"));
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index 0b42df0f1a4..b77e4fd4a78 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -67,7 +67,7 @@ public:
}
~GameDialogBox() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(pyrodactyl::event::Info &info, Common::String &message);
void Draw(const bool &player);
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index e9440b099b8..e74d7041c20 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -52,14 +52,14 @@ void Element::Init(const int &X, const int &Y, const Align &align_x, const Align
}
}
-void Element::BasicLoad(rapidxml::xml_node<char> *node, const bool &echo) {
- raw.Load(node, echo);
+void Element::Basicload(rapidxml::xml_node<char> *node, const bool &echo) {
+ raw.load(node, echo);
loadAlign(align.x, node, echo, "align_x");
loadAlign(align.y, node, echo, "align_y");
}
-void Element::Load(rapidxml::xml_node<char> *node, ImageKey img, const bool &echo) {
- BasicLoad(node, echo);
+void Element::load(rapidxml::xml_node<char> *node, ImageKey img, const bool &echo) {
+ Basicload(node, echo);
if (node->first_attribute("w") == NULL)
w = g_engine->_imageManager->GetTexture(img).W();
@@ -74,8 +74,8 @@ void Element::Load(rapidxml::xml_node<char> *node, ImageKey img, const bool &ech
SetUI();
}
-void Element::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
- BasicLoad(node, echo);
+void Element::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
+ Basicload(node, echo);
loadNum(w, "w", node, false);
loadNum(h, "h", node, false);
SetUI(parent);
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index a13ff5ccb7e..85a9c0e94f4 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -50,7 +50,7 @@ class Element : public Rect {
Align x, y;
} align;
- void BasicLoad(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void Basicload(rapidxml::xml_node<char> *node, const bool &echo = true);
public:
Element() {
@@ -71,10 +71,10 @@ public:
}
// The parent is the object inside which the element exists
- void Load(rapidxml::xml_node<char> *node, ImageKey img, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, ImageKey img, const bool &echo = true);
// The parent is the object inside which the element exists
- void Load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
void SetUI(Rect *parent = NULL);
};
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 4de537a7544..db8f49c8ade 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -35,9 +35,9 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
-void EmotionIndicator::Load(rapidxml::xml_node<char> *node) {
+void EmotionIndicator::load(rapidxml::xml_node<char> *node) {
if (nodeValid("text", node))
- text.Load(node->first_node("text"));
+ text.load(node->first_node("text"));
}
void EmotionIndicator::Draw(const int &select) {
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index ebf1ac7ee54..63c433a1ee7 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -49,7 +49,7 @@ struct EmotionIndicator {
EmotionIndicator() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(const int &select);
void SetUI();
};
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 5e2e84f3657..958a566cc33 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -40,35 +40,35 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
-void HUD::Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm) {
+void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("hud");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("tray", node))
- menu.Load(node->first_node("tray"));
+ menu.load(node->first_node("tray"));
- pause.Load(node->first_node("pause"));
- gom.Load(node->first_node("game_over"));
- back.Load(node->first_node("back"));
- // health.Load(node->first_node("health"));
+ pause.load(node->first_node("pause"));
+ gom.load(node->first_node("game_over"));
+ back.load(node->first_node("back"));
+ // health.load(node->first_node("health"));
if (nodeValid("notify", node)) {
rapidxml::xml_node<char> *notifynode = node->first_node("notify");
loadImgKey(g_engine->_imageManager->notify, "img", notifynode);
- tn.Load(notifynode);
- pdm.Load(notifynode);
+ tn.load(notifynode);
+ pdm.load(notifynode);
if (nodeValid("anim", notifynode)) {
rapidxml::xml_node<char> *animnode = notifynode->first_node("anim");
loadImgKey(notify_anim, "img", animnode);
- clip.Load(animnode);
+ clip.load(animnode);
- timer.Load(animnode, "delay");
+ timer.load(animnode, "delay");
timer.Start();
}
}
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index ee08218009a..ac795b94a6a 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -98,7 +98,7 @@ public:
void State(const int &val);
- void Load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
+ void load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
HUDSignal HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index a73376de201..8d188ca3c95 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -39,22 +39,22 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
// Purpose: Load game
//------------------------------------------------------------------------
-void Journal::Load(const Common::String &filename) {
+void Journal::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("objectives");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.Load(node->first_node("bg"));
+ bg.load(node->first_node("bg"));
if (nodeValid("map", node))
- bu_map.Load(node->first_node("map"));
+ bu_map.load(node->first_node("map"));
if (nodeValid("category", node))
- category.Load(node->first_node("category"));
+ category.load(node->first_node("category"));
if (nodeValid("quest_list", node))
- ref.Load(node->first_node("quest_list"));
+ ref.load(node->first_node("quest_list"));
category.UseKeyboard(true);
}
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 0d8a3dfeb83..671fa347520 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -94,7 +94,7 @@ public:
Journal() { select = 0; }
~Journal() {}
- void Load(const Common::String &filename);
+ void load(const Common::String &filename);
void Draw(const Common::String &id);
// Return true if "go to map" is selected
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 32506aab2bf..c54c83ee699 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
// Purpose: Load stuff that can't be modified by the user
//------------------------------------------------------------------------
-void Map::Load(const Common::String &filename, pyrodactyl::event::Info &info) {
+void Map::load(const Common::String &filename, pyrodactyl::event::Info &info) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("map");
@@ -54,7 +54,7 @@ void Map::Load(const Common::String &filename, pyrodactyl::event::Info &info) {
}
if (nodeValid("fg", node))
- fg.Load(node->first_node("fg"));
+ fg.load(node->first_node("fg"));
if (nodeValid("dim", node)) {
loadNum(camera.w, "x", node->first_node("dim"));
@@ -62,22 +62,22 @@ void Map::Load(const Common::String &filename, pyrodactyl::event::Info &info) {
}
if (nodeValid("pos", node))
- pos.Load(node->first_node("pos"));
+ pos.load(node->first_node("pos"));
if (nodeValid("scroll", node))
- scroll.Load(node->first_node("scroll"));
+ scroll.load(node->first_node("scroll"));
if (nodeValid("marker", node))
- marker.Load(node->first_node("marker"));
+ marker.load(node->first_node("marker"));
if (nodeValid("title", node))
- title.Load(node->first_node("title"));
+ title.load(node->first_node("title"));
if (nodeValid("locations", node))
- travel.Load(node->first_node("locations"));
+ travel.load(node->first_node("locations"));
if (nodeValid("overlay", node))
- bu_overlay.Load(node->first_node("overlay"));
+ bu_overlay.load(node->first_node("overlay"));
}
}
@@ -389,8 +389,8 @@ void Map::SetImage(const unsigned int &val, const bool &force) {
img_bg.Delete();
img_overlay.Delete();
- img_bg.Load(map[cur].path_bg);
- img_overlay.Load(map[cur].path_overlay);
+ img_bg.load(map[cur].path_bg);
+ img_overlay.load(map[cur].path_overlay);
size.x = img_bg.W();
size.y = img_bg.H();
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 06dad6a1db5..af043155d6f 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -118,7 +118,7 @@ public:
img_overlay.Delete();
}
- void Load(const Common::String &filename, pyrodactyl::event::Info &info);
+ void load(const Common::String &filename, pyrodactyl::event::Info &info);
void Draw(pyrodactyl::event::Info &info);
bool HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
diff --git a/engines/crab/ui/mapbutton.h b/engines/crab/ui/mapbutton.h
index 6cd2caa8ee3..4fa129f386c 100644
--- a/engines/crab/ui/mapbutton.h
+++ b/engines/crab/ui/mapbutton.h
@@ -50,12 +50,12 @@ public:
MapButton() {}
~MapButton() {}
- void Load(rapidxml::xml_node<char> *node) {
- Button::Load(node);
+ void load(rapidxml::xml_node<char> *node) {
+ Button::load(node);
loadStr(loc, "id", node);
if (nodeValid("unlock", node, false))
- unlock.Load(node->first_node("unlock"));
+ unlock.load(node->first_node("unlock"));
}
};
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 02c5bf440dd..55300ce644b 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -238,11 +238,11 @@ public:
//------------------------------------------------------------------------
// Purpose: Load the menu from a file
//------------------------------------------------------------------------
- void Load(rapidxml::xml_node<char> *node) {
+ void load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
T b;
- b.Load(n);
+ b.load(n);
element.push_back(b);
}
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index a9efdc7fdfb..2f82cecb033 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -50,33 +50,33 @@ QuestMenu::QuestMenu() {
//------------------------------------------------------------------------
// Purpose: Load layout from file
//------------------------------------------------------------------------
-void QuestMenu::Load(rapidxml::xml_node<char> *node) {
+void QuestMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
if (nodeValid("menu", node))
- menu.Load(node->first_node("menu"));
+ menu.load(node->first_node("menu"));
if (nodeValid("tab", node)) {
rapidxml::xml_node<char> *tabnode = node->first_node("tab");
loadNum(font, "font", tabnode);
loadAlign(align, tabnode);
- off_title.Load(tabnode);
- off_unread.Load(tabnode->first_node("unread"));
+ off_title.load(tabnode);
+ off_unread.load(tabnode->first_node("unread"));
if (nodeValid("normal", tabnode)) {
rapidxml::xml_node<char> *nornode = tabnode->first_node("normal");
- img_n.Load(nornode);
+ img_n.load(nornode);
//loadColor(col_n, nornode);
}
if (nodeValid("select", tabnode)) {
rapidxml::xml_node<char> *selnode = tabnode->first_node("select");
- img_s.Load(selnode);
+ img_s.load(selnode);
//loadColor(col_s, selnode);
}
}
if (nodeValid("text", node))
- text.Load(node->first_node("text"));
+ text.load(node->first_node("text"));
}
}
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 9de1191dd15..009e0354414 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -74,7 +74,7 @@ public:
QuestMenu();
~QuestMenu() {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
void Draw(Button &bu_map);
bool HandleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event);
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 1a8f7dfe52d..7b24084518b 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -37,10 +37,10 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
-void Slider::Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val) {
+void Slider::load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val) {
if (nodeValid(node)) {
- knob.Load(node->first_node("knob"), false);
- bar.Load(node->first_node("bar"));
+ knob.load(node->first_node("knob"), false);
+ bar.load(node->first_node("bar"));
knob.y = bar.y;
knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).W();
@@ -51,7 +51,7 @@ void Slider::Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
max = Max;
Value(Val);
- caption.Load(node->first_node("caption"), &bar);
+ caption.load(node->first_node("caption"), &bar);
}
CreateBackup();
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 625be5e00c7..17ac2546635 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -66,7 +66,7 @@ public:
}
~Slider() {}
- void Load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val);
+ void load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val);
bool HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 20f00840615..47f4f3c713d 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -41,8 +41,8 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
using namespace pyrodactyl::input;
-void TextArea::Load(rapidxml::xml_node<char> *node) {
- if (TextData::Load(node)) {
+void TextArea::load(rapidxml::xml_node<char> *node) {
+ if (TextData::load(node)) {
loadStr(text, "text", node);
loadNum(size, "size", node);
@@ -51,7 +51,7 @@ void TextArea::Load(rapidxml::xml_node<char> *node) {
loadNum(se_accept, "accept", node);
if (nodeValid("caption", node))
- title.Load(node->first_node("caption"), this);
+ title.load(node->first_node("caption"), this);
}
}
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 954a42b3a36..11c9c1b95ec 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -66,7 +66,7 @@ public:
}
~TextArea(void) {}
- void Load(rapidxml::xml_node<char> *node);
+ void load(rapidxml::xml_node<char> *node);
bool HandleEvents(const Common::Event &Event, bool numbers_only = false);
#if 0
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index c0751502817..558d4adad2e 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -36,9 +36,9 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
-bool TextData::Load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
+bool TextData::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
if (nodeValid(node, echo)) {
- Element::Load(node, parent, echo);
+ Element::load(node, parent, echo);
LoadFontKey(font, "font", node);
loadNum(col, "color", node);
loadAlign(align, node, false);
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index 39f21c83a72..d32df7f0c4d 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -51,7 +51,7 @@ public:
y = Y;
}
- bool Load(rapidxml::xml_node<char> *node, const bool &echo = true) {
+ bool load(rapidxml::xml_node<char> *node, const bool &echo = true) {
return loadNum(x, "x", node, echo) && loadNum(y, "y", node, echo);
}
@@ -103,14 +103,14 @@ public:
T x, y, z;
Vector3D(T X = 0, T Y = 0, T Z = 0) { Set(X, Y, Z); }
- Vector3D(rapidxml::xml_node<char> *node) { Load(node); }
+ Vector3D(rapidxml::xml_node<char> *node) { load(node); }
void Set(T X = 0, T Y = 0, T Z = 0) {
x = X;
y = Y;
z = Z;
}
- bool Load(rapidxml::xml_node<char> *node) { return loadXYZ<T>(x, y, z, node); }
+ bool load(rapidxml::xml_node<char> *node) { return loadXYZ<T>(x, y, z, node); }
// operators
void operator+=(const Vector3D &v) {
Commit: 05ded6201d4591931927b98285519d4e82d959ba
https://github.com/scummvm/scummvm/commit/05ded6201d4591931927b98285519d4e82d959ba
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename Draw() to draw() across CRAB codebase
Changed paths:
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/Shape.cpp
engines/crab/Shape.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/animation/AnimationFrame.cpp
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/imageeffect.cpp
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/app.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gamestate_container.h
engines/crab/image/Image.cpp
engines/crab/image/Image.h
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
engines/crab/item/Item.cpp
engines/crab/item/Item.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/item/StatPreview.cpp
engines/crab/item/StatPreview.h
engines/crab/level/level.h
engines/crab/level/level_draw.cpp
engines/crab/level/level_objects.cpp
engines/crab/level/level_objects.h
engines/crab/level/talknotify.cpp
engines/crab/level/talknotify.h
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/splash.cpp
engines/crab/splash.h
engines/crab/stat/StatDrawHelper.cpp
engines/crab/stat/StatDrawHelper.h
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/AlphaImage.h
engines/crab/ui/Caption.cpp
engines/crab/ui/Caption.h
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/ClipButton.cpp
engines/crab/ui/ClipButton.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/HealthIndicator.h
engines/crab/ui/HoverInfo.cpp
engines/crab/ui/HoverInfo.h
engines/crab/ui/ImageData.cpp
engines/crab/ui/ImageData.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/ItemDesc.h
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/ParagraphData.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SectionHeader.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/TextData.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitButton.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/emotion.cpp
engines/crab/ui/emotion.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
engines/crab/ui/textdata.cpp
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 9b00cdf392e..f72f7bdfa24 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -51,16 +51,16 @@ void LoadingScreen::load() {
}
}
-void LoadingScreen::Draw() {
+void LoadingScreen::draw() {
// Change to a random screen
Change();
// Draw the current screen
if (cur < screen.size())
- screen[cur].Draw();
+ screen[cur].draw();
// Draw the loading text
- text.Draw((g_engine->_screenSettings->cur.w - text.W()) / 2, (g_engine->_screenSettings->cur.h - text.H()) / 2);
+ text.draw((g_engine->_screenSettings->cur.w - text.W()) / 2, (g_engine->_screenSettings->cur.h - text.H()) / 2);
g_engine->_screen->update();
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 1ef6d274396..e9fa82b26bb 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -45,7 +45,7 @@ class LoadingScreen {
Screen(rapidxml::xml_node<char> *node) { bg.load(node, "bg"); }
void Delete() { bg.Delete(); }
- void Draw() { bg.Draw((g_engine->_screenSettings->cur.w - bg.W()) / 2, (g_engine->_screenSettings->cur.h - bg.H()) / 2); }
+ void draw() { bg.draw((g_engine->_screenSettings->cur.w - bg.W()) / 2, (g_engine->_screenSettings->cur.h - bg.H()) / 2); }
};
// The different loading screens
@@ -66,7 +66,7 @@ public:
}
void load();
- void Draw();
+ void draw();
void Dim();
void Quit();
};
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 349de03c7cd..23b94c52826 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -257,7 +257,7 @@ bool Polygon2D::Contains(const float &X, const float &Y) {
return result;
}
-void Polygon2D::Draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
+void Polygon2D::draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
Vector2f p1, p2;
for (unsigned int i = 0; i < point.size(); i++) {
p1 = point[i];
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index b2403031082..c39f98716d3 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -89,7 +89,7 @@ public:
// Calculate the projection of a polygon on an axis and returns it as a [min, max] interval
void Project(const Vector2f &axis, float &min, float &max) const;
- void Draw(const int &XOffset = 0, const int &YOffset = 0,
+ void draw(const int &XOffset = 0, const int &YOffset = 0,
const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0.0f, const uint8 &a = 255);
};
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 1e088fe5d28..b1b55680c4c 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -107,7 +107,7 @@ void Rect::Flip(const TextureFlipType &flip, const Vector2i &axis) {
y = 2 * axis.y - y - h;
}
-void Rect::Draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
+void Rect::draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
int X = x + XOffset, Y = y + YOffset;
DrawLine(X, Y, X + w, Y, r, g, b, a);
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index fb452aa7a48..c36960e0c00 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -83,7 +83,7 @@ struct Rect {
void Flip(const TextureFlipType &flip, const Vector2i &axis);
// Draw the borders of the rectangle
- void Draw(const int &XOffset = 0, const int &YOffset = 0, const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0, const uint8 &a = 255);
+ void draw(const int &XOffset = 0, const int &YOffset = 0, const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0, const uint8 &a = 255);
// Check if a rectangle is the same as another
bool operator==(const Rect &r) { return r.x == x && r.y == y && r.w == w && r.h == h; }
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index 94dc43f235b..709a4dee40b 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -75,11 +75,11 @@ bool Shape::Contains(const Vector2i &pos) {
return false;
}
-void Shape::Draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
+void Shape::draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
if (type == SHAPE_POLYGON)
- poly.Draw(XOffset, YOffset, r, g, b, a);
+ poly.draw(XOffset, YOffset, r, g, b, a);
else
- rect.Draw(XOffset, YOffset, r, g, b, a);
+ rect.draw(XOffset, YOffset, r, g, b, a);
}
} // End of namespace Crab
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index b6ce77d768a..ec33994dcc3 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -77,7 +77,7 @@ public:
bool Contains(const Vector2i &pos);
- void Draw(const int &XOffset = 0, const int &YOffset = 0,
+ void draw(const int &XOffset = 0, const int &YOffset = 0,
const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0, const uint8 &a = 255);
};
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index fb49fca3109..5d51f4d4b4d 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -252,24 +252,24 @@ void TMXMap::DrawDebug(const Rect &camera) {
using namespace pyrodactyl::text;
for (auto i = area_trig.begin(); i != area_trig.end(); ++i)
- i->Draw(-camera.x, -camera.y, 0, 0, 254, 254);
+ i->draw(-camera.x, -camera.y, 0, 0, 254, 254);
for (auto i = area_exit.begin(); i != area_exit.end(); ++i)
- i->dim.Draw(-camera.x, -camera.y, 0, 254, 254, 254);
+ i->dim.draw(-camera.x, -camera.y, 0, 254, 254, 254);
for (auto i = prop.begin(); i != prop.end(); ++i)
- i->pos.Draw(-camera.x, -camera.y, 254, 0, 254, 254);
+ i->pos.draw(-camera.x, -camera.y, 254, 0, 254, 254);
for (auto i = area_nowalk.begin(); i != area_nowalk.end(); ++i)
- i->Draw(-camera.x, -camera.y, 254, 0, 0, 254);
+ i->draw(-camera.x, -camera.y, 254, 0, 0, 254);
for (auto i = area_music.begin(); i != area_music.end(); ++i)
- i->Draw(-camera.x, -camera.y, 254, 254, 0, 254);
+ i->draw(-camera.x, -camera.y, 254, 254, 0, 254);
for (auto i = area_stairs.begin(); i != area_stairs.end(); ++i) {
- i->Draw(-camera.x, -camera.y, 0, 254, 0, 254);
- //g_engine->_textManager->Draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x), 0);
- //g_engine->_textManager->Draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y), 0);
+ i->draw(-camera.x, -camera.y, 0, 254, 0, 254);
+ //g_engine->_textManager->draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x), 0);
+ //g_engine->_textManager->draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y), 0);
}
// Draw the pathfinding grid (SZ)
@@ -278,17 +278,17 @@ void TMXMap::DrawDebug(const Rect &camera) {
for(int y = 0; y < grid->GetDimensions().y; ++y)
{
if(grid->GetNodeAtCoords(x, y)->GetMovementCost() < 0.0f)
- grid->GetNodeAtCoords(x, y)->GetRect().Draw(-camera.x, -camera.y, 0, 0, 0, 254);
+ grid->GetNodeAtCoords(x, y)->GetRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
else
- grid->GetNodeAtCoords(x, y)->GetRect().Draw(-camera.x, -camera.y, 200, 200, 0, 254);
+ grid->GetNodeAtCoords(x, y)->GetRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
}
}*/
for (auto i = layer.begin(); i != layer.end(); ++i)
- i->pos.Draw(-camera.x, -camera.y, 254, 216, 0);
+ i->pos.draw(-camera.x, -camera.y, 254, 216, 0);
- area_walk.Draw(-camera.x, -camera.y, 254, 254, 254, 254);
- // g_engine->_textManager->Draw(0, 200, NumberToString(sprite_layer), 0);
+ area_walk.draw(-camera.x, -camera.y, 254, 254, 254, 254);
+ // g_engine->_textManager->draw(0, 200, NumberToString(sprite_layer), 0);
// Use this if you want to draw poly lines in debug
/*bool start = true;
@@ -305,8 +305,8 @@ void TMXMap::DrawDebug(const Rect &camera) {
DrawLine(prev.x - camera.x, prev.y - camera.y, j->x - camera.x, j->y - camera.y, 0, 0, 0, 254);
- g_engine->_textManager->Draw(j->x - camera.x + 100, j->y - camera.y, NumberToString(j->x), 0);
- g_engine->_textManager->Draw(j->x - camera.x + 200, j->y - camera.y, NumberToString(j->y), 0);
+ g_engine->_textManager->draw(j->x - camera.x + 100, j->y - camera.y, NumberToString(j->x), 0);
+ g_engine->_textManager->draw(j->x - camera.x + 200, j->y - camera.y, NumberToString(j->y), 0);
prev = *j;
}
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index c74a1de36f1..66cc8c5f9c6 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -81,12 +81,12 @@ void TileSetGroup::load(const Common::String &path, rapidxml::xml_node<char> *no
}
}
-void TileSet::Draw(const Vector2i &pos, const TileInfo &tile) {
+void TileSet::draw(const Vector2i &pos, const TileInfo &tile) {
if (tile.gid != 0) {
clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
- img.Draw(pos.x, pos.y, &clip, tile.flip);
+ img.draw(pos.x, pos.y, &clip, tile.flip);
}
}
@@ -95,7 +95,7 @@ void TileSet::PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::Manag
clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
- img.Draw(pos.x, pos.y, &clip, tile.flip, surf);
+ img.draw(pos.x, pos.y, &clip, tile.flip, surf);
}
}
@@ -174,7 +174,7 @@ void TileSetGroup::ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i
for (int y = start.y; y < finish.y; ++y) {
for (int i = tileset.size() - 1; i >= 0; --i)
if (layer.tile[x][y].gid >= tileset[i].first_gid) {
- tileset[i].Draw(v, layer.tile[x][y]);
+ tileset[i].draw(v, layer.tile[x][y]);
break;
}
@@ -186,9 +186,9 @@ void TileSetGroup::ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i
}
}
-void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img) {
+void TileSetGroup::draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img) {
if (layer.type == LAYER_IMAGE)
- layer.img.Draw(-1.0f * camera.x * layer.rate.x, -1.0f * camera.y * layer.rate.y);
+ layer.img.draw(-1.0f * camera.x * layer.rate.x, -1.0f * camera.y * layer.rate.y);
else if (layer.type == LAYER_PARALLAX) {
// The row and column we start drawing at
start.x = 0;
@@ -205,7 +205,7 @@ void TileSetGroup::Draw(MapLayer &layer, const Rect &camera, const Vector2i &til
for (int y = start.y; y < finish.y; ++y) {
for (int i = tileset.size() - 1; i >= 0; --i)
if (layer.tile[x][y].gid >= tileset[i].first_gid) {
- tileset[i].Draw(v, layer.tile[x][y]);
+ tileset[i].draw(v, layer.tile[x][y]);
break;
}
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 4d6871fb41c..1c963a9d5b2 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -77,7 +77,7 @@ struct TileSet {
}
void load(const Common::String &path, rapidxml::xml_node<char> *node);
- void Draw(const Vector2i &pos, const TileInfo &tile);
+ void draw(const Vector2i &pos, const TileInfo &tile);
void PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf);
};
@@ -96,7 +96,7 @@ public:
void Reset();
void load(const Common::String &path, rapidxml::xml_node<char> *node);
- void Draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img);
+ void draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img);
void PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf);
void ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
};
diff --git a/engines/crab/animation/AnimationFrame.cpp b/engines/crab/animation/AnimationFrame.cpp
index 30837b44182..dd56112d164 100644
--- a/engines/crab/animation/AnimationFrame.cpp
+++ b/engines/crab/animation/AnimationFrame.cpp
@@ -64,7 +64,7 @@ void AnimationFrame::reset() {
}
void AnimationFrame::draw(const uint32 ×tamp) {
- warning("STUB: AnimationFrame::Draw()");
+ warning("STUB: AnimationFrame::draw()");
#if 0
// Only draw the frame in the specified duration
@@ -74,8 +74,8 @@ void AnimationFrame::draw(const uint32 ×tamp) {
SDL_SetRenderDrawColor(gRenderer, col.r, col.g, col.b, col.a);
SDL_RenderFillRect(gRenderer, NULL);
- g_engine->_imageManager->Draw(x, y, img);
- text.Draw();
+ g_engine->_imageManager->draw(x, y, img);
+ text.draw();
}
#endif
}
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 825adde1931..d36096560e5 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -113,20 +113,20 @@ void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const Common
//------------------------------------------------------------------------
// Purpose: Draw functions
//------------------------------------------------------------------------
-void PopUp::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
+void PopUp::draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
if (show) {
if (x + pop.x < camera.w / 3)
- g_engine->_textManager->Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
else if (x + pop.x > (2 * camera.w) / 3)
- g_engine->_textManager->Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
else
- g_engine->_textManager->Draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
}
}
-void PopUpCollection::Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
+void PopUpCollection::draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
if (cur >= 0 && (unsigned int)cur < element.size())
- element[cur].Draw(x, y, pop, camera);
+ element[cur].draw(x, y, pop, camera);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index e380c20cba5..1d95e42e587 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -82,7 +82,7 @@ struct PopUp {
}
void load(rapidxml::xml_node<char> *node);
- void Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
+ void draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
// return true if we should proceed to next event, false otherwise
bool InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
@@ -118,7 +118,7 @@ struct PopUpCollection {
void InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
- void Draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
+ void draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
index 59947dea43c..d621b7fe9db 100644
--- a/engines/crab/animation/imageeffect.cpp
+++ b/engines/crab/animation/imageeffect.cpp
@@ -44,7 +44,7 @@ void ImageEffect::load(rapidxml::xml_node<char> *node) {
void ImageEffect::draw(const int &xOffset, const int &yOffset) {
if (_visible)
- g_engine->_imageManager->Draw(x + xOffset, y + yOffset, _img);
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _img);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index fca50eaf475..2da31b8d6e7 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -239,7 +239,7 @@ Vector2i Sprite::CamFocus() {
//------------------------------------------------------------------------
// Purpose: Draw the sprite
//------------------------------------------------------------------------
-void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
+void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
@@ -249,26 +249,26 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
ShadowOffset sh = anim_set.shadow(dir);
if (sh.valid) {
// Draw using custom offset
- g_engine->_imageManager->Draw(x + clip.w / 2 - anim_set._shadow.size.x + sh.x,
+ g_engine->_imageManager->draw(x + clip.w / 2 - anim_set._shadow.size.x + sh.x,
y + clip.h - anim_set._shadow.size.y + sh.y,
anim_set._shadow.img);
} else {
// Draw using default offset
- g_engine->_imageManager->Draw(x + clip.w / 2 - anim_set._shadow.size.x + anim_set._shadow.offset.x,
+ g_engine->_imageManager->draw(x + clip.w / 2 - anim_set._shadow.size.x + anim_set._shadow.offset.x,
y + clip.h - anim_set._shadow.size.y + anim_set._shadow.offset.y,
anim_set._shadow.img);
}
- g_engine->_imageManager->Draw(x, y, image, &clip, anim_set.flip(dir));
+ g_engine->_imageManager->draw(x, y, image, &clip, anim_set.flip(dir));
img_eff.draw(x, y);
if (GameDebug) {
// Nice boxes for the frames and box_v, box_d
Rect bounds = BoundRect(), vul = BoxV(), dmg = BoxD(), debugpos = PosRect();
- bounds.Draw(-camera.x, -camera.y);
- debugpos.Draw(-camera.x, -camera.y, 255, 255, 255);
- dmg.Draw(-camera.x, -camera.y, 255, 0, 0);
- vul.Draw(-camera.x, -camera.y, 0, 0, 255);
+ bounds.draw(-camera.x, -camera.y);
+ debugpos.draw(-camera.x, -camera.y, 255, 255, 255);
+ dmg.draw(-camera.x, -camera.y, 255, 0, 0);
+ vul.draw(-camera.x, -camera.y, 0, 0, 255);
FightMove fm;
if (anim_set._fight.nextMove(fm)) {
@@ -278,17 +278,17 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
actual_range.w = fm._ai._range.val[dir].w;
actual_range.h = fm._ai._range.val[dir].h;
- actual_range.Draw(-camera.x, -camera.y, 255, 0, 255);
+ actual_range.draw(-camera.x, -camera.y, 255, 0, 255);
}
/*int health = 0;
info.StatGet(id, pyrodactyl::stat::STAT_HEALTH, health);
- g_engine->_textManager->Draw(x + 60.0f, y - 100.0f, NumberToString(health), 0);
+ g_engine->_textManager->draw(x + 60.0f, y - 100.0f, NumberToString(health), 0);
pyrodactyl::people::PersonState state = info.State(id);
- g_engine->_textManager->Draw(x, y - 60.0f, NumberToString(state), 0);
+ g_engine->_textManager->draw(x, y - 60.0f, NumberToString(state), 0);
- g_engine->_textManager->Draw(x + 120.0f, y - 60.0f, NumberToString(ai_data.dest.y), 0);*/
+ g_engine->_textManager->draw(x + 120.0f, y - 60.0f, NumberToString(ai_data.dest.y), 0);*/
if (pathing.m_vSolution.size() > 0) {
for (auto iter = pathing.m_vSolution.begin(); iter != pathing.m_vSolution.end(); ++iter) {
@@ -301,25 +301,25 @@ void Sprite::Draw(pyrodactyl::event::Info &info, const Rect &camera) {
}
if (nextToWall)
- (*iter)->GetRect().Draw(-camera.x, -camera.y, 0, 0, 0, 254);
+ (*iter)->GetRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
else
- (*iter)->GetRect().Draw(-camera.x, -camera.y, 200, 200, 0, 254);
+ (*iter)->GetRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
}
- pathing.m_pGoalTile->GetRect().Draw(-camera.x, -camera.y, 0, 0, 200, 254);
- pathing.m_pStartTile->GetRect().Draw(-camera.x, -camera.y, 0, 200, 0, 254);
+ pathing.m_pGoalTile->GetRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
+ pathing.m_pStartTile->GetRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
// Draw adjacencies to the goal tile.
/* for(auto neighbor = pathing.m_pGoalTile->neighborNodes.begin(); neighbor != pathing.m_pGoalTile->neighborNodes.end(); ++neighbor)
{
- (*neighbor)->GetRect().Draw(-camera.x, -camera.y, 200, 0, 0, 254);
+ (*neighbor)->GetRect().draw(-camera.x, -camera.y, 200, 0, 0, 254);
}*/
}
Rect destinationRect = Rect((int)pathing.destination.x - 5,
(int)pathing.destination.y - 5,
10,
10);
- destinationRect.Draw(-camera.x, -camera.y, 0, 200, 0, 254);
+ destinationRect.draw(-camera.x, -camera.y, 0, 200, 0, 254);
}
}
@@ -328,7 +328,7 @@ void Sprite::DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
int x = pos.x - camera.x - anim_set.anchorX(dir) + (anim_set._bounds.w / 2);
int y = pos.y - camera.y - anim_set.anchorY(dir);
- popup.Draw(x, y, pop, camera);
+ popup.draw(x, y, pop, camera);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index bfa202ceca1..3d02be33569 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -188,7 +188,7 @@ public:
void InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
- void Draw(pyrodactyl::event::Info &info, const Rect &camera);
+ void draw(pyrodactyl::event::Info &info, const Rect &camera);
void DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
void Walk(const bool &reset);
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 694fe57933b..dac2e301355 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -252,7 +252,7 @@ void App::Run() {
}
// Do state Drawing
- CurrentState->Draw();
+ CurrentState->draw();
#if 0
if (GameDebug) {
@@ -264,7 +264,7 @@ void App::Run() {
++fpscount;
if (CurrentStateID >= 0)
- g_engine->_textManager->Draw(0, 0, NumberToString(fpsval), 0);
+ g_engine->_textManager->draw(0, 0, NumberToString(fpsval), 0);
}
#endif
if (g_system->getMillis() - lasts > 1000) {
@@ -275,7 +275,7 @@ void App::Run() {
++fpscount;
if (CurrentStateID >= 0)
- g_engine->_textManager->Draw(0, 0, NumberToString(fpsval).c_str(), 0);
+ g_engine->_textManager->draw(0, 0, NumberToString(fpsval).c_str(), 0);
//const Graphics::ManagedSurface *s = g_engine->_renderSurface;
//g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
g_engine->_screen->update();
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 919ee850141..3c22dc11aff 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -185,9 +185,9 @@ public:
// Draw the inventory
void InvDraw(const Common::String &id) {
if (var.contains(money_var))
- inv.Draw(people[id], var[money_var]);
+ inv.draw(people[id], var[money_var]);
else
- inv.Draw(people[id], 0);
+ inv.draw(people[id], 0);
}
// Get whether game is iron man or not
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 5f8e891d2f5..acc47013457 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -315,7 +315,7 @@ void Manager::UpdateDialogBox(Info &info, Level &level) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Manager::Draw(Info &info, HUD &hud, Level &level) {
+void Manager::draw(Info &info, HUD &hud, Level &level) {
if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_ANIM:
@@ -324,32 +324,32 @@ void Manager::Draw(Info &info, HUD &hud, Level &level) {
case EVENT_DIALOG:
g_engine->_imageManager->DimScreen();
if (oh.show_journal) {
- info.journal.Draw(level.PlayerID());
- hud.back.Draw();
+ info.journal.draw(level.PlayerID());
+ hud.back.draw();
} else
- oh.Draw(info, cur_event, cur_event->title, player, cur_sp);
+ oh.draw(info, cur_event, cur_event->title, player, cur_sp);
break;
case EVENT_REPLY:
g_engine->_imageManager->DimScreen();
if (oh.show_journal) {
- info.journal.Draw(level.PlayerID());
- hud.back.Draw();
+ info.journal.draw(level.PlayerID());
+ hud.back.draw();
} else {
- oh.Draw(info, cur_event, cur_event->title, player, cur_sp);
- reply.Draw();
+ oh.draw(info, cur_event, cur_event->title, player, cur_sp);
+ reply.draw();
}
break;
case EVENT_TEXT:
- oh.Draw(info, cur_event, cur_event->title, player, cur_sp);
- textin.Draw();
+ oh.draw(info, cur_event, cur_event->title, player, cur_sp);
+ textin.draw();
break;
case EVENT_SPLASH:
g_engine->_imageManager->DimScreen();
if (intro.show_traits) {
- per.Draw(info, cur_event->title);
- hud.back.Draw();
+ per.draw(info, cur_event->title);
+ hud.back.draw();
} else
- intro.Draw(info, cur_event->dialog, cur_sp, cur_event->state);
+ intro.draw(info, cur_event->dialog, cur_sp, cur_event->state);
break;
default:
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 1629de3040a..40708ace7e2 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -90,7 +90,7 @@ public:
void Init();
void load(rapidxml::xml_node<char> *node, pyrodactyl::ui::ParagraphData &popup);
- void Draw(Info &info, pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level);
+ void draw(Info &info, pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level);
// cur_per is also updated here
void InternalEvents(Info &info, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 7af72ec7a0f..a0647e5dba2 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -115,7 +115,7 @@ void Game::Init(const Common::String &filename) {
bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
if (g_engine->_filePath->level.contains(id)) {
- g_engine->_loadingScreen->Draw();
+ g_engine->_loadingScreen->draw();
// Load the assets local to this level
// If the filename is same as the previous one, skip loading
@@ -499,67 +499,67 @@ void Game::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Game::Draw() {
+void Game::draw() {
if (gem.draw_game)
- level.Draw(info);
+ level.draw(info);
else
g_engine->_imageManager->BlackScreen();
switch (state) {
case STATE_GAME:
if (gem.EventInProgress())
- gem.Draw(info, hud, level);
+ gem.draw(info, hud, level);
else
- hud.Draw(info, level.PlayerID());
+ hud.draw(info, level.PlayerID());
break;
case STATE_PAUSE:
g_engine->_imageManager->DimScreen();
- hud.pause.Draw(hud.back);
- hud.Draw(info, level.PlayerID());
+ hud.pause.draw(hud.back);
+ hud.draw(info, level.PlayerID());
break;
case STATE_MAP:
g_engine->_imageManager->DimScreen();
- map.Draw(info);
- hud.Draw(info, level.PlayerID());
- hud.back.Draw();
+ map.draw(info);
+ hud.draw(info, level.PlayerID());
+ hud.back.draw();
break;
case STATE_JOURNAL:
g_engine->_imageManager->DimScreen();
- info.journal.Draw(level.PlayerID());
- hud.Draw(info, level.PlayerID());
- hud.back.Draw();
+ info.journal.draw(level.PlayerID());
+ hud.draw(info, level.PlayerID());
+ hud.back.draw();
break;
case STATE_CHARACTER:
g_engine->_imageManager->DimScreen();
- gem.per.Draw(info, level.PlayerID());
- hud.Draw(info, level.PlayerID());
- hud.back.Draw();
+ gem.per.draw(info, level.PlayerID());
+ hud.draw(info, level.PlayerID());
+ hud.back.draw();
break;
case STATE_INVENTORY:
g_engine->_imageManager->DimScreen();
info.InvDraw(level.PlayerID());
- hud.Draw(info, level.PlayerID());
- hud.back.Draw();
+ hud.draw(info, level.PlayerID());
+ hud.back.draw();
break;
case STATE_HELP:
g_engine->_imageManager->DimScreen();
- g_engine->_helpScreen->Draw();
- hud.back.Draw();
- hud.Draw(info, level.PlayerID());
+ g_engine->_helpScreen->draw();
+ hud.back.draw();
+ hud.draw(info, level.PlayerID());
break;
case STATE_LOSE_MENU:
- hud.gom.Draw();
+ hud.gom.draw();
break;
case STATE_LOSE_LOAD:
- g_engine->_loadMenu->Draw();
- hud.back.Draw();
+ g_engine->_loadMenu->draw();
+ hud.back.draw();
break;
default:
break;
}
if (GameDebug)
- debug_console.Draw(info);
- g_engine->_mouse->Draw();
+ debug_console.draw(info);
+ g_engine->_mouse->draw();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 5e572cea8ad..e550e2d894f 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -135,7 +135,7 @@ public:
void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
- void Draw();
+ void draw();
void LoadState(Common::SeekableReadStream *stream);
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index c67328582fe..ce68e3f14a7 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -47,7 +47,7 @@ class GameState {
public:
virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
- virtual void Draw() = 0;
+ virtual void draw() = 0;
virtual void SetUI() = 0;
virtual void AutoSave() = 0;
virtual ~GameState(){};
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index bd464f15d95..cff275bac5a 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -119,7 +119,7 @@ bool Image::load(const Image &image, Rect *clip, const TextureFlipType &flip) {
//------------------------------------------------------------------------
// Purpose: Draw a texture to the screen without cropping
//------------------------------------------------------------------------
-void Image::Draw(const int &x, const int &y, Common::Rect *clip, const TextureFlipType &flip) {
+void Image::draw(const int &x, const int &y, Common::Rect *clip, const TextureFlipType &flip) {
Common::Rect srcRect;
if (clip != NULL) {
@@ -186,7 +186,7 @@ Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, ImageRotat
return dest;
}
-void Image::Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip, Graphics::ManagedSurface *surf) {
+void Image::draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip, Graphics::ManagedSurface *surf) {
if (surf == NULL)
surf = g_engine->_screen;
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 9fb66ef1d02..add482c5c18 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -103,8 +103,8 @@ public:
// Draw the openGL texture
- void Draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
- void Draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE, Graphics::ManagedSurface *surf = NULL);
+ void draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+ void draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE, Graphics::ManagedSurface *surf = NULL);
void FastDraw(const int &x, const int &y, Rect *clip = NULL);
// Delete the openGL texture
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index bc1fb9fa84b..321b8e0934d 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -144,17 +144,17 @@ bool ImageManager::ValidTexture(const ImageKey &id) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Common::Rect *clip,
+void ImageManager::draw(const int &x, const int &y, const ImageKey &id, Common::Rect *clip,
const TextureFlipType &flip) {
- GetTexture(id).Draw(x, y, clip, flip);
+ GetTexture(id).draw(x, y, clip, flip);
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ImageManager::Draw(const int &x, const int &y, const ImageKey &id, Rect *clip,
+void ImageManager::draw(const int &x, const int &y, const ImageKey &id, Rect *clip,
const TextureFlipType &flip) {
- GetTexture(id).Draw(x, y, clip, flip);
+ GetTexture(id).draw(x, y, clip, flip);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index 5ef97fec6f3..7a87d8565bb 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -97,9 +97,9 @@ public:
Image &GetTexture(const ImageKey &id);
bool ValidTexture(const ImageKey &id);
- void Draw(const int &x, const int &y, const ImageKey &id,
+ void draw(const int &x, const int &y, const ImageKey &id,
Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
- void Draw(const int &x, const int &y, const ImageKey &id,
+ void draw(const int &x, const int &y, const ImageKey &id,
Rect *clip, const TextureFlipType &flip = FLIP_NONE);
void DimScreen();
@@ -108,7 +108,7 @@ public:
// Draw the notification icon
void NotifyDraw(const int &x, const int &y) {
auto *k = &GetTexture(notify);
- Draw(x - k->W() / 2, y - k->H() / 2, notify);
+ draw(x - k->W() / 2, y - k->H() / 2, notify);
}
};
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index bcea8204f8c..0ade3a5d804 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -121,7 +121,7 @@ void Cursor::HandleEvents(const Common::Event &event) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Cursor::Draw() {
+void Cursor::draw() {
uint8 oldState = state;
state = (hover ? 1 : 0) | (pressed << 1);
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index f5ae8ec3255..acec8be5cdc 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -85,7 +85,7 @@ public:
void load(rapidxml::xml_node<char> *node);
void HandleEvents(const Common::Event &event);
- void Draw();
+ void draw();
bool Pressed() { return pressed; }
};
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 517c1cc5ba1..979ddd1f5f5 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -115,8 +115,8 @@ void Item::StatChange(Person &obj, bool increase) {
obj.stat.Change(i->type, -i->val);
}
-void Item::Draw(const int &x, const int &y) {
- g_engine->_imageManager->Draw(x, y, img);
+void Item::draw(const int &x, const int &y) {
+ g_engine->_imageManager->draw(x, y, img);
}
} // End of namespace Crab
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index 6fd47ec26af..bbd5244635a 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -63,7 +63,7 @@ struct Item {
void StatChange(pyrodactyl::people::Person &obj, bool increase);
void load(rapidxml::xml_node<char> *node);
- void Draw(const int &x, const int &y);
+ void draw(const int &x, const int &y);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 9e0291f4a6a..39ffe37ec47 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -87,9 +87,9 @@ void ItemCollection::HandleEvents(const Common::String &char_id, const SDL_Event
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ItemCollection::Draw(const Common::String &char_id) {
+void ItemCollection::draw(const Common::String &char_id) {
if (item.contains(char_id) > 0)
- item[char_id].Draw(item_info);
+ item[char_id].draw(item_info);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index cdbcde702c3..68de8359f25 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -77,7 +77,7 @@ public:
#endif
void Init(const Common::String &char_id);
- void Draw(const Common::String &char_id);
+ void draw(const Common::String &char_id);
// Requires: id of the character, the item information
void Add(const Common::String &char_id, Item &item_data);
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 8a406ce47ef..5f642dbacb1 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -98,12 +98,12 @@ void ItemMenu::HandleEvents(const SDL_Event &Event, const int &XOffset, const in
//------------------------------------------------------------------------
// Purpose: Draw the slot backgrounds first, then the items
//------------------------------------------------------------------------
-void ItemMenu::Draw(ItemDesc &item_info) {
+void ItemMenu::draw(ItemDesc &item_info) {
if (select_index != -1)
- item_info.Draw(element[select_index].item);
+ item_info.draw(element[select_index].item);
for (auto i = element.begin(); i != element.end(); ++i)
- i->Draw();
+ i->draw();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index c845ee3b355..ff1d46fac29 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -64,7 +64,7 @@ public:
int HoverIndex() { return hover_index; }
- void Draw(pyrodactyl::ui::ItemDesc &item_info);
+ void draw(pyrodactyl::ui::ItemDesc &item_info);
/*pyrodactyl::people::Person &obj, pyrodactyl::stat::StatDrawHelper &helper*/
void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index d015e8cfcbe..cec9abdfcad 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -103,11 +103,11 @@ void ItemSlot::LoadState(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ItemSlot::Draw() {
- StateButton::Draw();
+void ItemSlot::draw() {
+ StateButton::draw();
if (!empty)
- item.Draw(x, y);
+ item.draw(x, y);
if (unread)
g_engine->_imageManager->NotifyDraw(x + w, y);
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index faf86fa214b..1d8a24dffe6 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -78,7 +78,7 @@ public:
void Init(const ItemSlot &ref, const int &XOffset = 0, const int &YOffset = 0);
void load(rapidxml::xml_node<char> *node);
- void Draw();
+ void draw();
pyrodactyl::ui::ButtonAction HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index bbf9fb9d355..4eb8a9fbe50 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -53,12 +53,12 @@ void StatPreview::load(rapidxml::xml_node<char> *node) {
}
}
-void StatPreview::Draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
+void StatPreview::draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
if (enabled) {
int count = 0;
for (auto i = item.bonus.begin(); i != item.bonus.end(); ++i, ++count) {
- stat.Draw(helper.Name(i->type), inc_s.x * count, inc_s.y * count);
- unit.Draw(gStrPool->Get(i->val), inc_u.x * count, inc_u.y * count);
+ stat.draw(helper.Name(i->type), inc_s.x * count, inc_s.y * count);
+ unit.draw(gStrPool->Get(i->val), inc_u.x * count, inc_u.y * count);
}
}
}
diff --git a/engines/crab/item/StatPreview.h b/engines/crab/item/StatPreview.h
index 79dd0996c55..0bba5251e4e 100644
--- a/engines/crab/item/StatPreview.h
+++ b/engines/crab/item/StatPreview.h
@@ -51,7 +51,7 @@ struct StatPreview {
StatPreview() { enabled = false; }
void load(rapidxml::xml_node<char> *node);
- void Draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper);
+ void draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper);
};
} // End of namespace item
} // End of namespace pyrodactyl
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index aa79fb44cc5..ed6bf621012 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -198,7 +198,7 @@ public:
void PreDraw();
void PreDrawObjects(Graphics::ManagedSurface *surf);
- void Draw(pyrodactyl::event::Info &info);
+ void draw(pyrodactyl::event::Info &info);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void LoadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 0b8dcb66467..4638c1fabb6 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -63,7 +63,7 @@ void Level::PreDraw() {
//------------------------------------------------------------------------
// Purpose: Draw the level
//------------------------------------------------------------------------
-void Level::Draw(pyrodactyl::event::Info &info) {
+void Level::draw(pyrodactyl::event::Info &info) {
SetCamera();
SortObjectsToDraw();
@@ -73,7 +73,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
unsigned int layer_count = 0u;
// Draw the terrain layer
- g_engine->_imageManager->tileset.Draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].PosRect(), img);
+ g_engine->_imageManager->tileset.draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].PosRect(), img);
Vector2i pos = objects[player_index].ai_data._dest;
Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
@@ -85,7 +85,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
if ((unsigned int)b->layer > layer_count) // We don't have any sprites to draw at this layer
break;
else if ((unsigned int)b->layer == layer_count && b->Visible())
- b->Draw(info, camera);
+ b->draw(info, camera);
}
// Draw the normal sprites if this is the layer for it
@@ -101,7 +101,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
if ((unsigned int)b->layer > layer_count) // We don't have any sprites to draw at this layer
break;
else if ((unsigned int)b->layer >= layer_count && b->Visible())
- b->Draw(info, camera);
+ b->draw(info, camera);
}
// This is to ensure we don't miss out on drawing sprites
@@ -112,7 +112,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
for (auto &i : fly) {
// Only draw if it is supposed to be flying
if (i.ai_data._walk._enabled)
- i.Draw(info, camera);
+ i.draw(info, camera);
}
// Draw popup text over all level layers
@@ -126,7 +126,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
//(a) hovered over by the mouse, OR
//(b) are in talk range and don't have popup text over their head
if (i.hover || (info.LastPerson() == i.ID() && !i.PopupShow()))
- talk_notify.Draw(info, i, camera);
+ talk_notify.draw(info, i, camera);
}
}
}
@@ -141,7 +141,7 @@ void Level::Draw(pyrodactyl::event::Info &info) {
void Level::DrawObjects(pyrodactyl::event::Info &info) {
// Draw player destination marker
if (objects[player_index].ai_data._dest._active)
- dest_marker.Draw(objects[player_index].ai_data._dest, camera);
+ dest_marker.draw(objects[player_index].ai_data._dest, camera);
Vector2i pos = objects[player_index].ai_data._dest;
Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
@@ -149,7 +149,7 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
if (terrain.prop.empty()) {
for (auto &entry : obj_seq) {
if (entry.second->Visible() && LayerVisible(entry.second))
- entry.second->Draw(info, camera);
+ entry.second->draw(info, camera);
}
} else {
auto a = terrain.prop.begin();
@@ -159,7 +159,7 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
auto obj = b->second;
if (a->pos.y + a->pos.h < obj->Y() + obj->H()) {
for (auto &i : a->boundRect) {
- i.Draw(-camera.x, -camera.y, 128, 128, 0, 255);
+ i.draw(-camera.x, -camera.y, 128, 128, 0, 255);
if (i.Collide(objects[player_index].PosRect())) {
g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
}
@@ -171,7 +171,7 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
++a;
} else {
if (obj->Visible() && LayerVisible(obj))
- obj->Draw(info, camera);
+ obj->draw(info, camera);
++b;
}
}
@@ -180,12 +180,12 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
for (; b != obj_seq.end(); ++b) {
auto obj = b->second;
if (obj->Visible() && LayerVisible(obj))
- obj->Draw(info, camera);
+ obj->draw(info, camera);
}
} else if (b == obj_seq.end()) {
for (; a != terrain.prop.end(); ++a) {
for (auto &i : a->boundRect) {
- i.Draw(-camera.x, -camera.y, 128, 128, 0, 255);
+ i.draw(-camera.x, -camera.y, 128, 128, 0, 255);
if (i.Collide(objects[player_index].PosRect())) {
g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
}
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index 4cddc046da2..dba8e655b08 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -42,8 +42,8 @@ void PlayerDestMarker::load(rapidxml::xml_node<char> *node) {
size.y = g_engine->_imageManager->GetTexture(img).H();
}
-void PlayerDestMarker::Draw(const Vector2i &pos, const Rect &camera) {
- g_engine->_imageManager->Draw(pos.x - (size.x / 2) - camera.x, pos.y - (size.y / 2) - camera.y, img);
+void PlayerDestMarker::draw(const Vector2i &pos, const Rect &camera) {
+ g_engine->_imageManager->draw(pos.x - (size.x / 2) - camera.x, pos.y - (size.y / 2) - camera.y, img);
}
} // End of namespace Crab
diff --git a/engines/crab/level/level_objects.h b/engines/crab/level/level_objects.h
index 8254612649e..f6f5dcad1ca 100644
--- a/engines/crab/level/level_objects.h
+++ b/engines/crab/level/level_objects.h
@@ -58,7 +58,7 @@ struct PlayerDestMarker {
PlayerDestMarker() { img = 0; }
void load(rapidxml::xml_node<char> *node);
- void Draw(const Vector2i &pos, const Rect &camera);
+ void draw(const Vector2i &pos, const Rect &camera);
};
} // End of namespace level
} // End of namespace pyrodactyl
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index 630f77280d3..9624fddbff9 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -43,7 +43,7 @@ void TalkNotify::load(rapidxml::xml_node<char> *node) {
loadNum(col, "col", node);
}
-void TalkNotify::Draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s, const Rect &camera) {
+void TalkNotify::draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s, const Rect &camera) {
Rect rect = s.PosRect();
// Find position to draw name (over the sprite's top edge)
@@ -54,7 +54,7 @@ void TalkNotify::Draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s
// Find the sprite name
Common::String text = info.GetName(s.ID());
- g_engine->_textManager->Draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
+ g_engine->_textManager->draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
}
} // End of namespace Crab
diff --git a/engines/crab/level/talknotify.h b/engines/crab/level/talknotify.h
index ab8d33f5510..896d000094c 100644
--- a/engines/crab/level/talknotify.h
+++ b/engines/crab/level/talknotify.h
@@ -55,7 +55,7 @@ public:
}
void load(rapidxml::xml_node<char> *node);
- void Draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s, const Rect &camera);
+ void draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s, const Rect &camera);
};
} // End of namespace level
} // End of namespace pyrodactyl
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 761a519711f..90c049411d2 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -479,75 +479,75 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
//------------------------------------------------------------------------
// Purpose: Drawing function
//------------------------------------------------------------------------
-void MainMenu::Draw() {
- bg.Draw();
+void MainMenu::draw() {
+ bg.draw();
for (auto &i : lights)
- i.Draw();
+ i.draw();
switch (state) {
case STATE_NORMAL:
// Draw the logo
- logo.Draw();
+ logo.draw();
// Draw the game name and mod path if a mod is loaded
if (g_engine->_filePath->mod_cur != "res/default.xml") {
- g_engine->_textManager->Draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
- //g_engine->_textManager->Draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2 + 50, g_engine->_filePath->mod_cur, 5, 1, ALIGN_CENTER);
+ g_engine->_textManager->draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
+ //g_engine->_textManager->draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2 + 50, g_engine->_filePath->mod_cur, 5, 1, ALIGN_CENTER);
}
- me_main.Draw();
+ me_main.draw();
#ifdef UNREST_DEMO
- g_engine->_textManager->Draw(logo.x + logo.w, logo.y + logo.h / 2, "Demo", 0, 0, ALIGN_CENTER);
- steam.Draw();
- direct.Draw();
+ g_engine->_textManager->draw(logo.x + logo.w, logo.y + logo.h / 2, "Demo", 0, 0, ALIGN_CENTER);
+ steam.draw();
+ direct.draw();
#endif
break;
case STATE_OPTIONS:
- g_engine->_optionMenu->Draw(back);
- me_main.Draw();
+ g_engine->_optionMenu->draw(back);
+ me_main.draw();
break;
case STATE_CREDITS:
- credits.Draw();
+ credits.draw();
break;
case STATE_DIFF:
- diff.bg.Draw();
- diff.heading.Draw();
- diff.menu.Draw();
- back.Draw();
- me_main.Draw();
+ diff.bg.draw();
+ diff.heading.draw();
+ diff.menu.draw();
+ back.draw();
+ me_main.draw();
break;
case STATE_SAVENAME:
- bg_save.Draw();
- warning.Draw();
- save.Draw();
- accept.Draw();
- cancel.Draw();
- me_main.Draw();
+ bg_save.draw();
+ warning.draw();
+ save.draw();
+ accept.draw();
+ cancel.draw();
+ me_main.draw();
break;
case STATE_MOD:
- mod.Draw();
- back.Draw();
- me_main.Draw();
+ mod.draw();
+ back.draw();
+ me_main.draw();
break;
case STATE_HELP:
- g_engine->_helpScreen->Draw();
- back.Draw();
- me_main.Draw();
+ g_engine->_helpScreen->draw();
+ back.draw();
+ me_main.draw();
break;
default:
break;
}
- g_engine->_mouse->Draw();
+ g_engine->_mouse->draw();
}
void MainMenu::SetUI() {
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 82d334da166..b9cf44efda1 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -130,7 +130,7 @@ public:
#endif
void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
- void Draw();
+ void draw();
void ChangeState(MenuState ms, const bool &start = false);
void SetUI();
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 2cf541fde0c..7126f854d2e 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -78,8 +78,8 @@ void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
//------------------------------------------------------------------------
// Purpose: Drawing function
//------------------------------------------------------------------------
-void Splash::Draw() {
- background.Draw(x, y);
+void Splash::draw() {
+ background.draw(x, y);
first_run = false;
}
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 3ac7a9cf276..cb2346b7ed9 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -61,7 +61,7 @@ public:
~Splash();
void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {}
void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
- void Draw();
+ void draw();
void SetUI();
// We don't need to save game state here
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index f4a907d2962..1501410be29 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -52,16 +52,16 @@ void StatInfo::load(rapidxml::xml_node<char> *node) {
}
}
-void StatInfo::Draw(const int &val, const int &max) {
+void StatInfo::draw(const int &val, const int &max) {
if (active) {
using namespace pyrodactyl::image;
- desc.Draw(text);
+ desc.draw(text);
int i = 0;
for (; i < val; ++i)
- g_engine->_imageManager->Draw(dim.x + i * dim.w, dim.y + i * dim.h, full);
+ g_engine->_imageManager->draw(dim.x + i * dim.w, dim.y + i * dim.h, full);
for (; i < max; ++i)
- g_engine->_imageManager->Draw(dim.x + i * dim.w, dim.y + i * dim.h, empty);
+ g_engine->_imageManager->draw(dim.x + i * dim.w, dim.y + i * dim.h, empty);
}
}
@@ -78,7 +78,7 @@ void StatDrawHelper::load(rapidxml::xml_node<char> *node) {
void StatDrawHelper::DrawInfo(const Person &obj) {
for (int i = 0; i < STAT_TOTAL; i++)
- info[i].Draw(obj.stat.val[i].cur, obj.stat.val[i].max);
+ info[i].draw(obj.stat.val[i].cur, obj.stat.val[i].max);
}
} // End of namespace Crab
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index f3e3aeb8701..c56598309d9 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -55,7 +55,7 @@ struct StatInfo {
}
void load(rapidxml::xml_node<char> *node);
- void Draw(const int &val, const int &max);
+ void draw(const int &val, const int &max);
};
class StatDrawHelper {
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 2c873f4eecf..8906798d39d 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -143,9 +143,9 @@ Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &fKey, co
//------------------------------------------------------------------------
// Purpose: Draw text
//------------------------------------------------------------------------
-void TextManager::Draw(const int &x, const int &y, const Common::String &text, const int &color,
+void TextManager::draw(const int &x, const int &y, const Common::String &text, const int &color,
const FontKey &fontk, const Align &align, const bool &background) {
- //warning("STUB: TextManager::Draw()");
+ //warning("STUB: TextManager::draw()");
if (text == " ") return;
@@ -193,7 +193,7 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- cache[pos].img.Draw(x, y);
+ cache[pos].img.draw(x, y);
} else if (align == ALIGN_CENTER) {
rect.x = x - cache[pos].img.W() / 2 - pad_bg.x;
rect.y = y - cache[pos].img.H() / 2 - pad_bg.y;
@@ -202,7 +202,7 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- cache[pos].img.Draw(x - cache[pos].img.W() / 2, y - cache[pos].img.H() / 2);
+ cache[pos].img.draw(x - cache[pos].img.W() / 2, y - cache[pos].img.H() / 2);
} else {
rect.x = x - cache[pos].img.W() - pad_bg.x;
rect.y = y - pad_bg.y;
@@ -211,22 +211,22 @@ void TextManager::Draw(const int &x, const int &y, const Common::String &text, c
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- cache[pos].img.Draw(x - cache[pos].img.W(), y);
+ cache[pos].img.draw(x - cache[pos].img.W(), y);
}
surf.free();
} else {
if (align == ALIGN_LEFT)
- cache[pos].img.Draw(x, y);
+ cache[pos].img.draw(x, y);
else if (align == ALIGN_CENTER)
- cache[pos].img.Draw(x - cache[pos].img.W() / 2, y - cache[pos].img.H() / 2);
+ cache[pos].img.draw(x - cache[pos].img.W() / 2, y - cache[pos].img.H() / 2);
else
- cache[pos].img.Draw(x - cache[pos].img.W(), y);
+ cache[pos].img.draw(x - cache[pos].img.W(), y);
}
}
-void TextManager::Draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &fKey, const Align &align,
+void TextManager::draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &fKey, const Align &align,
const unsigned int &line_width, const unsigned int &line_height, const bool &background) {
for (unsigned int start_pos = 0, len = text.size(); start_pos < len; y += line_height) {
unsigned int end_pos = start_pos + 1;
@@ -259,7 +259,7 @@ void TextManager::Draw(const int &x, int y, const Common::String &text, const in
start_pos += line_width;
}
- Draw(x, y, word, color, fKey, align, background);
+ draw(x, y, word, color, fKey, align, background);
}
}
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 6b45435ded6..254622523dc 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -109,10 +109,10 @@ public:
SDL_Surface *RenderTextBlended(const FontKey &font, const Common::String &text, const int &color);
#endif
- void Draw(const int &x, const int &y, const Common::String &text, const int &color,
+ void draw(const int &x, const int &y, const Common::String &text, const int &color,
const FontKey &font = 0, const Align &align = ALIGN_LEFT, const bool &background = false);
- void Draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &font, const Align &align,
+ void draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &font, const Align &align,
const unsigned int &line_width, const unsigned int &line_height, const bool &background = false);
};
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 45bbddbd087..7aaf811ca92 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -67,9 +67,9 @@ void AlphaImage::InternalEvents() {
g_engine->_imageManager->GetTexture(img).Alpha(alpha.cur);
}
-void AlphaImage::Draw(const int &XOffset, const int &YOffset) {
+void AlphaImage::draw(const int &XOffset, const int &YOffset) {
if (g_engine->_imageManager->ValidTexture(img))
- g_engine->_imageManager->GetTexture(img).Draw(pos.x + XOffset, pos.y + YOffset);
+ g_engine->_imageManager->GetTexture(img).draw(pos.x + XOffset, pos.y + YOffset);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/AlphaImage.h b/engines/crab/ui/AlphaImage.h
index 735b260517a..b40c5996717 100644
--- a/engines/crab/ui/AlphaImage.h
+++ b/engines/crab/ui/AlphaImage.h
@@ -74,7 +74,7 @@ public:
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &XOffset = 0, const int &YOffset = 0);
// This is used to vary the alpha
void InternalEvents();
diff --git a/engines/crab/ui/Caption.cpp b/engines/crab/ui/Caption.cpp
index f4094463a85..91a511ab572 100644
--- a/engines/crab/ui/Caption.cpp
+++ b/engines/crab/ui/Caption.cpp
@@ -50,12 +50,12 @@ void Caption::load(rapidxml::xml_node<char> *node, Rect *parent) {
}
}
-void Caption::Draw(bool selected, const int &XOffset, const int &YOffset) {
+void Caption::draw(bool selected, const int &XOffset, const int &YOffset) {
if (enabled) {
if (selected)
TextData::DrawColor(text, col_s, XOffset, YOffset);
else
- TextData::Draw(text, XOffset, YOffset);
+ TextData::draw(text, XOffset, YOffset);
}
}
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index 8ba229fcf4a..cfb8145475a 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -55,7 +55,7 @@ public:
void Init(const Caption &c, const int &XOffset = 0, const int &YOffset = 0);
void load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
- void Draw(bool selected, const int &XOffset = 0, const int &YOffset = 0);
+ void draw(bool selected, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index c8bce321fd7..2afc8a766dd 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -61,16 +61,16 @@ bool ChapterIntro::HandleEvents(SDL_Event &Event) {
}
#endif
-void ChapterIntro::Draw(pyrodactyl::event::Info &info, Common::String &text,
+void ChapterIntro::draw(pyrodactyl::event::Info &info, Common::String &text,
pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state) {
- dialog.Draw(false);
- dialog.Draw(info, text);
+ dialog.draw(false);
+ dialog.draw(info, text);
- traits.Draw();
+ traits.draw();
if (cur_sp != nullptr) {
Rect clip = cur_sp->DialogClip(state);
- g_engine->_imageManager->Draw(pos.x, pos.y, cur_sp->Img(), &clip);
+ g_engine->_imageManager->draw(pos.x, pos.y, cur_sp->Img(), &clip);
}
}
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index 007f83abb90..84574eedb5b 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -63,7 +63,7 @@ public:
bool HandleEvents(SDL_Event &Event);
#endif
- void Draw(pyrodactyl::event::Info &info, Common::String &text,
+ void draw(pyrodactyl::event::Info &info, Common::String &text,
pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state);
};
} // End of namespace ui
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index 9d1d3e70c5e..a2fc69fbb6d 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -49,8 +49,8 @@ void ClipButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
}
}
-void ClipButton::Draw(const int &XOffset, const int &YOffset) {
- Button::Draw(XOffset, YOffset, &clip);
+void ClipButton::draw(const int &XOffset, const int &YOffset) {
+ Button::draw(XOffset, YOffset, &clip);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ClipButton.h b/engines/crab/ui/ClipButton.h
index 829c057e5d1..0edcd7e3d4e 100644
--- a/engines/crab/ui/ClipButton.h
+++ b/engines/crab/ui/ClipButton.h
@@ -47,7 +47,7 @@ public:
~ClipButton() {}
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 23484b69cc0..7fd34f204cc 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -137,19 +137,19 @@ bool CreditScreen::HandleEvents(SDL_Event &Event) {
}
#endif
-void CreditScreen::Draw() {
- bg.Draw();
+void CreditScreen::draw() {
+ bg.draw();
- slow.Draw();
- fast.Draw();
- pause.Draw();
- reverse.Draw();
+ slow.draw();
+ fast.draw();
+ pause.draw();
+ reverse.draw();
- logo.Draw();
- twitter.Draw();
- website.Draw();
+ logo.draw();
+ twitter.draw();
+ website.draw();
- back.Draw();
+ back.draw();
cur.y = start.y;
@@ -159,9 +159,9 @@ void CreditScreen::Draw() {
if (i->heading) {
cur.y += heading.inc;
if (cur.y > -30 && cur.y < g_engine->_screenSettings->cur.h + 40) // Only draw text if it is actually visible on screen
- g_engine->_textManager->Draw(cur.x, cur.y, i->text, heading.color, heading.font, heading.align);
+ g_engine->_textManager->draw(cur.x, cur.y, i->text, heading.color, heading.font, heading.align);
} else if (cur.y > -30 && cur.y < g_engine->_screenSettings->cur.h + 40)
- g_engine->_textManager->Draw(cur.x, cur.y, i->text, paragraph.color, paragraph.font, paragraph.align);
+ g_engine->_textManager->draw(cur.x, cur.y, i->text, paragraph.color, paragraph.font, paragraph.align);
// If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
if (cur.y > g_engine->_screenSettings->cur.h + 40)
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index e25ce8112d8..408b8526881 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -118,7 +118,7 @@ public:
#if 0
bool HandleEvents(SDL_Event &Event);
#endif
- void Draw();
+ void draw();
void SetUI();
};
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 7ac1d7646cd..a7ca83145de 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -64,23 +64,23 @@ void DebugConsole::load(const Common::String &filename) {
}
}
-void DebugConsole::Draw(pyrodactyl::event::Info &info) {
+void DebugConsole::draw(pyrodactyl::event::Info &info) {
switch (state) {
case STATE_NORMAL:
- menu.Draw();
+ menu.draw();
break;
case STATE_VAR:
- bg.Draw();
- check.Draw();
- back.Draw();
- text_field.Draw();
+ bg.draw();
+ check.draw();
+ back.draw();
+ text_field.draw();
{
int temp = 0;
if (info.VarGet(var_name, temp))
- value.Draw(NumberToString(temp));
+ value.draw(NumberToString(temp));
else
- value.Draw("Does not exist.");
+ value.draw("Does not exist.");
}
break;
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index c7498737e13..ed35264c554 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -64,7 +64,7 @@ public:
bool RestrictInput() { return (state == STATE_VAR || menu.HoverIndex() != -1); }
void load(const Common::String &filename);
- void Draw(pyrodactyl::event::Info &info);
+ void draw(pyrodactyl::event::Info &info);
#if 0
void HandleEvents(const SDL_Event &Event);
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index c61e8c318c2..599e9e98790 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -221,13 +221,13 @@ public:
}
#endif
- void Draw() {
- bg.Draw();
- menu.Draw();
+ void draw() {
+ bg.draw();
+ menu.draw();
for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++) {
auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
- td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
- td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
+ td_b[DATA_SAVENAME].draw(slot_info[i].name, base_x, base_y);
+ td_b[DATA_LASTMODIFIED].draw(slot_info[i].last_modified, base_x, base_y);
}
DrawHover();
@@ -245,15 +245,15 @@ public:
}
hover = true;
- img.preview.Draw(img.pos.x, img.pos.y);
+ img.preview.draw(img.pos.x, img.pos.y);
- td_h[DATA_LOCNAME].Draw(slot_info[i].loc_name);
- td_h[DATA_DIFFICULTY].Draw(slot_info[i].diff);
- td_h[DATA_TIMEPLAYED].Draw(slot_info[i].time);
- td_h[DATA_PLAYERNAME].Draw(slot_info[i].char_name);
+ td_h[DATA_LOCNAME].draw(slot_info[i].loc_name);
+ td_h[DATA_DIFFICULTY].draw(slot_info[i].diff);
+ td_h[DATA_TIMEPLAYED].draw(slot_info[i].time);
+ td_h[DATA_PLAYERNAME].draw(slot_info[i].char_name);
for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
- hov[num].Draw();
+ hov[num].draw();
} else if (hover)
Reset();
}
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index 6b8903d3f80..d02723ee05d 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -66,12 +66,12 @@ int GameOverMenu::HandleEvents(const SDL_Event &Event) {
}
#endif
-void GameOverMenu::Draw() {
- bg.Draw();
+void GameOverMenu::draw() {
+ bg.draw();
if (cur < quote.size())
- title.Draw(quote[cur]);
+ title.draw(quote[cur]);
- menu.Draw();
+ menu.draw();
}
void GameOverMenu::SetUI() {
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 52c9c8d69bd..2f3a2bdad75 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -73,7 +73,7 @@ public:
#if 0
int HandleEvents(const SDL_Event &Event);
#endif
- void Draw();
+ void draw();
void SetUI();
};
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 32b908c3133..e881fe0b64d 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -129,18 +129,18 @@ void GeneralSettingMenu::InternalEvents() {
//------------------------------------------------------------------------
// Purpose: Draw stuff
//------------------------------------------------------------------------
-void GeneralSettingMenu::Draw() {
+void GeneralSettingMenu::draw() {
// Draw volume sliders
- notice_volume.Draw();
- vol_music.Draw();
- vol_effects.Draw();
+ notice_volume.draw();
+ vol_music.draw();
+ vol_effects.draw();
// Draw the auto-save on exit option
- save_on_exit.Draw();
- mouse_trap.Draw();
+ save_on_exit.draw();
+ mouse_trap.draw();
// Text speed radio button menu
- text_speed.Draw();
+ text_speed.draw();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index c888b4f4f2d..77e8a4f3383 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -64,7 +64,7 @@ public:
void InternalEvents();
- void Draw();
+ void draw();
void SetUI();
void CreateBackup() {
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 970b7f16c94..6442289cedf 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -66,25 +66,25 @@ void GfxSettingMenu::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Draw stuff
//------------------------------------------------------------------------
-void GfxSettingMenu::Draw() {
+void GfxSettingMenu::draw() {
// Window border doesn't matter if you are in fullscreen
if (!g_engine->_screenSettings->fullscreen)
- border.Draw();
+ border.draw();
// Draw toggle buttons
- brightness.Draw();
- fullscreen.Draw();
- vsync.Draw();
+ brightness.draw();
+ fullscreen.draw();
+ vsync.draw();
// Quality and resolution can only be changed in the main menu
if (!g_engine->_screenSettings->in_game) {
// Tree quality button
- quality.Draw();
+ quality.draw();
} else
- notice_quality.Draw(); // Notice about quality settings
+ notice_quality.draw(); // Notice about quality settings
// Draw resolution menu
- resolution.Draw();
+ resolution.draw();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 99278335eb4..1ad1969cd29 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -67,7 +67,7 @@ public:
#endif
void InternalEvents();
- void Draw();
+ void draw();
void SetUI();
void SetInfo() { resolution.SetInfo(); }
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 5b2aec22add..78ce5dccab4 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -50,13 +50,13 @@ void HealthIndicator::load(rapidxml::xml_node<char> *node) {
}
}
-void HealthIndicator::Draw(int num) {
+void HealthIndicator::draw(int num) {
for (auto i = img.begin(); i != img.end(); ++i)
if (num == i->val) {
using namespace pyrodactyl::image;
- g_engine->_imageManager->Draw(x, y, i->normal);
+ g_engine->_imageManager->draw(x, y, i->normal);
g_engine->_imageManager->GetTexture(i->glow).Alpha(alpha);
- g_engine->_imageManager->Draw(x, y, i->glow);
+ g_engine->_imageManager->draw(x, y, i->glow);
if (inc) {
alpha += 2;
diff --git a/engines/crab/ui/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
index 4b7e573dab8..72a15ffa87e 100644
--- a/engines/crab/ui/HealthIndicator.h
+++ b/engines/crab/ui/HealthIndicator.h
@@ -61,7 +61,7 @@ public:
~HealthIndicator() {}
void load(rapidxml::xml_node<char> *node);
- void Draw(int num);
+ void draw(int num);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/HoverInfo.cpp b/engines/crab/ui/HoverInfo.cpp
index 002a250803f..920db50cf01 100644
--- a/engines/crab/ui/HoverInfo.cpp
+++ b/engines/crab/ui/HoverInfo.cpp
@@ -49,9 +49,9 @@ void HoverInfo::load(rapidxml::xml_node<char> *node, Rect *parent) {
}
}
-void HoverInfo::Draw(const int &XOffset, const int &YOffset) {
+void HoverInfo::draw(const int &XOffset, const int &YOffset) {
if (enabled)
- TextData::Draw(text, XOffset, YOffset);
+ TextData::draw(text, XOffset, YOffset);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index 87c0cf7445d..2b9b35d8512 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -50,7 +50,7 @@ public:
void Init(const HoverInfo &h, const int &XOffset = 0, const int &YOffset = 0);
void load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 950fe470bfd..92bcbcb1067 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -46,11 +46,11 @@ void ImageData::load(rapidxml::xml_node<char> *node, const bool &echo) {
Element::load(node, key, echo);
}
-void ImageData::Draw(const int &XOffset, const int &YOffset) {
+void ImageData::draw(const int &XOffset, const int &YOffset) {
if (crop)
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, key, &clip);
+ g_engine->_imageManager->draw(x + XOffset, y + YOffset, key, &clip);
else
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, key);
+ g_engine->_imageManager->draw(x + XOffset, y + YOffset, key);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ImageData.h b/engines/crab/ui/ImageData.h
index 4d8c1be9d10..b6df47eb5d5 100644
--- a/engines/crab/ui/ImageData.h
+++ b/engines/crab/ui/ImageData.h
@@ -57,7 +57,7 @@ public:
~ImageData() {}
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 867c4b566c3..494446d3193 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -90,13 +90,13 @@ bool Inventory::HasItem(const Common::String &char_id, const Common::String &con
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Inventory::Draw(Person &obj, const int &money_val) {
- bg.Draw();
+void Inventory::draw(Person &obj, const int &money_val) {
+ bg.draw();
// helper.DrawInfo(obj);
- collection.Draw(obj.id /*, helper*/);
+ collection.draw(obj.id /*, helper*/);
money.caption.text = NumberToString(money_val);
- money.Draw();
+ money.draw();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index 59ad47aa6a2..8112d95b438 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -70,7 +70,7 @@ public:
bool HasItem(const Common::String &char_id, const Common::String &container, const Common::String &item_id);
void load(const Common::String &filename);
- void Draw(pyrodactyl::people::Person &obj, const int &money_val);
+ void draw(pyrodactyl::people::Person &obj, const int &money_val);
void HandleEvents(const Common::String &char_id, const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index 713ce6a84c7..530a9c59c33 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -58,9 +58,9 @@ public:
desc.load(node->first_node("desc"));
}
- void Draw(pyrodactyl::item::Item &item) {
- name.Draw(item.name);
- desc.Draw(item.desc);
+ void draw(pyrodactyl::item::Item &item) {
+ name.draw(item.name);
+ desc.draw(item.desc);
}
void SetUI() {
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index d6dce0072cf..cf12bdf2ca7 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -119,14 +119,14 @@ void KeyBindMenu::DrawDesc(const int &type) {
int xoffset = inc.x * i + divide.x * (i / dim.x);
int yoffset = inc.y * (i % dim.x) + divide.y * (i / dim.x);
- desc.Draw(g_engine->_inputManager->iv[i + start].name, xoffset, yoffset);
+ desc.draw(g_engine->_inputManager->iv[i + start].name, xoffset, yoffset);
}
}
-void KeyBindMenu::Draw() {
- sel_controls.Draw();
+void KeyBindMenu::draw() {
+ sel_controls.draw();
- menu[sel_controls.cur].Draw();
+ menu[sel_controls.cur].draw();
DrawDesc(sel_controls.cur);
}
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 5e4800387f4..f504d1a4514 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -122,7 +122,7 @@ public:
#endif
void SetCaption();
- void Draw();
+ void draw();
void SetUI();
};
} // End of namespace ui
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 3e7f2b4bcc6..c26b5927129 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -60,7 +60,7 @@ void MapMarkerMenu::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void MapMarkerMenu::Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera) {
+void MapMarkerMenu::draw(const Element &pos, const Vector2i &player_pos, const Rect &camera) {
// Calculate all offsets
Vector2i offset_p(pos.x + player_pos.x + offset.player.x - camera.x, pos.y + player_pos.y + offset.player.y - camera.y);
Vector2i offset_m(pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 72e84399ebf..153409b4eeb 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -85,7 +85,7 @@ public:
void load(rapidxml::xml_node<char> *node);
- void Draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
+ void draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index a930322c23f..1648a5417a9 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -99,13 +99,13 @@ bool ModMenu::HandleEvents(const SDL_Event &Event) {
}
#endif
-void ModMenu::Draw() {
- bg.Draw();
- menu.Draw();
+void ModMenu::draw() {
+ bg.draw();
+ menu.draw();
for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++) {
auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
- td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
- td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
+ td_b[DATA_SAVENAME].draw(slot_info[i].name, base_x, base_y);
+ td_b[DATA_LASTMODIFIED].draw(slot_info[i].last_modified, base_x, base_y);
}
if (menu.HoverIndex() >= 0) {
@@ -119,15 +119,15 @@ void ModMenu::Draw() {
}
hover = true;
- img.preview.Draw(img.pos.x, img.pos.y);
+ img.preview.draw(img.pos.x, img.pos.y);
- td_h[DATA_AUTHOR].Draw(slot_info[i].author);
- td_h[DATA_VERSION].Draw(slot_info[i].version);
- td_h[DATA_INFO].Draw(slot_info[i].info);
- td_h[DATA_WEBSITE].Draw(slot_info[i].website);
+ td_h[DATA_AUTHOR].draw(slot_info[i].author);
+ td_h[DATA_VERSION].draw(slot_info[i].version);
+ td_h[DATA_INFO].draw(slot_info[i].info);
+ td_h[DATA_WEBSITE].draw(slot_info[i].website);
for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
- hov[num].Draw();
+ hov[num].draw();
} else if (hover)
Reset();
}
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index 0969c679c60..08ce52397f2 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -49,7 +49,7 @@ public:
#if 0
bool HandleEvents(const SDL_Event &Event);
#endif
- void Draw();
+ void draw();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 9779b317674..d8525ca0662 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -103,55 +103,55 @@ void OptionMenu::Reset() {
menu.element[i].State(i == STATE_GENERAL);
}
-void OptionMenu::Draw(Button &back) {
+void OptionMenu::draw(Button &back) {
if (state < STATE_ENTER_W) {
- bg.Draw();
+ bg.draw();
switch (state) {
case STATE_GENERAL:
- general.Draw();
+ general.draw();
break;
case STATE_GRAPHICS:
- gfx.Draw();
+ gfx.draw();
break;
case STATE_KEYBOARD:
- keybind.Draw();
+ keybind.draw();
break;
case STATE_CONTROLLER:
- conbind.Draw();
+ conbind.draw();
break;
default:
break;
}
- menu.Draw();
- back.Draw();
+ menu.draw();
+ back.draw();
} else {
- questionbox.Draw();
+ questionbox.draw();
switch (state) {
case STATE_ENTER_W:
- prompt_w.Draw();
+ prompt_w.draw();
break;
case STATE_ENTER_H:
- prompt_h.Draw();
+ prompt_h.draw();
break;
case STATE_CONFIRM:
- notice_res.Draw();
- countdown.Draw(NumberToString(timer.RemainingTicks() / 1000));
+ notice_res.draw();
+ countdown.draw(NumberToString(timer.RemainingTicks() / 1000));
break;
default:
break;
}
- accept.Draw();
- cancel.Draw();
+ accept.draw();
+ cancel.draw();
}
}
bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
if (state < STATE_ENTER_W) {
- bg.Draw();
+ bg.draw();
switch (state) {
case STATE_GENERAL:
@@ -176,7 +176,7 @@ bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
return HandleTabs(back, Event);
} else {
- questionbox.Draw();
+ questionbox.draw();
switch (state) {
case STATE_ENTER_W:
@@ -218,8 +218,8 @@ bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
break;
}
- accept.Draw();
- cancel.Draw();
+ accept.draw();
+ cancel.draw();
}
return false;
@@ -234,7 +234,7 @@ bool OptionMenu::HandleTabs(Button &back, const Common::Event &Event) {
#if 0
bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
if (state < STATE_ENTER_W) {
- bg.Draw();
+ bg.draw();
switch (state) {
case STATE_GENERAL:
@@ -259,7 +259,7 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
return HandleTabs(back, Event);
} else {
- questionbox.Draw();
+ questionbox.draw();
switch (state) {
case STATE_ENTER_W:
@@ -301,8 +301,8 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
break;
}
- accept.Draw();
- cancel.Draw();
+ accept.draw();
+ cancel.draw();
}
return false;
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 1c30e7260ef..8cd3a4f1acc 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -106,7 +106,7 @@ public:
bool DisableHotkeys() { return keybind.DisableHotkeys(); }
void load(const Common::String &filename);
- void Draw(Button &back);
+ void draw(Button &back);
bool HandleEvents(Button &back, const Common::Event &Event);
#if 0
bool HandleEvents(Button &back, const SDL_Event &Event);
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 1915e583ac3..695ff7f98c3 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -54,14 +54,14 @@ void OptionSelect::load(rapidxml::xml_node<char> *node) {
}
}
-void OptionSelect::Draw() {
- option.Draw(cur);
+void OptionSelect::draw() {
+ option.draw(cur);
if (cur > 0)
- prev.Draw();
+ prev.draw();
if ((unsigned int)cur < option.text.size() - 1)
- next.Draw();
+ next.draw();
}
bool OptionSelect::HandleEvents(const Common::Event &Event) {
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index 6b70c1d987b..250c8aa63b7 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -45,9 +45,9 @@ class OptionSelect {
Common::Array<Common::String> text;
TextData data;
- void Draw(const int &index) {
+ void draw(const int &index) {
if (index >= 0 && (unsigned int)index < text.size())
- data.Draw(text[index]);
+ data.draw(text[index]);
}
} option;
@@ -63,7 +63,7 @@ public:
}
void load(rapidxml::xml_node<char> *node);
- void Draw();
+ void draw();
bool HandleEvents(const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index eb41f8adab9..cace12fb211 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -246,15 +246,15 @@ public:
}
#endif
- void Draw() {
- status.Draw(info);
- menu[current_page].Draw();
+ void draw() {
+ status.draw(info);
+ menu[current_page].draw();
if (current_page > 0)
- prev.Draw();
+ prev.draw();
if (current_page < menu.size() - 1)
- next.Draw();
+ next.draw();
}
};
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index ccb3cf88c0a..383fd5dd883 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -42,8 +42,8 @@ bool ParagraphData::load(rapidxml::xml_node<char> *node, Rect *parent, const boo
return TextData::load(node, parent, echo);
}
-void ParagraphData::Draw(const Common::String &val, const int &XOffset, const int &YOffset) {
- g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
+void ParagraphData::draw(const Common::String &val, const int &XOffset, const int &YOffset) {
+ g_engine->_textManager->draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ParagraphData.h b/engines/crab/ui/ParagraphData.h
index 2d42f1d6144..e04e5578d15 100644
--- a/engines/crab/ui/ParagraphData.h
+++ b/engines/crab/ui/ParagraphData.h
@@ -47,7 +47,7 @@ public:
bool load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
- void Draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 917a3804ddd..01922804c6c 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -43,14 +43,14 @@ void PauseMenu::load(rapidxml::xml_node<char> *node) {
bg.load(node->first_node("bg"));
}
-bool PauseMenu::Draw(Button &back) {
+bool PauseMenu::draw(Button &back) {
switch (state) {
case STATE_NORMAL:
- bg.Draw();
- menu.Draw();
+ bg.draw();
+ menu.draw();
break;
case STATE_OPTION:
- g_engine->_optionMenu->Draw(back);
+ g_engine->_optionMenu->draw(back);
return true;
default:
break;
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 5257db2a653..359da8c4b07 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -91,7 +91,7 @@ public:
#endif
// Returns true if inside options menu, false otherwise
- bool Draw(Button &back);
+ bool draw(Button &back);
void Reset() { state = STATE_NORMAL; }
void ScanDir() { save.ScanDir(); }
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 18c907ec606..e4ab30dba3e 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -69,10 +69,10 @@ void PersonHandler::load(rapidxml::xml_node<char> *node) {
jb.load(node->first_node("journal"));
}
-void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
+void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
const bool &player, pyrodactyl::anim::Sprite *s) {
// Draw the dialog box background
- dlbox.Draw(player);
+ dlbox.draw(player);
if (s != NULL) {
Rect r = s->DialogClip(Event->state);
@@ -88,24 +88,24 @@ void PersonHandler::Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
else if (sprite_align.y == ALIGN_RIGHT)
y -= r.h;
- g_engine->_imageManager->Draw(x, y, s->Img(), &r);
+ g_engine->_imageManager->draw(x, y, s->Img(), &r);
}
if (info.PersonValid(person_id)) {
- name.Draw(info.PersonGet(person_id).name);
+ name.draw(info.PersonGet(person_id).name);
if (!player) {
- opinion[OPI_LIKE].Draw(info.PersonGet(person_id).opinion.val[OPI_LIKE], OPINION_MAX);
- opinion[OPI_RESPECT].Draw(info.PersonGet(person_id).opinion.val[OPI_RESPECT], OPINION_MAX);
- opinion[OPI_FEAR].Draw(info.PersonGet(person_id).opinion.val[OPI_FEAR], OPINION_MAX);
+ opinion[OPI_LIKE].draw(info.PersonGet(person_id).opinion.val[OPI_LIKE], OPINION_MAX);
+ opinion[OPI_RESPECT].draw(info.PersonGet(person_id).opinion.val[OPI_RESPECT], OPINION_MAX);
+ opinion[OPI_FEAR].draw(info.PersonGet(person_id).opinion.val[OPI_FEAR], OPINION_MAX);
}
}
// Draw the journal button
- jb.Draw();
+ jb.draw();
// Draw the dialog box text
- dlbox.Draw(info, Event->dialog);
+ dlbox.draw(info, Event->dialog);
}
bool PersonHandler::HandleCommonEvents(const Common::Event &Event) {
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index e0efbdca660..91147c5319c 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -102,7 +102,7 @@ public:
void InternalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s);
- void Draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
+ void draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
const bool &player, pyrodactyl::anim::Sprite *s = nullptr);
void OpinionChange(pyrodactyl::event::Info &info, const Common::String &id,
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index aa94cc00217..2dd83ddc012 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -78,18 +78,18 @@ void PersonScreen::InternalEvents() {
cur_sp->DialogUpdateClip(PST_NORMAL);
}
-void PersonScreen::Draw(pyrodactyl::event::Info &info, const Common::String &id) {
- bg.Draw();
+void PersonScreen::draw(pyrodactyl::event::Info &info, const Common::String &id) {
+ bg.draw();
if (info.PersonValid(id)) {
- name.Draw(info.PersonGet(id).name);
- menu.Draw(&info.PersonGet(id));
+ name.draw(info.PersonGet(id).name);
+ menu.draw(&info.PersonGet(id));
} else
- menu.Draw(nullptr);
+ menu.draw(nullptr);
if (cur_sp != nullptr) {
Rect clip = cur_sp->DialogClip(PST_NORMAL);
- g_engine->_imageManager->Draw(img.x, img.y, cur_sp->Img(), &clip);
+ g_engine->_imageManager->draw(img.x, img.y, cur_sp->Img(), &clip);
}
}
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 843925371ac..839ce56f752 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -73,7 +73,7 @@ public:
#endif
void InternalEvents();
- void Draw(pyrodactyl::event::Info &info, const Common::String &id);
+ void draw(pyrodactyl::event::Info &info, const Common::String &id);
void SetUI();
};
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index 6571e1be1b5..a576f949069 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -53,7 +53,7 @@ void ProgressBar::load(rapidxml::xml_node<char> *node) {
}
}
-void ProgressBar::Draw(const int &value, const int &max) {
+void ProgressBar::draw(const int &value, const int &max) {
// We don't want divide by zero errors
if (max == 0)
return;
@@ -68,21 +68,21 @@ void ProgressBar::Draw(const int &value, const int &max) {
// If we don't have to draw animations for changing value, just draw the bar
if (!changed) {
clip.w = (g_engine->_imageManager->GetTexture(img.normal).W() * value) / max;
- ClipButton::Draw();
+ ClipButton::draw();
} else {
clip.w = (g_engine->_imageManager->GetTexture(img.normal).W() * cur) / max;
- ClipButton::Draw();
+ ClipButton::draw();
switch (type) {
case INCREASE:
- g_engine->_imageManager->Draw(x + clip.w + offset.x, y + offset.y, inc);
+ g_engine->_imageManager->draw(x + clip.w + offset.x, y + offset.y, inc);
if (timer.TargetReached()) {
cur++;
timer.Start();
}
break;
case DECREASE:
- g_engine->_imageManager->Draw(x + clip.w + offset.x, y + offset.y, dec);
+ g_engine->_imageManager->draw(x + clip.w + offset.x, y + offset.y, dec);
if (timer.TargetReached()) {
cur--;
timer.Start();
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index 30102af58f3..82b3082c231 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -105,7 +105,7 @@ public:
}
void load(rapidxml::xml_node<char> *node);
- void Draw(const int &value, const int &max);
+ void draw(const int &value, const int &max);
void Effect(const int &value, const int &prev);
};
} // End of namespace ui
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 5684f4670b0..b14f7f8e2af 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -64,7 +64,7 @@ void QuestText::load(rapidxml::xml_node<char> *node) {
status.load(node->first_node("status"));
}
-void QuestText::Draw(pyrodactyl::event::Quest &q) {
+void QuestText::draw(pyrodactyl::event::Quest &q) {
// First, we must scan and find the part of the quest text we should draw
// Assign default values to start and stop
@@ -108,13 +108,13 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
status.text = (NumberToString(current_page + 1) + " of " + NumberToString(total_page));
// Now, start drawing the quest
- status.Draw();
+ status.draw();
if (current_page > 0)
- prev.Draw();
+ prev.draw();
if (current_page < total_page - 1)
- next.Draw();
+ next.draw();
// Draw the current page of quest text
if (!q.text.empty()) {
@@ -122,13 +122,13 @@ void QuestText::Draw(pyrodactyl::event::Quest &q) {
int count = 0;
for (unsigned int i = start; i < (unsigned int)stop; ++i) {
- img.Draw(inc.x * count, inc.y * count);
+ img.draw(inc.x * count, inc.y * count);
// Draw first entry in selected color, and older quest entries in standard color
if (i == 0)
- g_engine->_textManager->Draw(x, y, q.text[i], col_s, font, align, line.x, line.y);
+ g_engine->_textManager->draw(x, y, q.text[i], col_s, font, align, line.x, line.y);
else
- ParagraphData::Draw(q.text[i], inc.x * count, inc.y * count);
+ ParagraphData::draw(q.text[i], inc.x * count, inc.y * count);
// Count is reduced extra by the amount of lines it takes for the message to be drawn
count += (q.text[i].size() / line.x) + 1;
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index 680e3bf173c..e865f9dfc83 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -86,7 +86,7 @@ public:
#if 0
void HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event);
#endif
- void Draw(pyrodactyl::event::Quest &q);
+ void draw(pyrodactyl::event::Quest &q);
void SetUI();
};
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index 27d4beca4c5..1d40777ce51 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -57,9 +57,9 @@ public:
Menu::load(node->first_node("menu"));
}
- void Draw(const int &XOffset = 0, const int &YOffset = 0) {
- desc.Draw(XOffset, YOffset);
- Menu::Draw(XOffset, YOffset);
+ void draw(const int &XOffset = 0, const int &YOffset = 0) {
+ desc.draw(XOffset, YOffset);
+ Menu::draw(XOffset, YOffset);
}
int HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 19ef72fff94..e1b275fbbd4 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -55,14 +55,14 @@ void ReplyButton::load(rapidxml::xml_node<char> *node) {
}
}
-void ReplyButton::Draw(const int &XOffset, const int &YOffset) {
+void ReplyButton::draw(const int &XOffset, const int &YOffset) {
if (visible) {
if (mousepressed)
- g_engine->_textManager->Draw(x + XOffset, y + YOffset, text, col_s, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_s, font, align, line_size.x, line_size.y);
else if (hover_mouse || hover_key)
- g_engine->_textManager->Draw(x + XOffset, y + YOffset, text, col_h, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_h, font, align, line_size.x, line_size.y);
else
- g_engine->_textManager->Draw(x + XOffset, y + YOffset, text, col_b, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_b, font, align, line_size.x, line_size.y);
}
}
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index 2e6d4b43950..41163e4939b 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -67,7 +67,7 @@ public:
~ReplyButton() {}
void load(rapidxml::xml_node<char> *node);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &XOffset = 0, const int &YOffset = 0);
// Used to calculate size and set the string
// Spacing is the minimum space between buttons added in case of overflow
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index dac7e2eaefd..e0f49715332 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -138,12 +138,12 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::Str
}
#endif
-void ReplyMenu::Draw() {
- bg.Draw();
- tone.Draw(hover_index);
+void ReplyMenu::draw() {
+ bg.draw();
+ tone.draw(hover_index);
// Draw the reply options
- Menu<ReplyButton>::Draw();
+ Menu<ReplyButton>::draw();
}
void ReplyMenu::Cache(Info &info, ConversationData &dat) {
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index 2abcc31f66b..b6f8fd86243 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -68,7 +68,7 @@ public:
const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event);
#endif
- void Draw();
+ void draw();
void Cache(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat);
void SetUI();
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 12a0f5cefb0..837ca33b7e8 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -79,17 +79,17 @@ void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
AssignPaths();
}
-void ResolutionMenu::Draw() {
- info.Draw();
+void ResolutionMenu::draw() {
+ info.draw();
switch (state) {
case STATE_NORMAL:
- change.Draw();
+ change.draw();
break;
case STATE_CHANGE:
- Menu::Draw();
- cancel.Draw();
- custom.Draw();
+ Menu::draw();
+ cancel.draw();
+ custom.draw();
break;
default:
break;
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 838dc397fc9..8d618f2b49e 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -69,7 +69,7 @@ public:
~ResolutionMenu(void) {}
void load(rapidxml::xml_node<char> *node);
- void Draw();
+ void draw();
// Return 1 if one of resolution buttons is pressed, 2 if custom button is pressed, 0 otherwise
int HandleEvents(const Common::Event &Event);
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index b92fec637e1..916896bd416 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -112,17 +112,17 @@ bool GameSaveMenu::HandleEvents(const Common::Event &Event) {
return false;
}
-void GameSaveMenu::Draw() {
- bg.Draw();
- menu.Draw();
+void GameSaveMenu::draw() {
+ bg.draw();
+ menu.draw();
for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++) {
float base_x = menu.BaseX(count), base_y = menu.BaseY(count);
- td_b[DATA_LASTMODIFIED].Draw(slot_info[i].last_modified, base_x, base_y);
+ td_b[DATA_LASTMODIFIED].draw(slot_info[i].last_modified, base_x, base_y);
if (i == (unsigned int)index && state == STATE_NAME)
- ta_name.Draw();
+ ta_name.draw();
else
- td_b[DATA_SAVENAME].Draw(slot_info[i].name, base_x, base_y);
+ td_b[DATA_SAVENAME].draw(slot_info[i].name, base_x, base_y);
}
DrawHover();
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 699cca6b78c..c551f3d6752 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -69,7 +69,7 @@ public:
#if 0
bool HandleEvents(const SDL_Event &Event);
#endif
- void Draw();
+ void draw();
void SetUI();
};
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 581ebe3077f..dd6f03bd079 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -76,18 +76,18 @@ void SectionHeader::load(rapidxml::xml_node<char> *node) {
}
-void SectionHeader::Draw(const int &XOffset, const int &YOffset) {
- Draw(text, XOffset, YOffset);
+void SectionHeader::draw(const int &XOffset, const int &YOffset) {
+ draw(text, XOffset, YOffset);
}
-void SectionHeader::Draw(const Common::String &str, const int &XOffset, const int &YOffset) {
+void SectionHeader::draw(const Common::String &str, const int &XOffset, const int &YOffset) {
if (draw_l)
- g_engine->_imageManager->Draw(left.x + XOffset, left.y + YOffset, img);
+ g_engine->_imageManager->draw(left.x + XOffset, left.y + YOffset, img);
if (draw_r)
- g_engine->_imageManager->Draw(right.x + XOffset, right.y + YOffset, img, (Rect*)NULL, FLIP_X);
+ g_engine->_imageManager->draw(right.x + XOffset, right.y + YOffset, img, (Rect*)NULL, FLIP_X);
- TextData::Draw(str, XOffset, YOffset);
+ TextData::draw(str, XOffset, YOffset);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/SectionHeader.h b/engines/crab/ui/SectionHeader.h
index ec3c5756bf7..5ead8f3d215 100644
--- a/engines/crab/ui/SectionHeader.h
+++ b/engines/crab/ui/SectionHeader.h
@@ -63,8 +63,8 @@ public:
void load(rapidxml::xml_node<char> *node);
- void Draw(const int &XOffset = 0, const int &YOffset = 0);
- void Draw(const Common::String &str, const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const Common::String &str, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index f26d8b470b3..ea75f9bbe80 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -66,15 +66,15 @@ void SlideShow::load(rapidxml::xml_node<char> *node) {
}
}
-void SlideShow::Draw() {
- bg.Draw();
- img.Draw(pos.x, pos.y);
+void SlideShow::draw() {
+ bg.draw();
+ img.draw(pos.x, pos.y);
if (index > 0)
- prev.Draw();
+ prev.draw();
if (index < path.size() - 1)
- next.Draw();
+ next.draw();
}
void SlideShow::HandleEvents(const Common::Event &Event) {
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index ea21af345ea..033f0e7f2c7 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -75,7 +75,7 @@ public:
#if 0
void HandleEvents(const SDL_Event &Event);
#endif
- void Draw();
+ void draw();
void SetUI();
};
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index c3e300773d7..2e0d7672567 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -57,7 +57,7 @@ public:
bool load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
// Plain drawing
- void Draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
// Draw with a different color
void DrawColor(const Common::String &val, const int &color, const int &XOffset = 0, const int &YOffset = 0);
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 1fdf92ed552..1d478314d95 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -45,13 +45,13 @@ void ToggleButton::load(rapidxml::xml_node<char> *node) {
offset.load(node->first_node("offset"));
}
-void ToggleButton::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
- Button::Draw(XOffset, YOffset, clip);
+void ToggleButton::draw(const int &XOffset, const int &YOffset, Rect *clip) {
+ Button::draw(XOffset, YOffset, clip);
if (state)
- g_engine->_imageManager->Draw(x + offset.x, y + offset.y, on);
+ g_engine->_imageManager->draw(x + offset.x, y + offset.y, on);
else
- g_engine->_imageManager->Draw(x + offset.x, y + offset.y, off);
+ g_engine->_imageManager->draw(x + offset.x, y + offset.y, off);
}
ButtonAction ToggleButton::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index 7d98e6274b2..27fe817b30b 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -59,7 +59,7 @@ public:
~ToggleButton() {}
void load(rapidxml::xml_node<char> *node);
- void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+ void draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
#if 0
ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index 4a19af5d4a0..c8e92c528e4 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -49,11 +49,11 @@ void TraitButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
offset.load(node->first_node("offset"), echo);
}
-void TraitButton::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
+void TraitButton::draw(const int &XOffset, const int &YOffset, Rect *clip) {
if (trait_img != 0)
- g_engine->_imageManager->Draw(x + offset.x, y + offset.y, trait_img);
+ g_engine->_imageManager->draw(x + offset.x, y + offset.y, trait_img);
- StateButton::Draw(XOffset, YOffset, clip);
+ StateButton::draw(XOffset, YOffset, clip);
}
void TraitButton::Cache(const pyrodactyl::people::Trait &trait) {
diff --git a/engines/crab/ui/TraitButton.h b/engines/crab/ui/TraitButton.h
index e8b897d0ce7..ba71c0dba49 100644
--- a/engines/crab/ui/TraitButton.h
+++ b/engines/crab/ui/TraitButton.h
@@ -53,7 +53,7 @@ public:
void Init(const TraitButton &ref, const int &XOffset = 0, const int &YOffset = 0);
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+ void draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
void Cache(const pyrodactyl::people::Trait &trait);
void Empty();
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 5300535ef56..cc15b57baf5 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -65,23 +65,23 @@ void TraitMenu::load(rapidxml::xml_node<char> *node) {
menu.AssignPaths();
}
-void TraitMenu::Draw(const pyrodactyl::people::Person *obj) {
+void TraitMenu::draw(const pyrodactyl::people::Person *obj) {
if (obj != nullptr) {
auto i = menu.element.begin();
for (auto t = obj->trait.begin(); t != obj->trait.end() && i != menu.element.end(); ++t, ++i) {
- i->Draw();
+ i->draw();
if (t->unread)
g_engine->_imageManager->NotifyDraw(i->x + i->w, i->y);
}
for (; i != menu.element.end(); ++i)
- i->Draw();
+ i->draw();
if (select > -1 && (unsigned int)select < obj->trait.size())
- desc.Draw(obj->trait[select].desc);
+ desc.draw(obj->trait[select].desc);
} else
for (auto &i : menu.element)
- i.Draw();
+ i.draw();
}
void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event) {
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index 33e64cb9c9f..a3308263af8 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -73,7 +73,7 @@ public:
void Clear();
void load(rapidxml::xml_node<char> *node);
- void Draw(const pyrodactyl::people::Person *obj);
+ void draw(const pyrodactyl::people::Person *obj);
void HandleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 3743cc01464..76826af807e 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -101,21 +101,21 @@ void Button::Reset() {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
+void Button::draw(const int &XOffset, const int &YOffset, Rect *clip) {
if (visible) {
if (mousepressed) {
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.select, clip);
+ g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.select, clip);
- tooltip.Draw(XOffset, YOffset);
- caption.Draw(true, XOffset, YOffset);
+ tooltip.draw(XOffset, YOffset);
+ caption.draw(true, XOffset, YOffset);
} else if (hover_mouse || hover_key) {
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.hover, clip);
+ g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.hover, clip);
- tooltip.Draw(XOffset, YOffset);
- caption.Draw(true, XOffset, YOffset);
+ tooltip.draw(XOffset, YOffset);
+ caption.draw(true, XOffset, YOffset);
} else {
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.normal, clip);
- caption.Draw(false, XOffset, YOffset);
+ g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.normal, clip);
+ caption.draw(false, XOffset, YOffset);
}
}
}
@@ -123,14 +123,14 @@ void Button::Draw(const int &XOffset, const int &YOffset, Rect *clip) {
void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
if (visible) {
if (mousepressed) {
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.select, clip);
- caption.Draw(true, XOffset, YOffset);
+ g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.select, clip);
+ caption.draw(true, XOffset, YOffset);
} else if (hover_mouse || hover_key) {
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.hover, clip);
- caption.Draw(true, XOffset, YOffset);
+ g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.hover, clip);
+ caption.draw(true, XOffset, YOffset);
} else {
- g_engine->_imageManager->Draw(x + XOffset, y + YOffset, img.normal, clip);
- caption.Draw(false, XOffset, YOffset);
+ g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.normal, clip);
+ caption.draw(false, XOffset, YOffset);
}
}
}
@@ -138,7 +138,7 @@ void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *
void Button::HoverInfoOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
if (visible) {
if (mousepressed || hover_mouse || hover_key)
- tooltip.Draw(XOffset, YOffset);
+ tooltip.draw(XOffset, YOffset);
}
}
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index cf4ed3d91ac..e77dd4c9076 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -116,7 +116,7 @@ public:
void Img(ButtonImage &image) { img = image; }
ButtonImage Img() { return img; }
- void Draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+ void draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
ButtonAction HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index 35d41017465..7bf3ccb6017 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -60,23 +60,23 @@ void GameDialogBox::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Draw the dialog box background
//------------------------------------------------------------------------
-void GameDialogBox::Draw(const bool &player) {
+void GameDialogBox::draw(const bool &player) {
if (player)
- g_engine->_imageManager->Draw(pos.x, pos.y, bg_p);
+ g_engine->_imageManager->draw(pos.x, pos.y, bg_p);
else
- g_engine->_imageManager->Draw(pos.x, pos.y, bg);
+ g_engine->_imageManager->draw(pos.x, pos.y, bg);
}
//------------------------------------------------------------------------
// Purpose: Draw the dialog box text
//------------------------------------------------------------------------
-void GameDialogBox::Draw(pyrodactyl::event::Info &info, Common::String &message) {
+void GameDialogBox::draw(pyrodactyl::event::Info &info, Common::String &message) {
// Create a copy of the string
Common::String msg = message;
info.InsertName(msg);
- text.Draw(message);
- button.Draw();
+ text.draw(message);
+ button.draw();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index b77e4fd4a78..4146a748018 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -69,8 +69,8 @@ public:
void load(rapidxml::xml_node<char> *node);
- void Draw(pyrodactyl::event::Info &info, Common::String &message);
- void Draw(const bool &player);
+ void draw(pyrodactyl::event::Info &info, Common::String &message);
+ void draw(const bool &player);
bool HandleEvents(const Common::Event &Event);
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index db8f49c8ade..f2d4a4b0f51 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -40,10 +40,10 @@ void EmotionIndicator::load(rapidxml::xml_node<char> *node) {
text.load(node->first_node("text"));
}
-void EmotionIndicator::Draw(const int &select) {
+void EmotionIndicator::draw(const int &select) {
if (select >= 0 && (unsigned int)select < value.size())
if (value[select] < g_engine->_eventStore->tone.size()) {
- text.Draw(g_engine->_eventStore->tone[value[select]].text);
+ text.draw(g_engine->_eventStore->tone[value[select]].text);
}
}
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index 63c433a1ee7..adfc8019c64 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -50,7 +50,7 @@ struct EmotionIndicator {
EmotionIndicator() {}
void load(rapidxml::xml_node<char> *node);
- void Draw(const int &select);
+ void draw(const int &select);
void SetUI();
};
} // End of namespace ui
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 958a566cc33..ab558b7e13f 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -82,27 +82,27 @@ void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
}
}
-void HUD::Draw(pyrodactyl::event::Info &info, const Common::String &id) {
- bg.Draw();
- menu.Draw();
+void HUD::draw(pyrodactyl::event::Info &info, const Common::String &id) {
+ bg.draw();
+ menu.draw();
if (info.unread.journal) {
- g_engine->_imageManager->Draw(menu.element[HS_JOURNAL].x + menu.element[HS_JOURNAL].w - clip.w / 2,
+ g_engine->_imageManager->draw(menu.element[HS_JOURNAL].x + menu.element[HS_JOURNAL].w - clip.w / 2,
menu.element[HS_JOURNAL].y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.inventory) {
- g_engine->_imageManager->Draw(menu.element[HS_INV].x + menu.element[HS_INV].w - clip.w / 2,
+ g_engine->_imageManager->draw(menu.element[HS_INV].x + menu.element[HS_INV].w - clip.w / 2,
menu.element[HS_INV].y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.trait) {
- g_engine->_imageManager->Draw(menu.element[HS_CHAR].x + menu.element[HS_CHAR].w - clip.w / 2,
+ g_engine->_imageManager->draw(menu.element[HS_CHAR].x + menu.element[HS_CHAR].w - clip.w / 2,
menu.element[HS_CHAR].y - clip.h / 2, notify_anim, &clip);
}
if (info.unread.map) {
- g_engine->_imageManager->Draw(menu.element[HS_MAP].x + menu.element[HS_MAP].w - clip.w / 2,
+ g_engine->_imageManager->draw(menu.element[HS_MAP].x + menu.element[HS_MAP].w - clip.w / 2,
menu.element[HS_MAP].y - clip.h / 2, notify_anim, &clip);
}
//#endif
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index ac795b94a6a..69bc9c2e0e6 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -105,7 +105,7 @@ public:
HUDSignal HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
- void Draw(pyrodactyl::event::Info &info, const Common::String &id);
+ void draw(pyrodactyl::event::Info &info, const Common::String &id);
// Set the tooltips for the buttons in the menu
// The tooltips are of the style <Name> (<Hotkey>), with Name being provided by the xml
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 8d188ca3c95..1f23b239612 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -106,9 +106,9 @@ void Journal::Select(const Common::String &id, const int &choice) {
//------------------------------------------------------------------------
// Purpose: Draw stuff
//------------------------------------------------------------------------
-void Journal::Draw(const Common::String &id) {
- bg.Draw();
- category.Draw();
+void Journal::draw(const Common::String &id) {
+ bg.draw();
+ category.draw();
// Always find valid journal group first
for (auto &jo : journal)
@@ -119,7 +119,7 @@ void Journal::Draw(const Common::String &id) {
g_engine->_imageManager->NotifyDraw(i->x + i->w, i->y);
if (select >= 0 && select < JE_TOTAL)
- jo.menu[select].Draw(bu_map);
+ jo.menu[select].draw(bu_map);
break;
}
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 671fa347520..82e0bc74963 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -95,7 +95,7 @@ public:
~Journal() {}
void load(const Common::String &filename);
- void Draw(const Common::String &id);
+ void draw(const Common::String &id);
// Return true if "go to map" is selected
bool HandleEvents(const Common::String &id, const Common::Event &Event);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index c54c83ee699..2956772f09b 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -89,10 +89,10 @@ void Map::load(const Common::String &filename, pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Map::Draw(pyrodactyl::event::Info &info) {
+void Map::draw(pyrodactyl::event::Info &info) {
// The map graphic is clipped to fit inside the UI
- img_bg.Draw(pos.x, pos.y, &camera);
+ img_bg.draw(pos.x, pos.y, &camera);
if (overlay) {
// The overlay needs to be clipped as well, so we must find the intersection of the camera and the clip itself
@@ -127,21 +127,21 @@ void Map::Draw(pyrodactyl::event::Info &info) {
if (Y + r.h > pos.y + camera.h)
r.h = pos.y + camera.h - Y;
- img_overlay.Draw(X, Y, &r);
+ img_overlay.draw(X, Y, &r);
}
}
- travel.Draw(camera.x - pos.x, camera.y - pos.y);
+ travel.draw(camera.x - pos.x, camera.y - pos.y);
- fg.Draw();
- bu_overlay.Draw();
+ fg.draw();
+ bu_overlay.draw();
title.text = info.CurLocName();
- title.Draw();
+ title.draw();
- marker.Draw(pos, player_pos, camera);
+ marker.draw(pos, player_pos, camera);
- scroll.Draw();
+ scroll.draw();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index af043155d6f..c3e103e49ea 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -120,7 +120,7 @@ public:
void load(const Common::String &filename, pyrodactyl::event::Info &info);
- void Draw(pyrodactyl::event::Info &info);
+ void draw(pyrodactyl::event::Info &info);
bool HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
bool HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 55300ce644b..14b353bedfd 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -367,9 +367,9 @@ public:
//------------------------------------------------------------------------
// Purpose: Draw the menu
//------------------------------------------------------------------------
- void Draw(const int &XOffset = 0, const int &YOffset = 0) {
+ void draw(const int &XOffset = 0, const int &YOffset = 0) {
for (auto it = element.begin(); it != element.end(); ++it)
- it->Draw(XOffset, YOffset);
+ it->draw(XOffset, YOffset);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 2f82cecb033..5de70281974 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -122,8 +122,8 @@ void QuestMenu::Marker(const Common::String &title, const bool &val) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void QuestMenu::Draw(Button &bu_map) {
- menu.Draw();
+void QuestMenu::draw(Button &bu_map) {
+ menu.draw();
using namespace pyrodactyl::text;
for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < quest.size(); i++, count++) {
@@ -131,21 +131,21 @@ void QuestMenu::Draw(Button &bu_map) {
// Only draw in _s color if we are on the same button and page
if ((unsigned int)sel_bu == count && (unsigned int)sel_page == menu.CurrentPage())
- g_engine->_textManager->Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_s, font, align);
+ g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_s, font, align);
else
- g_engine->_textManager->Draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_n, font, align);
+ g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_n, font, align);
if (quest[i].unread) {
using namespace pyrodactyl::image;
- g_engine->_imageManager->Draw(base_x + off_unread.x, base_y + off_unread.y, g_engine->_imageManager->notify);
+ g_engine->_imageManager->draw(base_x + off_unread.x, base_y + off_unread.y, g_engine->_imageManager->notify);
}
}
if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
- text.Draw(quest[sel_quest]);
+ text.draw(quest[sel_quest]);
if (quest[sel_quest].marker)
- bu_map.Draw();
+ bu_map.draw();
}
}
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 009e0354414..b24ed1cf584 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -75,7 +75,7 @@ public:
~QuestMenu() {}
void load(rapidxml::xml_node<char> *node);
- void Draw(Button &bu_map);
+ void draw(Button &bu_map);
bool HandleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 7b24084518b..77bf9914516 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -117,10 +117,10 @@ bool Slider::HandleEvents(const SDL_Event &Event) {
}
#endif
-void Slider::Draw() {
- bar.Draw();
- caption.Draw(false);
- knob.Draw();
+void Slider::draw() {
+ bar.draw();
+ caption.draw(false);
+ knob.draw();
}
void Slider::Value(const int val) {
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 17ac2546635..73a97b3ca21 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -74,7 +74,7 @@ public:
bool HandleEvents(const SDL_Event &Event);
#endif
- void Draw();
+ void draw();
int Value() { return value; }
void Value(const int val);
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 47f4f3c713d..44860e7f8e1 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -127,9 +127,9 @@ bool TextArea::HandleEvents(const SDL_Event &Event, bool numbers_only) {
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void TextArea::Draw() {
- title.Draw();
- TextData::Draw(text + "_");
+void TextArea::draw() {
+ title.draw();
+ TextData::draw(text + "_");
}
} // End of namespace Crab
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 11c9c1b95ec..e180417fe2d 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -73,7 +73,7 @@ public:
bool HandleEvents(const SDL_Event &Event, bool numbers_only = false);
#endif
- void Draw();
+ void draw();
void SetUI() {
title.SetUI();
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index 558d4adad2e..10823b3db40 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -49,12 +49,12 @@ bool TextData::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &ec
return false;
}
-void TextData::Draw(const Common::String &val, const int &XOffset, const int &YOffset) {
- g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, col, font, align, background);
+void TextData::draw(const Common::String &val, const int &XOffset, const int &YOffset) {
+ g_engine->_textManager->draw(x + XOffset, y + YOffset, val, col, font, align, background);
}
void TextData::DrawColor(const Common::String &val, const int &color, const int &XOffset, const int &YOffset) {
- g_engine->_textManager->Draw(x + XOffset, y + YOffset, val, color, font, align, background);
+ g_engine->_textManager->draw(x + XOffset, y + YOffset, val, color, font, align, background);
}
} // End of namespace Crab
Commit: 4db8e7cbcc6597b15e3fb6befd756de7a5d707fe
https://github.com/scummvm/scummvm/commit/4db8e7cbcc6597b15e3fb6befd756de7a5d707fe
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename InternalEvents() to internalEvents() across CRAB codebase
Changed paths:
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/app.cpp
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gamestate_container.h
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/splash.cpp
engines/crab/splash.h
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/AlphaImage.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index d36096560e5..ddfc03e1b9f 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -68,7 +68,7 @@ void PopUpCollection::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Internal events
//------------------------------------------------------------------------
-bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
+bool PopUp::internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
if (visible.Evaluate(info) || started_show) {
if (delay.TargetReached()) {
@@ -91,10 +91,10 @@ bool PopUp::InternalEvents(pyrodactyl::event::Info &info, const Common::String &
return false;
}
-void PopUpCollection::InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
+void PopUpCollection::internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
if (cur >= 0 && (unsigned int)cur < element.size()) {
- if (element[cur].InternalEvents(info, player_id, result, end_seq)) {
+ if (element[cur].internalEvents(info, player_id, result, end_seq)) {
if (element[cur].next <= 0 || (unsigned int)element[cur].next >= element.size()) {
// This means that this popup is the "end" node, we must loop back to start or end this
if (loop) {
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index 1d95e42e587..a0250a29426 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -85,7 +85,7 @@ struct PopUp {
void draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
// return true if we should proceed to next event, false otherwise
- bool InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
+ bool internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
};
@@ -115,7 +115,7 @@ struct PopUpCollection {
void load(rapidxml::xml_node<char> *node);
- void InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
+ void internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
void draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 2da31b8d6e7..f494128a507 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -722,8 +722,8 @@ void Sprite::ExchangeDamage(Info &info, Sprite &s, const SpriteConstant &sc) {
//------------------------------------------------------------------------
// Purpose: Update status of ambient dialog via popup object
//------------------------------------------------------------------------
-void Sprite::InternalEvents(Info &info, const Common::String &player_id, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
- popup.InternalEvents(info, player_id, result, end_seq);
+void Sprite::internalEvents(Info &info, const Common::String &player_id, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
+ popup.internalEvents(info, player_id, result, end_seq);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 3d02be33569..a09200b2ea6 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -185,7 +185,7 @@ public:
void ExchangeDamage(pyrodactyl::event::Info &info, Sprite &s, const pyrodactyl::ai::SpriteConstant &sc);
void load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations);
- void InternalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
+ void internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
void draw(pyrodactyl::event::Info &info, const Rect &camera);
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index dac2e301355..3b9f61cf50a 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -200,7 +200,7 @@ void App::Run() {
}
// Do state InternalEvents
- CurrentState->InternalEvents(ShouldChangeState, NextStateID);
+ CurrentState->internalEvents(ShouldChangeState, NextStateID);
#if 0
while (SDL_PollEvent(&Event)) {
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 30364a4c8b2..fc4192eede5 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -57,9 +57,9 @@ void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const Common::
return seq[id].NextEvent(info, player_id, result, end_seq, choice);
}
-void EventSeqGroup::InternalEvents(Info &info) {
+void EventSeqGroup::internalEvents(Info &info) {
for (auto it = seq.begin(); it != seq.end(); ++it)
- it->_value.InternalEvents(info);
+ it->_value.internalEvents(info);
}
bool EventSeqGroup::ActiveSeq(unsigned int &active_seq) {
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index 8d12fd60ae1..fc9aff67771 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -60,7 +60,7 @@ public:
void NextEvent(const unsigned int &id, Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
Common::Array<EventSeqInfo> &end_seq, const int choice = -1);
- void InternalEvents(Info &info);
+ void internalEvents(Info &info);
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void LoadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index b0af2465929..293fbdb2873 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -52,7 +52,7 @@ void EventSequence::load(const Common::String &filename) {
//------------------------------------------------------------------------
// Purpose: Check for events happening
//------------------------------------------------------------------------
-void EventSequence::InternalEvents(pyrodactyl::event::Info &info) {
+void EventSequence::internalEvents(pyrodactyl::event::Info &info) {
for (auto nxe = next.begin(); nxe != next.end(); ++nxe)
if (*nxe < events.size()) {
if (events[*nxe].trig.Evaluate(info)) {
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index f85dfff3d10..21ae39a61c7 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -66,7 +66,7 @@ public:
GameEvent *CurrentEvent() { return &events[cur]; }
// See if we should trigger any event
- void InternalEvents(pyrodactyl::event::Info &info);
+ void internalEvents(pyrodactyl::event::Info &info);
void NextEvent(Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
Common::Array<EventSeqInfo> &end_seq, int NextEventChoice = -1);
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index acc47013457..d378cddbb67 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -269,7 +269,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
-void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
+void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
if (event_map.contains(info.CurLocID()) > 0) {
if (event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
@@ -303,14 +303,14 @@ void Manager::InternalEvents(Info &info, Level &level, Common::Array<EventResult
EndSequence(info.CurLocID());
} else {
- event_map[info.CurLocID()].InternalEvents(info);
+ event_map[info.CurLocID()].internalEvents(info);
CalcActiveSeq(info, level, level.Camera());
}
}
}
void Manager::UpdateDialogBox(Info &info, Level &level) {
- oh.InternalEvents(cur_event->state, cur_sp);
+ oh.internalEvents(cur_event->state, cur_sp);
}
//------------------------------------------------------------------------
// Purpose: Draw
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 40708ace7e2..fa81810ad4c 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -93,7 +93,7 @@ public:
void draw(Info &info, pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level);
// cur_per is also updated here
- void InternalEvents(Info &info, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
+ void internalEvents(Info &info, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
void HandleEvents(Info &info, const Common::String &player_id, Common::Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index a0647e5dba2..2c40b128d12 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -466,20 +466,20 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
//------------------------------------------------------------------------
// Purpose: InternalEvents
//------------------------------------------------------------------------
-void Game::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
+void Game::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
switch (state) {
case STATE_GAME:
- hud.InternalEvents(level.ShowMap());
+ hud.internalEvents(level.ShowMap());
event_res.clear();
{
// HACK: Since sequences can only be ended in GameEventManager, we use this empty array
// to get effects to work for levels
Common::Array<pyrodactyl::event::EventSeqInfo> end_seq;
- ApplyResult(level.InternalEvents(info, event_res, end_seq, gem.EventInProgress()));
+ ApplyResult(level.internalEvents(info, event_res, end_seq, gem.EventInProgress()));
}
- gem.InternalEvents(info, level, event_res);
+ gem.internalEvents(info, level, event_res);
info.TalkKeyDown = false;
if (ApplyResult())
@@ -487,10 +487,10 @@ void Game::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
break;
case STATE_MAP:
- map.InternalEvents(info);
+ map.internalEvents(info);
break;
case STATE_CHARACTER:
- gem.per.InternalEvents();
+ gem.per.internalEvents();
break;
default:
break;
diff --git a/engines/crab/game.h b/engines/crab/game.h
index e550e2d894f..3e3804c79e3 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -134,7 +134,7 @@ public:
#if 0
void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
- void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
+ void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void draw();
void LoadState(Common::SeekableReadStream *stream);
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index ce68e3f14a7..4b2731ea335 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -46,7 +46,7 @@ namespace Crab {
class GameState {
public:
virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
- virtual void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
+ virtual void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void draw() = 0;
virtual void SetUI() = 0;
virtual void AutoSave() = 0;
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index ed6bf621012..5facee87bcf 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -193,7 +193,7 @@ public:
#if 0
void HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
- LevelResult InternalEvents(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
+ LevelResult internalEvents(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq, bool EventInProgress);
void PreDraw();
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 0c79e3c1a8c..90a6d726e44 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -44,10 +44,10 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Let the level tick along and notify if we go into an exit
//------------------------------------------------------------------------
-LevelResult Level::InternalEvents(Info &info, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq, bool EventInProgress) {
+LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq, bool EventInProgress) {
LevelResult l_result;
- // input.InternalEvents();
+ // input.internalEvents();
CalcTrigCollide(info);
if (terrain.CollideWithExit(objects[player_index].BoundRect(), l_result)) {
@@ -146,7 +146,7 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
i->MoveToDestPathfinding(info, sc_default);
}
- i->InternalEvents(info, PlayerID(), result, end_seq);
+ i->internalEvents(info, PlayerID(), result, end_seq);
MoveObject(info, *i);
}
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 90c049411d2..0295e37529c 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -420,13 +420,13 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
-void MainMenu::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
+void MainMenu::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
// Make the lights flicker
for (auto &i : lights)
- i.InternalEvents();
+ i.internalEvents();
if (state == STATE_OPTIONS)
- g_engine->_optionMenu->InternalEvents();
+ g_engine->_optionMenu->internalEvents();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index b9cf44efda1..b892e18add3 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -128,7 +128,7 @@ public:
#if 0
void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
- void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
+ void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void draw();
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 7126f854d2e..7a46cf751fa 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -59,7 +59,7 @@ Splash::~Splash() {
//------------------------------------------------------------------------
// Purpose: Event/Input Independent InternalEvents
//------------------------------------------------------------------------
-void Splash::InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
+void Splash::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
g_engine->_loadingScreen->load();
g_engine->_imageManager->Init();
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index cb2346b7ed9..797a62c7f1a 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -60,7 +60,7 @@ public:
Splash();
~Splash();
void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {}
- void InternalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
+ void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void draw();
void SetUI();
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 7aaf811ca92..3611a6665b1 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -48,7 +48,7 @@ void AlphaImage::load(rapidxml::xml_node<char> *node, const bool &echo) {
alpha.cur = alpha.max; //alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
}
-void AlphaImage::InternalEvents() {
+void AlphaImage::internalEvents() {
if (alpha.inc) {
alpha.cur += alpha.change;
if (alpha.cur >= alpha.max) {
diff --git a/engines/crab/ui/AlphaImage.h b/engines/crab/ui/AlphaImage.h
index b40c5996717..f08fb01bad7 100644
--- a/engines/crab/ui/AlphaImage.h
+++ b/engines/crab/ui/AlphaImage.h
@@ -77,7 +77,7 @@ public:
void draw(const int &XOffset = 0, const int &YOffset = 0);
// This is used to vary the alpha
- void InternalEvents();
+ void internalEvents();
void SetUI() { pos.SetUI(); }
};
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index a7ca83145de..7679427caa0 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -122,7 +122,7 @@ void DebugConsole::HandleEvents(const SDL_Event &Event) {
}
#endif
-void DebugConsole::InternalEvents() {
+void DebugConsole::internalEvents() {
}
} // End of namespace Crab
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index ed35264c554..a792a96ea2d 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -69,7 +69,7 @@ public:
#if 0
void HandleEvents(const SDL_Event &Event);
#endif
- void InternalEvents();
+ void internalEvents();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index e881fe0b64d..69fca813fee 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -121,7 +121,7 @@ void GeneralSettingMenu::HandleEvents(const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Sync our buttons with screen settings
//------------------------------------------------------------------------
-void GeneralSettingMenu::InternalEvents() {
+void GeneralSettingMenu::internalEvents() {
save_on_exit.state = g_engine->_screenSettings->save_on_exit;
mouse_trap.state = g_engine->_screenSettings->mouse_trap;
}
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 77e8a4f3383..7d0dc49808d 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -62,7 +62,7 @@ public:
void HandleEvents(const SDL_Event &Event);
#endif
- void InternalEvents();
+ void internalEvents();
void draw();
void SetUI();
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 6442289cedf..55ce38c6ce8 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -164,7 +164,7 @@ int GfxSettingMenu::HandleEvents(const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Keep button settings synced with our screen settings
//------------------------------------------------------------------------
-void GfxSettingMenu::InternalEvents() {
+void GfxSettingMenu::internalEvents() {
fullscreen.state = g_engine->_screenSettings->fullscreen;
vsync.state = g_engine->_screenSettings->vsync;
border.state = g_engine->_screenSettings->border;
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 1ad1969cd29..251ac71911c 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -65,7 +65,7 @@ public:
#if 0
int HandleEvents(const SDL_Event &Event);
#endif
- void InternalEvents();
+ void internalEvents();
void draw();
void SetUI();
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index c26b5927129..c56feb8bcb7 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -125,7 +125,7 @@ void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos,
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
-void MapMarkerMenu::InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds) {
+void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds) {
// Find if the player marker is visible or not
{
Rect r(pos.x + player_pos.x - offset.marker.x - camera.x,
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 153409b4eeb..ec00ccacd65 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -91,7 +91,7 @@ public:
#if 0
void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
#endif
- void InternalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
+ void internalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
void SetUI();
};
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index d8525ca0662..c92e32f7415 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -367,10 +367,10 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
}
#endif
-void OptionMenu::InternalEvents() {
+void OptionMenu::internalEvents() {
// Since these states can be changed at any time, we just update it regularly
- gfx.InternalEvents();
- general.InternalEvents();
+ gfx.internalEvents();
+ general.internalEvents();
if (state == STATE_CONFIRM && timer.TargetReached()) {
g_engine->_screenSettings->RestoreBackup();
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 8cd3a4f1acc..4b775e05859 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -111,7 +111,7 @@ public:
#if 0
bool HandleEvents(Button &back, const SDL_Event &Event);
#endif
- void InternalEvents();
+ void internalEvents();
void SetUI();
void SaveState();
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index e4ab30dba3e..8e4007966f7 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -146,7 +146,7 @@ bool PersonHandler::HandleDlboxEvents(const SDL_Event &Event) {
}
#endif
-void PersonHandler::InternalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s) {
+void PersonHandler::internalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s) {
if (s != NULL)
s->DialogUpdateClip(state);
}
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index 91147c5319c..74d50b366fd 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -100,7 +100,7 @@ public:
bool HandleDlboxEvents(const SDL_Event &Event);
#endif
- void InternalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s);
+ void internalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s);
void draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
const bool &player, pyrodactyl::anim::Sprite *s = nullptr);
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 2dd83ddc012..1d509f9e5c5 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -73,7 +73,7 @@ void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const Common::Str
}
#endif
-void PersonScreen::InternalEvents() {
+void PersonScreen::internalEvents() {
if (cur_sp != nullptr)
cur_sp->DialogUpdateClip(PST_NORMAL);
}
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 839ce56f752..11b592e2a5b 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -72,7 +72,7 @@ public:
void HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event);
#endif
- void InternalEvents();
+ void internalEvents();
void draw(pyrodactyl::event::Info &info, const Common::String &id);
void SetUI();
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index ab558b7e13f..bae6952b0b4 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -108,7 +108,7 @@ void HUD::draw(pyrodactyl::event::Info &info, const Common::String &id) {
//#endif
}
-void HUD::InternalEvents(bool ShowMap) {
+void HUD::internalEvents(bool ShowMap) {
menu.element[HS_MAP].visible = ShowMap;
if (timer.TargetReached()) {
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 69bc9c2e0e6..ff614445986 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -93,7 +93,7 @@ public:
}
~HUD() {}
- void InternalEvents(bool ShowMap);
+ void internalEvents(bool ShowMap);
void PlayerImg(const StateButtonImage &img) { menu.element[HS_CHAR].Img(img); }
void State(const int &val);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 2956772f09b..052ff9624e9 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -326,7 +326,7 @@ void Map::Move(const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
-void Map::InternalEvents(pyrodactyl::event::Info &info) {
+void Map::internalEvents(pyrodactyl::event::Info &info) {
// The map overlay and button state should be in sync
bu_overlay.state = overlay;
@@ -337,7 +337,7 @@ void Map::InternalEvents(pyrodactyl::event::Info &info) {
for (auto &i : travel.element)
i.visible = i.x >= camera.x && i.y >= camera.y;
- marker.InternalEvents(pos, player_pos, camera, bounds);
+ marker.internalEvents(pos, player_pos, camera, bounds);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index c3e103e49ea..8bc2973debb 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -125,7 +125,7 @@ public:
#if 0
bool HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
- void InternalEvents(pyrodactyl::event::Info &info);
+ void internalEvents(pyrodactyl::event::Info &info);
void Center(const Vector2i &pos);
void Move(const Common::Event &Event);
Commit: 793b39628d29edcf4093954666fd70d774b630ed
https://github.com/scummvm/scummvm/commit/793b39628d29edcf4093954666fd70d774b630ed
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Popup struct follow code formatting conventions
Changed paths:
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/sprite.h
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index ddfc03e1b9f..e43bfbf0808 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -39,72 +39,72 @@ using namespace pyrodactyl::event;
// Purpose: Load from xml
//------------------------------------------------------------------------
void PopUp::load(rapidxml::xml_node<char> *node) {
- duration.load(node, "duration", false);
- delay.load(node, "delay");
- loadStr(text, "text", node);
- loadNum(next, "next", node);
+ _duration.load(node, "duration", false);
+ _delay.load(node, "delay");
+ loadStr(_text, "text", node);
+ loadNum(_next, "next", node);
bool end = false;
loadBool(end, "end", node, false);
if (end)
- next = -1;
+ _next = -1;
- visible.load(node);
+ _visible.load(node);
- effect.clear();
+ _effect.clear();
for (rapidxml::xml_node<char> *n = node->first_node("effect"); n != NULL; n = n->next_sibling("effect")) {
Effect e;
e.load(n);
- effect.push_back(e);
+ _effect.push_back(e);
}
}
void PopUpCollection::load(rapidxml::xml_node<char> *node) {
- loadBool(loop, "loop", node);
+ loadBool(_loop, "loop", node);
for (auto n = node->first_node("dialog"); n != NULL; n = n->next_sibling("dialog"))
- element.push_back(n);
+ _element.push_back(n);
}
//------------------------------------------------------------------------
// Purpose: Internal events
//------------------------------------------------------------------------
-bool PopUp::internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
- Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
- if (visible.Evaluate(info) || started_show) {
- if (delay.TargetReached()) {
- if (duration.TargetReached(g_engine->_screenSettings->text_speed)) {
- show = false;
+bool PopUp::internalEvents(pyrodactyl::event::Info &info, const Common::String &playerId,
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq) {
+ if (_visible.Evaluate(info) || _startedShow) {
+ if (_delay.TargetReached()) {
+ if (_duration.TargetReached(g_engine->_screenSettings->text_speed)) {
+ _show = false;
- for (auto &i : effect)
- i.Execute(info, player_id, result, end_seq);
+ for (auto &i : _effect)
+ i.Execute(info, playerId, result, endSeq);
return true;
} else {
- started_show = true;
- show = true;
+ _startedShow = true;
+ _show = true;
}
} else
- show = false;
+ _show = false;
} else
- show = false;
+ _show = false;
return false;
}
-void PopUpCollection::internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
- Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
- if (cur >= 0 && (unsigned int)cur < element.size()) {
- if (element[cur].internalEvents(info, player_id, result, end_seq)) {
- if (element[cur].next <= 0 || (unsigned int)element[cur].next >= element.size()) {
+void PopUpCollection::internalEvents(pyrodactyl::event::Info &info, const Common::String &playerId,
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq) {
+ if (_cur >= 0 && (unsigned int)_cur < _element.size()) {
+ if (_element[_cur].internalEvents(info, playerId, result, endSeq)) {
+ if (_element[_cur]._next <= 0 || (unsigned int)_element[_cur]._next >= _element.size()) {
// This means that this popup is the "end" node, we must loop back to start or end this
- if (loop) {
- cur = 0;
- element[cur].Reset();
+ if (_loop) {
+ _cur = 0;
+ _element[_cur].reset();
} else
- cur = -1;
+ _cur = -1;
} else {
- cur = element[cur].next;
- element[cur].Reset();
+ _cur = _element[_cur]._next;
+ _element[_cur].reset();
}
}
}
@@ -114,19 +114,19 @@ void PopUpCollection::internalEvents(pyrodactyl::event::Info &info, const Common
// Purpose: Draw functions
//------------------------------------------------------------------------
void PopUp::draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
- if (show) {
+ if (_show) {
if (x + pop.x < camera.w / 3)
- g_engine->_textManager->draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop.col, pop.font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
else if (x + pop.x > (2 * camera.w) / 3)
- g_engine->_textManager->draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop.col, pop.font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
else
- g_engine->_textManager->draw(x + pop.x, y + pop.y, text, pop.col, pop.font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop.col, pop.font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
}
}
void PopUpCollection::draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
- if (cur >= 0 && (unsigned int)cur < element.size())
- element[cur].draw(x, y, pop, camera);
+ if (_cur >= 0 && (unsigned int)_cur < _element.size())
+ _element[_cur].draw(x, y, pop, camera);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index a0250a29426..fae49213776 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -45,69 +45,72 @@ namespace pyrodactyl {
namespace anim {
struct PopUp {
// The total time the popup stays on the screen
- Timer duration;
+ Timer _duration;
// The time we wait before showing the trigger for the first time
- Timer delay;
+ Timer _delay;
// Should we draw this or not? (Decided by internal events)
- bool show;
+ bool _show;
// Popups with "talk key pressed" condition need to be shown once the key is pressed
- bool started_show;
+ bool _startedShow;
// Triggers for when you only want to display this in certain conditions
- pyrodactyl::event::TriggerSet visible;
+ pyrodactyl::event::TriggerSet _visible;
// Effects for changing variables and other related stuff
- Common::Array<pyrodactyl::event::Effect> effect;
+ Common::Array<pyrodactyl::event::Effect> _effect;
// The text displayed
- Common::String text;
+ Common::String _text;
// The next popup we should go to, negative values means the end
- int next;
+ int _next;
PopUp() {
- next = -1;
- Reset();
+ _next = -1;
+ reset();
}
- PopUp(rapidxml::xml_node<char> *node) : PopUp() { load(node); }
- void Reset() {
- show = false;
- started_show = false;
- delay.Stop();
- duration.Stop();
+ PopUp(rapidxml::xml_node<char> *node) : PopUp() {
+ load(node);
+ }
+
+ void reset() {
+ _show = false;
+ _startedShow = false;
+ _delay.Stop();
+ _duration.Stop();
}
void load(rapidxml::xml_node<char> *node);
void draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
// return true if we should proceed to next event, false otherwise
- bool internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
- Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
+ bool internalEvents(pyrodactyl::event::Info &info, const Common::String &playerId,
+ Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &endSeq);
};
struct PopUpCollection {
// Collection of environmental dialog
- Common::Array<PopUp> element;
+ Common::Array<PopUp> _element;
// The current dialog being played
- int cur;
+ int _cur;
// true if dialog needs to loop, false otherwise
- bool loop;
+ bool _loop;
PopUpCollection() {
- cur = 0;
- loop = true;
+ _cur = 0;
+ _loop = true;
}
// Return true if any of the popup dialog is visible, false otherwise
- bool Show() {
- for (auto &i : element)
- if (i.show)
+ bool show() {
+ for (auto &i : _element)
+ if (i._show)
return true;
return false;
@@ -115,8 +118,8 @@ struct PopUpCollection {
void load(rapidxml::xml_node<char> *node);
- void internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
- Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
+ void internalEvents(pyrodactyl::event::Info &info, const Common::String &playerId,
+ Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &endSeq);
void draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
};
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index a09200b2ea6..336d03ee7bd 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -167,7 +167,7 @@ public:
Rect DialogClip(const pyrodactyl::people::PersonState &state) { return anim_set._walk.DialogClip(state); }
void DialogUpdateClip(const pyrodactyl::people::PersonState &state) { anim_set._walk.UpdateClip(state); }
- bool PopupShow() { return popup.Show(); }
+ bool PopupShow() { return popup.show(); }
Rect BoundRect();
Rect BoxV();
Commit: 2ce24324af8837ded398674b97e18381c5e463c2
https://github.com/scummvm/scummvm/commit/2ce24324af8837ded398674b97e18381c5e463c2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename Reset() to reset() across CRAB codebase
Changed paths:
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/crab.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
engines/crab/input/fightinput.h
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_load.cpp
engines/crab/mainmenu.cpp
engines/crab/people/person.cpp
engines/crab/people/person.h
engines/crab/stat/Stat.h
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.h
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 61986ef0505..5bc46947060 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -49,10 +49,10 @@ PathfindingGrid::PathfindingGrid(void) {
}
PathfindingGrid::~PathfindingGrid(void) {
- Reset();
+ reset();
}
-void PathfindingGrid::Reset() {
+void PathfindingGrid::reset() {
for (int x = 0; x < dimensions.x; ++x) {
delete[] nodes[x];
}
@@ -69,7 +69,7 @@ void PathfindingGrid::Reset() {
void PathfindingGrid::SetupNodes(TMXMap map) {
// delete nodes if they exist
- Reset();
+ reset();
dimensions.x = map.path_rows; // Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
dimensions.y = map.path_cols;
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index e9eb964a3e0..d2d6f59e6b2 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -67,7 +67,7 @@ public:
PathfindingGrid(void);
~PathfindingGrid(void);
- void Reset();
+ void reset();
void SetupNodes(TMX::TMXMap map);
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 5d51f4d4b4d..974a981f5d2 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -231,8 +231,8 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
//------------------------------------------------------------------------
// Purpose: Clear all data from the level
//------------------------------------------------------------------------
-void TMXMap::Reset() {
- g_engine->_imageManager->tileset.Reset();
+void TMXMap::reset() {
+ g_engine->_imageManager->tileset.reset();
layer.clear();
area_nowalk.clear();
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 0988a899636..797ca72dbb6 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -105,7 +105,7 @@ public:
TMXMap();
~TMXMap() {}
- void Reset();
+ void reset();
void load(const Common::String &path, Common::String filename);
void DrawDebug(const Rect &camera);
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 66cc8c5f9c6..330d895fd35 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -65,7 +65,7 @@ void TileSet::load(const Common::String &path, rapidxml::xml_node<char> *node) {
total_cols = 1;
}
-void TileSetGroup::Reset() {
+void TileSetGroup::reset() {
for (auto i = tileset.begin(); i != tileset.end(); ++i)
i->img.Delete();
@@ -73,7 +73,7 @@ void TileSetGroup::Reset() {
}
void TileSetGroup::load(const Common::String &path, rapidxml::xml_node<char> *node) {
- Reset();
+ reset();
for (auto n = node->first_node("tileset"); n != NULL; n = n->next_sibling("tileset")) {
TileSet t;
t.load(path, n);
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 1c963a9d5b2..01298e3b512 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -93,7 +93,7 @@ class TileSetGroup {
public:
TileSetGroup() {}
- void Reset();
+ void reset();
void load(const Common::String &path, rapidxml::xml_node<char> *node);
void draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img);
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 25fe664577d..5586ffb6559 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -163,7 +163,7 @@ bool FightMoves::forceUpdate(const unsigned int &index, pyrodactyl::input::Fight
input = _move[_cur]._input;
input.state = _move[_cur]._frames[d]._frame[0]._state;
} else
- input.Reset();
+ input.reset();
_timer.Start();
_start = true;
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index f494128a507..6855bc04fd9 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -604,13 +604,13 @@ void Sprite::ForceUpdateMove(const unsigned int &index) {
Stop();
AssignFrame();
} else
- input.Reset();
+ input.reset();
}
//------------------------------------------------------------------------
// Purpose: Reset the frame info of the sprite
//------------------------------------------------------------------------
void Sprite::ResetFrame(const pyrodactyl::people::PersonState &pst) {
- input.Reset();
+ input.reset();
Walk(true);
anim_set._fight.reset();
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 336d03ee7bd..fce09a05b06 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -149,7 +149,7 @@ public:
target.Set();
ai_data._dest._active = false;
}
- void InputStop() { input.Reset(); }
+ void InputStop() { input.reset(); }
void XVel(const float &val) { target.x = val * vel_mod.x; }
void YVel(const float &val) { target.y = val * vel_mod.y; }
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 4e419c5c349..65c4ae34b87 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -130,7 +130,7 @@ Common::Error CrabEngine::run() {
_screenSettings = new ScreenSettings();
CursorMan.showMouse(true);
- _mouse->Reset();
+ _mouse->reset();
_inputManager->Init();
_inputManager->PopulateKeyTable();
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index d378cddbb67..62854f31982 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -365,7 +365,7 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
if (event_map[info.CurLocID()].ActiveSeq(active_seq)) {
// Set all the pointers to the new values
cur_event = event_map[info.CurLocID()].CurEvent(active_seq);
- oh.Reset(cur_event->title);
+ oh.reset(cur_event->title);
cur_sp = level.GetSprite(cur_event->title);
// The player character's dialog is drawn a bit differently compared to others
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 2c40b128d12..783aaf640e9 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -220,7 +220,7 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
if (!game_over.Empty() && game_over.Evaluate(info)) {
state = STATE_LOSE_MENU;
- hud.gom.Reset();
+ hud.gom.reset();
return;
}
@@ -376,7 +376,7 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
if (!game_over.Empty() && game_over.Evaluate(info)) {
state = STATE_LOSE_MENU;
- hud.gom.Reset();
+ hud.gom.reset();
return;
}
@@ -652,7 +652,7 @@ void Game::ApplyResult(LevelResult result) {
return;
case LR_GAMEOVER:
state = STATE_LOSE_MENU;
- hud.gom.Reset();
+ hud.gom.reset();
break;
default:
break;
@@ -830,7 +830,7 @@ void Game::ToggleState(const State &s) {
// This is because game is the first state, the rest are in order
hud.State(state - 1);
- hud.pause.Reset();
+ hud.pause.reset();
// Only load help screen image if we have to
if (state == STATE_HELP)
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 0ade3a5d804..6cf59b70e4e 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -41,7 +41,7 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
// Purpose: Reset all values
//------------------------------------------------------------------------
-void Cursor::Reset() {
+void Cursor::reset() {
motion.x = 0;
motion.y = 0;
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index acec8be5cdc..7e6ebafa0a1 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -80,7 +80,7 @@ public:
img_hover_s.Delete();
}
- void Reset();
+ void reset();
void load(rapidxml::xml_node<char> *node);
void HandleEvents(const Common::Event &event);
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 52c8cd4d72e..28e9ff8a0fe 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -64,8 +64,8 @@ struct FightInput {
// The sprite state, used to have different moves trigger from the same move
unsigned int state;
- FightInput() { Reset(); }
- void Reset() {
+ FightInput() { reset(); }
+ void reset() {
type = FA_IDLE;
state = 0;
}
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 011071cded7..b62d0261eae 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -45,12 +45,12 @@ using namespace pyrodactyl::event;
// Purpose: We re-use the same level object each time
// this function cleans up everything to make it good as new (get it)
//------------------------------------------------------------------------
-void Level::Reset() {
+void Level::reset() {
if (player_index > 0 && objects.size() > player_index)
objects[player_index].pathing.shutdown();
player_index = 0;
- terrain.Reset();
+ terrain.reset();
objects.clear();
obj_seq.clear();
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 5facee87bcf..d20c66f8be7 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -143,10 +143,10 @@ public:
// A full rendered image of the level
pyrodactyl::image::Image img;
- Level() : player_index(0) { Reset(); }
- ~Level() { Reset(); }
+ Level() : player_index(0) { reset(); }
+ ~Level() { reset(); }
- void Reset();
+ void reset();
void Camera(int x, int y, int w, int h) {
camera.x = x;
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index c549505e54e..1fd74b702d6 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -52,7 +52,7 @@ bool CompSpriteLayer(const Sprite &a, const Sprite &b) {
//------------------------------------------------------------------------
void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
pyrodactyl::event::TriggerSet &game_over, const int &player_x, const int &player_y) {
- Reset();
+ reset();
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("level");
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 0295e37529c..85c4fb36573 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -189,7 +189,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
case 6:
ChangeState(STATE_CREDITS);
- credits.Reset();
+ credits.reset();
break;
case 7:
ShouldChangeState = true;
@@ -324,7 +324,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
break;
case 6:
ChangeState(STATE_CREDITS);
- credits.Reset();
+ credits.reset();
break;
case 7:
ShouldChangeState = true;
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 8b176b06e1a..3c61a8fffe4 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -92,9 +92,9 @@ void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
}
}
-void Person::Reset() {
+void Person::reset() {
for (auto i = 0; i < STAT_TOTAL; ++i)
- stat.val[i].Reset();
+ stat.val[i].reset();
}
void Person::Validate() {
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index 90ce9d03ebf..10e5c57b349 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -80,7 +80,7 @@ struct Person {
Person();
void load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem);
- void Reset();
+ void reset();
void Validate();
void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index f40a934a551..d398e71b4c4 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -50,7 +50,7 @@ struct Stat {
def = 1;
}
- void Reset() { cur = def; }
+ void reset() { cur = def; }
void Validate();
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 8906798d39d..8b81677db7a 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -79,7 +79,7 @@ void TextManager::Init() {
colpool.load(g_engine->_filePath->colors);
}
-void TextManager::Reset() {
+void TextManager::reset() {
cache.clear();
cache.resize(cache_size);
}
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 254622523dc..f833a46d446 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -100,7 +100,7 @@ public:
void Init();
void Quit();
- void Reset();
+ void reset();
Graphics::Font *GetFont(const FontKey &fontid) { return font[fontid]; }
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 7fd34f204cc..80d39c3dcdc 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
-void CreditScreen::Reset() {
+void CreditScreen::reset() {
start.x = g_engine->_screenSettings->cur.w / 2 - 150;
start.y = g_engine->_screenSettings->cur.h + 20;
cur.x = start.x;
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 408b8526881..d5f9f1c9057 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -108,11 +108,11 @@ class CreditScreen {
Button back, website, twitter;
public:
- CreditScreen() { Reset(); }
+ CreditScreen() { reset(); }
~CreditScreen() {}
void load(const Common::String &filename);
- void Reset();
+ void reset();
bool HandleEvents(Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 599e9e98790..8ebe18f3fa8 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -101,7 +101,7 @@ public:
if (img.loaded)
img.preview.Delete();
}
- void Reset() {
+ void reset() {
if (img.loaded)
img.preview.Delete();
img.loaded = false;
@@ -198,9 +198,9 @@ public:
bool HandleEvents(const Common::Event &Event) {
int choice = menu.HandleEvents(Event);
if (choice >= 0) {
- menu.Reset();
+ menu.reset();
selected = slot_info[menu.Index() + choice].path;
- Reset();
+ reset();
return true;
}
@@ -211,9 +211,9 @@ public:
bool HandleEvents(const SDL_Event &Event) {
int choice = menu.HandleEvents(Event);
if (choice >= 0) {
- menu.Reset();
+ menu.reset();
selected = slot_info[menu.Index() + choice].path;
- Reset();
+ reset();
return true;
}
@@ -255,7 +255,7 @@ public:
for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
hov[num].draw();
} else if (hover)
- Reset();
+ reset();
}
bool Empty() {
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 2f3a2bdad75..198579a2a77 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -60,8 +60,8 @@ public:
GameOverMenu(void) { cur = 0; }
~GameOverMenu(void) {}
- void Reset() {
- warning("STUB: GameOverMenu::Reset()");
+ void reset() {
+ warning("STUB: GameOverMenu::reset()");
#if 0
cur = gRandom.Num() % quote.size();
#endif
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index f504d1a4514..7c9c6fdb989 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -102,12 +102,12 @@ class KeyBindMenu {
public:
KeyBindMenu() {
- Reset();
+ reset();
choice = -1;
}
~KeyBindMenu() {}
- void Reset() { state = STATE_NORMAL; }
+ void reset() { state = STATE_NORMAL; }
#if 0
void SwapKey(const SDL_Scancode &find);
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 1648a5417a9..5f71d3849a5 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -129,7 +129,7 @@ void ModMenu::draw() {
for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
hov[num].draw();
} else if (hover)
- Reset();
+ reset();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index c92e32f7415..27b3ebcdbaf 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -95,8 +95,8 @@ void OptionMenu::load(const Common::String &filename) {
}
}
-void OptionMenu::Reset() {
- keybind.Reset();
+void OptionMenu::reset() {
+ keybind.reset();
state = STATE_GENERAL;
for (unsigned i = 0; i < menu.element.size(); ++i)
@@ -311,7 +311,7 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
if (back.HandleEvents(Event) == BUAC_LCLICK) {
- Reset();
+ reset();
return true;
}
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 4b775e05859..6c2f78d1fc7 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -102,7 +102,7 @@ public:
}
~OptionMenu(void) {}
- void Reset();
+ void reset();
bool DisableHotkeys() { return keybind.DisableHotkeys(); }
void load(const Common::String &filename);
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index cace12fb211..1f9407a0f25 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -71,9 +71,9 @@ public:
}
~PageMenu() {}
- void Reset() {
+ void reset() {
for (auto m = menu.begin(); m != menu.end(); ++m)
- m->Reset();
+ m->reset();
}
void Clear() {
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 01922804c6c..cdfafb2126a 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -101,7 +101,7 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
break;
case STATE_OPTION:
if (g_engine->_optionMenu->HandleEvents(back, Event)) {
- g_engine->_optionMenu->Reset();
+ g_engine->_optionMenu->reset();
state = STATE_NORMAL;
}
break;
@@ -162,7 +162,7 @@ PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
break;
case STATE_OPTION:
if (g_engine->_optionMenu->HandleEvents(back, Event)) {
- g_engine->_optionMenu->Reset();
+ g_engine->_optionMenu->reset();
state = STATE_NORMAL;
}
break;
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 359da8c4b07..c2b61acbc60 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -93,7 +93,7 @@ public:
// Returns true if inside options menu, false otherwise
bool draw(Button &back);
- void Reset() { state = STATE_NORMAL; }
+ void reset() { state = STATE_NORMAL; }
void ScanDir() { save.ScanDir(); }
Common::String SaveFile() { return save.SelectedPath(); }
bool DisableHotkeys();
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 8e4007966f7..eef63c63777 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -171,12 +171,12 @@ void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const Common::S
}
}
-void PersonHandler::Reset(const Common::String &id) {
+void PersonHandler::reset(const Common::String &id) {
if (prev != id) {
using namespace pyrodactyl::people;
- opinion[OPI_LIKE].Reset();
- opinion[OPI_RESPECT].Reset();
- opinion[OPI_FEAR].Reset();
+ opinion[OPI_LIKE].reset();
+ opinion[OPI_RESPECT].reset();
+ opinion[OPI_FEAR].reset();
}
}
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index 74d50b366fd..b36ca00ed22 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -85,7 +85,7 @@ public:
PersonHandler() { show_journal = false; }
~PersonHandler() {}
- void Reset(const Common::String &id);
+ void reset(const Common::String &id);
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index 82b3082c231..ec6e710b768 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -94,12 +94,12 @@ public:
inc = 0;
dec = 0;
notify_rate = 5;
- Reset();
+ reset();
}
~ProgressBar() {}
// Reset the effect
- void Reset() {
+ void reset() {
changed = false;
type = NONE;
}
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index e865f9dfc83..c797db07dad 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -80,7 +80,7 @@ public:
void load(rapidxml::xml_node<char> *node);
// Reset the value of current page
- void Reset() { current_page = 0; }
+ void reset() { current_page = 0; }
void HandleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event);
#if 0
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 916896bd416..ed35f46ba10 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -96,7 +96,7 @@ bool GameSaveMenu::HandleEvents(const Common::Event &Event) {
selected = ta_name.text;
state = STATE_NORMAL;
- Reset();
+ reset();
g_engine->_inputManager->SetKeyBindingMode(KBM_GAME);
return true;
}
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index a3308263af8..b5303d9af7d 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -69,7 +69,7 @@ public:
}
~TraitMenu() {}
- void Reset() { select = -1; }
+ void reset() { select = -1; }
void Clear();
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 76826af807e..07ca6f8f5ce 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -52,7 +52,7 @@ Button::Button() {
se_click = -1;
se_hover = -1;
hover_prev = false;
- Reset();
+ reset();
}
//------------------------------------------------------------------------
// Purpose: Load a new Button from a file
@@ -72,7 +72,7 @@ void Button::load(rapidxml::xml_node<char> *node, const bool &echo) {
visible = true;
canmove = false;
- Reset();
+ reset();
}
//------------------------------------------------------------------------
// Purpose: Load a new Button
@@ -88,12 +88,12 @@ void Button::Init(const Button &ref, const int &XOffset, const int &YOffset) {
visible = true;
canmove = false;
- Reset();
+ reset();
}
//------------------------------------------------------------------------
// Purpose: Reset the button
//------------------------------------------------------------------------
-void Button::Reset() {
+void Button::reset() {
mousepressed = false;
hover_mouse = false;
hover_key = false;
@@ -174,7 +174,7 @@ ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset
if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y))
mousepressed = true;
} else if ((Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP) && mousepressed) {
- Reset();
+ reset();
if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
mousepressed = false;
if (Event.type == Common::EVENT_LBUTTONUP) {
@@ -225,7 +225,7 @@ ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, co
if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y))
mousepressed = true;
} else if (Event.type == SDL_MOUSEBUTTONUP && mousepressed) {
- Reset();
+ reset();
if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
mousepressed = false;
if (Event.button.button == SDL_BUTTON_LEFT) {
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index e77dd4c9076..d67073e6c24 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -106,7 +106,7 @@ public:
Button();
~Button() {}
- void Reset();
+ void reset();
void SetUI(Rect *parent = NULL);
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 14b353bedfd..00071423f58 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -223,11 +223,11 @@ public:
}
~Menu() {}
- void Reset() {
+ void reset() {
latest_input = MOUSE;
hover_index = -1;
for (auto b = element.begin(); b != element.end(); ++b)
- b->Reset();
+ b->reset();
}
void SetUI() {
@@ -264,7 +264,7 @@ public:
// We have accepted a menu option using the keyboard
if (result != -1) {
// Reset the menu state
- Reset();
+ reset();
g_engine->_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
return result;
}
@@ -283,7 +283,7 @@ public:
// We clicked on a button using the mouse
if (it->HandleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
// Reset the menu state
- Reset();
+ reset();
g_engine->_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
return i;
}
@@ -321,7 +321,7 @@ public:
// We have accepted a menu option using the keyboard
if (result != -1) {
// Reset the menu state
- Reset();
+ reset();
return result;
}
}
@@ -339,7 +339,7 @@ public:
// We clicked on a button using the mouse
if (it->HandleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
// Reset the menu state
- Reset();
+ reset();
return i;
}
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 5de70281974..2693dc447ca 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -163,7 +163,7 @@ bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const Co
sel_quest = menu.Index() + sel_bu;
quest[sel_quest].unread = false;
- text.Reset();
+ text.reset();
menu.Image(sel_bu, sel_page, img_s);
}
@@ -197,7 +197,7 @@ bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const SD
sel_quest = menu.Index() + sel_bu;
quest[sel_quest].unread = false;
- text.Reset();
+ text.reset();
menu.Image(sel_bu, sel_page, img_s);
}
@@ -234,7 +234,7 @@ void QuestMenu::Select(const int &quest_index) {
sel_bu = quest_index % menu.ElementsPerPage();
quest[quest_index].unread = false;
- text.Reset();
+ text.reset();
menu.Image(sel_bu, sel_page, img_s);
}
Commit: e16af72a395fbc3d832fbd78122aeb0fb4b6f26a
https://github.com/scummvm/scummvm/commit/e16af72a395fbc3d832fbd78122aeb0fb4b6f26a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Range/Shadow related structs follow code formatting conventions
Changed paths:
engines/crab/animation/animframe.cpp
engines/crab/animation/fightanim.cpp
engines/crab/animation/range.h
engines/crab/animation/shadow.h
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index fa63e35bfa4..6308df5e660 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -73,7 +73,7 @@ void AnimationFrames::load(rapidxml::xml_node<char> *node) {
if (nodeValid("shadow", node)) {
_shadow.load(node->first_node("shadow"));
- _shadow.valid = true;
+ _shadow._valid = true;
}
if (nodeValid("frames", node)) {
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index 8b60e536ccc..9988362d79a 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -69,7 +69,7 @@ void FightAnimFrames::load(rapidxml::xml_node<char> *node) {
if (nodeValid("shadow", node)) {
_shadow.load(node->first_node("shadow"));
- _shadow.valid = true;
+ _shadow._valid = true;
}
if (nodeValid("frames", node)) {
diff --git a/engines/crab/animation/range.h b/engines/crab/animation/range.h
index ea3d9785fc0..f48534c0438 100644
--- a/engines/crab/animation/range.h
+++ b/engines/crab/animation/range.h
@@ -39,21 +39,23 @@ namespace Crab {
namespace pyrodactyl {
namespace anim {
struct Range {
- bool valid;
- Rect val[DIRECTION_TOTAL];
+ bool _valid;
+ Rect _val[DIRECTION_TOTAL];
- Range() { valid = false; }
+ Range() {
+ _valid = false;
+ }
void load(rapidxml::xml_node<char> *node) {
if (nodeValid(node, false)) {
- val[DIRECTION_DOWN].load(node->first_node("down"));
- val[DIRECTION_UP].load(node->first_node("up"));
- val[DIRECTION_LEFT].load(node->first_node("left"));
- val[DIRECTION_RIGHT].load(node->first_node("right"));
+ _val[DIRECTION_DOWN].load(node->first_node("down"));
+ _val[DIRECTION_UP].load(node->first_node("up"));
+ _val[DIRECTION_LEFT].load(node->first_node("left"));
+ _val[DIRECTION_RIGHT].load(node->first_node("right"));
- valid = true;
+ _valid = true;
} else
- valid = false;
+ _valid = false;
}
};
} // End of namespace anim
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index 58c770954b3..8286e4fe473 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -41,25 +41,27 @@ namespace pyrodactyl {
namespace anim {
struct ShadowData {
// The image of the sprite's shadow
- ImageKey img;
+ ImageKey _img;
// Size of image
- Vector2i size;
+ Vector2i _size;
// The default shadow offset
- Vector2i offset;
+ Vector2i _offset;
- ShadowData() : size(1, 1) { img = 0; }
+ ShadowData() : _size(1, 1) {
+ _img = 0;
+ }
void load(rapidxml::xml_node<char> *node) {
- loadImgKey(img, "img", node);
- offset.load(node);
+ loadImgKey(_img, "img", node);
+ _offset.load(node);
using namespace pyrodactyl::image;
Image dat;
- g_engine->_imageManager->GetTexture(img, dat);
- size.x = dat.W() / 2;
- size.y = dat.H() / 2;
+ g_engine->_imageManager->GetTexture(_img, dat);
+ _size.x = dat.W() / 2;
+ _size.y = dat.H() / 2;
}
};
@@ -67,9 +69,11 @@ struct ShadowData {
class ShadowOffset : public Vector2i {
public:
// Only use this offset if this is true
- bool valid;
+ bool _valid;
- ShadowOffset() { valid = false; }
+ ShadowOffset() {
+ _valid = false;
+ }
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 6855bc04fd9..d6c4a873520 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -219,10 +219,10 @@ Rect Sprite::PosRect() {
// Used for enemy sprite to find their required spot to attack the player
Rect Sprite::RangeRect(const Rect &bounds, const Range &range) {
Rect rect;
- rect.x = bounds.x + range.val[dir].x;
- rect.y = bounds.y + range.val[dir].y;
- rect.w = range.val[dir].w;
- rect.h = range.val[dir].h;
+ rect.x = bounds.x + range._val[dir].x;
+ rect.y = bounds.y + range._val[dir].y;
+ rect.w = range._val[dir].w;
+ rect.h = range._val[dir].h;
return rect;
}
@@ -247,16 +247,16 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
// Draw the shadow image relative to the bottom center of the sprite
ShadowOffset sh = anim_set.shadow(dir);
- if (sh.valid) {
+ if (sh._valid) {
// Draw using custom offset
- g_engine->_imageManager->draw(x + clip.w / 2 - anim_set._shadow.size.x + sh.x,
- y + clip.h - anim_set._shadow.size.y + sh.y,
- anim_set._shadow.img);
+ g_engine->_imageManager->draw(x + clip.w / 2 - anim_set._shadow._size.x + sh.x,
+ y + clip.h - anim_set._shadow._size.y + sh.y,
+ anim_set._shadow._img);
} else {
// Draw using default offset
- g_engine->_imageManager->draw(x + clip.w / 2 - anim_set._shadow.size.x + anim_set._shadow.offset.x,
- y + clip.h - anim_set._shadow.size.y + anim_set._shadow.offset.y,
- anim_set._shadow.img);
+ g_engine->_imageManager->draw(x + clip.w / 2 - anim_set._shadow._size.x + anim_set._shadow._offset.x,
+ y + clip.h - anim_set._shadow._size.y + anim_set._shadow._offset.y,
+ anim_set._shadow._img);
}
g_engine->_imageManager->draw(x, y, image, &clip, anim_set.flip(dir));
@@ -273,10 +273,10 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
FightMove fm;
if (anim_set._fight.nextMove(fm)) {
Rect actual_range;
- actual_range.x = bounds.x + fm._ai._range.val[dir].x;
- actual_range.y = bounds.y + fm._ai._range.val[dir].y;
- actual_range.w = fm._ai._range.val[dir].w;
- actual_range.h = fm._ai._range.val[dir].h;
+ actual_range.x = bounds.x + fm._ai._range._val[dir].x;
+ actual_range.y = bounds.y + fm._ai._range._val[dir].y;
+ actual_range.w = fm._ai._range._val[dir].w;
+ actual_range.h = fm._ai._range._val[dir].h;
actual_range.draw(-camera.x, -camera.y, 255, 0, 255);
}
@@ -521,7 +521,7 @@ void Sprite::Animate(const pyrodactyl::people::PersonState &pst) {
bool Sprite::FightCollide(Rect hitbox, Rect enemy_bounds, Range &range, const SpriteConstant &sc) {
Rect bounds = BoundRect();
- if (range.valid) {
+ if (range._valid) {
Rect actual_range = RangeRect(bounds, range);
// The second part is a sanity check so the stray hitbox of a sprite 1000 pixels below does not cause damage
Commit: 07ffe2069fda3802cd83f01f4dae53badc9b638f
https://github.com/scummvm/scummvm/commit/07ffe2069fda3802cd83f01f4dae53badc9b638f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename SaveState()/loadState() to saveState()/loadState() across CRAB codebase
Changed paths:
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/crab.cpp
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/event/quest.cpp
engines/crab/event/quest.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/input/input.cpp
engines/crab/input/inputval.cpp
engines/crab/input/inputval.h
engines/crab/item/Item.cpp
engines/crab/item/Item.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/level/level.h
engines/crab/level/level_load.cpp
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
engines/crab/people/opinion.cpp
engines/crab/people/opinion.h
engines/crab/people/person.cpp
engines/crab/people/person.h
engines/crab/people/trait.cpp
engines/crab/people/trait.h
engines/crab/stat/Stat.cpp
engines/crab/stat/Stat.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/MapData.cpp
engines/crab/ui/MapData.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/button.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/vectors.h
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index b1b55680c4c..a80c1cfaa9c 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -116,7 +116,7 @@ void Rect::draw(const int &XOffset, const int &YOffset, const uint8 &r, const ui
DrawLine(X, Y + h, X + w, Y + h, r, g, b, a);
}
-void Rect::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
+void Rect::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
child->append_attribute(doc.allocate_attribute("x", gStrPool->Get(x)));
child->append_attribute(doc.allocate_attribute("y", gStrPool->Get(y)));
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index c36960e0c00..feedae38ace 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -89,7 +89,7 @@ struct Rect {
bool operator==(const Rect &r) { return r.x == x && r.y == y && r.w == w && r.h == h; }
// Save to file
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name);
};
} // End of namespace Crab
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index 11477683a76..d1b9b90871b 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -143,7 +143,7 @@ void ScreenSettings::SetMouseTrap() {
#endif
}
-void ScreenSettings::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void ScreenSettings::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("version", gStrPool->Get(version)));
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "screen");
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index cd604a03a03..4e5b220b088 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -148,7 +148,7 @@ public:
void SetMouseTrap();
void load(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index d6c4a873520..28fc73e8a5e 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -729,7 +729,7 @@ void Sprite::internalEvents(Info &info, const Common::String &player_id, Common:
//------------------------------------------------------------------------
// Purpose: Save all sprite positions to save file
//------------------------------------------------------------------------
-void Sprite::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Sprite::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("id", id.c_str()));
root->append_attribute(doc.allocate_attribute("x", gStrPool->Get(pos.x)));
root->append_attribute(doc.allocate_attribute("y", gStrPool->Get(pos.y)));
@@ -738,7 +738,7 @@ void Sprite::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
//------------------------------------------------------------------------
// Purpose: Load all sprite positions from save file
//------------------------------------------------------------------------
-void Sprite::LoadState(rapidxml::xml_node<char> *node) {
+void Sprite::loadState(rapidxml::xml_node<char> *node) {
loadNum(pos.x, "x", node);
loadNum(pos.y, "y", node);
}
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index fce09a05b06..f8d67e46f84 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -236,8 +236,8 @@ public:
bool MoveToLoc(Vector2i &dest, const float &vel, const pyrodactyl::ai::SpriteConstant &sc);
bool MoveToLocPathfinding(Vector2i &dest, const float &vel, const pyrodactyl::ai::SpriteConstant &sc);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
};
} // End of namespace anim
} // End of namespace pyrodactyl
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 65c4ae34b87..49d3fa36db0 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -161,7 +161,7 @@ Common::Error CrabEngine::saveGameState(int slot, const Common::String &desc, bo
if (!saveFile)
return Common::kWritingFailed;
- _app->GetGame()->SaveState(saveFile);
+ _app->GetGame()->saveState(saveFile);
getMetaEngine()->appendExtendedSave(saveFile, getTotalPlayTime(), desc, isAutosave);
saveFile->finalize();
@@ -178,7 +178,7 @@ Common::Error CrabEngine::loadGameState(int slot) {
if (!saveFile)
return Common::kReadingFailed;
- _app->GetGame()->LoadState(saveFile);
+ _app->GetGame()->loadState(saveFile);
ExtendedSavegameHeader header;
if (MetaEngine::readSavegameHeader(saveFile, &header))
setTotalPlayTime(header.playtime);
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index fc4192eede5..6c3299ee5f9 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -73,7 +73,7 @@ bool EventSeqGroup::ActiveSeq(unsigned int &active_seq) {
return false;
}
-void EventSeqGroup::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void EventSeqGroup::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = end.begin(); i != end.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "end");
child->value(gStrPool->Get(*i));
@@ -81,10 +81,10 @@ void EventSeqGroup::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<
}
for (auto i = seq.begin(); i != seq.end(); ++i)
- i->_value.SaveState(doc, root, gStrPool->Get(i->_key));
+ i->_value.saveState(doc, root, gStrPool->Get(i->_key));
}
-void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node) {
+void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *i = node->first_node("end"); i != NULL; i = i->next_sibling("end"))
EndSeq(StringToNumber<unsigned int>(i->value()));
@@ -92,7 +92,7 @@ void EventSeqGroup::LoadState(rapidxml::xml_node<char> *node) {
if (n->first_attribute("name") != NULL) {
unsigned int id = StringToNumber<unsigned int>(n->first_attribute("name")->value());
if (seq.contains(id) > 0)
- seq[id].LoadState(n);
+ seq[id].loadState(n);
}
}
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index fc9aff67771..72b2568cf9d 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -62,8 +62,8 @@ public:
void internalEvents(Info &info);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 293fbdb2873..60290315d78 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -111,7 +111,7 @@ void EventSequence::NextEvent(pyrodactyl::event::Info &info, const Common::Strin
//------------------------------------------------------------------------
// Purpose: Save the state of the object
//------------------------------------------------------------------------
-void EventSequence::SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name) {
+void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *seqnode = doc.allocate_node(rapidxml::node_element, "set");
// Write current event id and name to node
@@ -131,7 +131,7 @@ void EventSequence::SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
//------------------------------------------------------------------------
// Purpose: Load the state of the object
//------------------------------------------------------------------------
-void EventSequence::LoadState(rapidxml::xml_node<char> *node) {
+void EventSequence::loadState(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *curid = node->first_attribute("current");
if (curid != NULL)
cur = StringToNumber<unsigned int>(curid->value());
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index 21ae39a61c7..810d947bbad 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -76,8 +76,8 @@ public:
// Load and save
void load(const Common::String &filename);
- void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
+ void loadState(rapidxml::xml_node<char> *node);
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 7cd2380fe69..3001ab9a9e6 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -330,8 +330,8 @@ Common::String Info::GetName(const Common::String &id) {
//------------------------------------------------------------------------
// Purpose: Save and load object state
//------------------------------------------------------------------------
-void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- warning("Info::SaveState()");
+void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ warning("Info::saveState()");
#if 0
for (auto v = var.begin(); v != var.end(); ++v) {
@@ -342,7 +342,7 @@ void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
}
for (auto p = people.begin(); p != people.end(); ++p)
- p->second.SaveState(doc, root);
+ p->second.saveState(doc, root);
rapidxml::xml_node<char> *child_unr = doc.allocate_node(rapidxml::node_element, "unread");
@@ -361,19 +361,19 @@ void Info::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
child_money->append_attribute(doc.allocate_attribute("var", money_var.c_str()));
root->append_node(child_money);
- journal.SaveState(doc, root);
- inv.SaveState(doc, root);
+ journal.saveState(doc, root);
+ inv.saveState(doc, root);
#endif
}
-void Info::LoadState(rapidxml::xml_node<char> *node) {
+void Info::loadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *v = node->first_node("var"); v != NULL; v = v->next_sibling("var"))
var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object")) {
Common::String id;
loadStr(id, "id", p);
- people[id].LoadState(p);
+ people[id].loadState(p);
}
if (nodeValid("unread", node)) {
@@ -390,8 +390,8 @@ void Info::LoadState(rapidxml::xml_node<char> *node) {
if (nodeValid("money", node))
loadStr(money_var, "var", node->first_node("money"));
- journal.LoadState(node);
- inv.LoadState(node);
+ journal.loadState(node);
+ inv.loadState(node);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 3c22dc11aff..4e9f044cd42 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -199,8 +199,8 @@ public:
ironman = (str == "Iron Man");
}
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
void SetUI();
};
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 62854f31982..77a74fcdcaa 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -409,11 +409,11 @@ bool Manager::EventInProgress() {
//------------------------------------------------------------------------
// Purpose: Save the state of the object
//------------------------------------------------------------------------
-void Manager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Manager::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = event_map.begin(); i != event_map.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "loc");
child->append_attribute(doc.allocate_attribute("name", i->_key.c_str()));
- i->_value.SaveState(doc, child);
+ i->_value.saveState(doc, child);
root->append_node(child);
}
}
@@ -421,12 +421,12 @@ void Manager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
//------------------------------------------------------------------------
// Purpose: Load the state of the object
//------------------------------------------------------------------------
-void Manager::LoadState(rapidxml::xml_node<char> *node) {
+void Manager::loadState(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
if (n->first_attribute("name") != NULL) {
Common::String name = n->first_attribute("name")->value();
if (event_map.contains(name) > 0)
- event_map[name].LoadState(n);
+ event_map[name].loadState(n);
}
}
}
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index fa81810ad4c..cbe66bf9310 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -107,8 +107,8 @@ public:
void EndSequence(const Common::String &curloc);
bool EventInProgress();
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
void SetUI();
};
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index 1fe55a3d198..0601a65c3d6 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -40,7 +40,7 @@ Quest::Quest(const Common::String &Title, const Common::String &Text, const bool
marker = Marker;
}
-void Quest::LoadState(rapidxml::xml_node<char> *node) {
+void Quest::loadState(rapidxml::xml_node<char> *node) {
loadStr(title, "title", node);
loadBool(unread, "unread", node);
loadBool(marker, "marker", node);
@@ -49,7 +49,7 @@ void Quest::LoadState(rapidxml::xml_node<char> *node) {
text.push_back(n->value());
}
-void Quest::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Quest::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "quest");
child->append_attribute(doc.allocate_attribute("title", title.c_str()));
diff --git a/engines/crab/event/quest.h b/engines/crab/event/quest.h
index dbf11d5ffeb..0929ae93975 100644
--- a/engines/crab/event/quest.h
+++ b/engines/crab/event/quest.h
@@ -57,8 +57,8 @@ struct Quest {
}
Quest(const Common::String &Title, const Common::String &Text, const bool &Unread, const bool &Marker);
- void LoadState(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 783aaf640e9..2b6aa60afe2 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -662,7 +662,7 @@ void Game::ApplyResult(LevelResult result) {
//------------------------------------------------------------------------
// Purpose: Save/load game
//------------------------------------------------------------------------
-void Game::LoadState(Common::SeekableReadStream *stream) {
+void Game::loadState(Common::SeekableReadStream *stream) {
if (!_isInited)
LoadGame();
@@ -686,13 +686,13 @@ void Game::LoadState(Common::SeekableReadStream *stream) {
hud.pause.UpdateMode(info.IronMan());
if (nodeValid("events", node))
- gem.LoadState(node->first_node("events"));
+ gem.loadState(node->first_node("events"));
if (nodeValid("info", node))
- info.LoadState(node->first_node("info"));
+ info.loadState(node->first_node("info"));
if (nodeValid("map", node))
- map.LoadState(node->first_node("map"));
+ map.loadState(node->first_node("map"));
PlayerImg();
@@ -701,7 +701,7 @@ void Game::LoadState(Common::SeekableReadStream *stream) {
LoadLevel(loc);
if (nodeValid("level", node))
- level.LoadState(node->first_node("level"));
+ level.loadState(node->first_node("level"));
gem.per.Cache(info, level.PlayerID(), level);
@@ -714,7 +714,7 @@ void Game::LoadState(Common::SeekableReadStream *stream) {
//------------------------------------------------------------------------
// Purpose: Write game state to file
//------------------------------------------------------------------------
-void Game::SaveState(Common::SeekableWriteStream *stream) {
+void Game::saveState(Common::SeekableWriteStream *stream) {
rapidxml::xml_document<char> doc;
// xml declaration
@@ -758,19 +758,19 @@ void Game::SaveState(Common::SeekableWriteStream *stream) {
root->append_attribute(doc.allocate_attribute("time", playtime.c_str()));
rapidxml::xml_node<char> *child_gem = doc.allocate_node(rapidxml::node_element, "events");
- gem.SaveState(doc, child_gem);
+ gem.saveState(doc, child_gem);
root->append_node(child_gem);
rapidxml::xml_node<char> *child_info = doc.allocate_node(rapidxml::node_element, "info");
- info.SaveState(doc, child_info);
+ info.saveState(doc, child_info);
root->append_node(child_info);
rapidxml::xml_node<char> *child_map = doc.allocate_node(rapidxml::node_element, "map");
- map.SaveState(doc, child_map);
+ map.saveState(doc, child_map);
root->append_node(child_map);
rapidxml::xml_node<char> *child_level = doc.allocate_node(rapidxml::node_element, "level");
- level.SaveState(doc, child_level);
+ level.saveState(doc, child_level);
root->append_node(child_level);
Common::String xml_as_string;
@@ -846,27 +846,27 @@ void Game::CreateSaveGame(const SaveGameType &savetype) {
#if 0
// Disregard type in iron man mode, we only save to one file
if (info.IronMan())
- SaveState(savefile.ironman, true);
+ saveState(savefile.ironman, true);
else {
switch (savetype) {
case SAVEGAME_NORMAL:
- SaveState(hud.pause.SaveFile(), false);
+ saveState(hud.pause.SaveFile(), false);
break;
case SAVEGAME_EVENT:
if (savefile.auto_slot)
- SaveState(savefile.auto_2, true);
+ saveState(savefile.auto_2, true);
else
- SaveState(savefile.auto_1, true);
+ saveState(savefile.auto_1, true);
savefile.auto_slot = !savefile.auto_slot;
break;
case SAVEGAME_EXIT:
- SaveState(savefile.auto_quit, true);
+ saveState(savefile.auto_quit, true);
break;
case SAVEGAME_QUICK:
- SaveState(savefile.quick, true);
+ saveState(savefile.quick, true);
break;
default:
break;
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 3e3804c79e3..8a482e44f38 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -137,10 +137,10 @@ public:
void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void draw();
- void LoadState(Common::SeekableReadStream *stream);
+ void loadState(Common::SeekableReadStream *stream);
// Raw function to save game to file - generally, using the CreateSaveGame function is recommended
- void SaveState(Common::SeekableWriteStream *stream);
+ void saveState(Common::SeekableWriteStream *stream);
void AutoSave() { CreateSaveGame(SAVEGAME_EXIT); }
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 94fcceff871..3e2b33142ac 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -162,7 +162,7 @@ void InputManager::load(const Common::String &filename) {
int i = 0;
for (auto n = node->first_node(); n != NULL && i < IT_TOTAL; n = n->next_sibling(), ++i)
- iv[i].LoadState(n);
+ iv[i].loadState(n);
}
}
}
@@ -267,7 +267,7 @@ void InputManager::Save() {
rapidxml::xml_node<char> *root = doc.allocate_node(rapidxml::node_element, "controls");
root->append_attribute(doc.allocate_attribute("version", gStrPool->Get(version)));
for (int i = 0; i < IT_TOTAL; i++)
- iv[i].SaveState(doc, root, "i");
+ iv[i].saveState(doc, root, "i");
doc.append_node(root);
Common::String xml_as_string;
diff --git a/engines/crab/input/inputval.cpp b/engines/crab/input/inputval.cpp
index e15b5e6e4ee..19a9b8f3f1a 100644
--- a/engines/crab/input/inputval.cpp
+++ b/engines/crab/input/inputval.cpp
@@ -48,8 +48,8 @@ InputVal::InputVal() {
//------------------------------------------------------------------------
// Purpose: Load input values
//------------------------------------------------------------------------
-void InputVal::LoadState(rapidxml::xml_node<char> *node) {
- warning("STUB: InputVal::LoadState()");
+void InputVal::loadState(rapidxml::xml_node<char> *node) {
+ warning("STUB: InputVal::loadState()");
#if 0
loadStr(name, "name", node);
@@ -58,15 +58,15 @@ void InputVal::LoadState(rapidxml::xml_node<char> *node) {
loadEnum(c_bu, "bu", node);
if (nodeValid("axis", node, false))
- c_ax.LoadState(node->first_node("axis"));
+ c_ax.loadState(node->first_node("axis"));
#endif
}
//------------------------------------------------------------------------
// Purpose: Save them
//------------------------------------------------------------------------
-void InputVal::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title) {
- warning("STUB: InputVal::SaveState()");
+void InputVal::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title) {
+ warning("STUB: InputVal::saveState()");
#if 0
rapidxml::xml_node<char> *child;
@@ -78,7 +78,7 @@ void InputVal::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
child->append_attribute(doc.allocate_attribute("bu", gStrPool.Get(c_bu)));
if (c_ax.id != SDL_CONTROLLER_AXIS_INVALID)
- c_ax.SaveState(doc, child);
+ c_ax.saveState(doc, child);
root->append_node(child);
#endif
diff --git a/engines/crab/input/inputval.h b/engines/crab/input/inputval.h
index 9222bd89f8c..fb1530a4373 100644
--- a/engines/crab/input/inputval.h
+++ b/engines/crab/input/inputval.h
@@ -78,13 +78,13 @@ public:
#endif
}
- void LoadState(rapidxml::xml_node<char> *node) {
+ void loadState(rapidxml::xml_node<char> *node) {
//loadEnum(id, "id", node);
loadNum(val, "val", node);
loadBool(greater, "greater", node);
}
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child;
child = doc.allocate_node(rapidxml::node_element, "axis");
@@ -105,8 +105,8 @@ public:
const bool Equals(const SDL_ControllerAxisEvent &Event);
#endif
- void LoadState(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title);
+ void loadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title);
};
} // End of namespace input
} // End of namespace pyrodactyl
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 979ddd1f5f5..5d6b3f567c5 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -71,7 +71,7 @@ void Item::Clear() {
//------------------------------------------------------------------------
// Purpose: Save and load state
//------------------------------------------------------------------------
-void Item::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("id", id.c_str()));
root->append_attribute(doc.allocate_attribute("name", name.c_str()));
root->append_attribute(doc.allocate_attribute("type", type.c_str()));
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index bbd5244635a..a32a8770aca 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -65,7 +65,7 @@ struct Item {
void load(rapidxml::xml_node<char> *node);
void draw(const int &x, const int &y);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
} // End of namespace item
} // End of namespace pyrodactyl
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 39ffe37ec47..b1f26661dd9 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -124,21 +124,21 @@ bool ItemCollection::Has(const Common::String &char_id, const Common::String &co
//------------------------------------------------------------------------
// Purpose: Load items from save file
//------------------------------------------------------------------------
-void ItemCollection::LoadState(rapidxml::xml_node<char> *node) {
+void ItemCollection::loadState(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
// Add all characters in the save file, whether we have them in the inventory or not
Init(n->name());
- item[n->name()].LoadState(n);
+ item[n->name()].loadState(n);
}
}
//------------------------------------------------------------------------
// Purpose: Write items to save file
//------------------------------------------------------------------------
-void ItemCollection::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void ItemCollection::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = item.begin(); i != item.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, i->_key.c_str());
- i->_value.SaveState(doc, child);
+ i->_value.saveState(doc, child);
root->append_node(child);
}
}
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 68de8359f25..981b6b3e846 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -88,8 +88,8 @@ public:
// Requires: id of the character, the name of the container and name of the item
bool Has(const Common::String &char_id, const Common::String &container, const Common::String &item_id);
- void LoadState(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void SetUI();
};
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 5f642dbacb1..f956dfcb7fc 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -55,18 +55,18 @@ void ItemMenu::Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int
//------------------------------------------------------------------------
// Purpose: Load items from file
//------------------------------------------------------------------------
-void ItemMenu::LoadState(rapidxml::xml_node<char> *node) {
+void ItemMenu::loadState(rapidxml::xml_node<char> *node) {
unsigned int count = 0;
for (auto n = node->first_node(); n != NULL && count < element.size(); n = n->next_sibling(), ++count)
- element[count].LoadState(n);
+ element[count].loadState(n);
}
//------------------------------------------------------------------------
// Purpose: Save to file
//------------------------------------------------------------------------
-void ItemMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void ItemMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = element.begin(); i != element.end(); ++i)
- i->SaveState(doc, root);
+ i->saveState(doc, root);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index ff1d46fac29..8fbc744d84a 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -84,8 +84,8 @@ public:
// Used to calculate enabled slots
// void SetEnable();
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
};
} // End of namespace item
} // End of namespace pyrodactyl
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index cec9abdfcad..f6e12547cba 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -73,7 +73,7 @@ void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset)
//------------------------------------------------------------------------
// Purpose: Save state to file
//------------------------------------------------------------------------
-void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void ItemSlot::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child;
if (category == SLOT_EQUIP)
@@ -81,7 +81,7 @@ void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
else
child = doc.allocate_node(rapidxml::node_element, "storage");
- item.SaveState(doc, child);
+ item.saveState(doc, child);
saveBool(unread, "unread", doc, child);
root->append_node(child);
@@ -90,7 +90,7 @@ void ItemSlot::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
//------------------------------------------------------------------------
// Purpose: Load state from file
//------------------------------------------------------------------------
-void ItemSlot::LoadState(rapidxml::xml_node<char> *node) {
+void ItemSlot::loadState(rapidxml::xml_node<char> *node) {
item.load(node);
loadBool(unread, "unread", node);
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index 1d8a24dffe6..d1abd1176be 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -91,8 +91,8 @@ public:
void StatChange(pyrodactyl::people::Person &obj, bool increase);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
};
} // End of namespace item
} // End of namespace pyrodactyl
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index d20c66f8be7..dfabc19db4f 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -200,8 +200,8 @@ public:
void PreDrawObjects(Graphics::ManagedSurface *surf);
void draw(pyrodactyl::event::Info &info);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
void SetUI();
};
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 1fd74b702d6..954bbdda2e6 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -211,12 +211,12 @@ void Level::LoadConst(const Common::String &filename) {
//------------------------------------------------------------------------
// Purpose: Save all sprite positions to save file
//------------------------------------------------------------------------
-void Level::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Level::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("player_index", gStrPool->Get(player_index)));
for (auto &i : objects) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sprite");
- i.SaveState(doc, child);
+ i.saveState(doc, child);
root->append_node(child);
}
}
@@ -224,12 +224,12 @@ void Level::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *r
//------------------------------------------------------------------------
// Purpose: Load all sprite positions from save file
//------------------------------------------------------------------------
-void Level::LoadState(rapidxml::xml_node<char> *node) {
+void Level::loadState(rapidxml::xml_node<char> *node) {
loadNum(player_index, "player_index", node);
auto i = objects.begin();
for (auto *n = node->first_node("sprite"); n != NULL && i != objects.end(); n = n->next_sibling("sprite"), ++i)
- i->LoadState(n);
+ i->loadState(n);
}
} // End of namespace Crab
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 7a6b3661d19..0f9a8bd26e7 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -155,8 +155,8 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
return true;
}
-void MusicManager::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- warning("STUB: MusicManager::SaveState()");
+void MusicManager::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ warning("STUB: MusicManager::saveState()");
#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sound");
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index cc67d9e1760..d2c6e2ac41d 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -141,7 +141,7 @@ public:
}
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void FreeMusic();
void FreeChunk();
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index 8a5af19bfde..3cf1619b245 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -70,7 +70,7 @@ void Opinion::Validate(const OpinionType &type) {
val[type] = OPINION_MAX;
}
-void Opinion::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Opinion::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "opinion");
child->append_attribute(doc.allocate_attribute("like", gStrPool->Get(val[OPI_LIKE])));
child->append_attribute(doc.allocate_attribute("fear", gStrPool->Get(val[OPI_FEAR])));
diff --git a/engines/crab/people/opinion.h b/engines/crab/people/opinion.h
index 4232889b7c0..fab37edd5c6 100644
--- a/engines/crab/people/opinion.h
+++ b/engines/crab/people/opinion.h
@@ -63,7 +63,7 @@ struct Opinion {
void Validate(const OpinionType &type);
void load(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
} // End of namespace people
} // End of namespace pyrodactyl
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 3c61a8fffe4..a99f9c99bce 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -102,7 +102,7 @@ void Person::Validate() {
stat.val[i].Validate();
}
-void Person::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Person::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "object");
child->append_attribute(doc.allocate_attribute("id", id.c_str()));
child->append_attribute(doc.allocate_attribute("name", name.c_str()));
@@ -110,26 +110,26 @@ void Person::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
unsigned int val = static_cast<unsigned int>(state);
child->append_attribute(doc.allocate_attribute("state", gStrPool->Get(val)));
- opinion.SaveState(doc, child);
+ opinion.saveState(doc, child);
rapidxml::xml_node<char> *child_s = doc.allocate_node(rapidxml::node_element, "stats");
- stat.val[STAT_HEALTH].SaveState(doc, child_s, STATNAME_HEALTH);
- stat.val[STAT_ATTACK].SaveState(doc, child_s, STATNAME_ATTACK);
- stat.val[STAT_DEFENSE].SaveState(doc, child_s, STATNAME_DEFENSE);
- stat.val[STAT_SPEED].SaveState(doc, child_s, STATNAME_SPEED);
- /*stat.val[STAT_CHARISMA].SaveState(doc, child_s, STATNAME_CHARISMA);
- stat.val[STAT_INTELLIGENCE].SaveState(doc, child_s, STATNAME_INTELLIGENCE);*/
+ stat.val[STAT_HEALTH].saveState(doc, child_s, STATNAME_HEALTH);
+ stat.val[STAT_ATTACK].saveState(doc, child_s, STATNAME_ATTACK);
+ stat.val[STAT_DEFENSE].saveState(doc, child_s, STATNAME_DEFENSE);
+ stat.val[STAT_SPEED].saveState(doc, child_s, STATNAME_SPEED);
+ /*stat.val[STAT_CHARISMA].saveState(doc, child_s, STATNAME_CHARISMA);
+ stat.val[STAT_INTELLIGENCE].saveState(doc, child_s, STATNAME_INTELLIGENCE);*/
child->append_node(child_s);
rapidxml::xml_node<char> *child_t = doc.allocate_node(rapidxml::node_element, "traits");
for (auto &i : trait)
- i.SaveState(doc, child_t, "trait");
+ i.saveState(doc, child_t, "trait");
child->append_node(child_t);
root->append_node(child);
}
-void Person::LoadState(rapidxml::xml_node<char> *node) {
+void Person::loadState(rapidxml::xml_node<char> *node) {
loadStr(id, "id", node);
loadStr(name, "name", node);
loadEnum(state, "state", node);
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index 10e5c57b349..b878e6de4e2 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -83,8 +83,8 @@ struct Person {
void reset();
void Validate();
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
};
typedef Common::HashMap<Common::String, Person> PersonMap;
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index ad21d6772bd..6da7ef528c0 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -59,7 +59,7 @@ void Trait::Clear() {
//------------------------------------------------------------------------
// Purpose: Save and load state
//------------------------------------------------------------------------
-void Trait::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname) {
+void Trait::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, rootname);
child->append_attribute(doc.allocate_attribute("id", gStrPool->Get(id)));
child->append_attribute(doc.allocate_attribute("name", name.c_str()));
diff --git a/engines/crab/people/trait.h b/engines/crab/people/trait.h
index e88f76e5e21..db95c317375 100644
--- a/engines/crab/people/trait.h
+++ b/engines/crab/people/trait.h
@@ -67,7 +67,7 @@ struct Trait {
void Clear();
void load(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname);
};
} // End of namespace people
} // End of namespace pyrodactyl
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index 2eee693427f..ecc246b3dae 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -102,7 +102,7 @@ void Stat::Validate() {
cur = max;
}
-void Stat::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
+void Stat::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(cur)));
child->append_attribute(doc.allocate_attribute("def", gStrPool->Get(def)));
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index d398e71b4c4..103a83b6614 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -54,7 +54,7 @@ struct Stat {
void Validate();
void load(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name);
};
struct StatGroup {
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 494446d3193..3264c77c8f2 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -120,14 +120,14 @@ void Inventory::HandleEvents(const Common::String &char_id, const SDL_Event &Eve
//------------------------------------------------------------------------
// Purpose: Load and save items
//------------------------------------------------------------------------
-void Inventory::LoadState(rapidxml::xml_node<char> *node) {
+void Inventory::loadState(rapidxml::xml_node<char> *node) {
if (nodeValid("items", node))
- collection.LoadState(node->first_node("items"));
+ collection.loadState(node->first_node("items"));
}
-void Inventory::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Inventory::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "items");
- collection.SaveState(doc, child);
+ collection.saveState(doc, child);
root->append_node(child);
}
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index 8112d95b438..7352700ddca 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -77,8 +77,8 @@ public:
void HandleEvents(const Common::String &char_id, const SDL_Event &Event);
#endif
- void LoadState(rapidxml::xml_node<char> *node);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void ItemFile(const Common::String &filename) { itemfile = filename; }
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index 8369fc855af..272d84f687e 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -47,10 +47,10 @@ void MapData::DestAdd(const Common::String &name, const int &x, const int &y) {
dest.push_back(md);
}
-void MapData::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void MapData::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child_clip = doc.allocate_node(rapidxml::node_element, "clip");
for (auto c = reveal.begin(); c != reveal.end(); ++c)
- c->SaveState(doc, child_clip, "rect");
+ c->saveState(doc, child_clip, "rect");
root->append_node(child_clip);
rapidxml::xml_node<char> *child_dest = doc.allocate_node(rapidxml::node_element, "dest");
@@ -64,7 +64,7 @@ void MapData::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
root->append_node(child_dest);
}
-void MapData::LoadState(rapidxml::xml_node<char> *node) {
+void MapData::loadState(rapidxml::xml_node<char> *node) {
reveal.clear();
if (nodeValid("clip", node)) {
rapidxml::xml_node<char> *clipnode = node->first_node("clip");
diff --git a/engines/crab/ui/MapData.h b/engines/crab/ui/MapData.h
index 94b0013090e..8a4cc97a4bd 100644
--- a/engines/crab/ui/MapData.h
+++ b/engines/crab/ui/MapData.h
@@ -63,8 +63,8 @@ struct MapData {
void load(rapidxml::xml_node<char> *node);
void DestAdd(const Common::String &name, const int &x, const int &y);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 27b3ebcdbaf..9706e63d3cb 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -338,7 +338,7 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
case 4:
// Save settings to file
g_engine->_inputManager->Save();
- SaveState();
+ saveState();
general.CreateBackup();
g_engine->_screenSettings->CreateBackup();
return true;
@@ -380,8 +380,8 @@ void OptionMenu::internalEvents() {
}
}
-void OptionMenu::SaveState() {
- warning("STUB: OptionMenu::SaveState()");
+void OptionMenu::saveState() {
+ warning("STUB: OptionMenu::saveState()");
#if 0
rapidxml::xml_document<char> doc;
@@ -394,8 +394,8 @@ void OptionMenu::SaveState() {
// root node
rapidxml::xml_node<char> *root = doc.allocate_node(rapidxml::node_element, "settings");
- g_engine->_screenSettings->SaveState(doc, root);
- g_engine->_musicManager->SaveState(doc, root);
+ g_engine->_screenSettings->saveState(doc, root);
+ g_engine->_musicManager->saveState(doc, root);
doc.append_node(root);
Common::String xml_as_string;
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 6c2f78d1fc7..30e9aba83fc 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -114,7 +114,7 @@ public:
void internalEvents();
void SetUI();
- void SaveState();
+ void saveState();
};
} // End of namespace ui
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index d67073e6c24..d7af98c97d0 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -72,7 +72,7 @@ struct ButtonImage {
}
}
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("img_b", gStrPool->Get(normal)));
root->append_attribute(doc.allocate_attribute("img_s", gStrPool->Get(select)));
root->append_attribute(doc.allocate_attribute("img_h", gStrPool->Get(hover)));
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 1f23b239612..178f1187e5c 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -261,21 +261,21 @@ void Journal::Open(const Common::String &id, const JournalCategory &Category, co
//------------------------------------------------------------------------
// Purpose: Load save game stuff
//------------------------------------------------------------------------
-void Journal::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Journal::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto &m : journal) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "journal");
child->append_attribute(doc.allocate_attribute("id", m.id.c_str()));
- m.menu[JE_CUR].SaveState(doc, child, JE_CUR_NAME);
- m.menu[JE_DONE].SaveState(doc, child, JE_DONE_NAME);
- m.menu[JE_PEOPLE].SaveState(doc, child, JE_PEOPLE_NAME);
- m.menu[JE_LOCATION].SaveState(doc, child, JE_LOCATION_NAME);
- m.menu[JE_HISTORY].SaveState(doc, child, JE_HISTORY_NAME);
+ m.menu[JE_CUR].saveState(doc, child, JE_CUR_NAME);
+ m.menu[JE_DONE].saveState(doc, child, JE_DONE_NAME);
+ m.menu[JE_PEOPLE].saveState(doc, child, JE_PEOPLE_NAME);
+ m.menu[JE_LOCATION].saveState(doc, child, JE_LOCATION_NAME);
+ m.menu[JE_HISTORY].saveState(doc, child, JE_HISTORY_NAME);
root->append_node(child);
}
}
-void Journal::LoadState(rapidxml::xml_node<char> *node) {
+void Journal::loadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *n = node->first_node("journal"); n != NULL; n = n->next_sibling("journal")) {
Common::String id;
loadStr(id, "id", n);
@@ -284,11 +284,11 @@ void Journal::LoadState(rapidxml::xml_node<char> *node) {
for (auto &i : journal)
if (i.id == id) {
- i.menu[JE_CUR].LoadState(n->first_node(JE_CUR_NAME));
- i.menu[JE_DONE].LoadState(n->first_node(JE_DONE_NAME));
- i.menu[JE_PEOPLE].LoadState(n->first_node(JE_PEOPLE_NAME));
- i.menu[JE_LOCATION].LoadState(n->first_node(JE_LOCATION_NAME));
- i.menu[JE_HISTORY].LoadState(n->first_node(JE_HISTORY_NAME));
+ i.menu[JE_CUR].loadState(n->first_node(JE_CUR_NAME));
+ i.menu[JE_DONE].loadState(n->first_node(JE_DONE_NAME));
+ i.menu[JE_PEOPLE].loadState(n->first_node(JE_PEOPLE_NAME));
+ i.menu[JE_LOCATION].loadState(n->first_node(JE_LOCATION_NAME));
+ i.menu[JE_HISTORY].loadState(n->first_node(JE_HISTORY_NAME));
}
}
}
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 82e0bc74963..d42e94f29f7 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -113,8 +113,8 @@ public:
// Prepare a new character's journal
void Init(const Common::String &id);
- void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
void SetUI();
};
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 052ff9624e9..99245f78edb 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -468,7 +468,7 @@ void Map::DestDel(const Common::String &name) {
//------------------------------------------------------------------------
// Purpose: Save and load object state
//------------------------------------------------------------------------
-void Map::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
+void Map::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "map");
child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(cur)));
@@ -476,14 +476,14 @@ void Map::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *roo
for (auto r = map.begin(); r != map.end(); ++r) {
rapidxml::xml_node<char> *child_data = doc.allocate_node(rapidxml::node_element, "data");
- r->SaveState(doc, child_data);
+ r->saveState(doc, child_data);
child->append_node(child_data);
}
root->append_node(child);
}
-void Map::LoadState(rapidxml::xml_node<char> *node) {
+void Map::loadState(rapidxml::xml_node<char> *node) {
if (nodeValid("map", node)) {
rapidxml::xml_node<char> *mapnode = node->first_node("map");
loadBool(overlay, "overlay", mapnode);
@@ -493,7 +493,7 @@ void Map::LoadState(rapidxml::xml_node<char> *node) {
auto r = map.begin();
for (rapidxml::xml_node<char> *n = mapnode->first_node("data"); n != NULL && r != map.end(); n = n->next_sibling("data"), ++r)
- r->LoadState(n);
+ r->loadState(n);
SetImage(val, true);
}
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 8bc2973debb..edc30c026db 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -142,8 +142,8 @@ public:
void Update(pyrodactyl::event::Info &info);
void SetImage(const unsigned int &val, const bool &force = false);
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
+ void loadState(rapidxml::xml_node<char> *node);
void SetUI();
};
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 2693dc447ca..2a1c560756f 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -243,13 +243,13 @@ void QuestMenu::Select(const int &quest_index) {
//------------------------------------------------------------------------
// Purpose: Save state to file
//------------------------------------------------------------------------
-void QuestMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
+void QuestMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
saveBool(unread, "unread", doc, child);
for (auto q = quest.begin(); q != quest.end(); ++q)
- q->SaveState(doc, child);
+ q->saveState(doc, child);
root->append_node(child);
}
@@ -257,13 +257,13 @@ void QuestMenu::SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char
//------------------------------------------------------------------------
// Purpose: Load state from file
//------------------------------------------------------------------------
-void QuestMenu::LoadState(rapidxml::xml_node<char> *node) {
+void QuestMenu::loadState(rapidxml::xml_node<char> *node) {
loadBool(unread, "unread", node);
quest.clear();
for (auto n = node->first_node("quest"); n != NULL; n = n->next_sibling("quest")) {
Quest q;
- q.LoadState(n);
+ q.loadState(n);
quest.push_back(q);
menu.Add();
}
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index b24ed1cf584..d3e3b268b06 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -93,8 +93,8 @@ public:
void Select(const int &quest_index);
- void SaveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
- void LoadState(rapidxml::xml_node<char> *node);
+ void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
+ void loadState(rapidxml::xml_node<char> *node);
void SetUI();
};
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index d32df7f0c4d..d2f3c29819f 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -55,8 +55,8 @@ public:
return loadNum(x, "x", node, echo) && loadNum(y, "y", node, echo);
}
- void SaveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
- warning("STUB: Vector2D::SaveState()");
+ void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
+ warning("STUB: Vector2D::saveState()");
#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
child->append_attribute(doc.allocate_attribute("x", gStrPool->Get((int)x)));
Commit: f0697d4888192706918a7bb4e2186bfbac53a845
https://github.com/scummvm/scummvm/commit/f0697d4888192706918a7bb4e2186bfbac53a845
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Sprite follow code formatting conventions
Changed paths:
engines/crab/ai/spriteai.cpp
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/game.cpp
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/level/talknotify.cpp
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index ede2bd83561..6a032a9ceb9 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -39,51 +39,51 @@ using namespace pyrodactyl::ai;
//------------------------------------------------------------------------
// Purpose: Calculate distance between two sprites
//------------------------------------------------------------------------
-double Sprite::DistSq(const Sprite &s) {
- double result = (pos.x - s.pos.x) * (pos.x - s.pos.x) + (pos.y - s.pos.y) * (pos.y - s.pos.y);
+double Sprite::distSq(const Sprite &s) {
+ double result = (_pos.x - s._pos.x) * (_pos.x - s._pos.x) + (_pos.y - s._pos.y) * (_pos.y - s._pos.y);
return result;
}
//------------------------------------------------------------------------
// Purpose: Used for player movement
//------------------------------------------------------------------------
-void Sprite::MoveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
- if (ai_data._dest._active) {
+void Sprite::moveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
+ if (_aiData._dest._active) {
int num = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
- float player_speed = static_cast<float>(num);
+ float playerSpeed = static_cast<float>(num);
- if (MoveToLoc(ai_data._dest, player_speed, sc)) {
- ai_data._dest._active = false;
- XVel(0.0f);
- YVel(0.0f);
+ if (moveToLoc(_aiData._dest, playerSpeed, sc)) {
+ _aiData._dest._active = false;
+ xVel(0.0f);
+ yVel(0.0f);
}
}
}
-void Sprite::MoveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
- if (ai_data._dest._active) {
+void Sprite::moveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
+ if (_aiData._dest._active) {
int num = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
- float player_speed = static_cast<float>(num);
+ float playerSpeed = static_cast<float>(num);
- Rect b = BoundRect();
+ Rect b = boundRect();
// Use to provide a bit of leeway with reaching the goal.
- pathing.SetNodeBufferDistance((b.w * b.w) / 2.0f);
+ _pathing.SetNodeBufferDistance((b.w * b.w) / 2.0f);
// IF we either have a solution, have reached our destination, and it was our final destination OR
// IF there is no solution OR
// IF we haven't yet found a solution
// THEN stop.
- if ((MoveToLocPathfinding(ai_data._dest, player_speed, sc) && pathing.solutionFound &&
- pathing.GetImmediateDest() == Vector2i(pathing.destination.x, pathing.destination.y)) ||
- pathing.noSolution || !pathing.solutionFound) {
- ai_data._dest._active = false;
- XVel(0.0f);
- YVel(0.0f);
+ if ((moveToLocPathfinding(_aiData._dest, playerSpeed, sc) && _pathing.solutionFound &&
+ _pathing.GetImmediateDest() == Vector2i(_pathing.destination.x, _pathing.destination.y)) ||
+ _pathing.noSolution || !_pathing.solutionFound) {
+ _aiData._dest._active = false;
+ xVel(0.0f);
+ yVel(0.0f);
}
}
}
@@ -91,39 +91,39 @@ void Sprite::MoveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteCo
//------------------------------------------------------------------------
// Purpose: Move towards a location without any path finding
//------------------------------------------------------------------------
-bool Sprite::MoveToLoc(Vector2i &dest, const float &velocity, const SpriteConstant &sc) {
+bool Sprite::moveToLoc(Vector2i &dest, const float &velocity, const SpriteConstant &sc) {
// Use the bound rectangle dimensions
- Rect b = BoundRect();
+ Rect b = boundRect();
// X axis
if (b.x + b.w < dest.x)
- XVel(velocity * sc._walkVelMod.x);
+ xVel(velocity * sc._walkVelMod.x);
else if (b.x > dest.x)
- XVel(-velocity * sc._walkVelMod.x);
+ xVel(-velocity * sc._walkVelMod.x);
else
- XVel(0.0f);
+ xVel(0.0f);
// Y axis
if (b.y + b.h < dest.y)
- YVel(velocity * sc._walkVelMod.y);
+ yVel(velocity * sc._walkVelMod.y);
else if (b.y > dest.y)
- YVel(-velocity * sc._walkVelMod.y);
+ yVel(-velocity * sc._walkVelMod.y);
else
- YVel(0.0f);
+ yVel(0.0f);
return b.Contains(dest);
}
// Move toward the location using pathfinding.
-bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &velocity, const SpriteConstant &sc) {
+bool Sprite::moveToLocPathfinding(Vector2i &dest, const float &velocity, const SpriteConstant &sc) {
// Rect b = BoundRect();
- Vector2i immediateDest = pathing.GetImmediateDest();
+ Vector2i immediateDest = _pathing.GetImmediateDest();
- Vector2f vecTo = Vector2f((float)immediateDest.x, (float)immediateDest.y) - pathing.GetPosition();
+ Vector2f vecTo = Vector2f((float)immediateDest.x, (float)immediateDest.y) - _pathing.GetPosition();
// If the destination is not the pathing goal, we must reach it exactly before moving on.
- if (immediateDest != Vector2i(pathing.destination.x, pathing.destination.y)) {
+ if (immediateDest != Vector2i(_pathing.destination.x, _pathing.destination.y)) {
Timer fps;
float deltaTime = 1.0f / (float)g_engine->_screenSettings->fps;
@@ -133,71 +133,71 @@ bool Sprite::MoveToLocPathfinding(Vector2i &dest, const float &velocity, const S
if (vecTo.Magnitude() > velVec.Magnitude()) {
vecTo.Normalize();
- XVel(vecTo.x * sc._walkVelMod.x * velocity);
- YVel(vecTo.y * sc._walkVelMod.y * velocity);
+ xVel(vecTo.x * sc._walkVelMod.x * velocity);
+ yVel(vecTo.y * sc._walkVelMod.y * velocity);
} else {
- XVel(0.0f);
- YVel(0.0f);
+ xVel(0.0f);
+ yVel(0.0f);
}
} else {
- Vector2i loc = pathing.GetImmediateDest();
- MoveToLoc(loc, velocity, sc);
+ Vector2i loc = _pathing.GetImmediateDest();
+ moveToLoc(loc, velocity, sc);
}
- // return(MoveToLoc(pathing.GetImmediateDest(), vel, sc) || (XVel() == 0.0f && YVel() == 0.0f));
+ // return(MoveToLoc(pathing.GetImmediateDest(), vel, sc) || (xVel() == 0.0f && yVel() == 0.0f));
- return (XVel() == 0.0f && YVel() == 0.0f);
+ return (xVel() == 0.0f && yVel() == 0.0f);
}
//------------------------------------------------------------------------
// Purpose: AI routine for running to the nearest exit, then disappearing
//------------------------------------------------------------------------
-void Sprite::Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level::Exit> &area_exit, const SpriteConstant &sc) {
- switch (ai_data._flee._state) {
+void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level::Exit> &areaExit, const SpriteConstant &sc) {
+ switch (_aiData._flee._state) {
case FLEESTATE_GETNEARESTEXIT: {
- if (area_exit.empty()) {
+ if (areaExit.empty()) {
// No valid exits in the level
- ai_data._flee._state = FLEESTATE_CANTFLEE;
+ _aiData._flee._state = FLEESTATE_CANTFLEE;
break;
} else {
- ai_data._flee._state = FLEESTATE_GETNEARESTEXIT;
+ _aiData._flee._state = FLEESTATE_GETNEARESTEXIT;
// Standard way to find nearest exit
int min_dist = INT_MAX;
// Find the nearest exit
- for (auto &i : area_exit) {
+ for (auto &i : areaExit) {
// Compare distance to the rough center of each exit
- int dist = Distance2D(pos.x, pos.y, i.dim.rect.x + i.dim.rect.w / 2, i.dim.rect.y + i.dim.rect.h / 2);
+ int dist = Distance2D(_pos.x, _pos.y, i.dim.rect.x + i.dim.rect.w / 2, i.dim.rect.y + i.dim.rect.h / 2);
if (dist < min_dist) {
min_dist = dist;
// Set the destination of sprite to this exit
- ai_data.dest(i.dim.rect.x + i.dim.rect.w / 2, i.dim.rect.y + i.dim.rect.h / 2);
+ _aiData.dest(i.dim.rect.x + i.dim.rect.w / 2, i.dim.rect.y + i.dim.rect.h / 2);
- pathing.SetDestination(Vector2f((float)ai_data._dest.x, (float)ai_data._dest.y));
+ _pathing.SetDestination(Vector2f((float)_aiData._dest.x, (float)_aiData._dest.y));
}
}
}
} break;
case FLEESTATE_RUNTOEXIT: {
- Rect b = BoundRect();
- if (b.Contains(ai_data._dest)) {
+ Rect b = boundRect();
+ if (b.Contains(_aiData._dest)) {
// We have reached the exit, time to make the sprite disappear
- ai_data._flee._state = FLEESTATE_DISAPPEAR;
+ _aiData._flee._state = FLEESTATE_DISAPPEAR;
break;
} else {
int num = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float velocity = static_cast<float>(num);
- // MoveToLoc(ai_data.dest, vel, sc);
- MoveToLocPathfinding(ai_data._dest, velocity, sc);
+ // MoveToLoc(aiData.dest, vel, sc);
+ moveToLocPathfinding(_aiData._dest, velocity, sc);
}
} break;
case FLEESTATE_DISAPPEAR:
- visible.Result(false);
+ _visible.Result(false);
break;
default:
break;
@@ -207,22 +207,22 @@ void Sprite::Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
//------------------------------------------------------------------------
// Purpose: AI routine for fighting the player
//------------------------------------------------------------------------
-void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const SpriteConstant &sc) {
- warning("STUB: Sprite::Attack()");
+void Sprite::attack(pyrodactyl::event::Info &info, Sprite &target_sp, const SpriteConstant &sc) {
+ warning("STUB: Sprite::attack()");
#if 0
- switch (ai_data.fight._state) {
+ switch (aiData.fight._state) {
case FIGHTSTATE_GETNEXTMOVE: {
- ai_data.fight._state = FIGHTSTATE_GETINRANGE;
- ai_data.fight.delay.Start();
+ aiData.fight._state = FIGHTSTATE_GETINRANGE;
+ aiData.fight.delay.Start();
- unsigned int size = ai_data.fight.attack.size();
+ unsigned int size = aiData.fight.attack.size();
if (size > 1)
- anim_set.fight.Next(ai_data.fight.attack[gRandom.Num() % ai_data.fight.attack.size()]);
+ anim_set.fight.Next(aiData.fight.attack[gRandom.Num() % aiData.fight.attack.size()]);
else if (size <= 0)
- ai_data.fight._state = FIGHTSTATE_CANTFIGHT;
+ aiData.fight._state = FIGHTSTATE_CANTFIGHT;
else
- anim_set.fight.Next(ai_data.fight.attack[0]);
+ anim_set.fight.Next(aiData.fight.attack[0]);
} break;
case FIGHTSTATE_GETINRANGE: {
// Set destination path to the player location
@@ -236,15 +236,15 @@ void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const Spri
FightMove f;
if (anim_set.fight.NextMove(f) && FightCollide(target_sp.BoxV(), target_sp.BoundRect(), f.ai.range, sc)) {
- if (ai_data.fight.delay.Ticks() > f.ai.delay)
- ai_data.fight._state = FIGHTSTATE_EXECUTEMOVE;
+ if (aiData.fight.delay.Ticks() > f.ai.delay)
+ aiData.fight._state = FIGHTSTATE_EXECUTEMOVE;
} else if (input.Idle())
MoveToDestPathfinding(info, sc);
} break;
case FIGHTSTATE_EXECUTEMOVE:
UpdateMove(anim_set.fight.Next());
- ai_data.fight._state = FIGHTSTATE_GETNEXTMOVE;
- ai_data.fight.delay.Stop();
+ aiData.fight._state = FIGHTSTATE_GETNEXTMOVE;
+ aiData.fight.delay.Stop();
break;
default:
break;
@@ -252,65 +252,65 @@ void Sprite::Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const Spri
#endif
}
-void Sprite::FlyAround(const Rect &camera, const SpriteConstant &sc) {
+void Sprite::flyAround(const Rect &camera, const SpriteConstant &sc) {
// Is this sprite flying right now?
- if (ai_data._walk._enabled) {
+ if (_aiData._walk._enabled) {
// We're flying towards the left edge
- if (XVel() < 0) {
+ if (xVel() < 0) {
// Are we completely out of the left edge of the camera?
- if (X() < camera.x - W()) {
- ai_data._walk._enabled = false;
+ if (x() < camera.x - w()) {
+ _aiData._walk._enabled = false;
// Start the timer, set a semi-random time
- ai_data._walk._timer.Target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
- ai_data._walk._timer.Start();
+ _aiData._walk._timer.Target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
+ _aiData._walk._timer.Start();
}
}
// Flying towards the right edge
- else if (XVel() > 0) {
+ else if (xVel() > 0) {
// Are we completely out of the left edge of the camera?
- if (X() > camera.x + camera.w + W()) {
- ai_data._walk._enabled = false;
+ if (x() > camera.x + camera.w + w()) {
+ _aiData._walk._enabled = false;
// Start the timer, set a semi-random time
- ai_data._walk._timer.Target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
- ai_data._walk._timer.Start();
+ _aiData._walk._timer.Target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
+ _aiData._walk._timer.Start();
}
}
- Move(sc);
+ move(sc);
} else {
// Safety condition in case timer isn't running
- if (!ai_data._walk._timer.Started())
- ai_data._walk._timer.Start();
+ if (!_aiData._walk._timer.Started())
+ _aiData._walk._timer.Start();
// Is it time to start flying?
- if (ai_data._walk._timer.TargetReached()) {
+ if (_aiData._walk._timer.TargetReached()) {
// Stop the timer
- ai_data._walk._timer.Stop();
+ _aiData._walk._timer.Stop();
// Decide if the sprite flies from the left or right of the camera
if (g_engine->getRandomNumber(1)) {
// Fly in from the right
- X(camera.x + camera.w + sc._fly._start.x);
- XVel(-1.0f * sc._fly._vel.x);
+ x(camera.x + camera.w + sc._fly._start.x);
+ xVel(-1.0f * sc._fly._vel.x);
// Sprite needs to face left
- dir = DIRECTION_LEFT;
+ _dir = DIRECTION_LEFT;
} else {
// Fly in from the left
- X(camera.x - W() - sc._fly._start.x);
- XVel(sc._fly._vel.x);
+ x(camera.x - w() - sc._fly._start.x);
+ xVel(sc._fly._vel.x);
// Sprite needs to face right
- dir = DIRECTION_RIGHT;
+ _dir = DIRECTION_RIGHT;
}
- Y(camera.y + sc._fly._start.y + (g_engine->getRandomNumber(camera.h - (2 * sc._fly._start.y))));
- YVel(sc._fly._vel.y);
+ y(camera.y + sc._fly._start.y + (g_engine->getRandomNumber(camera.h - (2 * sc._fly._start.y))));
+ yVel(sc._fly._vel.y);
// Set state to flying
- ai_data._walk._enabled = true;
+ _aiData._walk._enabled = true;
}
}
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 28fc73e8a5e..c1f115f1e35 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -40,14 +40,14 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Constructor
//------------------------------------------------------------------------
-Sprite::Sprite() : img_size(1, 1), vel_mod(1.0f, 1.0f) {
- dir = DIRECTION_LEFT;
- layer = -1;
- image = 0;
- Visible(true);
- damage_done = false;
- hover = false;
- // pathing.SetSprite(this);
+Sprite::Sprite() : _imgSize(1, 1), _velMod(1.0f, 1.0f) {
+ _dir = DIRECTION_LEFT;
+ _layer = -1;
+ _image = 0;
+ visible(true);
+ _damageDone = false;
+ _hover = false;
+ // _pathing.SetSprite(this);
}
//------------------------------------------------------------------------
@@ -57,116 +57,116 @@ void Sprite::load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
using namespace pyrodactyl::image;
if (nodeValid(node)) {
- loadStr(id, "id", node);
+ loadStr(_id, "id", node);
// The amount by which the sprite x,y should be multiplied
int multiply = 1;
loadNum(multiply, "multiply", node, false);
- loadNum(pos.x, "x", node);
- loadNum(pos.y, "y", node);
+ loadNum(_pos.x, "x", node);
+ loadNum(_pos.y, "y", node);
- pos.x *= multiply;
- pos.y *= multiply;
+ _pos.x *= multiply;
+ _pos.y *= multiply;
- loadImgKey(image, "img", node);
- loadNum(layer, "layer", node, false);
+ loadImgKey(_image, "img", node);
+ loadNum(_layer, "layer", node, false);
Image dat;
- g_engine->_imageManager->GetTexture(image, dat);
- img_size.x = dat.W();
- img_size.y = dat.H();
+ g_engine->_imageManager->GetTexture(_image, dat);
+ _imgSize.x = dat.W();
+ _imgSize.y = dat.H();
unsigned int index = 0;
loadNum(index, "moveset", node);
if (index < animations.size())
- anim_set.load(animations[index]);
+ _animSet.load(animations[index]);
- anim_set._fight.listAttackMoves(ai_data._fight._attack);
+ _animSet._fight.listAttackMoves(_aiData._fight._attack);
- loadDirection(dir, node);
- clip = anim_set._walk.Clip(dir);
- box_v = anim_set._walk.BoxV(dir);
+ loadDirection(_dir, node);
+ _clip = _animSet._walk.Clip(_dir);
+ _boxV = _animSet._walk.BoxV(_dir);
if (nodeValid("visible", node, false))
- visible.load(node->first_node("visible"));
+ _visible.load(node->first_node("visible"));
if (nodeValid("movement", node, false))
- ai_data._walk.load(node->first_node("movement"));
+ _aiData._walk.load(node->first_node("movement"));
if (nodeValid("popup", node, false))
- popup.load(node->first_node("popup"));
+ _popup.load(node->first_node("popup"));
}
}
//------------------------------------------------------------------------
// Purpose: Move along x and y axis
//------------------------------------------------------------------------
-void Sprite::Move(const SpriteConstant &sc) {
- if (target.x == 0.0f && (vel.x > -sc._tweening && vel.x < sc._tweening))
- vel.x = 0.0f;
+void Sprite::move(const SpriteConstant &sc) {
+ if (_target.x == 0.0f && (_vel.x > -sc._tweening && _vel.x < sc._tweening))
+ _vel.x = 0.0f;
else {
- vel.x += (target.x - vel.x) * sc._tweening;
- pos.x += vel.x;
+ _vel.x += (_target.x - _vel.x) * sc._tweening;
+ _pos.x += _vel.x;
}
- if (target.y == 0.0f && (vel.y > -sc._tweening && vel.y < sc._tweening))
- vel.y = 0.0f;
+ if (_target.y == 0.0f && (_vel.y > -sc._tweening && _vel.y < sc._tweening))
+ _vel.y = 0.0f;
else {
- vel.y += (target.y - vel.y) * sc._tweening;
- pos.y += vel.y;
+ _vel.y += (_target.y - _vel.y) * sc._tweening;
+ _pos.y += _vel.y;
}
}
//------------------------------------------------------------------------
// Purpose: Resolve collision with shapes excluding the level bounding rectangle
//------------------------------------------------------------------------
-void Sprite::ResolveCollide() {
+void Sprite::resolveCollide() {
// NOTE: we don't check i->intersect here because we do that in the level functions
- for (auto i = collide_data.begin(); i != collide_data.end(); ++i) {
- Rect bounds = BoundRect();
+ for (auto i = _collideData.begin(); i != _collideData.end(); ++i) {
+ Rect bounds = boundRect();
if (i->type == SHAPE_POLYGON) {
- pos.x -= i->data.x;
- pos.y -= i->data.y;
+ _pos.x -= i->data.x;
+ _pos.y -= i->data.y;
} else {
Direction d = bounds.ResolveY(i->data);
if (d == DIRECTION_UP)
- pos.y -= i->data.y + i->data.h - anim_set._bounds.y + anim_set.anchorY(dir) + 1;
+ _pos.y -= i->data.y + i->data.h - _animSet._bounds.y + _animSet.anchorY(_dir) + 1;
else if (d == DIRECTION_DOWN)
- pos.y -= i->data.y - bounds.h - anim_set._bounds.y + anim_set.anchorY(dir) - 1;
+ _pos.y -= i->data.y - bounds.h - _animSet._bounds.y + _animSet.anchorY(_dir) - 1;
d = bounds.ResolveX(i->data);
if (d == DIRECTION_LEFT)
- pos.x -= i->data.x + i->data.w - anim_set._bounds.x + anim_set.anchorX(dir) + 1;
+ _pos.x -= i->data.x + i->data.w - _animSet._bounds.x + _animSet.anchorX(_dir) + 1;
else if (d == DIRECTION_RIGHT)
- pos.x -= i->data.x - bounds.w - anim_set._bounds.x + anim_set.anchorX(dir) - 1;
+ _pos.x -= i->data.x - bounds.w - _animSet._bounds.x + _animSet.anchorX(_dir) - 1;
}
}
// Clear the collision data
- collide_data.clear();
+ _collideData.clear();
}
//------------------------------------------------------------------------
// Purpose: Resolve collision with the level bounding rectangle
//------------------------------------------------------------------------
-void Sprite::ResolveInside(Rect collider) {
- Rect bounds = BoundRect();
+void Sprite::resolveInside(Rect collider) {
+ Rect bounds = boundRect();
Direction d = bounds.ResolveX(collider);
if (d == DIRECTION_RIGHT)
- pos.x = collider.x - anim_set._bounds.x + anim_set.anchorX(dir) + 1;
+ _pos.x = collider.x - _animSet._bounds.x + _animSet.anchorX(_dir) + 1;
else if (d == DIRECTION_LEFT)
- pos.x = collider.x + collider.w - anim_set._bounds.x - bounds.w + anim_set.anchorX(dir) - 1;
+ _pos.x = collider.x + collider.w - _animSet._bounds.x - bounds.w + _animSet.anchorX(_dir) - 1;
- bounds = BoundRect();
+ bounds = boundRect();
d = bounds.ResolveY(collider);
if (d == DIRECTION_DOWN)
- pos.y = collider.y - anim_set._bounds.y + anim_set.anchorY(dir) + 1;
+ _pos.y = collider.y - _animSet._bounds.y + _animSet.anchorY(_dir) + 1;
else if (d == DIRECTION_UP)
- pos.y = collider.y + collider.h - anim_set._bounds.y - bounds.h + anim_set.anchorY(dir) - 1;
+ _pos.y = collider.y + collider.h - _animSet._bounds.y - bounds.h + _animSet.anchorY(_dir) - 1;
}
//------------------------------------------------------------------------
@@ -176,62 +176,62 @@ void Sprite::ResolveInside(Rect collider) {
//------------------------------------------------------------------------
// Used for walking and level geometry collision
-Rect Sprite::BoundRect() {
+Rect Sprite::boundRect() {
Rect rect;
- rect.x = pos.x + anim_set._bounds.x - anim_set.anchorX(dir);
- rect.y = pos.y + anim_set._bounds.y - anim_set.anchorY(dir);
- rect.w = anim_set._bounds.w;
- rect.h = anim_set._bounds.h;
+ rect.x = _pos.x + _animSet._bounds.x - _animSet.anchorX(_dir);
+ rect.y = _pos.y + _animSet._bounds.y - _animSet.anchorY(_dir);
+ rect.w = _animSet._bounds.w;
+ rect.h = _animSet._bounds.h;
return rect;
}
// Used for fighting
-Rect Sprite::BoxV() {
+Rect Sprite::boxV() {
Rect rect;
- rect.x = pos.x + box_v.x;
- rect.y = pos.y + box_v.y;
- rect.w = box_v.w;
- rect.h = box_v.h;
+ rect.x = _pos.x + _boxV.x;
+ rect.y = _pos.y + _boxV.y;
+ rect.w = _boxV.w;
+ rect.h = _boxV.h;
return rect;
}
// Used for fighting
-Rect Sprite::BoxD() {
+Rect Sprite::boxD() {
Rect rect;
- rect.x = pos.x + box_d.x;
- rect.y = pos.y + box_d.y;
- rect.w = box_d.w;
- rect.h = box_d.h;
+ rect.x = _pos.x + _boxD.x;
+ rect.y = _pos.y + _boxD.y;
+ rect.w = _boxD.w;
+ rect.h = _boxD.h;
return rect;
}
// Used for drawing object notifications over stuff
-Rect Sprite::PosRect() {
+Rect Sprite::posRect() {
Rect rect;
- rect.x = pos.x - anim_set.anchorX(dir);
- rect.y = pos.y - anim_set.anchorY(dir);
- rect.w = clip.w;
- rect.h = clip.h;
+ rect.x = _pos.x - _animSet.anchorX(_dir);
+ rect.y = _pos.y - _animSet.anchorY(_dir);
+ rect.w = _clip.w;
+ rect.h = _clip.h;
return rect;
}
// The range rectangle is relative to the bounding rectangle, and needs to be updated according to the actual position
// Used for enemy sprite to find their required spot to attack the player
-Rect Sprite::RangeRect(const Rect &bounds, const Range &range) {
+Rect Sprite::rangeRect(const Rect &bounds, const Range &range) {
Rect rect;
- rect.x = bounds.x + range._val[dir].x;
- rect.y = bounds.y + range._val[dir].y;
- rect.w = range._val[dir].w;
- rect.h = range._val[dir].h;
+ rect.x = bounds.x + range._val[_dir].x;
+ rect.y = bounds.y + range._val[_dir].y;
+ rect.w = range._val[_dir].w;
+ rect.h = range._val[_dir].h;
return rect;
}
// Used for focusing the camera on the sprite
-Vector2i Sprite::CamFocus() {
+Vector2i Sprite::camFocus() {
Vector2i v;
- v.x = pos.x + anim_set._focus.x;
- v.y = pos.y + anim_set._focus.y;
+ v.x = _pos.x + _animSet._focus.x;
+ v.y = _pos.y + _animSet._focus.y;
return v;
}
@@ -243,40 +243,40 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
using namespace pyrodactyl::image;
using namespace pyrodactyl::text;
- int x = pos.x - camera.x - anim_set.anchorX(dir), y = pos.y - camera.y - anim_set.anchorY(dir);
+ int x = _pos.x - camera.x - _animSet.anchorX(_dir), y = _pos.y - camera.y - _animSet.anchorY(_dir);
// Draw the shadow image relative to the bottom center of the sprite
- ShadowOffset sh = anim_set.shadow(dir);
+ ShadowOffset sh = _animSet.shadow(_dir);
if (sh._valid) {
// Draw using custom offset
- g_engine->_imageManager->draw(x + clip.w / 2 - anim_set._shadow._size.x + sh.x,
- y + clip.h - anim_set._shadow._size.y + sh.y,
- anim_set._shadow._img);
+ g_engine->_imageManager->draw(x + _clip.w / 2 - _animSet._shadow._size.x + sh.x,
+ y + _clip.h - _animSet._shadow._size.y + sh.y,
+ _animSet._shadow._img);
} else {
// Draw using default offset
- g_engine->_imageManager->draw(x + clip.w / 2 - anim_set._shadow._size.x + anim_set._shadow._offset.x,
- y + clip.h - anim_set._shadow._size.y + anim_set._shadow._offset.y,
- anim_set._shadow._img);
+ g_engine->_imageManager->draw(x + _clip.w / 2 - _animSet._shadow._size.x + _animSet._shadow._offset.x,
+ y + _clip.h - _animSet._shadow._size.y + _animSet._shadow._offset.y,
+ _animSet._shadow._img);
}
- g_engine->_imageManager->draw(x, y, image, &clip, anim_set.flip(dir));
- img_eff.draw(x, y);
+ g_engine->_imageManager->draw(x, y, _image, &_clip, _animSet.flip(_dir));
+ _imgEff.draw(x, y);
if (GameDebug) {
- // Nice boxes for the frames and box_v, box_d
- Rect bounds = BoundRect(), vul = BoxV(), dmg = BoxD(), debugpos = PosRect();
+ // Nice boxes for the frames and boxV, boxD
+ Rect bounds = boundRect(), vul = boxV(), dmg = boxD(), debugpos = posRect();
bounds.draw(-camera.x, -camera.y);
debugpos.draw(-camera.x, -camera.y, 255, 255, 255);
dmg.draw(-camera.x, -camera.y, 255, 0, 0);
vul.draw(-camera.x, -camera.y, 0, 0, 255);
FightMove fm;
- if (anim_set._fight.nextMove(fm)) {
+ if (_animSet._fight.nextMove(fm)) {
Rect actual_range;
- actual_range.x = bounds.x + fm._ai._range._val[dir].x;
- actual_range.y = bounds.y + fm._ai._range._val[dir].y;
- actual_range.w = fm._ai._range._val[dir].w;
- actual_range.h = fm._ai._range._val[dir].h;
+ actual_range.x = bounds.x + fm._ai._range._val[_dir].x;
+ actual_range.y = bounds.y + fm._ai._range._val[_dir].y;
+ actual_range.w = fm._ai._range._val[_dir].w;
+ actual_range.h = fm._ai._range._val[_dir].h;
actual_range.draw(-camera.x, -camera.y, 255, 0, 255);
}
@@ -288,10 +288,10 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
pyrodactyl::people::PersonState state = info.State(id);
g_engine->_textManager->draw(x, y - 60.0f, NumberToString(state), 0);
- g_engine->_textManager->draw(x + 120.0f, y - 60.0f, NumberToString(ai_data.dest.y), 0);*/
+ g_engine->_textManager->draw(x + 120.0f, y - 60.0f, NumberToString(_aiData.dest.y), 0);*/
- if (pathing.m_vSolution.size() > 0) {
- for (auto iter = pathing.m_vSolution.begin(); iter != pathing.m_vSolution.end(); ++iter) {
+ if (_pathing.m_vSolution.size() > 0) {
+ for (auto iter = _pathing.m_vSolution.begin(); iter != _pathing.m_vSolution.end(); ++iter) {
bool nextToWall = false;
for (auto neighbor = (*iter)->neighborNodes.begin(); neighbor != (*iter)->neighborNodes.end(); ++neighbor) {
if ((*neighbor)->GetMovementCost() < 0 || (*neighbor)->GetMovementCost() > 1) {
@@ -306,95 +306,95 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
(*iter)->GetRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
}
- pathing.m_pGoalTile->GetRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
- pathing.m_pStartTile->GetRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
+ _pathing.m_pGoalTile->GetRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
+ _pathing.m_pStartTile->GetRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
// Draw adjacencies to the goal tile.
- /* for(auto neighbor = pathing.m_pGoalTile->neighborNodes.begin(); neighbor != pathing.m_pGoalTile->neighborNodes.end(); ++neighbor)
+ /* for(auto neighbor = _pathing.m_pGoalTile->neighborNodes.begin(); neighbor != _pathing.m_pGoalTile->neighborNodes.end(); ++neighbor)
{
(*neighbor)->GetRect().draw(-camera.x, -camera.y, 200, 0, 0, 254);
}*/
}
- Rect destinationRect = Rect((int)pathing.destination.x - 5,
- (int)pathing.destination.y - 5,
+ Rect destinationRect = Rect((int)_pathing.destination.x - 5,
+ (int)_pathing.destination.y - 5,
10,
10);
destinationRect.draw(-camera.x, -camera.y, 0, 200, 0, 254);
}
}
-void Sprite::DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
+void Sprite::drawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
// This is different from draw because we draw the popup centered over the head
- int x = pos.x - camera.x - anim_set.anchorX(dir) + (anim_set._bounds.w / 2);
- int y = pos.y - camera.y - anim_set.anchorY(dir);
+ int x = _pos.x - camera.x - _animSet.anchorX(_dir) + (_animSet._bounds.w / 2);
+ int y = _pos.y - camera.y - _animSet.anchorY(_dir);
- popup.draw(x, y, pop, camera);
+ _popup.draw(x, y, pop, camera);
}
//------------------------------------------------------------------------
// Purpose: Handle the movement in a level for the player only
//------------------------------------------------------------------------
-void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const Common::Event &Event) {
+void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const Common::Event &Event) {
int num = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
+ info.StatGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float player_speed = static_cast<float>(num);
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!ai_data._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
+ if (!_aiData._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
- int x = pos.x - camera.x - anim_set.anchorX(dir), y = pos.y - camera.y - anim_set.anchorY(dir);
+ int x = _pos.x - camera.x - _animSet.anchorX(_dir), y = _pos.y - camera.y - _animSet.anchorY(_dir);
// Just use the bound rectangle dimensions
- Rect b = BoundRect();
+ Rect b = boundRect();
int w = b.w, h = b.h;
// X axis
if (g_engine->_mouse->motion.x > x + w)
- XVel(player_speed * sc._walkVelMod.x);
+ xVel(player_speed * sc._walkVelMod.x);
else if (g_engine->_mouse->motion.x < x)
- XVel(-player_speed * sc._walkVelMod.x);
+ xVel(-player_speed * sc._walkVelMod.x);
else
- XVel(0.0f);
+ xVel(0.0f);
// Y axis
if (g_engine->_mouse->motion.y > y + h)
- YVel(player_speed * sc._walkVelMod.y);
+ yVel(player_speed * sc._walkVelMod.y);
else if (g_engine->_mouse->motion.y < y)
- YVel(-player_speed * sc._walkVelMod.y);
+ yVel(-player_speed * sc._walkVelMod.y);
else
- YVel(0.0f);
+ yVel(0.0f);
} else // Keyboard movement
{
// Disable destination as soon as player presses a direction key
// X axis
if (g_engine->_inputManager->State(IG_LEFT)) {
- ai_data._dest._active = false;
- XVel(-player_speed * sc._walkVelMod.x);
+ _aiData._dest._active = false;
+ xVel(-player_speed * sc._walkVelMod.x);
} else if (g_engine->_inputManager->State(IG_RIGHT)) {
- ai_data._dest._active = false;
- XVel(player_speed * sc._walkVelMod.x);
- } else if (!ai_data._dest._active)
- XVel(0.0f);
+ _aiData._dest._active = false;
+ xVel(player_speed * sc._walkVelMod.x);
+ } else if (!_aiData._dest._active)
+ xVel(0.0f);
// Y axis
if (g_engine->_inputManager->State(IG_UP)) {
- ai_data._dest._active = false;
- YVel(-player_speed * sc._walkVelMod.y);
+ _aiData._dest._active = false;
+ yVel(-player_speed * sc._walkVelMod.y);
} else if (g_engine->_inputManager->State(IG_DOWN)) {
- ai_data._dest._active = false;
- YVel(player_speed * sc._walkVelMod.y);
- } else if (!ai_data._dest._active)
- YVel(0.0f);
+ _aiData._dest._active = false;
+ yVel(player_speed * sc._walkVelMod.y);
+ } else if (!_aiData._dest._active)
+ yVel(0.0f);
}
- UpdateMove(input.HandleEvents(Event));
+ updateMove(_input.HandleEvents(Event));
// This is to prevent one frame of drawing with incorrect parameters
- Animate(info);
+ animate(info);
}
#if 0
@@ -409,51 +409,51 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!ai_data._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
+ if (!_aiData._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
- int x = pos.x - camera.x - anim_set.anchorX(dir), y = pos.y - camera.y - anim_set.anchorY(dir);
+ int x = _pos.x - camera.x - _animSet.anchorX(_dir), y = _pos.y - camera.y - _animSet.anchorY(_dir);
// Just use the bound rectangle dimensions
- Rect b = BoundRect();
+ Rect b = boundRect();
int w = b.w, h = b.h;
// X axis
if (g_engine->_mouse->motion.x > x + w)
- XVel(player_speed * sc._walkVelMod.x);
+ xVel(player_speed * sc._walkVelMod.x);
else if (g_engine->_mouse->motion.x < x)
- XVel(-player_speed * sc._walkVelMod.x);
+ xVel(-player_speed * sc._walkVelMod.x);
else
- XVel(0.0f);
+ xVel(0.0f);
// Y axis
if (g_engine->_mouse->motion.y > y + h)
- YVel(player_speed * sc._walkVelMod.y);
+ yVel(player_speed * sc._walkVelMod.y);
else if (g_engine->_mouse->motion.y < y)
- YVel(-player_speed * sc._walkVelMod.y);
+ yVel(-player_speed * sc._walkVelMod.y);
else
- YVel(0.0f);
+ yVel(0.0f);
} else // Keyboard movement
{
// Disable destination as soon as player presses a direction key
// X axis
if (g_engine->_inputManager->State(IG_LEFT)) {
- ai_data._dest._active = false;
- XVel(-player_speed * sc._walkVelMod.x);
+ _aiData._dest._active = false;
+ xVel(-player_speed * sc._walkVelMod.x);
} else if (g_engine->_inputManager->State(IG_RIGHT)) {
- ai_data._dest._active = false;
- XVel(player_speed * sc._walkVelMod.x);
- } else if (!ai_data._dest._active)
- XVel(0.0f);
+ _aiData._dest._active = false;
+ xVel(player_speed * sc._walkVelMod.x);
+ } else if (!_aiData._dest._active)
+ xVel(0.0f);
// Y axis
if (g_engine->_inputManager->State(IG_UP)) {
- ai_data._dest._active = false;
- YVel(-player_speed * sc._walkVelMod.y);
+ _aiData._dest._active = false;
+ yVel(-player_speed * sc._walkVelMod.y);
} else if (g_engine->_inputManager->State(IG_DOWN)) {
- ai_data._dest._active = false;
- YVel(player_speed * sc._walkVelMod.y);
- } else if (!ai_data._dest._active)
- YVel(0.0f);
+ _aiData._dest._active = false;
+ yVel(player_speed * sc._walkVelMod.y);
+ } else if (!_aiData._dest._active)
+ yVel(0.0f);
}
UpdateMove(input.HandleEvents(Event));
@@ -466,69 +466,69 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
//------------------------------------------------------------------------
// Purpose: Set destination for sprite movement
//------------------------------------------------------------------------
-void Sprite::SetDestPathfinding(const Vector2i &dest, bool reachable) {
- ai_data.dest(dest, true);
- pathing.SetDestination(dest, reachable);
+void Sprite::setDestPathfinding(const Vector2i &dest, bool reachable) {
+ _aiData.dest(dest, true);
+ _pathing.SetDestination(dest, reachable);
}
//------------------------------------------------------------------------
// Purpose: Walking animation
//------------------------------------------------------------------------
-void Sprite::Walk(const pyrodactyl::people::PersonState &pst) {
- img_eff._visible = false;
+void Sprite::walk(const pyrodactyl::people::PersonState &pst) {
+ _imgEff._visible = false;
- bool first_x = true;
+ bool firstX = true;
- if (ai_data._dest._active) {
- Rect b = BoundRect();
- if (pos.x - ai_data._dest.x > -b.w && pos.x - ai_data._dest.x < b.w)
- first_x = false;
+ if (_aiData._dest._active) {
+ Rect b = boundRect();
+ if (_pos.x - _aiData._dest.x > -b.w && _pos.x - _aiData._dest.x < b.w)
+ firstX = false;
}
- bool reset = anim_set._walk.Type(vel, dir, pst, first_x);
+ bool reset = _animSet._walk.Type(_vel, _dir, pst, firstX);
if (reset)
- anim_set._walk.ResetClip(dir);
+ _animSet._walk.ResetClip(_dir);
- Walk(reset);
+ walk(reset);
}
-void Sprite::Walk(const bool &reset) {
- if (anim_set._walk.UpdateClip(dir, reset)) {
- clip = anim_set._walk.Clip(dir);
- box_v = anim_set._walk.BoxV(dir);
+void Sprite::walk(const bool &reset) {
+ if (_animSet._walk.UpdateClip(_dir, reset)) {
+ _clip = _animSet._walk.Clip(_dir);
+ _boxV = _animSet._walk.BoxV(_dir);
}
}
//------------------------------------------------------------------------
// Purpose: Decide which animation to play
//------------------------------------------------------------------------
-void Sprite::Animate(Info &info) {
- if (input.Idle())
- Walk(info.State(id));
+void Sprite::animate(Info &info) {
+ if (_input.Idle())
+ walk(info.State(_id));
else
- UpdateFrame(info.State(id));
+ updateFrame(info.State(_id));
}
-void Sprite::Animate(const pyrodactyl::people::PersonState &pst) {
- Walk(pst);
+void Sprite::animate(const pyrodactyl::people::PersonState &pst) {
+ walk(pst);
}
//------------------------------------------------------------------------
// Purpose: We need to find if the vulnerable area of this sprite collides
// with hitbox (usually the damage area of another sprite)
//------------------------------------------------------------------------
-bool Sprite::FightCollide(Rect hitbox, Rect enemy_bounds, Range &range, const SpriteConstant &sc) {
- Rect bounds = BoundRect();
+bool Sprite::fightCollide(Rect hitbox, Rect enemyBounds, Range &range, const SpriteConstant &sc) {
+ Rect bounds = boundRect();
if (range._valid) {
- Rect actual_range = RangeRect(bounds, range);
+ Rect actualRange = rangeRect(bounds, range);
// The second part is a sanity check so the stray hitbox of a sprite 1000 pixels below does not cause damage
- if (hitbox.Collide(actual_range) && abs(bounds.y + bounds.h - enemy_bounds.y - enemy_bounds.h) < sc._planeW)
+ if (hitbox.Collide(actualRange) && abs(bounds.y + bounds.h - enemyBounds.y - enemyBounds.h) < sc._planeW)
return true;
} else {
- if (hitbox.Collide(bounds) && abs(bounds.y + bounds.h - enemy_bounds.y - enemy_bounds.h) < sc._planeW)
+ if (hitbox.Collide(bounds) && abs(bounds.y + bounds.h - enemyBounds.y - enemyBounds.h) < sc._planeW)
return true;
}
@@ -538,92 +538,92 @@ bool Sprite::FightCollide(Rect hitbox, Rect enemy_bounds, Range &range, const Sp
//------------------------------------------------------------------------
// Purpose: Update the frame info of the sprite
//------------------------------------------------------------------------
-void Sprite::UpdateFrame(const pyrodactyl::people::PersonState &pst, const bool &repeat) {
- FrameUpdateResult res = anim_set._fight.updateFrame(dir);
+void Sprite::updateFrame(const pyrodactyl::people::PersonState &pst, const bool &repeat) {
+ FrameUpdateResult res = _animSet._fight.updateFrame(_dir);
if (res == FUR_SUCCESS) {
- AssignFrame();
+ assignFrame();
} else if (res == FUR_FAIL) {
- damage_done = false;
- Stop();
+ _damageDone = false;
+ stop();
if (repeat == false)
- ResetFrame(pst);
+ resetFrame(pst);
else
- anim_set._fight.frameIndex(0);
+ _animSet._fight.frameIndex(0);
}
}
-void Sprite::AssignFrame() {
+void Sprite::assignFrame() {
FightAnimFrame faf;
- if (anim_set._fight.curFrame(faf, dir)) {
- clip = faf._clip;
- BoxV(faf._boxV);
- BoxD(faf._boxD);
+ if (_animSet._fight.curFrame(faf, _dir)) {
+ _clip = faf._clip;
+ boxV(faf._boxV);
+ boxD(faf._boxD);
- pos.x += faf._delta.x;
- pos.y += faf._delta.y;
+ _pos.x += faf._delta.x;
+ _pos.y += faf._delta.y;
- input.state = faf._state;
+ _input.state = faf._state;
}
}
//------------------------------------------------------------------------
// Purpose: Update the move info of the player sprite
//------------------------------------------------------------------------
-void Sprite::UpdateMove(const FightAnimationType &combo) {
+void Sprite::updateMove(const FightAnimationType &combo) {
if (combo != FA_IDLE) {
- if (input.Idle())
- ForceUpdateMove(combo);
+ if (_input.Idle())
+ forceUpdateMove(combo);
else {
FightAnimFrame faf;
- if (anim_set._fight.curFrame(faf, dir))
+ if (_animSet._fight.curFrame(faf, _dir))
if (faf._branch)
- ForceUpdateMove(combo);
+ forceUpdateMove(combo);
}
}
}
-void Sprite::ForceUpdateMove(const FightAnimationType &combo) {
- unsigned int index = anim_set._fight.findMove(combo, input.state);
- ForceUpdateMove(index);
+void Sprite::forceUpdateMove(const FightAnimationType &combo) {
+ unsigned int index = _animSet._fight.findMove(combo, _input.state);
+ forceUpdateMove(index);
}
//------------------------------------------------------------------------
// Purpose: Update the move info of the AI or player sprite
//------------------------------------------------------------------------
-void Sprite::UpdateMove(const unsigned int &index) {
- if (input.Idle())
- ForceUpdateMove(index);
+void Sprite::updateMove(const unsigned int &index) {
+ if (_input.Idle())
+ forceUpdateMove(index);
}
-void Sprite::ForceUpdateMove(const unsigned int &index) {
- if (anim_set._fight.forceUpdate(index, input, dir)) {
+void Sprite::forceUpdateMove(const unsigned int &index) {
+ if (_animSet._fight.forceUpdate(index, _input, _dir)) {
// This sets the sprite input to the current move input
- anim_set._fight.curCombo(input);
+ _animSet._fight.curCombo(_input);
- Stop();
- AssignFrame();
+ stop();
+ assignFrame();
} else
- input.reset();
+ _input.reset();
}
//------------------------------------------------------------------------
// Purpose: Reset the frame info of the sprite
//------------------------------------------------------------------------
-void Sprite::ResetFrame(const pyrodactyl::people::PersonState &pst) {
- input.reset();
- Walk(true);
- anim_set._fight.reset();
+void Sprite::resetFrame(const pyrodactyl::people::PersonState &pst) {
+ _input.reset();
+ walk(true);
+ _animSet._fight.reset();
- box_d.w = 0;
- box_d.h = 0;
+ _boxD.w = 0;
+ _boxD.h = 0;
}
//------------------------------------------------------------------------
// Purpose: Check if both sprites in the same plane
//------------------------------------------------------------------------
-bool Sprite::DamageValid(Sprite &s, const SpriteConstant &sc) {
+bool Sprite::damageValid(Sprite &s, const SpriteConstant &sc) {
// Get the y coordinates where these sprites are standing
- float Y = pos.y + clip.h, SY = s.pos.y + s.clip.h;
+ float Y = _pos.y + _clip.h, SY = s._pos.y + s._clip.h;
if (abs(Y - SY) < sc._planeW)
return true;
@@ -634,18 +634,18 @@ bool Sprite::DamageValid(Sprite &s, const SpriteConstant &sc) {
//------------------------------------------------------------------------
// Purpose: Checks about dealing damage to sprite
//------------------------------------------------------------------------
-void Sprite::CalcProperties(Info &info) {
- visible.Evaluate(info);
- anim_set._fight.evaluate(info);
+void Sprite::calcProperties(Info &info) {
+ _visible.Evaluate(info);
+ _animSet._fight.evaluate(info);
}
//------------------------------------------------------------------------
// Purpose: Checks about dealing damage to sprite
//------------------------------------------------------------------------
-bool Sprite::TakingDamage(Sprite &sp, const SpriteConstant &sc) {
- if (DamageValid(sp, sc))
- if (BoxV().w > 0 && BoxV().h > 0 && sp.BoxD().w > 0 && sp.BoxD().h > 0)
- if (BoxV().Collide(sp.BoxD()))
+bool Sprite::takingDamage(Sprite &sp, const SpriteConstant &sc) {
+ if (damageValid(sp, sc))
+ if (boxV().w > 0 && boxV().h > 0 && sp.boxD().w > 0 && sp.boxD().h > 0)
+ if (boxV().Collide(sp.boxD()))
return true;
/*Common::String words = NumberToString(BoxV().x) + " " + NumberToString(BoxV().y)+ " " + NumberToString(BoxV().w)
@@ -659,63 +659,63 @@ bool Sprite::TakingDamage(Sprite &sp, const SpriteConstant &sc) {
//------------------------------------------------------------------------
// Purpose: We know we are taking damage, now is the time to update stats
//------------------------------------------------------------------------
-void Sprite::TakeDamage(Info &info, Sprite &s) {
+void Sprite::takeDamage(Info &info, Sprite &s) {
using namespace pyrodactyl::stat;
using namespace pyrodactyl::music;
FightMove f;
- if (s.anim_set._fight.curMove(f) && info.PersonValid(s.ID()) && info.PersonValid(id)) {
- int dmg = -1 * (f._eff._dmg + info.PersonGet(s.ID()).stat.val[STAT_ATTACK].cur - info.PersonGet(id).stat.val[STAT_DEFENSE].cur);
+ if (s._animSet._fight.curMove(f) && info.PersonValid(s.id()) && info.PersonValid(_id)) {
+ int dmg = -1 * (f._eff._dmg + info.PersonGet(s.id()).stat.val[STAT_ATTACK].cur - info.PersonGet(_id).stat.val[STAT_DEFENSE].cur);
if (dmg >= 0)
dmg = -1;
- info.StatChange(id, STAT_HEALTH, dmg);
+ info.StatChange(_id, STAT_HEALTH, dmg);
int health = 1;
- info.StatGet(id, STAT_HEALTH, health);
+ info.StatGet(_id, STAT_HEALTH, health);
// Play death animation if dead, hurt animation otherwise
if (health <= 0 && f._eff._death != -1)
- ForceUpdateMove(f._eff._death);
+ forceUpdateMove(f._eff._death);
else if (f._eff._hurt != -1)
- ForceUpdateMove(f._eff._hurt);
+ forceUpdateMove(f._eff._hurt);
g_engine->_musicManager->PlayEffect(f._eff._hit, 0);
- img_eff = f._eff._img;
+ _imgEff = f._eff._img;
}
- Stop();
- s.damage_done = true;
+ stop();
+ s._damageDone = true;
}
//------------------------------------------------------------------------
// Purpose: We have 2 sprites, *this and s.
-// Check damage between s.box_v and this->box_d and vice versa
+// Check damage between s.boxV and this->boxD and vice versa
//------------------------------------------------------------------------
-void Sprite::ExchangeDamage(Info &info, Sprite &s, const SpriteConstant &sc) {
+void Sprite::exchangeDamage(Info &info, Sprite &s, const SpriteConstant &sc) {
using namespace pyrodactyl::people;
using namespace pyrodactyl::stat;
// This object is taking damage from s
- if (!s.damage_done && TakingDamage(s, sc))
- TakeDamage(info, s);
+ if (!s._damageDone && takingDamage(s, sc))
+ takeDamage(info, s);
// Is the other sprite taking damage from this sprite?
- if (!damage_done && s.TakingDamage(*this, sc))
- s.TakeDamage(info, *this);
+ if (!_damageDone && s.takingDamage(*this, sc))
+ s.takeDamage(info, *this);
// We change the animation to dying in order to give time to the death animation to play out
int num = 0;
- info.StatGet(s.ID(), STAT_HEALTH, num);
+ info.StatGet(s.id(), STAT_HEALTH, num);
if (num <= 0) {
- info.State(s.ID(), PST_DYING);
- info.StatChange(s.ID(), STAT_HEALTH, 1);
+ info.State(s.id(), PST_DYING);
+ info.StatChange(s.id(), STAT_HEALTH, 1);
}
- info.StatGet(id, STAT_HEALTH, num);
+ info.StatGet(_id, STAT_HEALTH, num);
if (num <= 0) {
- info.State(id, PST_DYING);
- info.StatChange(id, STAT_HEALTH, 1);
+ info.State(_id, PST_DYING);
+ info.StatChange(_id, STAT_HEALTH, 1);
}
}
@@ -723,24 +723,24 @@ void Sprite::ExchangeDamage(Info &info, Sprite &s, const SpriteConstant &sc) {
// Purpose: Update status of ambient dialog via popup object
//------------------------------------------------------------------------
void Sprite::internalEvents(Info &info, const Common::String &player_id, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
- popup.internalEvents(info, player_id, result, end_seq);
+ _popup.internalEvents(info, player_id, result, end_seq);
}
//------------------------------------------------------------------------
// Purpose: Save all sprite positions to save file
//------------------------------------------------------------------------
void Sprite::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("id", id.c_str()));
- root->append_attribute(doc.allocate_attribute("x", gStrPool->Get(pos.x)));
- root->append_attribute(doc.allocate_attribute("y", gStrPool->Get(pos.y)));
+ root->append_attribute(doc.allocate_attribute("id", _id.c_str()));
+ root->append_attribute(doc.allocate_attribute("x", gStrPool->Get(_pos.x)));
+ root->append_attribute(doc.allocate_attribute("y", gStrPool->Get(_pos.y)));
}
//------------------------------------------------------------------------
// Purpose: Load all sprite positions from save file
//------------------------------------------------------------------------
void Sprite::loadState(rapidxml::xml_node<char> *node) {
- loadNum(pos.x, "x", node);
- loadNum(pos.y, "y", node);
+ loadNum(_pos.x, "x", node);
+ loadNum(_pos.y, "y", node);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index f8d67e46f84..186ac6c21c0 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -55,186 +55,243 @@ namespace anim {
class Sprite {
protected:
// Used to sync sprite to character
- Common::String id;
+ Common::String _id;
// The position of the sprite
- Vector2i pos;
+ Vector2i _pos;
// The velocity of the sprite, target velocity is our maximum velocity
- Vector2f vel, target;
+ Vector2f _vel, _target;
// The image of the sprite and it's dimensions
- ImageKey image;
- Vector2i img_size;
+ ImageKey _image;
+ Vector2i _imgSize;
// Clip is the portion of the sprite map to be drawn
- Rect clip;
+ Rect _clip;
// The hit boxes of the character - v is vulnerable hit box, d is damage hit box
- Rect box_v, box_d;
+ Rect _boxV, _boxD;
// The direction the sprite is facing
- Direction dir;
+ Direction _dir;
// The currently playing image effect
- ImageEffect img_eff;
+ ImageEffect _imgEff;
// The complete animation set for the sprite
- AnimSet anim_set;
+ AnimSet _animSet;
// The conditions for sprite visibility
- pyrodactyl::event::TriggerSet visible;
+ pyrodactyl::event::TriggerSet _visible;
// Current sprite combo and input for the sprite
- pyrodactyl::input::FightInput input;
+ pyrodactyl::input::FightInput _input;
// Have we done damage for this frame - used to avoid repeated damage for the same frame
- bool damage_done;
+ bool _damageDone;
// Dialog shown without events
- PopUpCollection popup;
+ PopUpCollection _popup;
protected:
- void ResetFrame(const pyrodactyl::people::PersonState &pst);
- bool FightCollide(Rect hitbox, Rect enemy_bounds, Range &range, const pyrodactyl::ai::SpriteConstant &sc);
- bool DamageValid(Sprite &s, const pyrodactyl::ai::SpriteConstant &sc);
+ void resetFrame(const pyrodactyl::people::PersonState &pst);
+ bool fightCollide(Rect hitbox, Rect enemy_bounds, Range &range, const pyrodactyl::ai::SpriteConstant &sc);
+ bool damageValid(Sprite &s, const pyrodactyl::ai::SpriteConstant &sc);
- void Clip(const Rect &rect) { clip = rect; }
- void BoxV(const Rect &rect) { box_v = rect; }
- void BoxD(const Rect &rect) { box_d = rect; }
+ void clip(const Rect &rect) { _clip = rect; }
+ void boxV(const Rect &rect) { _boxV = rect; }
+ void boxD(const Rect &rect) { _boxD = rect; }
public:
// The AI data for the sprite
- pyrodactyl::ai::SpriteAIData ai_data;
- PathfindingAgent pathing;
+ pyrodactyl::ai::SpriteAIData _aiData;
+ PathfindingAgent _pathing;
// The modifier applied to the sprite velocity
- Vector2f vel_mod;
+ Vector2f _velMod;
// The layer associated with the sprite (used to show/hide sprite according to auto hide layers)
- int layer;
+ int _layer;
// Is the mouse hovering over this sprite?
- bool hover;
+ bool _hover;
// The list of collisions currently taking place with the sprite
- Common::List<CollisionData> collide_data;
+ Common::List<CollisionData> _collideData;
Sprite();
- ~Sprite() { pathing.reset(); }
- void Visible(bool val) { visible.Result(val); }
- bool Visible() { return visible.Result(); }
+ ~Sprite() {
+ _pathing.reset();
+ }
- void CalcProperties(pyrodactyl::event::Info &info);
+ void visible(bool val) {
+ _visible.Result(val);
+ }
- void X(int X) { pos.x = X; }
- void Y(int Y) { pos.y = Y; }
+ bool visible() {
+ return _visible.Result();
+ }
- int X() { return pos.x; }
- int Y() { return pos.y; }
+ void calcProperties(pyrodactyl::event::Info &info);
- void WalkPattern(const pyrodactyl::ai::MovementSet &set) { ai_data._walk = set; }
+ void x(int X) {
+ _pos.x = X;
+ }
- void Move(const pyrodactyl::ai::SpriteConstant &sc);
+ void y(int Y) {
+ _pos.y = Y;
+ }
+
+ int x() {
+ return _pos.x;
+ }
+
+ int y() {
+ return _pos.y;
+ }
+
+ void walkPattern(const pyrodactyl::ai::MovementSet &set) {
+ _aiData._walk = set;
+ }
+
+ void move(const pyrodactyl::ai::SpriteConstant &sc);
// Resolve collisions for polygons we want to be outside of
- void ResolveCollide();
+ void resolveCollide();
// Resolve collisions for the walk rectangle
- void ResolveInside(Rect collider);
+ void resolveInside(Rect collider);
+
+ void stop() {
+ _vel.Set();
+ _target.Set();
+ _aiData._dest._active = false;
+ }
+ void inputStop() {
+ _input.reset();
+ }
+
+ void xVel(const float &val) {
+ _target.x = val * _velMod.x;
+ }
+ void yVel(const float &val) {
+ _target.y = val * _velMod.y;
+ }
- void Stop() {
- vel.Set();
- target.Set();
- ai_data._dest._active = false;
+ float xVel() {
+ return _vel.x;
}
- void InputStop() { input.reset(); }
- void XVel(const float &val) { target.x = val * vel_mod.x; }
- void YVel(const float &val) { target.y = val * vel_mod.y; }
+ float yVel() {
+ return _vel.y;
+ }
- float XVel() { return vel.x; }
- float YVel() { return vel.y; }
- Vector2f Vel() { return vel; }
+ Vector2f vel() {
+ return _vel;
+ }
- const Common::String &ID() { return id; }
+ const Common::String &id() {
+ return _id;
+ }
- int W() { return clip.w; }
- int H() { return clip.h; }
+ int w() {
+ return _clip.w;
+ }
- const ImageKey &Img() { return image; }
- Rect DialogClip(const pyrodactyl::people::PersonState &state) { return anim_set._walk.DialogClip(state); }
- void DialogUpdateClip(const pyrodactyl::people::PersonState &state) { anim_set._walk.UpdateClip(state); }
+ int h() {
+ return _clip.h;
+ }
- bool PopupShow() { return popup.show(); }
+ const ImageKey &img() {
+ return _image;
+ }
- Rect BoundRect();
- Rect BoxV();
- Rect BoxD();
- Rect PosRect();
- Rect RangeRect(const Rect &bounds, const Range &range);
- Vector2i CamFocus();
+ Rect dialogClip(const pyrodactyl::people::PersonState &state) {
+ return _animSet._walk.DialogClip(state);
+ }
- double DistSq(const Sprite &s);
- void EffectImg(bool vis) { img_eff._visible = vis; }
- bool LastFrame() { return anim_set._fight.lastFrame(); }
+ void dialogUpdateClip(const pyrodactyl::people::PersonState &state) {
+ _animSet._walk.UpdateClip(state);
+ }
+
+ bool popupShow() {
+ return _popup.show();
+ }
+
+ Rect boundRect();
+ Rect boxV();
+ Rect boxD();
+ Rect posRect();
+ Rect rangeRect(const Rect &bounds, const Range &range);
+ Vector2i camFocus();
+
+ double distSq(const Sprite &s);
+
+ void effectImg(bool vis) {
+ _imgEff._visible = vis;
+ }
+
+ bool lastFrame() {
+ return _animSet._fight.lastFrame();
+ }
- bool TakingDamage(Sprite &sp, const pyrodactyl::ai::SpriteConstant &sc);
- void TakeDamage(pyrodactyl::event::Info &info, Sprite &s);
- void ExchangeDamage(pyrodactyl::event::Info &info, Sprite &s, const pyrodactyl::ai::SpriteConstant &sc);
+ bool takingDamage(Sprite &sp, const pyrodactyl::ai::SpriteConstant &sc);
+ void takeDamage(pyrodactyl::event::Info &info, Sprite &s);
+ void exchangeDamage(pyrodactyl::event::Info &info, Sprite &s, const pyrodactyl::ai::SpriteConstant &sc);
void load(rapidxml::xml_node<char> *node, Common::Array<Common::String> &animations);
void internalEvents(pyrodactyl::event::Info &info, const Common::String &player_id,
Common::Array<pyrodactyl::event::EventResult> &result, Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq);
void draw(pyrodactyl::event::Info &info, const Rect &camera);
- void DrawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
+ void drawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera);
- void Walk(const bool &reset);
- void Walk(const pyrodactyl::people::PersonState &pst);
+ void walk(const bool &reset);
+ void walk(const pyrodactyl::people::PersonState &pst);
- void UpdateFrame(const pyrodactyl::people::PersonState &pst, const bool &repeat = false);
- void AssignFrame();
+ void updateFrame(const pyrodactyl::people::PersonState &pst, const bool &repeat = false);
+ void assignFrame();
- void UpdateMove(const pyrodactyl::input::FightAnimationType &combo);
- void ForceUpdateMove(const pyrodactyl::input::FightAnimationType &combo);
+ void updateMove(const pyrodactyl::input::FightAnimationType &combo);
+ void forceUpdateMove(const pyrodactyl::input::FightAnimationType &combo);
- void UpdateMove(const unsigned int &index);
- void ForceUpdateMove(const unsigned int &index);
+ void updateMove(const unsigned int &index);
+ void forceUpdateMove(const unsigned int &index);
// Set sprite destination
- void SetDestPathfinding(const Vector2i &dest, bool reachable = true);
+ void setDestPathfinding(const Vector2i &dest, bool reachable = true);
// Used for sprite movement controlled by player input (usually the player sprite)
- void HandleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const Common::Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const Common::Event &Event);
#if 0
void HandleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const SDL_Event &Event);
#endif
// This is for sprites with valid object ids
- void Animate(pyrodactyl::event::Info &info);
+ void animate(pyrodactyl::event::Info &info);
// This is for objects without valid ids - like <background> and <fly> sprites
- void Animate(const pyrodactyl::people::PersonState &pst);
+ void animate(const pyrodactyl::people::PersonState &pst);
// AI behavior routine for sprites attacking the player
- void Attack(pyrodactyl::event::Info &info, Sprite &target_sp, const pyrodactyl::ai::SpriteConstant &sc);
+ void attack(pyrodactyl::event::Info &info, Sprite &targetSp, const pyrodactyl::ai::SpriteConstant &sc);
// AI behavior routine for sprites running away from the player
// Requires every exit in the level be accessible
- void Flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level::Exit> &area_exit, const pyrodactyl::ai::SpriteConstant &sc);
+ void flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level::Exit> &areaExit, const pyrodactyl::ai::SpriteConstant &sc);
// Used for sprites that fly across semi randomly on the screen
- void FlyAround(const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc);
+ void flyAround(const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc);
// Used for the player destination movement
- void MoveToDest(pyrodactyl::event::Info &info, const pyrodactyl::ai::SpriteConstant &sc);
- void MoveToDestPathfinding(pyrodactyl::event::Info &info, const pyrodactyl::ai::SpriteConstant &sc);
+ void moveToDest(pyrodactyl::event::Info &info, const pyrodactyl::ai::SpriteConstant &sc);
+ void moveToDestPathfinding(pyrodactyl::event::Info &info, const pyrodactyl::ai::SpriteConstant &sc);
// Used for AI movement - returns true if at the destination, false otherwise
- bool MoveToLoc(Vector2i &dest, const float &vel, const pyrodactyl::ai::SpriteConstant &sc);
- bool MoveToLocPathfinding(Vector2i &dest, const float &vel, const pyrodactyl::ai::SpriteConstant &sc);
+ bool moveToLoc(Vector2i &dest, const float &vel, const pyrodactyl::ai::SpriteConstant &sc);
+ bool moveToLocPathfinding(Vector2i &dest, const float &vel, const pyrodactyl::ai::SpriteConstant &sc);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 2b6aa60afe2..fcab1cde51f 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -605,9 +605,9 @@ bool Game::ApplyResult() {
break;
case ER_MOVE:
for (auto &o : level.objects) {
- if (i->val == o.ID()) {
- o.X(i->x);
- o.Y(i->y);
+ if (i->val == o.id()) {
+ o.x(i->x);
+ o.y(i->y);
break;
}
}
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index b62d0261eae..83c32ccad5e 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -47,7 +47,7 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
void Level::reset() {
if (player_index > 0 && objects.size() > player_index)
- objects[player_index].pathing.shutdown();
+ objects[player_index]._pathing.shutdown();
player_index = 0;
terrain.reset();
@@ -74,7 +74,7 @@ void Level::reset() {
pyrodactyl::anim::Sprite *Level::GetSprite(const Common::String &id) {
int count = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++count)
- if (i->ID() == id)
+ if (i->id() == id)
return &objects[count];
return NULL;
@@ -85,7 +85,7 @@ pyrodactyl::anim::Sprite *Level::GetSprite(const Common::String &id) {
//------------------------------------------------------------------------
void Level::CalcProperties(Info &info) {
for (auto i = objects.begin(); i != objects.end(); ++i)
- i->CalcProperties(info);
+ i->calcProperties(info);
}
//------------------------------------------------------------------------
@@ -101,18 +101,18 @@ void Level::HandleEvents(Info &info, const Common::Event &Event) {
dest.x += camera.x;
dest.y += camera.y;
- Rect b = objects[player_index].BoundRect();
+ Rect b = objects[player_index].boundRect();
b.w /= 2;
b.h /= 2;
b.x = dest.x - b.w / 2;
b.y = dest.y - b.h / 2;
- objects[player_index].SetDestPathfinding(dest, !terrain.InsideNoWalk(dest));
+ objects[player_index].setDestPathfinding(dest, !terrain.InsideNoWalk(dest));
}
}
}
- objects[player_index].HandleEvents(info, camera, sc_default, Event);
+ objects[player_index].handleEvents(info, camera, sc_default, Event);
}
#if 0
@@ -150,13 +150,13 @@ void Level::HandleEvents(Info &info, const SDL_Event &Event) {
void Level::PlayerID(const Common::String &ID, const int &X, const int &Y) {
int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
- if (i->ID() == ID) {
+ if (i->id() == ID) {
player_index = index;
if (X != -1)
- i->X(X);
+ i->x(X);
if (Y != -1)
- i->Y(Y);
+ i->y(Y);
break;
}
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index dfabc19db4f..a245fc7b669 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -156,9 +156,9 @@ public:
}
Rect Camera() { return camera; }
- void PlayerStop() { objects[player_index].Stop(); }
+ void PlayerStop() { objects[player_index].stop(); }
- const Common::String &PlayerID() { return objects[player_index].ID(); }
+ const Common::String &PlayerID() { return objects[player_index].id(); }
void PlayerID(const Common::String &ID, const int &X, const int &Y);
void ShowMap(bool val) { showmap.normal = val; }
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 90a6d726e44..345352c9012 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -50,7 +50,7 @@ LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result
// input.internalEvents();
CalcTrigCollide(info);
- if (terrain.CollideWithExit(objects[player_index].BoundRect(), l_result)) {
+ if (terrain.CollideWithExit(objects[player_index].boundRect(), l_result)) {
if (PlayerInCombat(info)) {
inside_exit = true;
} else if (inside_exit == false) {
@@ -89,38 +89,38 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
// Only bother if the sprite is visible
- if (i->Visible()) {
+ if (i->visible()) {
// TODO: Find a place where this should be initialized... (SZ)
- if (i->pathing.grid == NULL)
- i->pathing.initialize(&pathfindingGrid);
+ if (i->_pathing.grid == NULL)
+ i->_pathing.initialize(&pathfindingGrid);
// If a sprite is dead, nothing else matters
- if (info.State(i->ID()) == PST_DYING) {
- if (i->LastFrame()) {
- info.StatSet(i->ID(), STAT_HEALTH, 0);
- info.State(i->ID(), PST_KO);
- i->EffectImg(false);
- i->InputStop();
+ if (info.State(i->id()) == PST_DYING) {
+ if (i->lastFrame()) {
+ info.StatSet(i->id(), STAT_HEALTH, 0);
+ info.State(i->id(), PST_KO);
+ i->effectImg(false);
+ i->inputStop();
}
- } else if (info.State(i->ID()) != PST_KO) {
- Rect boundRect = i->BoundRect();
+ } else if (info.State(i->id()) != PST_KO) {
+ Rect boundRect = i->boundRect();
- i->pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
- i->pathing.Update(0);
+ i->_pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
+ i->_pathing.Update(0);
// For the AI sprites
if (index != player_index) {
- switch (info.State(i->ID())) {
+ switch (info.State(i->id())) {
case PST_FIGHT: {
// Only attack if the player is alive
- if (info.State(objects[player_index].ID()) < PST_KO)
- i->Attack(info, objects[player_index], sc_default);
+ if (info.State(objects[player_index].id()) < PST_KO)
+ i->attack(info, objects[player_index], sc_default);
} break;
case PST_FLEE:
- i->Flee(info, terrain.area_exit, sc_default);
+ i->flee(info, terrain.area_exit, sc_default);
break;
case PST_NORMAL:
- if (i->TakingDamage(objects[player_index], sc_default)) {
+ if (i->takingDamage(objects[player_index], sc_default)) {
if (first_hit) {
BattleAlert(info);
first_hit = false;
@@ -134,35 +134,35 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
}
// Only do this if the player is alive
- if (info.State(objects[player_index].ID()) < PST_KO)
- objects[player_index].ExchangeDamage(info, *i, sc_default);
+ if (info.State(objects[player_index].id()) < PST_KO)
+ objects[player_index].exchangeDamage(info, *i, sc_default);
} else {
// For the player sprite
- boundRect = i->BoundRect();
+ boundRect = i->boundRect();
- i->pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
- i->pathing.Update(0);
+ i->_pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
+ i->_pathing.Update(0);
- i->MoveToDestPathfinding(info, sc_default);
+ i->moveToDestPathfinding(info, sc_default);
}
i->internalEvents(info, PlayerID(), result, end_seq);
MoveObject(info, *i);
}
- i->Animate(info);
+ i->animate(info);
}
}
// Background sprites don't move
for (auto &i : background)
- i.Animate(PST_NORMAL);
+ i.animate(PST_NORMAL);
// Flier sprites fly across the screen from left to right or vice versa
// The movement is semi-random
for (auto &i : fly) {
- i.FlyAround(camera, sc_default);
- i.Animate(PST_NORMAL);
+ i.flyAround(camera, sc_default);
+ i.animate(PST_NORMAL);
}
}
@@ -172,14 +172,14 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
void Level::BattleAlert(Info &info) {
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
- if (index != player_index && i->Visible() && info.State(i->ID()) != PST_KO) {
- switch (info.Type(i->ID())) {
+ if (index != player_index && i->visible() && info.State(i->id()) != PST_KO) {
+ switch (info.Type(i->id())) {
case PE_NEUTRAL:
case PE_HOSTILE:
- info.State(i->ID(), PST_FIGHT);
+ info.State(i->id(), PST_FIGHT);
break;
case PE_COWARD:
- info.State(i->ID(), PST_FLEE);
+ info.State(i->id(), PST_FLEE);
break;
default:
break;
@@ -193,15 +193,15 @@ void Level::BattleAlert(Info &info) {
//------------------------------------------------------------------------
void Level::MoveObject(Info &info, pyrodactyl::anim::Sprite &s) {
// Update x,y coordinates according to velocity
- s.Move(sc_default);
+ s.move(sc_default);
// First check collision with objects and forbidden areas inside a level
if (CollidingWithLevel(info, s))
- s.ResolveCollide();
+ s.resolveCollide();
// Finally see if we are inside the overall level bounds
- if (!terrain.InsideWalk(s.BoundRect()))
- s.ResolveInside(terrain.AreaWalk());
+ if (!terrain.InsideWalk(s.boundRect()))
+ s.resolveInside(terrain.AreaWalk());
}
//------------------------------------------------------------------------
@@ -210,7 +210,7 @@ void Level::MoveObject(Info &info, pyrodactyl::anim::Sprite &s) {
bool Level::PlayerInCombat(Info &info) {
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index)
- if (index != player_index && info.State(i->ID()) == PST_FIGHT && i->Visible())
+ if (index != player_index && info.State(i->id()) == PST_FIGHT && i->visible())
return true;
return false;
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index ea99f787e9b..80df6ab9e11 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -49,24 +49,24 @@ bool Level::ContainsClick(const Common::String &id, const Common::Event &Event)
// If mouse is moved and is hovering on the specified sprite (id), set hover = true
if (Event.type == Common::EVENT_MOUSEMOVE) {
for (auto &i : objects) {
- Rect r = i.PosRect();
+ Rect r = i.posRect();
if (r.Contains(g_engine->_mouse->motion.x + camera.x, g_engine->_mouse->motion.y + camera.y)) {
// This is to show the sprite's name on top of their head
- i.hover = true;
+ i._hover = true;
// This is to update the mouse cursor only if we're in talking range of a sprite
- if (i.ID() == id)
+ if (i.id() == id)
g_engine->_mouse->hover = true;
} else
- i.hover = false;
+ i._hover = false;
}
return false;
} else if (g_engine->_mouse->Pressed()) {
for (auto &i : objects) {
- if (i.ID() == id) {
- Rect r = i.PosRect();
+ if (i.id() == id) {
+ Rect r = i.posRect();
if (r.Contains(g_engine->_mouse->button.x + camera.x, g_engine->_mouse->button.y + camera.y)) {
g_engine->_mouse->hover = true;
return true;
@@ -86,7 +86,7 @@ bool Level::ContainsClick(const Common::String &id, const SDL_Event &Event) {
// If mouse is moved and is hovering on the specified sprite (id), set hover = true
if (Event.type == SDL_MOUSEMOTION) {
for (auto &i : objects) {
- Rect r = i.PosRect();
+ Rect r = i.posRect();
if (r.Contains(g_engine->_mouse->motion.x + camera.x, g_engine->_mouse->motion.y + camera.y)) {
// This is to show the sprite's name on top of their head
@@ -103,7 +103,7 @@ bool Level::ContainsClick(const Common::String &id, const SDL_Event &Event) {
} else if (g_engine->_mouse->Pressed()) {
for (auto &i : objects) {
if (i.ID() == id) {
- Rect r = i.PosRect();
+ Rect r = i.posRect();
if (r.Contains(g_engine->_mouse->button.x + camera.x, g_engine->_mouse->button.y + camera.y)) {
g_engine->_mouse->hover = true;
return true;
@@ -119,11 +119,11 @@ bool Level::ContainsClick(const Common::String &id, const SDL_Event &Event) {
// Purpose: Find if a layer is visible (used only for objects with layers associated with them)
//------------------------------------------------------------------------
bool Level::LayerVisible(Sprite *obj) {
- if (obj->layer < 0)
+ if (obj->_layer < 0)
return true;
- if ((unsigned int)obj->layer < terrain.layer.size())
- return terrain.layer[obj->layer].collide;
+ if ((unsigned int)obj->_layer < terrain.layer.size())
+ return terrain.layer[obj->_layer].collide;
return false;
}
@@ -134,8 +134,8 @@ bool Level::LayerVisible(Sprite *obj) {
//------------------------------------------------------------------------
void Level::CalcTrigCollide(Info &info) {
for (auto i = objects.begin(); i != objects.end(); ++i)
- if (info.PersonValid(i->ID()))
- terrain.CollideWithTrigger(i->BoundRect(), info.PersonGet(i->ID()).trig);
+ if (info.PersonValid(i->id()))
+ terrain.CollideWithTrigger(i->boundRect(), info.PersonGet(i->id()).trig);
}
//------------------------------------------------------------------------
@@ -144,16 +144,16 @@ void Level::CalcTrigCollide(Info &info) {
//------------------------------------------------------------------------
bool Level::CollidingWithObject(Info &info, Common::String &id) {
// Clip and Bounding rectangle of player
- Rect p_pos = objects[player_index].PosRect(), p_bound = objects[player_index].BoundRect();
+ Rect p_pos = objects[player_index].posRect(), p_bound = objects[player_index].boundRect();
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
- if (i->Visible() && player_index != index && info.State(i->ID()) == PST_NORMAL) {
+ if (i->visible() && player_index != index && info.State(i->id()) == PST_NORMAL) {
// Clip and bounding rectangles for the NPC sprite
- Rect i_pos = i->PosRect(), i_bound = i->BoundRect();
+ Rect i_pos = i->posRect(), i_bound = i->boundRect();
if (p_pos.Collide(i_pos) || i_pos.Contains(p_pos) || p_bound.Collide(i_bound) || i_bound.Contains(p_bound)) {
- id = i->ID();
+ id = i->id();
return true;
}
}
@@ -167,11 +167,11 @@ bool Level::CollidingWithObject(Info &info, Common::String &id) {
// id is set to the id of colliding object
//------------------------------------------------------------------------
bool Level::CollidingWithLevel(Info &info, Sprite &s) {
- terrain.CollideWithNoWalk(s.BoundRect(), s.collide_data);
+ terrain.CollideWithNoWalk(s.boundRect(), s._collideData);
- terrain.CollideWithStairs(s.BoundRect(), s.vel_mod);
+ terrain.CollideWithStairs(s.boundRect(), s._velMod);
- if (terrain.CollideWithMusic(s.BoundRect(), music)) {
+ if (terrain.CollideWithMusic(s.boundRect(), music)) {
if (music.track)
g_engine->_musicManager->PlayMusic(music.id);
else
@@ -179,7 +179,7 @@ bool Level::CollidingWithLevel(Info &info, Sprite &s) {
}
// If we are colliding with something, return true
- return !s.collide_data.empty();
+ return !s._collideData.empty();
}
} // End of namespace Crab
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 4638c1fabb6..fcbe1e74b20 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -73,18 +73,18 @@ void Level::draw(pyrodactyl::event::Info &info) {
unsigned int layer_count = 0u;
// Draw the terrain layer
- g_engine->_imageManager->tileset.draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].PosRect(), img);
+ g_engine->_imageManager->tileset.draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].posRect(), img);
- Vector2i pos = objects[player_index].ai_data._dest;
+ Vector2i pos = objects[player_index]._aiData._dest;
Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
// Draw the background sprites
for (; b != background.end(); ++b) {
- if ((unsigned int)b->layer > layer_count) // We don't have any sprites to draw at this layer
+ if ((unsigned int)b->_layer > layer_count) // We don't have any sprites to draw at this layer
break;
- else if ((unsigned int)b->layer == layer_count && b->Visible())
+ else if ((unsigned int)b->_layer == layer_count && b->visible())
b->draw(info, camera);
}
@@ -93,14 +93,14 @@ void Level::draw(pyrodactyl::event::Info &info) {
DrawObjects(info);
// Draw the terrain layer
- g_engine->_imageManager->tileset.ForceDraw(*l, camera, terrain.tile_size, objects[player_index].PosRect());
+ g_engine->_imageManager->tileset.ForceDraw(*l, camera, terrain.tile_size, objects[player_index].posRect());
}
// Draw the background sprites
for (; b != background.end(); ++b) {
- if ((unsigned int)b->layer > layer_count) // We don't have any sprites to draw at this layer
+ if ((unsigned int)b->_layer > layer_count) // We don't have any sprites to draw at this layer
break;
- else if ((unsigned int)b->layer >= layer_count && b->Visible())
+ else if ((unsigned int)b->_layer >= layer_count && b->visible())
b->draw(info, camera);
}
@@ -111,21 +111,21 @@ void Level::draw(pyrodactyl::event::Info &info) {
// Fliers are drawn above every sprite but below popup text
for (auto &i : fly) {
// Only draw if it is supposed to be flying
- if (i.ai_data._walk._enabled)
+ if (i._aiData._walk._enabled)
i.draw(info, camera);
}
// Draw popup text over all level layers
for (auto &i : objects) {
// Only draw popups for visible sprites
- if (i.Visible()) {
- if (i.PopupShow())
- i.DrawPopup(pop, camera);
+ if (i.visible()) {
+ if (i.popupShow())
+ i.drawPopup(pop, camera);
else {
// Only draw their name if they are
//(a) hovered over by the mouse, OR
//(b) are in talk range and don't have popup text over their head
- if (i.hover || (info.LastPerson() == i.ID() && !i.PopupShow()))
+ if (i._hover || (info.LastPerson() == i.id() && !i.popupShow()))
talk_notify.draw(info, i, camera);
}
}
@@ -140,15 +140,15 @@ void Level::draw(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
void Level::DrawObjects(pyrodactyl::event::Info &info) {
// Draw player destination marker
- if (objects[player_index].ai_data._dest._active)
- dest_marker.draw(objects[player_index].ai_data._dest, camera);
+ if (objects[player_index]._aiData._dest._active)
+ dest_marker.draw(objects[player_index]._aiData._dest, camera);
- Vector2i pos = objects[player_index].ai_data._dest;
+ Vector2i pos = objects[player_index]._aiData._dest;
Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
if (terrain.prop.empty()) {
for (auto &entry : obj_seq) {
- if (entry.second->Visible() && LayerVisible(entry.second))
+ if (entry.second->visible() && LayerVisible(entry.second))
entry.second->draw(info, camera);
}
} else {
@@ -157,20 +157,20 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
while (a != terrain.prop.end() && b != obj_seq.end()) {
auto obj = b->second;
- if (a->pos.y + a->pos.h < obj->Y() + obj->H()) {
+ if (a->pos.y + a->pos.h < obj->y() + obj->h()) {
for (auto &i : a->boundRect) {
i.draw(-camera.x, -camera.y, 128, 128, 0, 255);
- if (i.Collide(objects[player_index].PosRect())) {
- g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
+ if (i.Collide(objects[player_index].posRect())) {
+ g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].posRect());
}
- if (i.Contains(objects[player_index].ai_data._dest)) {
+ if (i.Contains(objects[player_index]._aiData._dest)) {
g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
}
}
++a;
} else {
- if (obj->Visible() && LayerVisible(obj))
+ if (obj->visible() && LayerVisible(obj))
obj->draw(info, camera);
++b;
}
@@ -179,18 +179,18 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
if (a == terrain.prop.end()) {
for (; b != obj_seq.end(); ++b) {
auto obj = b->second;
- if (obj->Visible() && LayerVisible(obj))
+ if (obj->visible() && LayerVisible(obj))
obj->draw(info, camera);
}
} else if (b == obj_seq.end()) {
for (; a != terrain.prop.end(); ++a) {
for (auto &i : a->boundRect) {
i.draw(-camera.x, -camera.y, 128, 128, 0, 255);
- if (i.Collide(objects[player_index].PosRect())) {
- g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].PosRect());
+ if (i.Collide(objects[player_index].posRect())) {
+ g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].posRect());
}
- if (i.Contains(objects[player_index].ai_data._dest)) {
+ if (i.Contains(objects[player_index]._aiData._dest)) {
g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
}
}
@@ -208,7 +208,7 @@ void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
while (a != terrain.prop.end() && b != obj_seq.end()) {
auto obj = b->second;
- if (a->pos.y + a->pos.h < obj->Y() + obj->H()) {
+ if (a->pos.y + a->pos.h < obj->y() + obj->h()) {
g_engine->_imageManager->tileset.PreDraw(*a, terrain.tile_size, surf);
++a;
} else {
@@ -228,14 +228,14 @@ void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
// Purpose: Sort objects to draw them according to their Y coordinates
//------------------------------------------------------------------------
bool Level::operator()(int i, int j) {
- return objects[i].Y() + objects[i].H() < objects[j].Y() + objects[j].H();
+ return objects[i].y() + objects[i].h() < objects[j].y() + objects[j].h();
}
void Level::SortObjectsToDraw() {
// add each object to the map to sort it
obj_seq.clear();
for (auto &object : objects)
- obj_seq.insert(Common::Pair<int, Sprite *>(object.Y() + object.H(), &object));
+ obj_seq.insert(Common::Pair<int, Sprite *>(object.y() + object.h(), &object));
}
//------------------------------------------------------------------------
@@ -243,7 +243,7 @@ void Level::SortObjectsToDraw() {
//------------------------------------------------------------------------
void Level::SetCamera() {
// Use the focus points of sprites
- Vector2i focus = objects[player_index].CamFocus();
+ Vector2i focus = objects[player_index].camFocus();
// Center the camera over the player
camera.x = focus.x - (g_engine->_screenSettings->cur.w / 2);
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 954bbdda2e6..ceea94765fd 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -44,7 +44,7 @@ using namespace pyrodactyl::input;
// Purpose: Used to sort background sprites
//------------------------------------------------------------------------
bool CompSpriteLayer(const Sprite &a, const Sprite &b) {
- return (a.layer < b.layer);
+ return (a._layer < b._layer);
}
//------------------------------------------------------------------------
@@ -106,8 +106,8 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
if (str == "player") {
player_index = objects.size();
if (player_x != -1 && player_y != -1) {
- s.X(player_x);
- s.Y(player_y);
+ s.x(player_x);
+ s.y(player_y);
}
}
@@ -134,7 +134,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
// Set the timer target for the first time
//s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
- s.ai_data._walk._timer.Target(sc_default._fly._delayMax);
+ s._aiData._walk._timer.Target(sc_default._fly._delayMax);
fly.push_back(s);
}
@@ -158,7 +158,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
Trigger t;
t.type = TRIG_STAT;
t.target = STATNAME_HEALTH;
- t.subject = objects[player_index].ID();
+ t.subject = objects[player_index].id();
t.operation = "<";
t.val = "1";
game_over.Add(t);
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index 9624fddbff9..6d9af8dc09b 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -44,7 +44,7 @@ void TalkNotify::load(rapidxml::xml_node<char> *node) {
}
void TalkNotify::draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s, const Rect &camera) {
- Rect rect = s.PosRect();
+ Rect rect = s.posRect();
// Find position to draw name (over the sprite's top edge)
Vector2i pos;
@@ -52,7 +52,7 @@ void TalkNotify::draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s
pos.y = rect.y + offset.y;
// Find the sprite name
- Common::String text = info.GetName(s.ID());
+ Common::String text = info.GetName(s.id());
g_engine->_textManager->draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
}
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 2afc8a766dd..82a310e6107 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -69,8 +69,8 @@ void ChapterIntro::draw(pyrodactyl::event::Info &info, Common::String &text,
traits.draw();
if (cur_sp != nullptr) {
- Rect clip = cur_sp->DialogClip(state);
- g_engine->_imageManager->draw(pos.x, pos.y, cur_sp->Img(), &clip);
+ Rect clip = cur_sp->dialogClip(state);
+ g_engine->_imageManager->draw(pos.x, pos.y, cur_sp->img(), &clip);
}
}
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index eef63c63777..09de80de029 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -75,7 +75,7 @@ void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
dlbox.draw(player);
if (s != NULL) {
- Rect r = s->DialogClip(Event->state);
+ Rect r = s->dialogClip(Event->state);
int x = img.x, y = img.y;
if (sprite_align.x == ALIGN_CENTER)
@@ -88,7 +88,7 @@ void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
else if (sprite_align.y == ALIGN_RIGHT)
y -= r.h;
- g_engine->_imageManager->draw(x, y, s->Img(), &r);
+ g_engine->_imageManager->draw(x, y, s->img(), &r);
}
if (info.PersonValid(person_id)) {
@@ -148,7 +148,7 @@ bool PersonHandler::HandleDlboxEvents(const SDL_Event &Event) {
void PersonHandler::internalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s) {
if (s != NULL)
- s->DialogUpdateClip(state);
+ s->dialogUpdateClip(state);
}
void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const Common::String &id, const pyrodactyl::people::OpinionType &type, const int &val) {
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 1d509f9e5c5..7be9d9a8fe3 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -75,7 +75,7 @@ void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const Common::Str
void PersonScreen::internalEvents() {
if (cur_sp != nullptr)
- cur_sp->DialogUpdateClip(PST_NORMAL);
+ cur_sp->dialogUpdateClip(PST_NORMAL);
}
void PersonScreen::draw(pyrodactyl::event::Info &info, const Common::String &id) {
@@ -88,8 +88,8 @@ void PersonScreen::draw(pyrodactyl::event::Info &info, const Common::String &id)
menu.draw(nullptr);
if (cur_sp != nullptr) {
- Rect clip = cur_sp->DialogClip(PST_NORMAL);
- g_engine->_imageManager->draw(img.x, img.y, cur_sp->Img(), &clip);
+ Rect clip = cur_sp->dialogClip(PST_NORMAL);
+ g_engine->_imageManager->draw(img.x, img.y, cur_sp->img(), &clip);
}
}
Commit: b0d129f1a5cf4afef620b26813d13c086a01d412
https://github.com/scummvm/scummvm/commit/b0d129f1a5cf4afef620b26813d13c086a01d412
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename SetUI() to setUI() across CRAB codebase
Changed paths:
engines/crab/ScreenSettings.h
engines/crab/app.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gamestate_container.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/splash.cpp
engines/crab/splash.h
engines/crab/ui/AlphaImage.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/ItemDesc.h
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/element.cpp
engines/crab/ui/element.h
engines/crab/ui/emotion.cpp
engines/crab/ui/emotion.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
engines/crab/ui/textarea.h
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index 4e5b220b088..73b2d05a41d 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -121,7 +121,7 @@ public:
// True if we are in game, false otherwise
bool in_game;
- // Set to true when we have to call SetUI() for rearranging UI after a resolution change
+ // Set to true when we have to call setUI() for rearranging UI after a resolution change
bool change_interface;
// The version of the settings
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 3b9f61cf50a..e4cc25009c8 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -247,7 +247,7 @@ void App::Run() {
// Do we have to reposition our interface?
if (g_engine->_screenSettings->change_interface) {
- CurrentState->SetUI();
+ CurrentState->setUI();
g_engine->_screenSettings->change_interface = false;
}
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 3001ab9a9e6..1ea33aa1fcd 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -397,9 +397,9 @@ void Info::loadState(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Calculate UI positions after change in screen size
//------------------------------------------------------------------------
-void Info::SetUI() {
- journal.SetUI();
- inv.SetUI();
+void Info::setUI() {
+ journal.setUI();
+ inv.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 4e9f044cd42..19db826e025 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -202,7 +202,7 @@ public:
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
- void SetUI();
+ void setUI();
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 77a74fcdcaa..d8469fc14b5 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -434,11 +434,11 @@ void Manager::loadState(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Function called when window size is changed to adjust UI
//------------------------------------------------------------------------
-void Manager::SetUI() {
- oh.SetUI();
- reply.SetUI();
- textin.SetUI();
- per.SetUI();
+void Manager::setUI() {
+ oh.setUI();
+ reply.setUI();
+ textin.setUI();
+ per.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index cbe66bf9310..b3e9b701c14 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -110,7 +110,7 @@ public:
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
- void SetUI();
+ void setUI();
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index fcab1cde51f..4ddf5434c1b 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -875,16 +875,16 @@ void Game::CreateSaveGame(const SaveGameType &savetype) {
#endif
}
-void Game::SetUI() {
- map.SetUI();
- hud.SetUI();
+void Game::setUI() {
+ map.setUI();
+ hud.setUI();
- g_engine->_loadMenu->SetUI();
- g_engine->_optionMenu->SetUI();
+ g_engine->_loadMenu->setUI();
+ g_engine->_optionMenu->setUI();
- gem.SetUI();
- info.SetUI();
- level.SetUI();
+ gem.setUI();
+ info.setUI();
+ level.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 8a482e44f38..9905a746929 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -144,7 +144,7 @@ public:
void AutoSave() { CreateSaveGame(SAVEGAME_EXIT); }
- void SetUI();
+ void setUI();
};
} // End of namespace Crab
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index 4b2731ea335..b86207778e3 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -48,7 +48,7 @@ public:
virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void draw() = 0;
- virtual void SetUI() = 0;
+ virtual void setUI() = 0;
virtual void AutoSave() = 0;
virtual ~GameState(){};
};
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index b1f26661dd9..c92e8f29d06 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -146,11 +146,11 @@ void ItemCollection::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node
//------------------------------------------------------------------------
// Purpose: Reset UI elements when resolution changes
//------------------------------------------------------------------------
-void ItemCollection::SetUI() {
- item_info.SetUI();
+void ItemCollection::setUI() {
+ item_info.setUI();
for (auto i = item.begin(); i != item.end(); ++i)
- i->_value.SetUI();
+ i->_value.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 981b6b3e846..2bcab04d959 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -91,7 +91,7 @@ public:
void loadState(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void SetUI();
+ void setUI();
};
} // End of namespace item
} // End of namespace pyrodactyl
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 83c32ccad5e..84521651736 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -166,7 +166,7 @@ void Level::PlayerID(const Common::String &ID, const int &X, const int &Y) {
//------------------------------------------------------------------------
// Purpose: Rearrange stuff after resolution change
//------------------------------------------------------------------------
-void Level::SetUI() {
+void Level::setUI() {
camera.w = g_engine->_screenSettings->cur.w;
camera.h = g_engine->_screenSettings->cur.h;
SetCamera();
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index a245fc7b669..5dcf89cf5db 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -203,7 +203,7 @@ public:
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
- void SetUI();
+ void setUI();
};
} // End of namespace level
} // End of namespace pyrodactyl
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 85c4fb36573..84e9fbd5b6f 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -550,35 +550,35 @@ void MainMenu::draw() {
g_engine->_mouse->draw();
}
-void MainMenu::SetUI() {
- me_main.SetUI();
- logo.SetUI();
+void MainMenu::setUI() {
+ me_main.setUI();
+ logo.setUI();
- back.SetUI();
- g_engine->_optionMenu->SetUI();
- mod.SetUI();
- g_engine->_loadMenu->SetUI();
- g_engine->_helpScreen->SetUI();
- credits.SetUI();
+ back.setUI();
+ g_engine->_optionMenu->setUI();
+ mod.setUI();
+ g_engine->_loadMenu->setUI();
+ g_engine->_helpScreen->setUI();
+ credits.setUI();
- accept.SetUI();
- cancel.SetUI();
+ accept.setUI();
+ cancel.setUI();
- bg.SetUI();
+ bg.setUI();
for (auto &i : lights)
- i.SetUI();
+ i.setUI();
- diff.menu.SetUI();
- diff.bg.SetUI();
- diff.heading.SetUI();
+ diff.menu.setUI();
+ diff.bg.setUI();
+ diff.heading.setUI();
- save.SetUI();
- warning.SetUI();
- bg_save.SetUI();
+ save.setUI();
+ warning.setUI();
+ bg_save.setUI();
#ifdef UNREST_DEMO
- steam.SetUI();
- direct.SetUI();
+ steam.setUI();
+ direct.setUI();
#endif
}
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index b892e18add3..3f8662f166c 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -133,7 +133,7 @@ public:
void draw();
void ChangeState(MenuState ms, const bool &start = false);
- void SetUI();
+ void setUI();
// We don't need to save game state here
void AutoSave() {}
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 7a46cf751fa..aaded90fd40 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -44,7 +44,7 @@ Splash::Splash() {
// Load the background
background.load("res/gfx/pyrodactyl.png");
- SetUI();
+ setUI();
load_complete = false;
first_run = true;
}
@@ -86,7 +86,7 @@ void Splash::draw() {
//------------------------------------------------------------------------
// Purpose: Reset UI position
//------------------------------------------------------------------------
-void Splash::SetUI() {
+void Splash::setUI() {
warning("ScreenSettings cur w : %d h : %d", g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h);
x = (g_engine->_screenSettings->cur.w - background.W()) / 2;
y = (g_engine->_screenSettings->cur.h - background.H()) / 2;
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 797a62c7f1a..e33705477cb 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -62,7 +62,7 @@ public:
void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {}
void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void draw();
- void SetUI();
+ void setUI();
// We don't need to save game state here
void AutoSave() {}
diff --git a/engines/crab/ui/AlphaImage.h b/engines/crab/ui/AlphaImage.h
index f08fb01bad7..0e2909aa7a9 100644
--- a/engines/crab/ui/AlphaImage.h
+++ b/engines/crab/ui/AlphaImage.h
@@ -79,7 +79,7 @@ public:
// This is used to vary the alpha
void internalEvents();
- void SetUI() { pos.SetUI(); }
+ void setUI() { pos.setUI(); }
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 80d39c3dcdc..078bfcd71bf 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -177,18 +177,18 @@ void CreditScreen::draw() {
start.y = INT_MIN + 10;
}
-void CreditScreen::SetUI() {
- bg.SetUI();
- back.SetUI();
-
- slow.SetUI();
- fast.SetUI();
- pause.SetUI();
- reverse.SetUI();
-
- logo.SetUI();
- twitter.SetUI();
- website.SetUI();
+void CreditScreen::setUI() {
+ bg.setUI();
+ back.setUI();
+
+ slow.setUI();
+ fast.setUI();
+ pause.setUI();
+ reverse.setUI();
+
+ logo.setUI();
+ twitter.setUI();
+ website.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index d5f9f1c9057..65702f9c20d 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -120,7 +120,7 @@ public:
#endif
void draw();
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 8ebe18f3fa8..2004a951511 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -272,18 +272,18 @@ public:
return false;
}
- void SetUI() {
- bg.SetUI();
- menu.SetUI();
+ void setUI() {
+ bg.setUI();
+ menu.setUI();
ScanDir();
- img.pos.SetUI();
+ img.pos.setUI();
for (int i = 0; i < DATA_BUTTON_TOTAL; ++i)
- td_b[i].SetUI();
+ td_b[i].setUI();
for (int i = 0; i < DATA_HOVER_TOTAL; ++i) {
- td_h[i].SetUI();
- hov[i].SetUI();
+ td_h[i].setUI();
+ hov[i].setUI();
}
}
};
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index d02723ee05d..f56a2784948 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -74,10 +74,10 @@ void GameOverMenu::draw() {
menu.draw();
}
-void GameOverMenu::SetUI() {
- bg.SetUI();
- title.SetUI();
- menu.SetUI();
+void GameOverMenu::setUI() {
+ bg.setUI();
+ title.setUI();
+ menu.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 198579a2a77..43cbdfd816b 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -75,7 +75,7 @@ public:
#endif
void draw();
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 69fca813fee..27d01d46ecf 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -157,14 +157,14 @@ void GeneralSettingMenu::RestoreBackup() {
//------------------------------------------------------------------------
// Purpose: Set UI positioned on screen size change
//------------------------------------------------------------------------
-void GeneralSettingMenu::SetUI() {
- save_on_exit.SetUI();
- mouse_trap.SetUI();
+void GeneralSettingMenu::setUI() {
+ save_on_exit.setUI();
+ mouse_trap.setUI();
- vol_music.SetUI();
- vol_effects.SetUI();
+ vol_music.setUI();
+ vol_effects.setUI();
- text_speed.SetUI();
+ text_speed.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 7d0dc49808d..1adea45902a 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -65,7 +65,7 @@ public:
void internalEvents();
void draw();
- void SetUI();
+ void setUI();
void CreateBackup() {
vol_music.CreateBackup();
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 55ce38c6ce8..21ea2d07b5d 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -174,16 +174,16 @@ void GfxSettingMenu::internalEvents() {
//------------------------------------------------------------------------
// Purpose: Rearrange UI when resolution changes
//------------------------------------------------------------------------
-void GfxSettingMenu::SetUI() {
- resolution.SetUI();
+void GfxSettingMenu::setUI() {
+ resolution.setUI();
- fullscreen.SetUI();
- vsync.SetUI();
- border.SetUI();
- quality.SetUI();
+ fullscreen.setUI();
+ vsync.setUI();
+ border.setUI();
+ quality.setUI();
- notice_quality.SetUI();
- brightness.SetUI();
+ notice_quality.setUI();
+ brightness.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 251ac71911c..b1930baadd2 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -68,7 +68,7 @@ public:
void internalEvents();
void draw();
- void SetUI();
+ void setUI();
void SetInfo() { resolution.SetInfo(); }
};
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 3264c77c8f2..4f67bcaafa6 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -134,10 +134,10 @@ void Inventory::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char
//------------------------------------------------------------------------
// Purpose: Set UI positions after screen size change
//------------------------------------------------------------------------
-void Inventory::SetUI() {
- bg.SetUI();
- collection.SetUI();
- money.SetUI();
+void Inventory::setUI() {
+ bg.setUI();
+ collection.setUI();
+ money.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index 7352700ddca..c8cb073743a 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -82,7 +82,7 @@ public:
void ItemFile(const Common::String &filename) { itemfile = filename; }
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index 530a9c59c33..17c1335340e 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -63,9 +63,9 @@ public:
desc.draw(item.desc);
}
- void SetUI() {
- name.SetUI();
- desc.SetUI();
+ void setUI() {
+ name.setUI();
+ desc.setUI();
}
};
} // End of namespace ui
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index cf12bdf2ca7..246118cdf9d 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -225,18 +225,18 @@ void KeyBindMenu::SwapKey(const SDL_Scancode &find) {
}
#endif
-void KeyBindMenu::SetUI() {
+void KeyBindMenu::setUI() {
menu[CON_GAME].Clear();
menu[CON_UI].Clear();
// Initialize the menus
- prim.SetUI();
- alt.SetUI();
+ prim.setUI();
+ alt.setUI();
InitMenu(CON_GAME);
InitMenu(CON_UI);
- desc.SetUI();
- sel_controls.SetUI();
+ desc.setUI();
+ sel_controls.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 7c9c6fdb989..662c3d0f0ee 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -123,7 +123,7 @@ public:
void SetCaption();
void draw();
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index c56feb8bcb7..51f3ace8ce3 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -151,9 +151,9 @@ void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &player_po
//------------------------------------------------------------------------
// Purpose: Reposition UI
//------------------------------------------------------------------------
-void MapMarkerMenu::SetUI() {
- player.SetUI();
- menu.SetUI();
+void MapMarkerMenu::setUI() {
+ player.setUI();
+ menu.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index ec00ccacd65..23af3d29d93 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -93,7 +93,7 @@ public:
#endif
void internalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 9706e63d3cb..5d50a91028b 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -414,26 +414,26 @@ void OptionMenu::saveState() {
#endif
}
-void OptionMenu::SetUI() {
- bg.SetUI();
- menu.SetUI();
+void OptionMenu::setUI() {
+ bg.setUI();
+ menu.setUI();
- keybind.SetUI();
- conbind.SetUI();
+ keybind.setUI();
+ conbind.setUI();
- gfx.SetUI();
- general.SetUI();
+ gfx.setUI();
+ general.setUI();
- notice_res.SetUI();
+ notice_res.setUI();
- countdown.SetUI();
- questionbox.SetUI();
+ countdown.setUI();
+ questionbox.setUI();
- prompt_w.SetUI();
- prompt_h.SetUI();
+ prompt_w.setUI();
+ prompt_h.setUI();
- accept.SetUI();
- cancel.SetUI();
+ accept.setUI();
+ cancel.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 30e9aba83fc..a5a7fea2187 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -113,7 +113,7 @@ public:
#endif
void internalEvents();
- void SetUI();
+ void setUI();
void saveState();
};
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 695ff7f98c3..6adfbd52a5c 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -109,10 +109,10 @@ bool OptionSelect::HandleEvents(const SDL_Event &Event) {
}
#endif
-void OptionSelect::SetUI() {
- option.data.SetUI();
- prev.SetUI();
- next.SetUI();
+void OptionSelect::setUI() {
+ option.data.setUI();
+ prev.setUI();
+ next.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index 250c8aa63b7..ad3ade4b6d6 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -70,7 +70,7 @@ public:
bool HandleEvents(const SDL_Event &Event);
#endif
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 1f9407a0f25..c76d7885c44 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -123,14 +123,14 @@ public:
m->UseKeyboard(val);
}
- void SetUI() {
- prev.SetUI();
- next.SetUI();
- ref.SetUI();
- status.SetUI();
+ void setUI() {
+ prev.setUI();
+ next.setUI();
+ ref.setUI();
+ status.setUI();
for (auto m = menu.begin(); m != menu.end(); ++m)
- m->SetUI();
+ m->setUI();
}
void UpdateInfo() {
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index cdfafb2126a..ba726ac83af 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -184,10 +184,10 @@ bool PauseMenu::DisableHotkeys() {
return (state == STATE_SAVE && save.DisableHotkeys()) || (state == STATE_OPTION && g_engine->_optionMenu->DisableHotkeys());
}
-void PauseMenu::SetUI() {
- bg.SetUI();
- menu.SetUI();
- save.SetUI();
+void PauseMenu::setUI() {
+ bg.setUI();
+ menu.setUI();
+ save.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index c2b61acbc60..7d2a613bba3 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -102,7 +102,7 @@ public:
// This is done because esc is both the "go back on menu level" and the pause key
bool ShowLevel() { return state == STATE_NORMAL; }
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 09de80de029..087f952628c 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -180,14 +180,14 @@ void PersonHandler::reset(const Common::String &id) {
}
}
-void PersonHandler::SetUI() {
- img.SetUI();
- name.SetUI();
- dlbox.SetUI();
- jb.SetUI();
+void PersonHandler::setUI() {
+ img.setUI();
+ name.setUI();
+ dlbox.setUI();
+ jb.setUI();
for (auto i = 0; i < pyrodactyl::people::OPI_TOTAL; ++i)
- opinion[i].SetUI();
+ opinion[i].setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index b36ca00ed22..1f11d4d612f 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -108,7 +108,7 @@ public:
void OpinionChange(pyrodactyl::event::Info &info, const Common::String &id,
const pyrodactyl::people::OpinionType &type, const int &val);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 7be9d9a8fe3..e5da6183f08 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -102,11 +102,11 @@ void PersonScreen::Cache(Info &info, const Common::String &id, pyrodactyl::level
menu.Clear();
}
-void PersonScreen::SetUI() {
- bg.SetUI();
- name.SetUI();
- img.SetUI();
- menu.SetUI();
+void PersonScreen::setUI() {
+ bg.setUI();
+ name.setUI();
+ img.setUI();
+ menu.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 11b592e2a5b..55b9c2eeae5 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -75,7 +75,7 @@ public:
void internalEvents();
void draw(pyrodactyl::event::Info &info, const Common::String &id);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index b14f7f8e2af..bdc88d5d50d 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -166,12 +166,12 @@ void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event
}
#endif
-void QuestText::SetUI() {
- ParagraphData::SetUI();
- img.SetUI();
- prev.SetUI();
- next.SetUI();
- status.SetUI();
+void QuestText::setUI() {
+ ParagraphData::setUI();
+ img.setUI();
+ prev.setUI();
+ next.setUI();
+ status.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index c797db07dad..0cdd206f45d 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -88,7 +88,7 @@ public:
#endif
void draw(pyrodactyl::event::Quest &q);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index 1d40777ce51..1e416f0ff37 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -90,9 +90,9 @@ public:
}
#endif
- void SetUI() {
- Menu::SetUI();
- desc.SetUI();
+ void setUI() {
+ Menu::setUI();
+ desc.setUI();
}
};
} // End of namespace ui
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index e1b275fbbd4..9aaa29671db 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -84,7 +84,7 @@ void ReplyButton::Cache(const Common::String &val, const int &spacing, const int
y = orig.y;
w = width;
h = height * lines;
- SetUI(parent);
+ setUI(parent);
if (orig.y < bottom_edge)
y = bottom_edge + spacing;
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index e0f49715332..0f45cc8352c 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -180,10 +180,10 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
element[element_count].visible = false;
}
-void ReplyMenu::SetUI() {
- Menu<ReplyButton>::SetUI();
- bg.SetUI();
- tone.SetUI();
+void ReplyMenu::setUI() {
+ Menu<ReplyButton>::setUI();
+ bg.setUI();
+ tone.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index b6f8fd86243..8194edc2200 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -71,7 +71,7 @@ public:
void draw();
void Cache(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 837ca33b7e8..f3a873ad3f8 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -163,14 +163,14 @@ void ResolutionMenu::SetInfo() {
info.text += NumberToString(g_engine->_screenSettings->cur.h);
}
-void ResolutionMenu::SetUI() {
- cancel.SetUI();
- change.SetUI();
- custom.SetUI();
-
- info.SetUI();
- ref.SetUI();
- ButtonMenu::SetUI();
+void ResolutionMenu::setUI() {
+ cancel.setUI();
+ change.setUI();
+ custom.setUI();
+
+ info.setUI();
+ ref.setUI();
+ ButtonMenu::setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 8d618f2b49e..7d569754935 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -79,7 +79,7 @@ public:
void SetInfo();
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index ed35f46ba10..ad2f0c7f3ee 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -128,9 +128,9 @@ void GameSaveMenu::draw() {
DrawHover();
}
-void GameSaveMenu::SetUI() {
- FileMenu<SaveFileData>::SetUI();
- ta_name.SetUI();
+void GameSaveMenu::setUI() {
+ FileMenu<SaveFileData>::setUI();
+ ta_name.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index c551f3d6752..7d09eb802e7 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -71,7 +71,7 @@ public:
#endif
void draw();
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index ea75f9bbe80..b890fdce35f 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -122,11 +122,11 @@ void SlideShow::Refresh() {
#endif
}
-void SlideShow::SetUI() {
- pos.SetUI();
- bg.SetUI();
- prev.SetUI();
- next.SetUI();
+void SlideShow::setUI() {
+ pos.setUI();
+ bg.setUI();
+ prev.setUI();
+ next.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 033f0e7f2c7..43a40bf48a2 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -77,7 +77,7 @@ public:
#endif
void draw();
- void SetUI();
+ void setUI();
};
} // End of namespace ui
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index cc15b57baf5..2491ae68b86 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -133,10 +133,10 @@ void TraitMenu::Clear() {
e->Empty();
}
-void TraitMenu::SetUI() {
- ref.SetUI();
- desc.SetUI();
- menu.SetUI();
+void TraitMenu::setUI() {
+ ref.setUI();
+ desc.setUI();
+ menu.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index b5303d9af7d..e31734c8184 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -81,7 +81,7 @@ public:
#endif
void Cache(const pyrodactyl::people::Person &obj);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 07ca6f8f5ce..a3b823f5274 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -244,11 +244,11 @@ ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, co
}
#endif
-void Button::SetUI(Rect *parent) {
- Element::SetUI(parent);
+void Button::setUI(Rect *parent) {
+ Element::setUI(parent);
- tooltip.SetUI(this);
- caption.SetUI(this);
+ tooltip.setUI(this);
+ caption.setUI(this);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index d7af98c97d0..dd51518cddc 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -107,7 +107,7 @@ public:
Button();
~Button() {}
void reset();
- void SetUI(Rect *parent = NULL);
+ void setUI(Rect *parent = NULL);
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
void Init(const Button &ref, const int &XOffset = 0, const int &YOffset = 0);
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index 7bf3ccb6017..ed505f99e19 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -97,10 +97,10 @@ bool GameDialogBox::HandleEvents(const SDL_Event &Event) {
-void GameDialogBox::SetUI() {
- pos.SetUI();
- text.SetUI(&pos);
- button.SetUI();
+void GameDialogBox::setUI() {
+ pos.setUI();
+ text.setUI(&pos);
+ button.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index 4146a748018..50dca5b8129 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -78,7 +78,7 @@ public:
bool HandleEvents(const SDL_Event &Event);
#endif
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index e74d7041c20..981c9f82ddb 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -71,17 +71,17 @@ void Element::load(rapidxml::xml_node<char> *node, ImageKey img, const bool &ech
else
loadNum(h, "h", node);
- SetUI();
+ setUI();
}
void Element::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
Basicload(node, echo);
loadNum(w, "w", node, false);
loadNum(h, "h", node, false);
- SetUI(parent);
+ setUI(parent);
}
-void Element::SetUI(Rect *parent) {
+void Element::setUI(Rect *parent) {
if (parent == NULL) {
switch (align.x) {
case ALIGN_CENTER:
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index 85a9c0e94f4..c633a7be226 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -76,7 +76,7 @@ public:
// The parent is the object inside which the element exists
void load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
- void SetUI(Rect *parent = NULL);
+ void setUI(Rect *parent = NULL);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index f2d4a4b0f51..514f604f055 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -47,8 +47,8 @@ void EmotionIndicator::draw(const int &select) {
}
}
-void EmotionIndicator::SetUI() {
- text.SetUI();
+void EmotionIndicator::setUI() {
+ text.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index adfc8019c64..a5459b143c9 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -51,7 +51,7 @@ struct EmotionIndicator {
void load(rapidxml::xml_node<char> *node);
void draw(const int &select);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index bae6952b0b4..b4c1ce5d7f7 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -171,13 +171,13 @@ void HUD::SetTooltip() {
menu.element[HS_PAUSE].tooltip.text = tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->GetAssociatedKey(IG_PAUSE) + ")";
}
-void HUD::SetUI() {
- bg.SetUI();
- menu.SetUI();
+void HUD::setUI() {
+ bg.setUI();
+ menu.setUI();
- gom.SetUI();
- pause.SetUI();
- back.SetUI();
+ gom.setUI();
+ pause.setUI();
+ back.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index ff614445986..5b130d499db 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -111,7 +111,7 @@ public:
// The tooltips are of the style <Name> (<Hotkey>), with Name being provided by the xml
void SetTooltip();
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 178f1187e5c..1ed2a04bcf4 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -296,14 +296,14 @@ void Journal::loadState(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Adjust UI elements
//------------------------------------------------------------------------
-void Journal::SetUI() {
- bg.SetUI();
- category.SetUI();
- ref.SetUI();
+void Journal::setUI() {
+ bg.setUI();
+ category.setUI();
+ ref.setUI();
for (auto &m : journal)
for (auto i = 0; i < JE_TOTAL; ++i)
- m.menu[i].SetUI();
+ m.menu[i].setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index d42e94f29f7..d9dc7e9f55e 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -116,7 +116,7 @@ public:
void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 99245f78edb..00ca51bb77b 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -502,16 +502,16 @@ void Map::loadState(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Reset the UI positions in response to change in resolution
//------------------------------------------------------------------------
-void Map::SetUI() {
- pos.SetUI();
- fg.SetUI();
+void Map::setUI() {
+ pos.setUI();
+ fg.setUI();
- travel.SetUI();
- marker.SetUI();
+ travel.setUI();
+ marker.setUI();
- bu_overlay.SetUI();
- scroll.SetUI();
- title.SetUI();
+ bu_overlay.setUI();
+ scroll.setUI();
+ title.setUI();
CalcBounds();
}
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index edc30c026db..f296ebf8d53 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -145,7 +145,7 @@ public:
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 00071423f58..59881affa84 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -230,9 +230,9 @@ public:
b->reset();
}
- void SetUI() {
+ void setUI() {
for (auto i = element.begin(); i != element.end(); ++i)
- i->SetUI();
+ i->setUI();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 2a1c560756f..34d217d601e 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -272,9 +272,9 @@ void QuestMenu::loadState(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Reposition UI elements
//------------------------------------------------------------------------
-void QuestMenu::SetUI() {
- menu.SetUI();
- text.SetUI();
+void QuestMenu::setUI() {
+ menu.setUI();
+ text.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index d3e3b268b06..185541424a2 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -96,7 +96,7 @@ public:
void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
void loadState(rapidxml::xml_node<char> *node);
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 77bf9914516..8480ca3eaeb 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -134,10 +134,10 @@ void Slider::Value(const int val) {
knob.x = bar.x + ((bar.w - knob.w) * (value - min)) / (max - min);
}
-void Slider::SetUI() {
- bar.SetUI();
- knob.SetUI();
- caption.SetUI(&bar);
+void Slider::setUI() {
+ bar.setUI();
+ knob.setUI();
+ caption.setUI(&bar);
knob.x = bar.x + ((bar.w - knob.w) * value / (max - min));
knob.y = bar.y;
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 73a97b3ca21..ae95d7f1c3f 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -82,7 +82,7 @@ public:
void CreateBackup() { backup = value; }
void RestoreBackup() { Value(backup); }
- void SetUI();
+ void setUI();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index e180417fe2d..6454d21a2fb 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -75,9 +75,9 @@ public:
void draw();
- void SetUI() {
- title.SetUI();
- TextData::SetUI();
+ void setUI() {
+ title.setUI();
+ TextData::setUI();
}
};
} // End of namespace ui
Commit: 957acdba71091649ec78ce2ef17e69bbdacdb8a0
https://github.com/scummvm/scummvm/commit/957acdba71091649ec78ce2ef17e69bbdacdb8a0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make WalkFrames class follow code formatting conventions
Changed paths:
engines/crab/animation/animset.cpp
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/animation/walkframes.cpp
engines/crab/animation/walkframes.h
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 8b9b9242afe..615c2a8c963 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -59,14 +59,14 @@ TextureFlipType AnimSet::flip(const Direction &dir) {
if (_fight.flip(ret, dir))
return ret;
- return _walk.Flip(dir);
+ return _walk.flip(dir);
}
const ShadowOffset &AnimSet::shadow(const Direction &dir) {
if (_fight.validMove())
return _fight.shadow(dir);
- return _walk.Shadow(dir);
+ return _walk.shadow(dir);
}
int AnimSet::anchorX(const Direction &dir) {
@@ -74,7 +74,7 @@ int AnimSet::anchorX(const Direction &dir) {
if (_fight.curFrame(faf, dir))
return faf._anchor.x;
- return _walk.AnchorX(dir);
+ return _walk.anchorX(dir);
}
int AnimSet::anchorY(const Direction &dir) {
@@ -82,7 +82,7 @@ int AnimSet::anchorY(const Direction &dir) {
if (_fight.curFrame(faf, dir))
return faf._anchor.y;
- return _walk.AnchorY(dir);
+ return _walk.anchorY(dir);
}
} // End of namespace Crab
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index c1f115f1e35..083846a0d80 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -86,8 +86,8 @@ void Sprite::load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
_animSet._fight.listAttackMoves(_aiData._fight._attack);
loadDirection(_dir, node);
- _clip = _animSet._walk.Clip(_dir);
- _boxV = _animSet._walk.BoxV(_dir);
+ _clip = _animSet._walk.clip(_dir);
+ _boxV = _animSet._walk.boxV(_dir);
if (nodeValid("visible", node, false))
_visible.load(node->first_node("visible"));
@@ -485,18 +485,18 @@ void Sprite::walk(const pyrodactyl::people::PersonState &pst) {
firstX = false;
}
- bool reset = _animSet._walk.Type(_vel, _dir, pst, firstX);
+ bool reset = _animSet._walk.type(_vel, _dir, pst, firstX);
if (reset)
- _animSet._walk.ResetClip(_dir);
+ _animSet._walk.resetClip(_dir);
walk(reset);
}
void Sprite::walk(const bool &reset) {
- if (_animSet._walk.UpdateClip(_dir, reset)) {
- _clip = _animSet._walk.Clip(_dir);
- _boxV = _animSet._walk.BoxV(_dir);
+ if (_animSet._walk.updateClip(_dir, reset)) {
+ _clip = _animSet._walk.clip(_dir);
+ _boxV = _animSet._walk.boxV(_dir);
}
}
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 186ac6c21c0..d1c9398b51c 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -209,11 +209,11 @@ public:
}
Rect dialogClip(const pyrodactyl::people::PersonState &state) {
- return _animSet._walk.DialogClip(state);
+ return _animSet._walk.dialogClip(state);
}
void dialogUpdateClip(const pyrodactyl::people::PersonState &state) {
- _animSet._walk.UpdateClip(state);
+ _animSet._walk.updateClip(state);
}
bool popupShow() {
diff --git a/engines/crab/animation/walkframes.cpp b/engines/crab/animation/walkframes.cpp
index a98b4180fbf..87447782591 100644
--- a/engines/crab/animation/walkframes.cpp
+++ b/engines/crab/animation/walkframes.cpp
@@ -41,112 +41,112 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
void WalkFrames::load(rapidxml::xml_node<char> *node) {
if (nodeValid("stand", node))
- set[WT_STAND].load(node->first_node("stand"));
+ _set[WT_STAND].load(node->first_node("stand"));
if (nodeValid("walk", node))
- set[WT_WALK].load(node->first_node("walk"));
+ _set[WT_WALK].load(node->first_node("walk"));
if (nodeValid("fight", node))
- set[WT_FIGHT].load(node->first_node("fight"));
+ _set[WT_FIGHT].load(node->first_node("fight"));
if (nodeValid("ko", node))
- set[WT_KO].load(node->first_node("ko"));
+ _set[WT_KO].load(node->first_node("ko"));
}
//------------------------------------------------------------------------
// Purpose: Used for walking inside levels
//------------------------------------------------------------------------
-bool WalkFrames::UpdateClip(Direction d, bool reset) {
- if (timer.Ticks() > set[cur].frames[d].currentFrame()._repeat || reset) {
- timer.Start();
- return set[cur].frames[d].updateClip();
+bool WalkFrames::updateClip(Direction d, bool reset) {
+ if (_timer.Ticks() > _set[_cur].frames[d].currentFrame()._repeat || reset) {
+ _timer.Start();
+ return _set[_cur].frames[d].updateClip();
}
return false;
}
-void WalkFrames::ResetClip(Direction d) {
- set[cur].frames[d].reset();
- timer.Start();
+void WalkFrames::resetClip(Direction d) {
+ _set[_cur].frames[d].reset();
+ _timer.Start();
}
//------------------------------------------------------------------------
// Purpose: Used inside dialog box
//------------------------------------------------------------------------
-void WalkFrames::UpdateClip(WalkAnimType type, Direction d) {
- if (!timer.Started())
- timer.Start();
+void WalkFrames::updateClip(WalkAnimType type, Direction d) {
+ if (!_timer.Started())
+ _timer.Start();
- if (timer.Ticks() > set[type].frames[d].currentFrame()._repeat) {
- set[type].frames[d].updateClip();
- timer.Start();
+ if (_timer.Ticks() > _set[type].frames[d].currentFrame()._repeat) {
+ _set[type].frames[d].updateClip();
+ _timer.Start();
}
}
-Rect WalkFrames::DialogClip(const PersonState &state) {
+Rect WalkFrames::dialogClip(const PersonState &state) {
if (state == PST_FIGHT)
- return set[WT_FIGHT].frames[DIRECTION_DOWN].currentFrame()._clip;
+ return _set[WT_FIGHT].frames[DIRECTION_DOWN].currentFrame()._clip;
else if (state == PST_KO)
- return set[WT_KO].frames[DIRECTION_DOWN].currentFrame()._clip;
+ return _set[WT_KO].frames[DIRECTION_DOWN].currentFrame()._clip;
- return set[WT_STAND].frames[DIRECTION_DOWN].currentFrame()._clip;
+ return _set[WT_STAND].frames[DIRECTION_DOWN].currentFrame()._clip;
}
-void WalkFrames::UpdateClip(const PersonState &state) {
+void WalkFrames::updateClip(const PersonState &state) {
if (state == PST_FIGHT)
- UpdateClip(WT_FIGHT, DIRECTION_DOWN);
+ updateClip(WT_FIGHT, DIRECTION_DOWN);
else if (state == PST_KO)
- UpdateClip(WT_KO, DIRECTION_DOWN);
+ updateClip(WT_KO, DIRECTION_DOWN);
else
- UpdateClip(WT_STAND, DIRECTION_DOWN);
+ updateClip(WT_STAND, DIRECTION_DOWN);
}
//------------------------------------------------------------------------
// Purpose: Decide direction and type of animation, return whether it has changed
//------------------------------------------------------------------------
-bool WalkFrames::Type(const Vector2f &vel, Direction &dir, const pyrodactyl::people::PersonState &pst, const bool &first_x) {
- Direction prev_dir = dir;
- WalkAnimType prev_type = cur;
+bool WalkFrames::type(const Vector2f &vel, Direction &dir, const pyrodactyl::people::PersonState &pst, const bool &firstX) {
+ Direction prevDir = dir;
+ WalkAnimType prevType = _cur;
if (pst == PST_KO) {
- cur = WT_KO;
- } else if (first_x) {
+ _cur = WT_KO;
+ } else if (firstX) {
// If we prioritize the X direction, X velocity is checked first for direction and then Y velocity
if (vel.x > 0) {
dir = DIRECTION_RIGHT;
- cur = WT_WALK;
+ _cur = WT_WALK;
} else if (vel.x < 0) {
dir = DIRECTION_LEFT;
- cur = WT_WALK;
+ _cur = WT_WALK;
} else if (vel.y > 0) {
dir = DIRECTION_DOWN;
- cur = WT_WALK;
+ _cur = WT_WALK;
} else if (vel.y < 0) {
dir = DIRECTION_UP;
- cur = WT_WALK;
+ _cur = WT_WALK;
} else {
- cur = WT_STAND;
+ _cur = WT_STAND;
}
} else {
// If we prioritize the Y direction, Y velocity is checked first for direction and then Y velocity
if (vel.y > 0) {
dir = DIRECTION_DOWN;
- cur = WT_WALK;
+ _cur = WT_WALK;
} else if (vel.y < 0) {
dir = DIRECTION_UP;
- cur = WT_WALK;
+ _cur = WT_WALK;
} else if (vel.x > 0) {
dir = DIRECTION_RIGHT;
- cur = WT_WALK;
+ _cur = WT_WALK;
} else if (vel.x < 0) {
dir = DIRECTION_LEFT;
- cur = WT_WALK;
+ _cur = WT_WALK;
} else {
- cur = WT_STAND;
+ _cur = WT_STAND;
}
}
- if (prev_dir != dir || prev_type != cur)
+ if (prevDir != dir || prevType != _cur)
return true;
return false;
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index 952c17c496d..f5145245f6f 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -41,11 +41,13 @@ namespace Crab {
namespace pyrodactyl {
namespace anim {
-enum WalkAnimType { WT_STAND,
- WT_WALK,
- WT_FIGHT,
- WT_KO,
- WT_TOTAL };
+enum WalkAnimType {
+ WT_STAND,
+ WT_WALK,
+ WT_FIGHT,
+ WT_KO,
+ WT_TOTAL
+};
class WalkFrames {
struct WalkFrameSet {
@@ -60,45 +62,66 @@ class WalkFrames {
};
// The walking animations of the sprite
- WalkFrameSet set[WT_TOTAL];
+ WalkFrameSet _set[WT_TOTAL];
// The current walking animation
- WalkAnimType cur;
+ WalkAnimType _cur;
// The timers used for animation playing
- Timer timer;
+ Timer _timer;
// Dialog box related
- void UpdateClip(WalkAnimType type, Direction d);
+ void updateClip(WalkAnimType type, Direction d);
public:
WalkFrames() {
- cur = WT_STAND;
- timer.Start();
+ _cur = WT_STAND;
+ _timer.Start();
}
~WalkFrames() {}
void load(rapidxml::xml_node<char> *node);
- bool UpdateClip(Direction d, bool reset);
- void ResetClip(Direction d);
+ bool updateClip(Direction d, bool reset);
+ void resetClip(Direction d);
+
+ void type(WalkAnimType type) {
+ _cur = type;
+ }
+
+ WalkAnimType type() {
+ return _cur;
+ }
+
+ bool type(const Vector2f &vel, Direction &dir, const pyrodactyl::people::PersonState &pst, const bool &first_x);
+
+ const Rect &clip(Direction d) {
+ return _set[_cur].frames[d].currentFrame()._clip;
+ }
- void Type(WalkAnimType type) { cur = type; }
- WalkAnimType Type() { return cur; }
- bool Type(const Vector2f &vel, Direction &dir, const pyrodactyl::people::PersonState &pst, const bool &first_x);
+ const Rect &boxV(Direction d) {
+ return _set[_cur].frames[d].currentFrame()._boxV;
+ }
- const Rect &Clip(Direction d) { return set[cur].frames[d].currentFrame()._clip; }
- const Rect &BoxV(Direction d) { return set[cur].frames[d].currentFrame()._boxV; }
- const TextureFlipType &Flip(Direction d) { return set[cur].frames[d]._flip; }
+ const TextureFlipType &flip(Direction d) {
+ return _set[_cur].frames[d]._flip;
+ }
- const ShadowOffset &Shadow(Direction d) { return set[cur].frames[d]._shadow; }
+ const ShadowOffset &shadow(Direction d) {
+ return _set[_cur].frames[d]._shadow;
+ }
- int AnchorX(Direction d) { return set[cur].frames[d].currentFrame()._anchor.x; }
- int AnchorY(Direction d) { return set[cur].frames[d].currentFrame()._anchor.y; }
+ int anchorX(Direction d) {
+ return _set[_cur].frames[d].currentFrame()._anchor.x;
+ }
+
+ int anchorY(Direction d) {
+ return _set[_cur].frames[d].currentFrame()._anchor.y;
+ }
// Dialog box related
- Rect DialogClip(const pyrodactyl::people::PersonState &state);
- void UpdateClip(const pyrodactyl::people::PersonState &state);
+ Rect dialogClip(const pyrodactyl::people::PersonState &state);
+ void updateClip(const pyrodactyl::people::PersonState &state);
};
} // End of namespace anim
} // End of namespace pyrodactyl
Commit: 3ae2210f427523862bea267d0a7519adbd04a953
https://github.com/scummvm/scummvm/commit/3ae2210f427523862bea267d0a7519adbd04a953
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make ChangeVal/Conversation related structs follow code formatting conventions
Changed paths:
engines/crab/event/changeval.h
engines/crab/event/conversationdata.cpp
engines/crab/event/conversationdata.h
engines/crab/ui/ReplyMenu.cpp
diff --git a/engines/crab/event/changeval.h b/engines/crab/event/changeval.h
index 430cb4c5646..302fb15c807 100644
--- a/engines/crab/event/changeval.h
+++ b/engines/crab/event/changeval.h
@@ -36,30 +36,32 @@
namespace Crab {
+using namespace pyrodactyl::people;
+
namespace pyrodactyl {
namespace event {
struct ChangeVal {
// The person whose opinion is changed
- Common::String id;
+ Common::String _id;
// How much does opinion change?
- int val[pyrodactyl::people::OPI_TOTAL];
+ int _val[pyrodactyl::people::OPI_TOTAL];
ChangeVal() {
- using namespace pyrodactyl::people;
- val[OPI_LIKE] = 0;
- val[OPI_RESPECT] = 0;
- val[OPI_FEAR] = 0;
+ _val[OPI_LIKE] = 0;
+ _val[OPI_RESPECT] = 0;
+ _val[OPI_FEAR] = 0;
}
- ChangeVal(rapidxml::xml_node<char> *node) : ChangeVal() { load(node); }
+ ChangeVal(rapidxml::xml_node<char> *node) : ChangeVal() {
+ load(node);
+ }
void load(rapidxml::xml_node<char> *node) {
- using namespace pyrodactyl::people;
- loadStr(id, "id", node);
- loadNum(val[OPI_LIKE], "like", node);
- loadNum(val[OPI_RESPECT], "respect", node);
- loadNum(val[OPI_FEAR], "fear", node);
+ loadStr(_id, "id", node);
+ loadNum(_val[OPI_LIKE], "like", node);
+ loadNum(_val[OPI_RESPECT], "respect", node);
+ loadNum(_val[OPI_FEAR], "fear", node);
}
};
} // End of namespace event
diff --git a/engines/crab/event/conversationdata.cpp b/engines/crab/event/conversationdata.cpp
index 841c48c7339..add2784bb28 100644
--- a/engines/crab/event/conversationdata.cpp
+++ b/engines/crab/event/conversationdata.cpp
@@ -35,21 +35,21 @@ namespace Crab {
using namespace pyrodactyl::event;
void ReplyChoice::load(rapidxml::xml_node<char> *node) {
- loadStr(text, "text", node);
- loadNum(tone, "tone", node);
- loadNum(nextid, "next", node);
+ loadStr(_text, "text", node);
+ loadNum(_tone, "tone", node);
+ loadNum(_nextid, "next", node);
if (nodeValid("unlock", node, false))
- unlock.load(node->first_node("unlock"));
+ _unlock.load(node->first_node("unlock"));
if (nodeValid("change", node, false))
for (auto n = node->first_node("change"); n != NULL; n = n->next_sibling("change"))
- change.push_back(n);
+ _change.push_back(n);
}
void ConversationData::load(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("reply"); n != NULL; n = n->next_sibling("reply"))
- reply.push_back(n);
+ _reply.push_back(n);
}
} // End of namespace Crab
diff --git a/engines/crab/event/conversationdata.h b/engines/crab/event/conversationdata.h
index ed8e21afbe0..24a1ea35a0a 100644
--- a/engines/crab/event/conversationdata.h
+++ b/engines/crab/event/conversationdata.h
@@ -41,33 +41,36 @@ namespace pyrodactyl {
namespace event {
struct ReplyChoice {
// The text for the reply
- Common::String text;
+ Common::String _text;
// The tone of the response
- unsigned int tone;
+ unsigned int _tone;
// The next event id
- unsigned int nextid;
+ unsigned int _nextid;
// The conditions to unlock this choice
- TriggerSet unlock;
+ TriggerSet _unlock;
// The changes to opinion that are possible for this reply
// All NPCs affected by this conversation
- Common::Array<ChangeVal> change;
+ Common::Array<ChangeVal> _change;
ReplyChoice() {
- tone = 0;
- nextid = 0;
+ _tone = 0;
+ _nextid = 0;
+ }
+
+ ReplyChoice(rapidxml::xml_node<char> *node) : ReplyChoice() {
+ load(node);
}
- ReplyChoice(rapidxml::xml_node<char> *node) : ReplyChoice() { load(node); }
void load(rapidxml::xml_node<char> *node);
};
struct ConversationData {
// The set of replies
- Common::Array<ReplyChoice> reply;
+ Common::Array<ReplyChoice> _reply;
ConversationData() {}
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 0f45cc8352c..d05a9059c20 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -63,21 +63,21 @@ void ReplyMenu::load(const Common::String &filename) {
int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event) {
// After that, check if the user has clicked on any reply option
int choice = Menu<ReplyButton>::HandleEvents(Event);
- if (choice >= 0 && (unsigned int)choice < dat.reply.size()) {
+ if (choice >= 0 && (unsigned int)choice < dat._reply.size()) {
bool play_sound = false;
// Loop through any opinion changes required
- for (auto &i : dat.reply[element[choice].index].change) {
- if (i.id == cur_id) {
+ for (auto &i : dat._reply[element[choice].index]._change) {
+ if (i._id == cur_id) {
// This is a special case because we also need to update the opinion bars
- oh.OpinionChange(info, i.id, OPI_LIKE, i.val[OPI_LIKE]);
- oh.OpinionChange(info, i.id, OPI_RESPECT, i.val[OPI_RESPECT]);
- oh.OpinionChange(info, i.id, OPI_FEAR, i.val[OPI_FEAR]);
+ oh.OpinionChange(info, i._id, OPI_LIKE, i._val[OPI_LIKE]);
+ oh.OpinionChange(info, i._id, OPI_RESPECT, i._val[OPI_RESPECT]);
+ oh.OpinionChange(info, i._id, OPI_FEAR, i._val[OPI_FEAR]);
play_sound = true;
} else {
- info.OpinionChange(i.id, OPI_LIKE, i.val[OPI_LIKE]);
- info.OpinionChange(i.id, OPI_RESPECT, i.val[OPI_RESPECT]);
- info.OpinionChange(i.id, OPI_FEAR, i.val[OPI_FEAR]);
+ info.OpinionChange(i._id, OPI_LIKE, i._val[OPI_LIKE]);
+ info.OpinionChange(i._id, OPI_RESPECT, i._val[OPI_RESPECT]);
+ info.OpinionChange(i._id, OPI_FEAR, i._val[OPI_FEAR]);
play_sound = true;
}
}
@@ -94,7 +94,7 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::Str
}
#endif
- return dat.reply[element[choice].index].nextid;
+ return dat._reply[element[choice].index]._nextid;
}
return -1;
@@ -104,11 +104,11 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::Str
int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event) {
// After that, check if the user has clicked on any reply option
int choice = Menu<ReplyButton>::HandleEvents(Event);
- if (choice >= 0 && choice < dat.reply.size()) {
+ if (choice >= 0 && choice < dat._reply.size()) {
bool play_sound = false;
// Loop through any opinion changes required
- for (auto &i : dat.reply[element[choice].index].change) {
+ for (auto &i : dat._reply[element[choice].index].change) {
if (i.id == cur_id) {
// This is a special case because we also need to update the opinion bars
oh.OpinionChange(info, i.id, OPI_LIKE, i.val[OPI_LIKE]);
@@ -131,7 +131,7 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::Str
info.sound.rep_inc = true;
}
- return dat.reply[element[choice].index].nextid;
+ return dat._reply[element[choice].index].nextid;
}
return -1;
@@ -151,16 +151,16 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
// which is why we need two count variables
unsigned int reply_count = 0, element_count = 0;
- for (auto i = dat.reply.begin(); i != dat.reply.end() && reply_count < dat.reply.size(); ++i, ++reply_count) {
- if (i->unlock.Evaluate(info)) {
+ for (auto i = dat._reply.begin(); i != dat._reply.end() && reply_count < dat._reply.size(); ++i, ++reply_count) {
+ if (i->_unlock.Evaluate(info)) {
element[element_count].visible = true;
element[element_count].index = reply_count;
- tone.value[element_count] = dat.reply[reply_count].tone;
+ tone.value[element_count] = dat._reply[reply_count]._tone;
const InputType type = static_cast<InputType>(IU_REPLY_0 + element_count);
Common::String text = g_engine->_inputManager->GetAssociatedKey(type);
- text += ". " + i->text;
+ text += ". " + i->_text;
info.InsertName(text);
if (element_count == 0)
Commit: 7c6d3b82b67dc6a0e49096a6ae3cdb1c880c5ee4
https://github.com/scummvm/scummvm/commit/7c6d3b82b67dc6a0e49096a6ae3cdb1c880c5ee4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Effect related structs follow code formatting conventions
Changed paths:
engines/crab/animation/PopUp.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/effect.cpp
engines/crab/event/effect.h
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index e43bfbf0808..123982d56dc 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -76,7 +76,7 @@ bool PopUp::internalEvents(pyrodactyl::event::Info &info, const Common::String &
_show = false;
for (auto &i : _effect)
- i.Execute(info, playerId, result, endSeq);
+ i.execute(info, playerId, result, endSeq);
return true;
} else {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 60290315d78..53a9a235bf3 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -73,7 +73,7 @@ void EventSequence::NextEvent(pyrodactyl::event::Info &info, const Common::Strin
// Execute all effects associated with the event
for (auto i = events[cur].effect.begin(); i != events[cur].effect.end(); ++i)
- if (i->Execute(info, player_id, result, end_seq))
+ if (i->execute(info, player_id, result, end_seq))
sync = true;
// Play a notification sound
@@ -92,7 +92,7 @@ void EventSequence::NextEvent(pyrodactyl::event::Info &info, const Common::Strin
if (!result.empty() || sync) {
EventResult r;
- r.type = ER_SYNC;
+ r._type = ER_SYNC;
result.push_back(r);
}
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index d8fe53ef425..92fe9960f95 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -42,118 +42,118 @@ void Effect::load(rapidxml::xml_node<char> *node) {
loadStr(ty, "type", node);
// Should we throw a warning about missing fields? Depends on the type of effect
- bool echo_op = true, echo_sub = true, echo_val = true;
+ bool echoOp = true, echoSub = true, echoVal = true;
if (ty == "var")
- type = EFF_VAR;
+ _type = EFF_VAR;
else if (ty == "journal")
- type = EFF_JOURNAL;
+ _type = EFF_JOURNAL;
else if (ty == "person")
- type = EFF_OBJ;
+ _type = EFF_OBJ;
else if (ty == "item")
- type = EFF_ITEM;
+ _type = EFF_ITEM;
else if (ty == "like")
- type = EFF_LIKE;
+ _type = EFF_LIKE;
else if (ty == "fear")
- type = EFF_FEAR;
+ _type = EFF_FEAR;
else if (ty == "respect")
- type = EFF_RESPECT;
+ _type = EFF_RESPECT;
else if (ty == STATNAME_HEALTH)
- type = EFF_HEALTH;
+ _type = EFF_HEALTH;
else if (ty == "sound")
- type = EFF_SOUND;
+ _type = EFF_SOUND;
else if (ty == "money")
- type = EFF_MONEY;
+ _type = EFF_MONEY;
else if (ty == "end") {
- type = EFF_END;
- echo_sub = false;
- echo_val = false;
+ _type = EFF_END;
+ echoSub = false;
+ echoVal = false;
} else if (ty == "map")
- type = EFF_MAP;
+ _type = EFF_MAP;
else if (ty == "dest")
- type = EFF_DEST;
+ _type = EFF_DEST;
else if (ty == "img") {
- type = EFF_IMG;
- echo_op = false;
- echo_sub = false;
+ _type = EFF_IMG;
+ echoOp = false;
+ echoSub = false;
} else if (ty == "trait") {
- type = EFF_TRAIT;
- echo_op = false;
+ _type = EFF_TRAIT;
+ echoOp = false;
} else if (ty == "move") {
- type = EFF_MOVE;
- echo_op = false;
+ _type = EFF_MOVE;
+ echoOp = false;
} else if (ty == "level")
- type = EFF_LEVEL;
+ _type = EFF_LEVEL;
else if (ty == "player") {
- type = EFF_PLAYER;
- echo_op = false;
- echo_sub = false;
+ _type = EFF_PLAYER;
+ echoOp = false;
+ echoSub = false;
} else if (ty == "save") {
- type = EFF_SAVE;
- echo_op = false;
- echo_sub = false;
- echo_val = false;
+ _type = EFF_SAVE;
+ echoOp = false;
+ echoSub = false;
+ echoVal = false;
} else if (ty == "quit") {
- type = EFF_QUIT;
- echo_op = false;
- echo_sub = false;
- echo_val = false;
+ _type = EFF_QUIT;
+ echoOp = false;
+ echoSub = false;
+ echoVal = false;
} else
- type = EFF_VAR;
+ _type = EFF_VAR;
- loadStr(subject, "subject", node, echo_sub);
- loadStr(operation, "operation", node, echo_op);
- loadStr(val, "val", node, echo_val);
+ loadStr(_subject, "_subject", node, echoSub);
+ loadStr(_operation, "operation", node, echoOp);
+ loadStr(_val, "_val", node, echoVal);
}
-void Effect::ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType opType) {
- int old_op = 0;
+void Effect::changeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType opType) {
+ int oldOp = 0;
// Only bother if the person exists and has a valid opinion
- if (info.OpinionGet(subject, opType, old_op)) {
- if (operation == "=")
- info.OpinionSet(subject, opType, StringToNumber<int>(val));
- else if (operation == "+")
- info.OpinionChange(subject, opType, StringToNumber<int>(val));
- else if (operation == "-")
- info.OpinionChange(subject, opType, -1 * StringToNumber<int>(val));
-
- int new_op = 0;
- info.OpinionGet(subject, opType, new_op);
-
- if (new_op > old_op)
+ if (info.OpinionGet(_subject, opType, oldOp)) {
+ if (_operation == "=")
+ info.OpinionSet(_subject, opType, StringToNumber<int>(_val));
+ else if (_operation == "+")
+ info.OpinionChange(_subject, opType, StringToNumber<int>(_val));
+ else if (_operation == "-")
+ info.OpinionChange(_subject, opType, -1 * StringToNumber<int>(_val));
+
+ int newOp = 0;
+ info.OpinionGet(_subject, opType, newOp);
+
+ if (newOp > oldOp)
info.sound.rep_inc = true;
- else if (new_op < old_op)
+ else if (newOp < oldOp)
info.sound.rep_dec = true;
}
}
-bool Effect::Execute(pyrodactyl::event::Info &info, const Common::String &player_id,
- Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq) {
- if (type < EFF_MOVE) {
- switch (type) {
+bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &playerId,
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq) {
+ if (_type < EFF_MOVE) {
+ switch (_type) {
case EFF_VAR:
- if (operation == "=")
- info.VarSet(subject, val);
- else if (operation == "del")
- info.VarDel(subject);
- else if (operation == "+")
- info.VarAdd(subject, StringToNumber<int>(val));
- else if (operation == "-")
- info.VarSub(subject, StringToNumber<int>(val));
- else if (operation == "*")
- info.VarMul(subject, StringToNumber<int>(val));
- else if (operation == "/")
- info.VarDiv(subject, StringToNumber<int>(val));
+ if (_operation == "=")
+ info.VarSet(_subject, _val);
+ else if (_operation == "del")
+ info.VarDel(_subject);
+ else if (_operation == "+")
+ info.VarAdd(_subject, StringToNumber<int>(_val));
+ else if (_operation == "-")
+ info.VarSub(_subject, StringToNumber<int>(_val));
+ else if (_operation == "*")
+ info.VarMul(_subject, StringToNumber<int>(_val));
+ else if (_operation == "/")
+ info.VarDiv(_subject, StringToNumber<int>(_val));
break;
case EFF_JOURNAL:
- if (subject == "finish")
- info.journal.Move(player_id, operation, true);
- else if (subject == "start")
- info.journal.Move(player_id, operation, false);
+ if (_subject == "finish")
+ info.journal.Move(playerId, _operation, true);
+ else if (_subject == "start")
+ info.journal.Move(playerId, _operation, false);
else
- info.journal.Add(player_id, subject, operation, val);
+ info.journal.Add(playerId, _subject, _operation, _val);
// Update unread status of journal
info.unread.journal = true;
@@ -163,17 +163,17 @@ bool Effect::Execute(pyrodactyl::event::Info &info, const Common::String &player
break;
case EFF_OBJ:
- if (operation == "type")
- info.Type(subject, pyrodactyl::people::StringToPersonType(val));
- else if (operation == "state")
- info.State(subject, pyrodactyl::people::StringToPersonState(val));
+ if (_operation == "type")
+ info.Type(_subject, pyrodactyl::people::StringToPersonType(_val));
+ else if (_operation == "state")
+ info.State(_subject, pyrodactyl::people::StringToPersonState(_val));
break;
case EFF_ITEM:
- if (operation == "del")
- info.inv.DelItem(subject, val);
+ if (_operation == "del")
+ info.inv.DelItem(_subject, _val);
else
- info.inv.LoadItem(subject, val);
+ info.inv.LoadItem(_subject, _val);
// Update unread status of inventory
info.unread.inventory = true;
@@ -183,56 +183,56 @@ bool Effect::Execute(pyrodactyl::event::Info &info, const Common::String &player
break;
case EFF_LIKE:
- ChangeOpinion(info, pyrodactyl::people::OPI_LIKE);
+ changeOpinion(info, pyrodactyl::people::OPI_LIKE);
break;
case EFF_FEAR:
- ChangeOpinion(info, pyrodactyl::people::OPI_FEAR);
+ changeOpinion(info, pyrodactyl::people::OPI_FEAR);
break;
case EFF_RESPECT:
- ChangeOpinion(info, pyrodactyl::people::OPI_RESPECT);
+ changeOpinion(info, pyrodactyl::people::OPI_RESPECT);
break;
case EFF_HEALTH: {
using namespace pyrodactyl::stat;
- int num = StringToNumber<int>(val);
-
- if (operation == "=")
- info.StatSet(subject, STAT_HEALTH, num);
- else if (operation == "+")
- info.StatChange(subject, STAT_HEALTH, num);
- else if (operation == "-")
- info.StatChange(subject, STAT_HEALTH, -1 * num);
+ int num = StringToNumber<int>(_val);
+
+ if (_operation == "=")
+ info.StatSet(_subject, STAT_HEALTH, num);
+ else if (_operation == "+")
+ info.StatChange(_subject, STAT_HEALTH, num);
+ else if (_operation == "-")
+ info.StatChange(_subject, STAT_HEALTH, -1 * num);
} break;
case EFF_SOUND:
- if (subject == "music") {
- if (operation == "play") {
- MusicKey m = StringToNumber<MusicKey>(val);
+ if (_subject == "music") {
+ if (_operation == "play") {
+ MusicKey m = StringToNumber<MusicKey>(_val);
g_engine->_musicManager->PlayMusic(m);
- } else if (operation == "stop")
+ } else if (_operation == "stop")
g_engine->_musicManager->Stop();
- else if (operation == "pause")
+ else if (_operation == "pause")
g_engine->_musicManager->Pause();
- else if (operation == "resume")
+ else if (_operation == "resume")
g_engine->_musicManager->Resume();
} else
- g_engine->_musicManager->PlayEffect(StringToNumber<ChunkKey>(val), 0);
+ g_engine->_musicManager->PlayEffect(StringToNumber<ChunkKey>(_val), 0);
break;
case EFF_MONEY:
- info.money_var = val;
+ info.money_var = _val;
break;
case EFF_END:
- if (operation == "cur")
- end_seq.push_back(true);
+ if (_operation == "cur")
+ endSeq.push_back(true);
else {
EventSeqInfo seqinfo;
- seqinfo.loc = subject;
- seqinfo.val = val;
- end_seq.push_back(seqinfo);
+ seqinfo._loc = _subject;
+ seqinfo._val = _val;
+ endSeq.push_back(seqinfo);
}
break;
@@ -243,40 +243,40 @@ bool Effect::Execute(pyrodactyl::event::Info &info, const Common::String &player
return true;
} else {
EventResult r;
- r.val = subject;
- r.x = StringToNumber<int>(operation);
- r.y = StringToNumber<int>(val);
+ r._val = _subject;
+ r._x = StringToNumber<int>(_operation);
+ r._y = StringToNumber<int>(_val);
- switch (type) {
+ switch (_type) {
case EFF_MOVE:
- r.type = ER_MOVE;
+ r._type = ER_MOVE;
break;
case EFF_MAP:
- r.type = ER_MAP;
+ r._type = ER_MAP;
break;
case EFF_DEST:
- r.type = ER_DEST;
+ r._type = ER_DEST;
break;
case EFF_IMG:
- r.type = ER_IMG;
- info.PlayerImg(StringToNumber<int>(val));
+ r._type = ER_IMG;
+ info.PlayerImg(StringToNumber<int>(_val));
break;
case EFF_TRAIT:
- r.type = ER_TRAIT;
+ r._type = ER_TRAIT;
info.unread.trait = true;
info.sound.notify = true;
break;
case EFF_LEVEL:
- r.type = ER_LEVEL;
+ r._type = ER_LEVEL;
break;
case EFF_PLAYER:
- r.type = ER_PLAYER;
+ r._type = ER_PLAYER;
break;
case EFF_SAVE:
- r.type = ER_SAVE;
+ r._type = ER_SAVE;
break;
case EFF_QUIT:
- r.type = ER_QUIT;
+ r._type = ER_QUIT;
break;
default:
break;
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index 02a991f470a..b30699d98be 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -56,23 +56,28 @@ enum EventResultType {
};
struct EventResult {
- EventResultType type;
- Common::String val;
- int x, y;
-
- EventResult() : val("") {
- type = ER_NONE;
- x = -1;
- y = -1;
+ EventResultType _type;
+ Common::String _val;
+ int _x, _y;
+
+ EventResult() : _val("") {
+ _type = ER_NONE;
+ _x = -1;
+ _y = -1;
}
};
struct EventSeqInfo {
- bool cur;
- Common::String loc, val;
+ bool _cur;
+ Common::String _loc, _val;
- EventSeqInfo() { cur = false; }
- EventSeqInfo(const bool &Cur) { cur = Cur; }
+ EventSeqInfo() {
+ _cur = false;
+ }
+
+ EventSeqInfo(const bool &cur) {
+ _cur = cur;
+ }
};
enum EffectType {
@@ -100,17 +105,20 @@ enum EffectType {
};
struct Effect {
- EffectType type;
- Common::String subject, operation, val;
+ EffectType _type;
+ Common::String _subject, _operation, _val;
+
+ Effect() {
+ _type = EFF_VAR;
+ }
- Effect() { type = EFF_VAR; }
~Effect() {}
void load(rapidxml::xml_node<char> *node);
- bool Execute(pyrodactyl::event::Info &info, const Common::String &player_id,
- Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq);
+ bool execute(pyrodactyl::event::Info &info, const Common::String &playerId,
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq);
- void ChangeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType type);
+ void changeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType type);
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index d8469fc14b5..c33e9d225ce 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -390,10 +390,10 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
void Manager::EndSequence(const Common::String &curloc) {
if (end_seq.empty() == false) {
for (auto i = end_seq.begin(); i != end_seq.end(); ++i)
- if (i->cur)
+ if (i->_cur)
event_map[curloc].EndSeq(active_seq);
- else if (event_map.contains(i->loc) > 0)
- event_map[i->loc].EndSeq(StringToNumber<unsigned int>(i->val));
+ else if (event_map.contains(i->_loc) > 0)
+ event_map[i->_loc].EndSeq(StringToNumber<unsigned int>(i->_val));
active_seq = UINT_MAX;
end_seq.clear();
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 4ddf5434c1b..3b7d88d7c93 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -569,22 +569,22 @@ bool Game::ApplyResult() {
using namespace pyrodactyl::event;
for (auto i = event_res.begin(); i != event_res.end(); ++i) {
- switch (i->type) {
+ switch (i->_type) {
case ER_MAP:
- if (i->val == "img")
- map.SetImage(i->y);
- else if (i->val == "pos") {
- map.player_pos.x = i->x;
- map.player_pos.y = i->y;
+ if (i->_val == "img")
+ map.SetImage(i->_y);
+ else if (i->_val == "pos") {
+ map.player_pos.x = i->_x;
+ map.player_pos.y = i->_y;
}
break;
case ER_DEST:
- if (i->x < 0 || i->y < 0) {
- info.journal.Marker(level.PlayerID(), i->val, false);
- map.DestDel(i->val);
+ if (i->_x < 0 || i->_y < 0) {
+ info.journal.Marker(level.PlayerID(), i->_val, false);
+ map.DestDel(i->_val);
} else {
- map.DestAdd(i->val, i->x, i->y);
- info.journal.Marker(level.PlayerID(), i->val, true);
+ map.DestAdd(i->_val, i->_x, i->_y);
+ info.journal.Marker(level.PlayerID(), i->_val, true);
info.unread.map = true;
}
break;
@@ -592,22 +592,22 @@ bool Game::ApplyResult() {
PlayerImg();
break;
case ER_TRAIT:
- if (i->x == 42)
- info.TraitDel(i->val, i->y);
+ if (i->_x == 42)
+ info.TraitDel(i->_val, i->_y);
else
- info.TraitAdd(i->val, i->y);
+ info.TraitAdd(i->_val, i->_y);
break;
case ER_LEVEL:
- if (i->val == "Map")
+ if (i->_val == "Map")
ToggleState(STATE_MAP);
else
- LoadLevel(i->val, i->x, i->y);
+ LoadLevel(i->_val, i->_x, i->_y);
break;
case ER_MOVE:
for (auto &o : level.objects) {
- if (i->val == o.id()) {
- o.x(i->x);
- o.y(i->y);
+ if (i->_val == o.id()) {
+ o.x(i->_x);
+ o.y(i->_y);
break;
}
}
@@ -617,7 +617,7 @@ bool Game::ApplyResult() {
level.PlayerStop();
// Then swap to the new id
- level.PlayerID(i->val, i->x, i->y);
+ level.PlayerID(i->_val, i->_x, i->_y);
// Stop the new player sprite's movement as well
level.PlayerStop();
@@ -630,7 +630,7 @@ bool Game::ApplyResult() {
map.Update(info);
break;
case ER_QUIT:
- g_engine->_tempData->credits = (i->val == "credits");
+ g_engine->_tempData->credits = (i->_val == "credits");
return true;
default:
break;
Commit: 0314db31a0e44e31e40e23fbdc15e303f5767983
https://github.com/scummvm/scummvm/commit/0314db31a0e44e31e40e23fbdc15e303f5767983
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make EventSeqGroup class follow code formatting conventions
Changed paths:
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
engines/crab/event/gameeventmanager.cpp
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 6c3299ee5f9..1093455a9a7 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -35,64 +35,64 @@ namespace Crab {
using namespace pyrodactyl::event;
-void EventSeqGroup::EndSeq(const unsigned int &id) {
- seq.erase(id);
- end.push_back(id);
+void EventSeqGroup::endSeq(const unsigned int &id) {
+ _seq.erase(id);
+ _end.push_back(id);
}
-void EventSeqGroup::AddSeq(const unsigned int &id, Common::String &path) {
- seq[id].load(path);
+void EventSeqGroup::addSeq(const unsigned int &id, Common::String &path) {
+ _seq[id].load(path);
}
-bool EventSeqGroup::EventInProgress(const unsigned int &id) {
- return seq.contains(id) > 0 && seq[id].EventInProgress();
+bool EventSeqGroup::eventInProgress(const unsigned int &id) {
+ return _seq.contains(id) > 0 && _seq[id].EventInProgress();
}
-GameEvent *EventSeqGroup::CurEvent(const unsigned int &id) {
- return seq[id].CurrentEvent();
+GameEvent *EventSeqGroup::curEvent(const unsigned int &id) {
+ return _seq[id].CurrentEvent();
}
-void EventSeqGroup::NextEvent(const unsigned int &id, Info &info, const Common::String &player_id,
- Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq, const int choice) {
- return seq[id].NextEvent(info, player_id, result, end_seq, choice);
+void EventSeqGroup::nextEvent(const unsigned int &id, Info &info, const Common::String &playerId,
+ Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq, const int choice) {
+ return _seq[id].NextEvent(info, playerId, result, endSeq, choice);
}
void EventSeqGroup::internalEvents(Info &info) {
- for (auto it = seq.begin(); it != seq.end(); ++it)
+ for (auto it = _seq.begin(); it != _seq.end(); ++it)
it->_value.internalEvents(info);
}
-bool EventSeqGroup::ActiveSeq(unsigned int &active_seq) {
- for (auto i = seq.begin(); i != seq.end(); ++i)
+bool EventSeqGroup::activeSeq(unsigned int &activeSeq) {
+ for (auto i = _seq.begin(); i != _seq.end(); ++i)
if (i->_value.EventInProgress()) {
- active_seq = i->_key;
+ activeSeq = i->_key;
return true;
}
- active_seq = UINT_MAX;
+ activeSeq = UINT_MAX;
return false;
}
void EventSeqGroup::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto i = end.begin(); i != end.end(); ++i) {
+ for (auto i = _end.begin(); i != _end.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "end");
child->value(gStrPool->Get(*i));
root->append_node(child);
}
- for (auto i = seq.begin(); i != seq.end(); ++i)
+ for (auto i = _seq.begin(); i != _seq.end(); ++i)
i->_value.saveState(doc, root, gStrPool->Get(i->_key));
}
void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *i = node->first_node("end"); i != NULL; i = i->next_sibling("end"))
- EndSeq(StringToNumber<unsigned int>(i->value()));
+ endSeq(StringToNumber<unsigned int>(i->value()));
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set"))
if (n->first_attribute("name") != NULL) {
unsigned int id = StringToNumber<unsigned int>(n->first_attribute("name")->value());
- if (seq.contains(id) > 0)
- seq[id].loadState(n);
+ if (_seq.contains(id) > 0)
+ _seq[id].loadState(n);
}
}
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index 72b2568cf9d..4c792b55552 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -42,23 +42,23 @@ class EventSeqGroup {
typedef Common::HashMap<unsigned int, EventSequence> SeqMap;
// The event sequences in this group
- SeqMap seq;
+ SeqMap _seq;
// The sequences that have ended in this group
- Common::Array<unsigned int> end;
+ Common::Array<unsigned int> _end;
public:
EventSeqGroup(void) {}
~EventSeqGroup(void) {}
- void AddSeq(const unsigned int &id, Common::String &path);
- void EndSeq(const unsigned int &id);
- bool EventInProgress(const unsigned int &id);
- bool ActiveSeq(unsigned int &active_seq);
+ void addSeq(const unsigned int &id, Common::String &path);
+ void endSeq(const unsigned int &id);
+ bool eventInProgress(const unsigned int &id);
+ bool activeSeq(unsigned int &activeSeq);
- GameEvent *CurEvent(const unsigned int &id);
- void NextEvent(const unsigned int &id, Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
- Common::Array<EventSeqInfo> &end_seq, const int choice = -1);
+ GameEvent *curEvent(const unsigned int &id);
+ void nextEvent(const unsigned int &id, Info &info, const Common::String &playerId, Common::Array<EventResult> &result,
+ Common::Array<EventSeqInfo> &endSeq, const int choice = -1);
void internalEvents(Info &info);
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index c33e9d225ce..6c86cee8a2d 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -64,7 +64,7 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
Common::String path;
loadNum(id, "name", n);
loadStr(path, "path", n);
- event_map[loc_name].AddSeq(id, path);
+ event_map[loc_name].addSeq(id, path);
}
}
}
@@ -97,7 +97,7 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].eventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
@@ -118,7 +118,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
}
if (oh.HandleDlboxEvents(Event)) {
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
oh.show_journal = false;
}
}
@@ -126,7 +126,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP)
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_REPLY:
if (oh.show_journal) {
@@ -142,7 +142,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
+ event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
}
}
@@ -154,7 +154,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
if (textin.HandleEvents(Event))
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
@@ -164,7 +164,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
intro.show_traits = false;
} else {
if (intro.HandleEvents(Event))
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
per.Cache(info, level.PlayerID(), level);
@@ -271,7 +271,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
//------------------------------------------------------------------------
void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
if (event_map.contains(info.CurLocID()) > 0) {
- if (event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ if (event_map[info.CurLocID()].eventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
UpdateDialogBox(info, level);
@@ -281,7 +281,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
DrawType draw_val = DRAW_SAME;
if (g_engine->_eventStore->anim[cur_event->special].internalEvents(draw_val))
- event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ event_map[info.CurLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
draw_game = false;
@@ -289,7 +289,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
draw_game = true;
} break;
case EVENT_SILENT:
- event_map[info.CurLocID()].NextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ event_map[info.CurLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
break;
case EVENT_REPLY:
UpdateDialogBox(info, level);
@@ -316,7 +316,7 @@ void Manager::UpdateDialogBox(Info &info, Level &level) {
// Purpose: Draw
//------------------------------------------------------------------------
void Manager::draw(Info &info, HUD &hud, Level &level) {
- if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].eventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_ANIM:
g_engine->_eventStore->anim[cur_event->special].draw();
@@ -362,9 +362,9 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
// Purpose: Calculate the current sequence in progress
//------------------------------------------------------------------------
void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
- if (event_map[info.CurLocID()].ActiveSeq(active_seq)) {
+ if (event_map[info.CurLocID()].activeSeq(active_seq)) {
// Set all the pointers to the new values
- cur_event = event_map[info.CurLocID()].CurEvent(active_seq);
+ cur_event = event_map[info.CurLocID()].curEvent(active_seq);
oh.reset(cur_event->title);
cur_sp = level.GetSprite(cur_event->title);
@@ -391,9 +391,9 @@ void Manager::EndSequence(const Common::String &curloc) {
if (end_seq.empty() == false) {
for (auto i = end_seq.begin(); i != end_seq.end(); ++i)
if (i->_cur)
- event_map[curloc].EndSeq(active_seq);
+ event_map[curloc].endSeq(active_seq);
else if (event_map.contains(i->_loc) > 0)
- event_map[i->_loc].EndSeq(StringToNumber<unsigned int>(i->_val));
+ event_map[i->_loc].endSeq(StringToNumber<unsigned int>(i->_val));
active_seq = UINT_MAX;
end_seq.clear();
Commit: 583a00327c1fe3d3eca76bdf0f3fa99cdf632794
https://github.com/scummvm/scummvm/commit/583a00327c1fe3d3eca76bdf0f3fa99cdf632794
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename HandleEvents() to handleEvents() throughout CRAB codebase
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/app.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gamestate_container.h
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
engines/crab/input/fightinput.cpp
engines/crab/input/fightinput.h
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/splash.h
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 083846a0d80..8222dbdac56 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -391,7 +391,7 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
}
- updateMove(_input.HandleEvents(Event));
+ updateMove(_input.handleEvents(Event));
// This is to prevent one frame of drawing with incorrect parameters
animate(info);
@@ -401,7 +401,7 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
//------------------------------------------------------------------------
// Purpose: Handle the movement in a level for the player only
//------------------------------------------------------------------------
-void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const SDL_Event &Event) {
+void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const SDL_Event &Event) {
int num = 0;
info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
++num;
@@ -456,7 +456,7 @@ void Sprite::HandleEvents(Info &info, const Rect &camera, const SpriteConstant &
yVel(0.0f);
}
- UpdateMove(input.HandleEvents(Event));
+ UpdateMove(input.handleEvents(Event));
// This is to prevent one frame of drawing with incorrect parameters
Animate(info);
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index d1c9398b51c..0df7edabacc 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -266,7 +266,7 @@ public:
// Used for sprite movement controlled by player input (usually the player sprite)
void handleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const Common::Event &Event);
#if 0
- void HandleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const SDL_Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const SDL_Event &Event);
#endif
// This is for sprites with valid object ids
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index e4cc25009c8..d55401fede3 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -205,7 +205,7 @@ void App::Run() {
#if 0
while (SDL_PollEvent(&Event)) {
// Do state Event handling
- CurrentState->HandleEvents(Event, ShouldChangeState, NextStateID);
+ CurrentState->handleEvents(Event, ShouldChangeState, NextStateID);
// If the user has closed the window or pressed ALT+F4
if (Event.type == SDL_QUIT || (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_F4 && Event.key.keysym.mod & KMOD_ALT)) {
@@ -241,7 +241,7 @@ void App::Run() {
}
// Do state Event handling
- CurrentState->HandleEvents(e, ShouldChangeState, NextStateID);
+ CurrentState->handleEvents(e, ShouldChangeState, NextStateID);
}
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 6c86cee8a2d..8c755a3cfdc 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -95,15 +95,15 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
+void Manager::handleEvents(Info &info, const Common::String &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].eventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
- info.journal.HandleEvents(player_id, Event);
+ info.journal.handleEvents(player_id, Event);
- if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
@@ -130,9 +130,9 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
break;
case EVENT_REPLY:
if (oh.show_journal) {
- info.journal.HandleEvents(player_id, Event);
+ info.journal.handleEvents(player_id, Event);
- if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
@@ -140,7 +140,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
+ int choice = reply.handleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -153,17 +153,17 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- if (textin.HandleEvents(Event))
+ if (textin.handleEvents(Event))
event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
- per.HandleEvents(info, cur_event->title, Event);
+ per.handleEvents(info, cur_event->title, Event);
- if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
intro.show_traits = false;
} else {
- if (intro.HandleEvents(Event))
+ if (intro.handleEvents(Event))
event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
@@ -182,15 +182,15 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, Common::
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
+void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
- info.journal.HandleEvents(player_id, Event);
+ info.journal.handleEvents(player_id, Event);
- if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
@@ -217,9 +217,9 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
break;
case EVENT_REPLY:
if (oh.show_journal) {
- info.journal.HandleEvents(player_id, Event);
+ info.journal.handleEvents(player_id, Event);
- if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
@@ -227,7 +227,7 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- int choice = reply.HandleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
+ int choice = reply.handleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -240,17 +240,17 @@ void Manager::HandleEvents(Info &info, const Common::String &player_id, SDL_Even
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- if (textin.HandleEvents(Event))
+ if (textin.handleEvents(Event))
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
- per.HandleEvents(info, cur_event->title, Event);
+ per.handleEvents(info, cur_event->title, Event);
- if (hud.back.HandleEvents(Event) == BUAC_LCLICK || hud.pausekey.HandleEvents(Event))
+ if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
intro.show_traits = false;
} else {
- if (intro.HandleEvents(Event))
+ if (intro.handleEvents(Event))
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index b3e9b701c14..95e1ecd2dfb 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -95,10 +95,10 @@ public:
// cur_per is also updated here
void internalEvents(Info &info, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
- void HandleEvents(Info &info, const Common::String &player_id, Common::Event &Event,
+ void handleEvents(Info &info, const Common::String &player_id, Common::Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
#if 0
- void HandleEvents(Info &info, const Common::String &player_id, SDL_Event &Event,
+ void handleEvents(Info &info, const Common::String &player_id, SDL_Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
#endif
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 3b7d88d7c93..2644ea9c775 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -156,15 +156,15 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- g_engine->_mouse->HandleEvents(Event);
+void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
+ g_engine->_mouse->handleEvents(Event);
// if (GameDebug)
- // debug_console.HandleEvents(Event);
+ // debug_console.handleEvents(Event);
if (!debug_console.RestrictInput()) {
if (state == STATE_LOSE_MENU) {
- switch (hud.gom.HandleEvents(Event)) {
+ switch (hud.gom.handleEvents(Event)) {
case 0:
state = STATE_LOSE_LOAD;
break;
@@ -175,17 +175,17 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
break;
}
} else if (state == STATE_LOSE_LOAD) {
- if (g_engine->_loadMenu->HandleEvents(Event)) {
+ if (g_engine->_loadMenu->handleEvents(Event)) {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
return;
}
- if (hud.pausekey.HandleEvents(Event) || hud.back.HandleEvents(Event) == BUAC_LCLICK)
+ if (hud.pausekey.handleEvents(Event) || hud.back.handleEvents(Event) == BUAC_LCLICK)
state = STATE_LOSE_MENU;
} else {
if (!gem.EventInProgress() && !hud.pause.DisableHotkeys()) {
- switch (hud.HandleEvents(info, Event)) {
+ switch (hud.handleEvents(info, Event)) {
case HS_MAP:
ToggleState(STATE_MAP);
break;
@@ -209,14 +209,14 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
if (state == STATE_GAME) {
if (gem.EventInProgress()) {
- gem.HandleEvents(info, level.PlayerID(), Event, hud, level, event_res);
+ gem.handleEvents(info, level.PlayerID(), Event, hud, level, event_res);
if (ApplyResult())
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
- level.HandleEvents(info, Event);
+ level.handleEvents(info, Event);
if (!game_over.Empty() && game_over.Evaluate(info)) {
state = STATE_LOSE_MENU;
@@ -236,11 +236,11 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
#endif
- if (hud.pausekey.HandleEvents(Event))
+ if (hud.pausekey.handleEvents(Event))
ToggleState(STATE_PAUSE);
}
} else if (state == STATE_PAUSE) {
- switch (hud.pause.HandleEvents(Event, hud.back)) {
+ switch (hud.pause.handleEvents(Event, hud.back)) {
case PS_RESUME:
ToggleState(STATE_GAME);
hud.SetTooltip();
@@ -273,19 +273,19 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
break;
}
} else {
- if (hud.back.HandleEvents(Event) == BUAC_LCLICK)
+ if (hud.back.handleEvents(Event) == BUAC_LCLICK)
ToggleState(STATE_GAME);
switch (state) {
case STATE_MAP:
- if (map.HandleEvents(info, Event)) {
+ if (map.handleEvents(info, Event)) {
// We need to load the new level
LoadLevel(map.cur_loc);
ToggleState(STATE_GAME);
}
break;
case STATE_JOURNAL:
- if (info.journal.HandleEvents(level.PlayerID(), Event)) {
+ if (info.journal.handleEvents(level.PlayerID(), Event)) {
// This means we selected the "find on map" button, so we need to:
// switch to the world map, and highlight the appropriate quest marker
map.SelectDest(info.journal.marker_title);
@@ -293,13 +293,13 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
break;
case STATE_CHARACTER:
- gem.per.HandleEvents(info, level.PlayerID(), Event);
+ gem.per.handleEvents(info, level.PlayerID(), Event);
break;
case STATE_INVENTORY:
- info.inv.HandleEvents(level.PlayerID(), Event);
+ info.inv.handleEvents(level.PlayerID(), Event);
break;
case STATE_HELP:
- g_engine->_helpScreen->HandleEvents(Event);
+ g_engine->_helpScreen->handleEvents(Event);
default:
break;
}
@@ -312,15 +312,15 @@ void Game::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- g_engine->_mouse->HandleEvents(Event);
+void Game::handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
+ g_engine->_mouse->handleEvents(Event);
if (GameDebug)
- debug_console.HandleEvents(Event);
+ debug_console.handleEvents(Event);
if (!debug_console.RestrictInput()) {
if (state == STATE_LOSE_MENU) {
- switch (hud.gom.HandleEvents(Event)) {
+ switch (hud.gom.handleEvents(Event)) {
case 0:
state = STATE_LOSE_LOAD;
break;
@@ -331,17 +331,17 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
break;
}
} else if (state == STATE_LOSE_LOAD) {
- if (g_engine->_loadMenu->HandleEvents(Event)) {
+ if (g_engine->_loadMenu->handleEvents(Event)) {
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
return;
}
- if (hud.pausekey.HandleEvents(Event) || hud.back.HandleEvents(Event) == BUAC_LCLICK)
+ if (hud.pausekey.handleEvents(Event) || hud.back.handleEvents(Event) == BUAC_LCLICK)
state = STATE_LOSE_MENU;
} else {
if (!gem.EventInProgress() && !hud.pause.DisableHotkeys()) {
- switch (hud.HandleEvents(info, Event)) {
+ switch (hud.handleEvents(info, Event)) {
case HS_MAP:
ToggleState(STATE_MAP);
break;
@@ -365,14 +365,14 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
if (state == STATE_GAME) {
if (gem.EventInProgress()) {
- gem.HandleEvents(info, level.PlayerID(), Event, hud, level, event_res);
+ gem.handleEvents(info, level.PlayerID(), Event, hud, level, event_res);
if (ApplyResult())
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
- level.HandleEvents(info, Event);
+ level.handleEvents(info, Event);
if (!game_over.Empty() && game_over.Evaluate(info)) {
state = STATE_LOSE_MENU;
@@ -390,11 +390,11 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
return;
}
- if (hud.pausekey.HandleEvents(Event))
+ if (hud.pausekey.handleEvents(Event))
ToggleState(STATE_PAUSE);
}
} else if (state == STATE_PAUSE) {
- switch (hud.pause.HandleEvents(Event, hud.back)) {
+ switch (hud.pause.handleEvents(Event, hud.back)) {
case PS_RESUME:
ToggleState(STATE_GAME);
hud.SetTooltip();
@@ -427,19 +427,19 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
break;
}
} else {
- if (hud.back.HandleEvents(Event) == BUAC_LCLICK)
+ if (hud.back.handleEvents(Event) == BUAC_LCLICK)
ToggleState(STATE_GAME);
switch (state) {
case STATE_MAP:
- if (map.HandleEvents(info, Event)) {
+ if (map.handleEvents(info, Event)) {
// We need to load the new level
LoadLevel(map.cur_loc);
ToggleState(STATE_GAME);
}
break;
case STATE_JOURNAL:
- if (info.journal.HandleEvents(level.PlayerID(), Event)) {
+ if (info.journal.handleEvents(level.PlayerID(), Event)) {
// This means we selected the "find on map" button, so we need to:
// switch to the world map, and highlight the appropriate quest marker
map.SelectDest(info.journal.marker_title);
@@ -447,13 +447,13 @@ void Game::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
}
break;
case STATE_CHARACTER:
- gem.per.HandleEvents(info, level.PlayerID(), Event);
+ gem.per.handleEvents(info, level.PlayerID(), Event);
break;
case STATE_INVENTORY:
- info.inv.HandleEvents(level.PlayerID(), Event);
+ info.inv.handleEvents(level.PlayerID(), Event);
break;
case STATE_HELP:
- g_engine->_helpScreen->HandleEvents(Event);
+ g_engine->_helpScreen->handleEvents(Event);
default:
break;
}
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 9905a746929..c01fb935d41 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -130,9 +130,9 @@ public:
void StartNewGame();
void LoadGame();
- void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
+ void handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#if 0
- void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
+ void handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void draw();
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index b86207778e3..adca3a28e77 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -45,7 +45,7 @@ namespace Crab {
//------------------------------------------------------------------------
class GameState {
public:
- virtual void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
+ virtual void handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void draw() = 0;
virtual void setUI() = 0;
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 6cf59b70e4e..f1ffb9942d6 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -78,7 +78,7 @@ void Cursor::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-void Cursor::HandleEvents(const Common::Event &event) {
+void Cursor::handleEvents(const Common::Event &event) {
g_engine->_mouse->hover = false;
#if 0
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index 7e6ebafa0a1..856da71e713 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -83,7 +83,7 @@ public:
void reset();
void load(rapidxml::xml_node<char> *node);
- void HandleEvents(const Common::Event &event);
+ void handleEvents(const Common::Event &event);
void draw();
bool Pressed() { return pressed; }
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index 76067fc1061..7fbaa2d3aa5 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -40,7 +40,7 @@ void FightInput::load(rapidxml::xml_node<char> *node) {
loadNum(state, "state", node);
}
-FightAnimationType FightInput::HandleEvents(const Common::Event &Event) {
+FightAnimationType FightInput::handleEvents(const Common::Event &Event) {
if (g_engine->_inputManager->State(IG_ATTACK))
return FA_ATTACK;
else if (g_engine->_inputManager->State(IG_BLOCK))
@@ -50,7 +50,7 @@ FightAnimationType FightInput::HandleEvents(const Common::Event &Event) {
}
#if 0
-FightAnimationType FightInput::HandleEvents(const SDL_Event &Event) {
+FightAnimationType FightInput::handleEvents(const SDL_Event &Event) {
if (g_engine->_inputManager->State(IG_ATTACK))
return FA_ATTACK;
else if (g_engine->_inputManager->State(IG_BLOCK))
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 28e9ff8a0fe..d7150bf63b2 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -75,9 +75,9 @@ struct FightInput {
void load(rapidxml::xml_node<char> *node);
- FightAnimationType HandleEvents(const Common::Event &Event);
+ FightAnimationType handleEvents(const Common::Event &Event);
#if 0
- FightAnimationType HandleEvents(const SDL_Event &Event);
+ FightAnimationType handleEvents(const SDL_Event &Event);
#endif
};
} // End of namespace input
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index 43f590bb993..1a61ca2b84f 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -42,7 +42,7 @@ void HotKey::load(rapidxml::xml_node<char> *node) {
}
#if 0
-bool HotKey::HandleEvents(const SDL_Event &Event) {
+bool HotKey::handleEvents(const SDL_Event &Event) {
if (input > IT_NONE && input < IT_TOTAL) {
int result = g_engine->_inputManager->Equals(input, Event);
@@ -58,8 +58,8 @@ bool HotKey::HandleEvents(const SDL_Event &Event) {
}
#endif
-bool HotKey::HandleEvents(const Common::Event &Event) {
- //warning("STUB: HotKey::HandleEvents()");
+bool HotKey::handleEvents(const Common::Event &Event) {
+ //warning("STUB: HotKey::handleEvents()");
if (input > IT_NONE && input < IT_TOTAL) {
return g_engine->_inputManager->State(input);
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 4ffea822bce..e02a1177db2 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -65,10 +65,10 @@ public:
void load(rapidxml::xml_node<char> *node);
- bool HandleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &Event);
#if 0
- bool HandleEvents(const SDL_Event &Event);
+ bool handleEvents(const SDL_Event &Event);
#endif
};
} // End of namespace input
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index c92e8f29d06..25fa939053f 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -69,18 +69,18 @@ void ItemCollection::Init(const Common::String &char_id) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void ItemCollection::HandleEvents(const Common::String &char_id, const Common::Event &Event) {
+void ItemCollection::handleEvents(const Common::String &char_id, const Common::Event &Event) {
if (item.contains(char_id) > 0)
- item[char_id].HandleEvents(Event);
+ item[char_id].handleEvents(Event);
}
#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void ItemCollection::HandleEvents(const Common::String &char_id, const SDL_Event &Event) {
+void ItemCollection::handleEvents(const Common::String &char_id, const SDL_Event &Event) {
if (item.contains(char_id) > 0)
- item[char_id].HandleEvents(Event);
+ item[char_id].handleEvents(Event);
}
#endif
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 2bcab04d959..2b5db140ddf 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -71,9 +71,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- void HandleEvents(const Common::String &char_id, const Common::Event &Event);
+ void handleEvents(const Common::String &char_id, const Common::Event &Event);
#if 0
- void HandleEvents(const Common::String &char_id, const SDL_Event &Event);
+ void handleEvents(const Common::String &char_id, const SDL_Event &Event);
#endif
void Init(const Common::String &char_id);
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index f956dfcb7fc..c2d49729e6e 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -72,8 +72,8 @@ void ItemMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
//------------------------------------------------------------------------
// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
//------------------------------------------------------------------------
-void ItemMenu::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
- int result = Menu<ItemSlot>::HandleEvents(Event);
+void ItemMenu::handleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ int result = Menu<ItemSlot>::handleEvents(Event);
if (result != -1) {
select_index = result;
for (unsigned int i = 0; i < element.size(); ++i)
@@ -85,8 +85,8 @@ void ItemMenu::HandleEvents(const Common::Event &Event, const int &XOffset, cons
//------------------------------------------------------------------------
// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
//------------------------------------------------------------------------
-void ItemMenu::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
- int result = Menu<ItemSlot>::HandleEvents(Event);
+void ItemMenu::handleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
+ int result = Menu<ItemSlot>::handleEvents(Event);
if (result != -1) {
select_index = result;
for (unsigned int i = 0; i < element.size(); ++i)
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index 8fbc744d84a..8fbc19d311c 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -70,9 +70,9 @@ public:
void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
const unsigned int &cols, const bool &keyboard);
- void HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ void handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
- void HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ void handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
/* pyrodactyl::people::Person &obj,*/
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index f6e12547cba..710181c51e3 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -116,8 +116,8 @@ void ItemSlot::draw() {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-ButtonAction ItemSlot::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
- ButtonAction ac = StateButton::HandleEvents(Event, XOffset, YOffset);
+ButtonAction ItemSlot::handleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ ButtonAction ac = StateButton::handleEvents(Event, XOffset, YOffset);
if (ac == BUAC_LCLICK || ac == BUAC_RCLICK)
unread = false;
@@ -128,8 +128,8 @@ ButtonAction ItemSlot::HandleEvents(const Common::Event &Event, const int &XOffs
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-ButtonAction ItemSlot::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
- ButtonAction ac = StateButton::HandleEvents(Event, XOffset, YOffset);
+ButtonAction ItemSlot::handleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
+ ButtonAction ac = StateButton::handleEvents(Event, XOffset, YOffset);
if (ac == BUAC_LCLICK || ac == BUAC_RCLICK)
unread = false;
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index d1abd1176be..f7bb72e55eb 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -80,9 +80,9 @@ public:
void draw();
- pyrodactyl::ui::ButtonAction HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ pyrodactyl::ui::ButtonAction handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
- pyrodactyl::ui::ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ pyrodactyl::ui::ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
bool CanSwap(ItemSlot &target) { return target.no_type || item.type == target.item_type; }
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 84521651736..e00b37dbd93 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -91,7 +91,7 @@ void Level::CalcProperties(Info &info) {
//------------------------------------------------------------------------
// Purpose: Handle the level movement
//------------------------------------------------------------------------
-void Level::HandleEvents(Info &info, const Common::Event &Event) {
+void Level::handleEvents(Info &info, const Common::Event &Event) {
if (!g_engine->_mouse->inside_hud) {
if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
// Only go to path if our mouse is a normal walking cursor
@@ -119,7 +119,7 @@ void Level::HandleEvents(Info &info, const Common::Event &Event) {
//------------------------------------------------------------------------
// Purpose: Handle the level movement
//------------------------------------------------------------------------
-void Level::HandleEvents(Info &info, const SDL_Event &Event) {
+void Level::handleEvents(Info &info, const SDL_Event &Event) {
if (!g_engine->_mouse->inside_hud) {
if (Event.type == SDL_MOUSEBUTTONDOWN) {
// Only go to path if our mouse is a normal walking cursor
@@ -140,7 +140,7 @@ void Level::HandleEvents(Info &info, const SDL_Event &Event) {
}
}
- objects[player_index].HandleEvents(info, camera, sc_default, Event);
+ objects[player_index].handleEvents(info, camera, sc_default, Event);
}
#endif
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 5dcf89cf5db..cb42d0f2679 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -189,9 +189,9 @@ public:
// Get index of a sprite in the object array
pyrodactyl::anim::Sprite *GetSprite(const Common::String &id);
- void HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
- void HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
LevelResult internalEvents(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq, bool EventInProgress);
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 84e9fbd5b6f..c3b77461cd0 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -154,11 +154,11 @@ MainMenu::MainMenu() {
//------------------------------------------------------------------------
// Purpose: Event/input handling Events
//------------------------------------------------------------------------
-void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- g_engine->_mouse->HandleEvents(Event);
+void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
+ g_engine->_mouse->handleEvents(Event);
if (state != STATE_CREDITS) {
- int choice = me_main.HandleEvents(Event);
+ int choice = me_main.handleEvents(Event);
if (choice >= 0) {
for (unsigned i = 0; i < me_main.element.size(); ++i)
me_main.element[i].State(i == (unsigned int)choice);
@@ -202,7 +202,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
}
#if 0
- if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_PRESSED || (back.HandleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
+ if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_PRESSED || (back.handleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
if (state == STATE_SAVENAME)
ChangeState(STATE_DIFF);
else if (state != STATE_NORMAL)
@@ -213,24 +213,24 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
switch (state) {
#ifdef UNREST_DEMO
case STATE_NORMAL:
- if (steam.HandleEvents(Event) == BUAC_LCLICK) {
+ if (steam.handleEvents(Event) == BUAC_LCLICK) {
// Open steam in browser window
OpenURL("https://store.steampowered.com/app/292400/");
}
- if (direct.HandleEvents(Event) == BUAC_LCLICK) {
+ if (direct.handleEvents(Event) == BUAC_LCLICK) {
// Open humble widget in browser window
OpenURL("https://www.humblebundle.com/store/unrest/Udg6Ytd8Dfw");
}
break;
#endif
case STATE_OPTIONS:
- if (g_engine->_optionMenu->HandleEvents(back, Event))
+ if (g_engine->_optionMenu->handleEvents(back, Event))
ChangeState(STATE_NORMAL);
break;
case STATE_CREDITS:
- if (credits.HandleEvents(Event))
+ if (credits.handleEvents(Event))
ChangeState(STATE_NORMAL);
break;
@@ -245,7 +245,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
case STATE_DIFF: {
- int choice = diff.menu.HandleEvents(Event);
+ int choice = diff.menu.handleEvents(Event);
// First menu option is Non-iron man, second is iron man
// For the second choice, we must display a prompt to choose the name of the save game
@@ -258,7 +258,7 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
} break;
case STATE_SAVENAME:
- if (save.HandleEvents(Event) || accept.HandleEvents(Event)) {
+ if (save.handleEvents(Event) || accept.handleEvents(Event)) {
if (save.text != "") {
g_engine->_tempData->filename = save.text;
g_engine->_tempData->ironman = true;
@@ -266,18 +266,18 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
NewStateID = GAMESTATE_NEW_GAME;
} else
debug("Please enter a valid filename for the iron man save.");
- } else if (cancel.HandleEvents(Event))
+ } else if (cancel.handleEvents(Event))
ChangeState(STATE_DIFF);
break;
case STATE_MOD:
- if (mod.HandleEvents(Event))
+ if (mod.handleEvents(Event))
ChangeState(STATE_NORMAL);
break;
case STATE_HELP:
- g_engine->_helpScreen->HandleEvents(Event);
+ g_engine->_helpScreen->handleEvents(Event);
break;
default:
@@ -289,11 +289,11 @@ void MainMenu::HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
//------------------------------------------------------------------------
// Purpose: Event/input handling Events
//------------------------------------------------------------------------
-void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- g_engine->_mouse->HandleEvents(Event);
+void MainMenu::handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
+ g_engine->_mouse->handleEvents(Event);
if (state != STATE_CREDITS) {
- int choice = me_main.HandleEvents(Event);
+ int choice = me_main.handleEvents(Event);
if (choice >= 0) {
for (unsigned i = 0; i < me_main.element.size(); ++i)
me_main.element[i].State(i == choice);
@@ -336,7 +336,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
}
}
- if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_PRESSED || (back.HandleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
+ if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_PRESSED || (back.handleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
if (state == STATE_SAVENAME)
ChangeState(STATE_DIFF);
else if (state != STATE_NORMAL)
@@ -346,29 +346,29 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
switch (state) {
#ifdef UNREST_DEMO
case STATE_NORMAL:
- if (steam.HandleEvents(Event) == BUAC_LCLICK) {
+ if (steam.handleEvents(Event) == BUAC_LCLICK) {
// Open steam in browser window
OpenURL("https://store.steampowered.com/app/292400/");
}
- if (direct.HandleEvents(Event) == BUAC_LCLICK) {
+ if (direct.handleEvents(Event) == BUAC_LCLICK) {
// Open humble widget in browser window
OpenURL("https://www.humblebundle.com/store/unrest/Udg6Ytd8Dfw");
}
break;
#endif
case STATE_OPTIONS:
- if (g_engine->_optionMenu->HandleEvents(back, Event))
+ if (g_engine->_optionMenu->handleEvents(back, Event))
ChangeState(STATE_NORMAL);
break;
case STATE_CREDITS:
- if (credits.HandleEvents(Event))
+ if (credits.handleEvents(Event))
ChangeState(STATE_NORMAL);
break;
case STATE_LOAD:
- if (g_engine->_loadMenu->HandleEvents(Event)) {
+ if (g_engine->_loadMenu->handleEvents(Event)) {
ChangeState(STATE_NORMAL);
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
@@ -377,7 +377,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
break;
case STATE_DIFF: {
- int choice = diff.menu.HandleEvents(Event);
+ int choice = diff.menu.handleEvents(Event);
// First menu option is Non-iron man, second is iron man
// For the second choice, we must display a prompt to choose the name of the save game
@@ -390,7 +390,7 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
} break;
case STATE_SAVENAME:
- if (save.HandleEvents(Event) || accept.HandleEvents(Event)) {
+ if (save.handleEvents(Event) || accept.handleEvents(Event)) {
if (save.text != "") {
g_engine->_tempData->filename = save.text;
g_engine->_tempData->ironman = true;
@@ -398,18 +398,18 @@ void MainMenu::HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
NewStateID = GAMESTATE_NEW_GAME;
} else
fprintf(stdout, "Please enter a valid filename for the iron man save.\n");
- } else if (cancel.HandleEvents(Event))
+ } else if (cancel.handleEvents(Event))
ChangeState(STATE_DIFF);
break;
case STATE_MOD:
- if (mod.HandleEvents(Event))
+ if (mod.handleEvents(Event))
ChangeState(STATE_NORMAL);
break;
case STATE_HELP:
- g_engine->_helpScreen->HandleEvents(Event);
+ g_engine->_helpScreen->handleEvents(Event);
break;
default:
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 3f8662f166c..9c325e20f36 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -124,9 +124,9 @@ public:
MainMenu();
~MainMenu() {}
- void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
+ void handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#if 0
- void HandleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
+ void handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index e33705477cb..1b8c7691749 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -59,7 +59,7 @@ class Splash : public GameState {
public:
Splash();
~Splash();
- void HandleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {}
+ void handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {}
void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
void draw();
void setUI();
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 82a310e6107..4524fe057d8 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -45,19 +45,19 @@ void ChapterIntro::load(rapidxml::xml_node<char> *node) {
traits.load(node->first_node("trait"));
}
-bool ChapterIntro::HandleEvents(Common::Event &Event) {
- if (traits.HandleEvents(Event))
+bool ChapterIntro::handleEvents(Common::Event &Event) {
+ if (traits.handleEvents(Event))
show_traits = true;
- return dialog.HandleEvents(Event);
+ return dialog.handleEvents(Event);
}
#if 0
-bool ChapterIntro::HandleEvents(SDL_Event &Event) {
- if (traits.HandleEvents(Event))
+bool ChapterIntro::handleEvents(SDL_Event &Event) {
+ if (traits.handleEvents(Event))
show_traits = true;
- return dialog.HandleEvents(Event);
+ return dialog.handleEvents(Event);
}
#endif
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index 84574eedb5b..38d2a950518 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -58,9 +58,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- bool HandleEvents(Common::Event &Event);
+ bool handleEvents(Common::Event &Event);
#if 0
- bool HandleEvents(SDL_Event &Event);
+ bool handleEvents(SDL_Event &Event);
#endif
void draw(pyrodactyl::event::Info &info, Common::String &text,
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 078bfcd71bf..7d6f5d92333 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -104,36 +104,36 @@ void CreditScreen::load(const Common::String &filename) {
}
}
-bool CreditScreen::HandleEvents(Common::Event &Event) {
- if (slow.HandleEvents(Event) == BUAC_LCLICK)
+bool CreditScreen::handleEvents(Common::Event &Event) {
+ if (slow.handleEvents(Event) == BUAC_LCLICK)
speed.cur = speed.slow;
- else if (fast.HandleEvents(Event) == BUAC_LCLICK)
+ else if (fast.handleEvents(Event) == BUAC_LCLICK)
speed.cur = speed.fast;
- else if (pause.HandleEvents(Event) == BUAC_LCLICK)
+ else if (pause.handleEvents(Event) == BUAC_LCLICK)
speed.cur = 0.0f;
- else if (reverse.HandleEvents(Event) == BUAC_LCLICK)
+ else if (reverse.handleEvents(Event) == BUAC_LCLICK)
speed.cur = speed.reverse;
- return (back.HandleEvents(Event) == BUAC_LCLICK);
+ return (back.handleEvents(Event) == BUAC_LCLICK);
}
#if 0
-bool CreditScreen::HandleEvents(SDL_Event &Event) {
- if (slow.HandleEvents(Event) == BUAC_LCLICK)
+bool CreditScreen::handleEvents(SDL_Event &Event) {
+ if (slow.handleEvents(Event) == BUAC_LCLICK)
speed.cur = speed.slow;
- else if (fast.HandleEvents(Event) == BUAC_LCLICK)
+ else if (fast.handleEvents(Event) == BUAC_LCLICK)
speed.cur = speed.fast;
- else if (pause.HandleEvents(Event) == BUAC_LCLICK)
+ else if (pause.handleEvents(Event) == BUAC_LCLICK)
speed.cur = 0.0f;
- else if (reverse.HandleEvents(Event) == BUAC_LCLICK)
+ else if (reverse.handleEvents(Event) == BUAC_LCLICK)
speed.cur = speed.reverse;
- if (website.HandleEvents(Event))
+ if (website.handleEvents(Event))
OpenURL("http://pyrodactyl.com");
- else if (twitter.HandleEvents(Event))
+ else if (twitter.handleEvents(Event))
OpenURL("https://www.twitter.com/pyrodactylgames");
- return (back.HandleEvents(Event) == BUAC_LCLICK);
+ return (back.handleEvents(Event) == BUAC_LCLICK);
}
#endif
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 65702f9c20d..99a221ca521 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -114,9 +114,9 @@ public:
void load(const Common::String &filename);
void reset();
- bool HandleEvents(Common::Event &Event);
+ bool handleEvents(Common::Event &Event);
#if 0
- bool HandleEvents(SDL_Event &Event);
+ bool handleEvents(SDL_Event &Event);
#endif
void draw();
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 7679427caa0..0da0a2a858f 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -90,17 +90,17 @@ void DebugConsole::draw(pyrodactyl::event::Info &info) {
}
#if 0
-void DebugConsole::HandleEvents(const SDL_Event &Event) {
+void DebugConsole::handleEvents(const SDL_Event &Event) {
switch (state) {
case STATE_NORMAL: {
- int choice = menu.HandleEvents(Event);
+ int choice = menu.handleEvents(Event);
if (choice == 0)
state = STATE_VAR;
} break;
case STATE_VAR:
- text_field.HandleEvents(Event);
+ text_field.handleEvents(Event);
- if (check.HandleEvents(Event))
+ if (check.handleEvents(Event))
var_name = text_field.text;
// Control+V pastes clipboard text into text field
@@ -112,7 +112,7 @@ void DebugConsole::HandleEvents(const SDL_Event &Event) {
}
}
- if (back.HandleEvents(Event))
+ if (back.handleEvents(Event))
state = STATE_NORMAL;
break;
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index a792a96ea2d..f67845fe88c 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -67,7 +67,7 @@ public:
void draw(pyrodactyl::event::Info &info);
#if 0
- void HandleEvents(const SDL_Event &Event);
+ void handleEvents(const SDL_Event &Event);
#endif
void internalEvents();
};
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 2004a951511..da3a1646e96 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -195,8 +195,8 @@ public:
ScanDir();
}
- bool HandleEvents(const Common::Event &Event) {
- int choice = menu.HandleEvents(Event);
+ bool handleEvents(const Common::Event &Event) {
+ int choice = menu.handleEvents(Event);
if (choice >= 0) {
menu.reset();
selected = slot_info[menu.Index() + choice].path;
@@ -208,8 +208,8 @@ public:
}
#if 0
- bool HandleEvents(const SDL_Event &Event) {
- int choice = menu.HandleEvents(Event);
+ bool handleEvents(const SDL_Event &Event) {
+ int choice = menu.handleEvents(Event);
if (choice >= 0) {
menu.reset();
selected = slot_info[menu.Index() + choice].path;
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index f56a2784948..1f4d73dc659 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -56,13 +56,13 @@ void GameOverMenu::load(rapidxml::xml_node<char> *node) {
}
}
-int GameOverMenu::HandleEvents(const Common::Event &Event) {
- return menu.HandleEvents(Event);
+int GameOverMenu::handleEvents(const Common::Event &Event) {
+ return menu.handleEvents(Event);
}
#if 0
-int GameOverMenu::HandleEvents(const SDL_Event &Event) {
- return menu.HandleEvents(Event);
+int GameOverMenu::handleEvents(const SDL_Event &Event) {
+ return menu.handleEvents(Event);
}
#endif
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 43cbdfd816b..8e3b3635b6b 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -69,9 +69,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- int HandleEvents(const Common::Event &Event);
+ int handleEvents(const Common::Event &Event);
#if 0
- int HandleEvents(const SDL_Event &Event);
+ int handleEvents(const SDL_Event &Event);
#endif
void draw();
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 27d01d46ecf..7cb264e23ee 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -71,23 +71,23 @@ void GeneralSettingMenu::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-void GeneralSettingMenu::HandleEvents(const Common::Event &Event) {
- if (vol_music.HandleEvents(Event))
+void GeneralSettingMenu::handleEvents(const Common::Event &Event) {
+ if (vol_music.handleEvents(Event))
g_engine->_musicManager->VolMusic(vol_music.Value());
- if (vol_effects.HandleEvents(Event))
+ if (vol_effects.handleEvents(Event))
g_engine->_musicManager->VolEffects(vol_effects.Value());
// No need to change screen here
- if (save_on_exit.HandleEvents(Event))
+ if (save_on_exit.handleEvents(Event))
g_engine->_screenSettings->save_on_exit = !g_engine->_screenSettings->save_on_exit;
- if (mouse_trap.HandleEvents(Event)) {
+ if (mouse_trap.handleEvents(Event)) {
g_engine->_screenSettings->mouse_trap = !g_engine->_screenSettings->mouse_trap;
g_engine->_screenSettings->SetMouseTrap();
}
- int result = text_speed.HandleEvents(Event);
+ int result = text_speed.handleEvents(Event);
if (result >= 0)
g_engine->_screenSettings->text_speed = text_speed.element[result].val;
}
@@ -96,23 +96,23 @@ void GeneralSettingMenu::HandleEvents(const Common::Event &Event) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-void GeneralSettingMenu::HandleEvents(const SDL_Event &Event) {
- if (vol_music.HandleEvents(Event))
+void GeneralSettingMenu::handleEvents(const SDL_Event &Event) {
+ if (vol_music.handleEvents(Event))
g_engine->_musicManager->VolMusic(vol_music.Value());
- if (vol_effects.HandleEvents(Event))
+ if (vol_effects.handleEvents(Event))
g_engine->_musicManager->VolEffects(vol_effects.Value());
// No need to change screen here
- if (save_on_exit.HandleEvents(Event))
+ if (save_on_exit.handleEvents(Event))
g_engine->_screenSettings->save_on_exit = !g_engine->_screenSettings->save_on_exit;
- if (mouse_trap.HandleEvents(Event)) {
+ if (mouse_trap.handleEvents(Event)) {
g_engine->_screenSettings->mouse_trap = !g_engine->_screenSettings->mouse_trap;
g_engine->_screenSettings->SetMouseTrap();
}
- int result = text_speed.HandleEvents(Event);
+ int result = text_speed.handleEvents(Event);
if (result >= 0)
g_engine->_screenSettings->text_speed = text_speed.element[result].val;
}
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 1adea45902a..a4be9d46bd5 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -57,9 +57,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- void HandleEvents(const Common::Event &Event);
+ void handleEvents(const Common::Event &Event);
#if 0
- void HandleEvents(const SDL_Event &Event);
+ void handleEvents(const SDL_Event &Event);
#endif
void internalEvents();
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 21ea2d07b5d..9f486d2cff5 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -90,74 +90,74 @@ void GfxSettingMenu::draw() {
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
-int GfxSettingMenu::HandleEvents(const Common::Event &Event) {
- if (fullscreen.HandleEvents(Event)) {
+int GfxSettingMenu::handleEvents(const Common::Event &Event) {
+ if (fullscreen.handleEvents(Event)) {
// Setting video flags is necessary when toggling fullscreen
g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
g_engine->_screenSettings->SetFullscreen();
}
// Vsync doesn't need to set the change value
- if (vsync.HandleEvents(Event)) {
+ if (vsync.handleEvents(Event)) {
g_engine->_screenSettings->vsync = !g_engine->_screenSettings->vsync;
g_engine->_screenSettings->SetVsync();
}
// Quality and resolution can only be changed in the main menu
if (!g_engine->_screenSettings->in_game) {
- if (quality.HandleEvents(Event))
+ if (quality.handleEvents(Event))
g_engine->_screenSettings->quality = !g_engine->_screenSettings->quality;
}
// Window border doesn't matter if you are in fullscreen
- if (border.HandleEvents(Event) && !g_engine->_screenSettings->fullscreen) {
+ if (border.handleEvents(Event) && !g_engine->_screenSettings->fullscreen) {
g_engine->_screenSettings->border = !g_engine->_screenSettings->border;
g_engine->_screenSettings->SetWindowBorder();
}
- if (brightness.HandleEvents(Event)) {
+ if (brightness.handleEvents(Event)) {
g_engine->_screenSettings->gamma = static_cast<float>(brightness.Value()) / 100.0f;
g_engine->_screenSettings->SetGamma();
}
- return resolution.HandleEvents(Event);
+ return resolution.handleEvents(Event);
}
#if 0
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
-int GfxSettingMenu::HandleEvents(const SDL_Event &Event) {
- if (fullscreen.HandleEvents(Event)) {
+int GfxSettingMenu::handleEvents(const SDL_Event &Event) {
+ if (fullscreen.handleEvents(Event)) {
// Setting video flags is necessary when toggling fullscreen
g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
g_engine->_screenSettings->SetFullscreen();
}
// Vsync doesn't need to set the change value
- if (vsync.HandleEvents(Event)) {
+ if (vsync.handleEvents(Event)) {
g_engine->_screenSettings->vsync = !g_engine->_screenSettings->vsync;
g_engine->_screenSettings->SetVsync();
}
// Quality and resolution can only be changed in the main menu
if (!g_engine->_screenSettings->in_game) {
- if (quality.HandleEvents(Event))
+ if (quality.handleEvents(Event))
g_engine->_screenSettings->quality = !g_engine->_screenSettings->quality;
}
// Window border doesn't matter if you are in fullscreen
- if (border.HandleEvents(Event) && !g_engine->_screenSettings->fullscreen) {
+ if (border.handleEvents(Event) && !g_engine->_screenSettings->fullscreen) {
g_engine->_screenSettings->border = !g_engine->_screenSettings->border;
g_engine->_screenSettings->SetWindowBorder();
}
- if (brightness.HandleEvents(Event)) {
+ if (brightness.handleEvents(Event)) {
g_engine->_screenSettings->gamma = static_cast<float>(brightness.Value()) / 100.0f;
g_engine->_screenSettings->SetGamma();
}
- return resolution.HandleEvents(Event);
+ return resolution.handleEvents(Event);
}
#endif
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index b1930baadd2..b36ddbead86 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -61,9 +61,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- int HandleEvents(const Common::Event &Event);
+ int handleEvents(const Common::Event &Event);
#if 0
- int HandleEvents(const SDL_Event &Event);
+ int handleEvents(const SDL_Event &Event);
#endif
void internalEvents();
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 4f67bcaafa6..af576c264b7 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -102,18 +102,18 @@ void Inventory::draw(Person &obj, const int &money_val) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Inventory::HandleEvents(const Common::String &char_id, const Common::Event &Event) {
- collection.HandleEvents(char_id, Event);
- money.HandleEvents(Event);
+void Inventory::handleEvents(const Common::String &char_id, const Common::Event &Event) {
+ collection.handleEvents(char_id, Event);
+ money.handleEvents(Event);
}
#if 0
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Inventory::HandleEvents(const Common::String &char_id, const SDL_Event &Event) {
- collection.HandleEvents(char_id, Event);
- money.HandleEvents(Event);
+void Inventory::handleEvents(const Common::String &char_id, const SDL_Event &Event) {
+ collection.handleEvents(char_id, Event);
+ money.handleEvents(Event);
}
#endif
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index c8cb073743a..acd1f436210 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -72,9 +72,9 @@ public:
void load(const Common::String &filename);
void draw(pyrodactyl::people::Person &obj, const int &money_val);
- void HandleEvents(const Common::String &char_id, const Common::Event &Event);
+ void handleEvents(const Common::String &char_id, const Common::Event &Event);
#if 0
- void HandleEvents(const Common::String &char_id, const SDL_Event &Event);
+ void handleEvents(const Common::String &char_id, const SDL_Event &Event);
#endif
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index 246118cdf9d..b39e9aed023 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -144,16 +144,16 @@ void KeyBindMenu::SetCaption() {
#endif
}
-void KeyBindMenu::HandleEvents(const Common::Event &Event) {
- warning("STUB: KeyBindMenu::HandleEvents()");
+void KeyBindMenu::handleEvents(const Common::Event &Event) {
+ warning("STUB: KeyBindMenu::handleEvents()");
/*
- if (sel_controls.HandleEvents(Event))
+ if (sel_controls.handleEvents(Event))
SetCaption();
switch (state) {
case STATE_NORMAL:
- choice = menu[sel_controls.cur].HandleEvents(Event);
+ choice = menu[sel_controls.cur].handleEvents(Event);
if (choice >= 0) {
prompt.Swap(menu[sel_controls.cur].element[choice].caption);
state = STATE_KEY;
@@ -176,13 +176,13 @@ void KeyBindMenu::HandleEvents(const Common::Event &Event) {
}
#if 0
-void KeyBindMenu::HandleEvents(const SDL_Event &Event) {
- if (sel_controls.HandleEvents(Event))
+void KeyBindMenu::handleEvents(const SDL_Event &Event) {
+ if (sel_controls.handleEvents(Event))
SetCaption();
switch (state) {
case STATE_NORMAL:
- choice = menu[sel_controls.cur].HandleEvents(Event);
+ choice = menu[sel_controls.cur].handleEvents(Event);
if (choice >= 0) {
prompt.Swap(menu[sel_controls.cur].element[choice].caption);
state = STATE_KEY;
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 662c3d0f0ee..85f48e3915b 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -116,9 +116,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- void HandleEvents(const Common::Event &Event);
+ void handleEvents(const Common::Event &Event);
#if 0
- void HandleEvents(const SDL_Event &Event);
+ void handleEvents(const SDL_Event &Event);
#endif
void SetCaption();
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 51f3ace8ce3..824bdc2a01e 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -81,11 +81,11 @@ void MapMarkerMenu::draw(const Element &pos, const Vector2i &player_pos, const R
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event) {
+void MapMarkerMenu::handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event) {
if (player_pos.x >= camera.x && player_pos.y >= camera.y)
- player.HandleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
+ player.handleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
- int choice = menu.HandleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+ int choice = menu.handleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
if (choice != -1) {
int c = 0;
for (auto &i : menu.element) {
@@ -103,11 +103,11 @@ void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos,
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-void MapMarkerMenu::HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event) {
+void MapMarkerMenu::handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event) {
if (player_pos.x >= camera.x && player_pos.y >= camera.y)
- player.HandleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
+ player.handleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
- int choice = menu.HandleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+ int choice = menu.handleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
if (choice != -1) {
int c = 0;
for (auto &i : menu.element) {
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 23af3d29d93..fa408f0f637 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -87,9 +87,9 @@ public:
void draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
- void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event);
+ void handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event);
#if 0
- void HandleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
+ void handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
#endif
void internalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 5f71d3849a5..0cfeba6f725 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -77,8 +77,8 @@ void ModMenu::load(const Common::String &filename) {
}
}
-bool ModMenu::HandleEvents(const Common::Event &Event) {
- int choice = menu.HandleEvents(Event);
+bool ModMenu::handleEvents(const Common::Event &Event) {
+ int choice = menu.handleEvents(Event);
if (choice >= 0) {
g_engine->_filePath->mod_cur = slot_info[menu.Index() + choice].path;
return true;
@@ -88,8 +88,8 @@ bool ModMenu::HandleEvents(const Common::Event &Event) {
}
#if 0
-bool ModMenu::HandleEvents(const SDL_Event &Event) {
- int choice = menu.HandleEvents(Event);
+bool ModMenu::handleEvents(const SDL_Event &Event) {
+ int choice = menu.handleEvents(Event);
if (choice >= 0) {
g_engine->_filePath->mod_cur = slot_info[menu.Index() + choice].path;
return true;
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index 08ce52397f2..b943a852140 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -45,9 +45,9 @@ public:
void load(const Common::String &filename);
- bool HandleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &Event);
#if 0
- bool HandleEvents(const SDL_Event &Event);
+ bool handleEvents(const SDL_Event &Event);
#endif
void draw();
};
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 5d50a91028b..6354e9544d2 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -149,19 +149,19 @@ void OptionMenu::draw(Button &back) {
}
}
-bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
+bool OptionMenu::handleEvents(Button &back, const Common::Event &Event) {
if (state < STATE_ENTER_W) {
bg.draw();
switch (state) {
case STATE_GENERAL:
- general.HandleEvents(Event);
+ general.handleEvents(Event);
break;
case STATE_KEYBOARD:
- keybind.HandleEvents(Event);
+ keybind.handleEvents(Event);
break;
case STATE_GRAPHICS: {
- int result = gfx.HandleEvents(Event);
+ int result = gfx.handleEvents(Event);
if (result == 1) {
state = STATE_CONFIRM;
timer.Start();
@@ -180,23 +180,23 @@ bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
switch (state) {
case STATE_ENTER_W:
- if (prompt_w.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
+ if (prompt_w.handleEvents(Event, true) || accept.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->cur.w = StringToNumber<int>(prompt_w.text);
state = STATE_ENTER_H;
- } else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
+ } else if (cancel.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
break;
case STATE_ENTER_H:
- if (prompt_h.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
+ if (prompt_h.handleEvents(Event, true) || accept.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->cur.h = StringToNumber<int>(prompt_h.text);
state = STATE_CONFIRM;
timer.Start();
g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
- } else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
+ } else if (cancel.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
@@ -204,10 +204,10 @@ bool OptionMenu::HandleEvents(Button &back, const Common::Event &Event) {
break;
case STATE_CONFIRM:
- if (accept.HandleEvents(Event)) {
+ if (accept.handleEvents(Event)) {
state = STATE_GRAPHICS;
timer.Stop();
- } else if (cancel.HandleEvents(Event)) {
+ } else if (cancel.handleEvents(Event)) {
g_engine->_screenSettings->RestoreBackup();
g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
@@ -232,19 +232,19 @@ bool OptionMenu::HandleTabs(Button &back, const Common::Event &Event) {
}
#if 0
-bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
+bool OptionMenu::handleEvents(Button &back, const SDL_Event &Event) {
if (state < STATE_ENTER_W) {
bg.draw();
switch (state) {
case STATE_GENERAL:
- general.HandleEvents(Event);
+ general.handleEvents(Event);
break;
case STATE_KEYBOARD:
- keybind.HandleEvents(Event);
+ keybind.handleEvents(Event);
break;
case STATE_GRAPHICS: {
- int result = gfx.HandleEvents(Event);
+ int result = gfx.handleEvents(Event);
if (result == 1) {
state = STATE_CONFIRM;
timer.Start();
@@ -263,23 +263,23 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
switch (state) {
case STATE_ENTER_W:
- if (prompt_w.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
+ if (prompt_w.handleEvents(Event, true) || accept.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->cur.w = StringToNumber<int>(prompt_w.text);
state = STATE_ENTER_H;
- } else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
+ } else if (cancel.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
}
break;
case STATE_ENTER_H:
- if (prompt_h.HandleEvents(Event, true) || accept.HandleEvents(Event) == BUAC_LCLICK) {
+ if (prompt_h.handleEvents(Event, true) || accept.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->cur.h = StringToNumber<int>(prompt_h.text);
state = STATE_CONFIRM;
timer.Start();
g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
- } else if (cancel.HandleEvents(Event) == BUAC_LCLICK) {
+ } else if (cancel.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->RestoreBackup();
gfx.SetInfo();
state = STATE_GRAPHICS;
@@ -287,10 +287,10 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
break;
case STATE_CONFIRM:
- if (accept.HandleEvents(Event)) {
+ if (accept.handleEvents(Event)) {
state = STATE_GRAPHICS;
timer.Stop();
- } else if (cancel.HandleEvents(Event)) {
+ } else if (cancel.handleEvents(Event)) {
g_engine->_screenSettings->RestoreBackup();
g_engine->_screenSettings->SetResolution();
gfx.SetInfo();
@@ -310,12 +310,12 @@ bool OptionMenu::HandleEvents(Button &back, const SDL_Event &Event) {
bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
- if (back.HandleEvents(Event) == BUAC_LCLICK) {
+ if (back.handleEvents(Event) == BUAC_LCLICK) {
reset();
return true;
}
- int choice = menu.HandleEvents(Event);
+ int choice = menu.handleEvents(Event);
if (choice >= 0) {
if (choice < 4)
for (unsigned i = 0; i < menu.element.size(); ++i)
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index a5a7fea2187..5eb15c9e138 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -107,9 +107,9 @@ public:
void load(const Common::String &filename);
void draw(Button &back);
- bool HandleEvents(Button &back, const Common::Event &Event);
+ bool handleEvents(Button &back, const Common::Event &Event);
#if 0
- bool HandleEvents(Button &back, const SDL_Event &Event);
+ bool handleEvents(Button &back, const SDL_Event &Event);
#endif
void internalEvents();
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 6adfbd52a5c..9facc782d36 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -64,12 +64,12 @@ void OptionSelect::draw() {
next.draw();
}
-bool OptionSelect::HandleEvents(const Common::Event &Event) {
+bool OptionSelect::handleEvents(const Common::Event &Event) {
using namespace pyrodactyl::input;
if (cur > 0) {
// Don't check for keyboard inputs for now
- if (prev.HandleEvents(Event) == BUAC_LCLICK) {
+ if (prev.handleEvents(Event) == BUAC_LCLICK) {
cur--;
return true;
}
@@ -78,7 +78,7 @@ bool OptionSelect::HandleEvents(const Common::Event &Event) {
if ((unsigned int)cur < option.text.size() - 1) {
// Don't check for keyboard inputs for now
- if (next.HandleEvents(Event) == BUAC_LCLICK) {
+ if (next.handleEvents(Event) == BUAC_LCLICK) {
cur++;
return true;
}
@@ -88,18 +88,18 @@ bool OptionSelect::HandleEvents(const Common::Event &Event) {
}
#if 0
-bool OptionSelect::HandleEvents(const SDL_Event &Event) {
+bool OptionSelect::handleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
if (cur > 0) {
- if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)) {
+ if (prev.handleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)) {
cur--;
return true;
}
}
if (cur < option.text.size() - 1) {
- if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
+ if (next.handleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
cur++;
return true;
}
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index ad3ade4b6d6..62fd998c36c 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -65,9 +65,9 @@ public:
void draw();
- bool HandleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &Event);
#if 0
- bool HandleEvents(const SDL_Event &Event);
+ bool handleEvents(const SDL_Event &Event);
#endif
void setUI();
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index c76d7885c44..41388acb491 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -85,7 +85,7 @@ public:
// Get the elements per page
unsigned int ElementsPerPage() { return elements_per_page; }
- // This is added to the result from HandleEvents to calculate the exact position
+ // This is added to the result from handleEvents to calculate the exact position
unsigned int Index() { return current_page * elements_per_page; }
// The end position of the elements
@@ -200,10 +200,10 @@ public:
UpdateInfo();
}
- int HandleEvents(const Common::Event &Event) {
+ int handleEvents(const Common::Event &Event) {
using namespace pyrodactyl::input;
- if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
+ if (current_page > 0 && prev.handleEvents(Event) == BUAC_LCLICK) {
current_page--;
UpdateInfo();
@@ -211,7 +211,7 @@ public:
current_page = 0;
}
- if (current_page < menu.size() - 1 && next.HandleEvents(Event) == BUAC_LCLICK) {
+ if (current_page < menu.size() - 1 && next.handleEvents(Event) == BUAC_LCLICK) {
current_page++;
UpdateInfo();
@@ -219,14 +219,14 @@ public:
current_page = menu.size() - 1;
}
- return menu[current_page].HandleEvents(Event);
+ return menu[current_page].handleEvents(Event);
}
#if 0
- int HandleEvents(const SDL_Event &Event) {
+ int handleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
- if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
+ if (current_page > 0 && prev.handleEvents(Event) == BUAC_LCLICK) {
current_page--;
UpdateInfo();
@@ -234,7 +234,7 @@ public:
current_page = 0;
}
- if (current_page < menu.size() - 1 && next.HandleEvents(Event) == BUAC_LCLICK) {
+ if (current_page < menu.size() - 1 && next.handleEvents(Event) == BUAC_LCLICK) {
current_page++;
UpdateInfo();
@@ -242,7 +242,7 @@ public:
current_page = menu.size() - 1;
}
- return menu[current_page].HandleEvents(Event);
+ return menu[current_page].handleEvents(Event);
}
#endif
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index ba726ac83af..69efda87345 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -59,12 +59,12 @@ bool PauseMenu::draw(Button &back) {
return false;
}
-PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
+PauseSignal PauseMenu::handleEvents(const Common::Event &Event, Button &back) {
switch (state) {
case STATE_NORMAL:
- choice = menu.HandleEvents(Event);
+ choice = menu.handleEvents(Event);
if (choice == -1) {
- if (back.hotkey.HandleEvents(Event))
+ if (back.hotkey.handleEvents(Event))
return PS_RESUME;
} else {
switch (choice) {
@@ -100,7 +100,7 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
}
break;
case STATE_OPTION:
- if (g_engine->_optionMenu->HandleEvents(back, Event)) {
+ if (g_engine->_optionMenu->handleEvents(back, Event)) {
g_engine->_optionMenu->reset();
state = STATE_NORMAL;
}
@@ -119,12 +119,12 @@ PauseSignal PauseMenu::HandleEvents(const Common::Event &Event, Button &back) {
}
#if 0
-PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
+PauseSignal PauseMenu::handleEvents(const SDL_Event &Event, Button &back) {
switch (state) {
case STATE_NORMAL:
- choice = menu.HandleEvents(Event);
+ choice = menu.handleEvents(Event);
if (choice == -1) {
- if (back.hotkey.HandleEvents(Event))
+ if (back.hotkey.handleEvents(Event))
return PS_RESUME;
} else {
switch (choice) {
@@ -154,22 +154,22 @@ PauseSignal PauseMenu::HandleEvents(const SDL_Event &Event, Button &back) {
}
break;
case STATE_SAVE:
- if (save.HandleEvents(Event)) {
+ if (save.handleEvents(Event)) {
state = STATE_NORMAL;
return PS_SAVE;
- } else if (back.HandleEvents(Event) == BUAC_LCLICK && !save.DisableHotkeys())
+ } else if (back.handleEvents(Event) == BUAC_LCLICK && !save.DisableHotkeys())
state = STATE_NORMAL;
break;
case STATE_OPTION:
- if (g_engine->_optionMenu->HandleEvents(back, Event)) {
+ if (g_engine->_optionMenu->handleEvents(back, Event)) {
g_engine->_optionMenu->reset();
state = STATE_NORMAL;
}
break;
case STATE_LOAD:
- if (g_engine->_loadMenu->HandleEvents(Event))
+ if (g_engine->_loadMenu->handleEvents(Event))
return PS_LOAD;
- else if (back.HandleEvents(Event) == BUAC_LCLICK)
+ else if (back.handleEvents(Event) == BUAC_LCLICK)
state = STATE_NORMAL;
break;
default:
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 7d2a613bba3..c4d6b2aa029 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -85,9 +85,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- PauseSignal HandleEvents(const Common::Event &Event, Button &back);
+ PauseSignal handleEvents(const Common::Event &Event, Button &back);
#if 0
- PauseSignal HandleEvents(const SDL_Event &Event, Button &back);
+ PauseSignal handleEvents(const SDL_Event &Event, Button &back);
#endif
// Returns true if inside options menu, false otherwise
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 087f952628c..6eb8388351d 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -109,11 +109,11 @@ void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
}
bool PersonHandler::HandleCommonEvents(const Common::Event &Event) {
- opinion[OPI_LIKE].HandleEvents(Event);
- opinion[OPI_RESPECT].HandleEvents(Event);
- opinion[OPI_FEAR].HandleEvents(Event);
+ opinion[OPI_LIKE].handleEvents(Event);
+ opinion[OPI_RESPECT].handleEvents(Event);
+ opinion[OPI_FEAR].handleEvents(Event);
- if (jb.HandleEvents(Event) == BUAC_LCLICK) {
+ if (jb.handleEvents(Event) == BUAC_LCLICK) {
// User wants to open their journal
show_journal = true;
return true;
@@ -123,16 +123,16 @@ bool PersonHandler::HandleCommonEvents(const Common::Event &Event) {
}
bool PersonHandler::HandleDlboxEvents(const Common::Event &Event) {
- return dlbox.HandleEvents(Event);
+ return dlbox.handleEvents(Event);
}
#if 0
bool PersonHandler::HandleCommonEvents(const SDL_Event &Event) {
- opinion[OPI_LIKE].HandleEvents(Event);
- opinion[OPI_RESPECT].HandleEvents(Event);
- opinion[OPI_FEAR].HandleEvents(Event);
+ opinion[OPI_LIKE].handleEvents(Event);
+ opinion[OPI_RESPECT].handleEvents(Event);
+ opinion[OPI_FEAR].handleEvents(Event);
- if (jb.HandleEvents(Event) == BUAC_LCLICK) {
+ if (jb.handleEvents(Event) == BUAC_LCLICK) {
// User wants to open their journal
show_journal = true;
return true;
@@ -142,7 +142,7 @@ bool PersonHandler::HandleCommonEvents(const SDL_Event &Event) {
}
bool PersonHandler::HandleDlboxEvents(const SDL_Event &Event) {
- return dlbox.HandleEvents(Event);
+ return dlbox.handleEvents(Event);
}
#endif
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index e5da6183f08..059de550aba 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -57,19 +57,19 @@ void PersonScreen::load(const Common::String &filename) {
}
}
-void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event) {
+void PersonScreen::handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event) {
if (info.PersonValid(id))
- menu.HandleEvents(&info.PersonGet(id), Event);
+ menu.handleEvents(&info.PersonGet(id), Event);
else
- menu.HandleEvents(nullptr, Event);
+ menu.handleEvents(nullptr, Event);
}
#if 0
-void PersonScreen::HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event) {
+void PersonScreen::handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event) {
if (info.PersonValid(id))
- menu.HandleEvents(&info.PersonGet(id), Event);
+ menu.handleEvents(&info.PersonGet(id), Event);
else
- menu.HandleEvents(nullptr, Event);
+ menu.handleEvents(nullptr, Event);
}
#endif
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 55b9c2eeae5..39483f1a0c6 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -67,9 +67,9 @@ public:
void load(const Common::String &filename);
void Cache(pyrodactyl::event::Info &info, const Common::String &id, pyrodactyl::level::Level &level);
- void HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event);
#if 0
- void HandleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event);
#endif
void internalEvents();
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index bdc88d5d50d..6d2e72883d0 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -136,11 +136,11 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
}
}
-void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event) {
- if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK)
+void QuestText::handleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event) {
+ if (current_page > 0 && prev.handleEvents(Event) == BUAC_LCLICK)
current_page--;
- if (current_page < total_page - 1 && next.HandleEvents(Event) == BUAC_LCLICK) {
+ if (current_page < total_page - 1 && next.handleEvents(Event) == BUAC_LCLICK) {
current_page++;
if (current_page >= total_page)
@@ -149,15 +149,15 @@ void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const Common::Event &E
}
#if 0
-void QuestText::HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event) {
- if (current_page > 0 && prev.HandleEvents(Event) == BUAC_LCLICK) {
+void QuestText::handleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event) {
+ if (current_page > 0 && prev.handleEvents(Event) == BUAC_LCLICK) {
current_page--;
if (current_page < 0)
current_page = 0;
}
- if (current_page < total_page - 1 && next.HandleEvents(Event) == BUAC_LCLICK) {
+ if (current_page < total_page - 1 && next.handleEvents(Event) == BUAC_LCLICK) {
current_page++;
if (current_page >= total_page)
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index 0cdd206f45d..f21e44cd804 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -82,9 +82,9 @@ public:
// Reset the value of current page
void reset() { current_page = 0; }
- void HandleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event);
+ void handleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event);
#if 0
- void HandleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event);
+ void handleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event);
#endif
void draw(pyrodactyl::event::Quest &q);
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index 1e416f0ff37..81908e29fb8 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -62,8 +62,8 @@ public:
Menu::draw(XOffset, YOffset);
}
- int HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
- int result = Menu::HandleEvents(Event, XOffset, YOffset);
+ int handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
+ int result = Menu::handleEvents(Event, XOffset, YOffset);
if (result >= 0) {
select = result;
@@ -76,8 +76,8 @@ public:
}
#if 0
- int HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
- int result = Menu::HandleEvents(Event, XOffset, YOffset);
+ int handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
+ int result = Menu::handleEvents(Event, XOffset, YOffset);
if (result >= 0) {
select = result;
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index d05a9059c20..9c52b56336c 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -60,9 +60,9 @@ void ReplyMenu::load(const Common::String &filename) {
}
}
-int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event) {
+int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event) {
// After that, check if the user has clicked on any reply option
- int choice = Menu<ReplyButton>::HandleEvents(Event);
+ int choice = Menu<ReplyButton>::handleEvents(Event);
if (choice >= 0 && (unsigned int)choice < dat._reply.size()) {
bool play_sound = false;
@@ -101,9 +101,9 @@ int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::Str
}
#if 0
-int ReplyMenu::HandleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event) {
+int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event) {
// After that, check if the user has clicked on any reply option
- int choice = Menu<ReplyButton>::HandleEvents(Event);
+ int choice = Menu<ReplyButton>::handleEvents(Event);
if (choice >= 0 && choice < dat._reply.size()) {
bool play_sound = false;
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index 8194edc2200..75241d7503e 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -61,10 +61,10 @@ public:
void load(const Common::String &filename);
- int HandleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
+ int handleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event);
#if 0
- int HandleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
+ int handleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index f3a873ad3f8..b93db457f4a 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -96,26 +96,26 @@ void ResolutionMenu::draw() {
}
}
-int ResolutionMenu::HandleEvents(const Common::Event &Event) {
+int ResolutionMenu::handleEvents(const Common::Event &Event) {
switch (state) {
case STATE_NORMAL:
- if (change.HandleEvents(Event) == BUAC_LCLICK)
+ if (change.handleEvents(Event) == BUAC_LCLICK)
state = STATE_CHANGE;
break;
case STATE_CHANGE: {
- int choice = Menu::HandleEvents(Event);
+ int choice = Menu::handleEvents(Event);
if (choice >= 0) {
g_engine->_screenSettings->cur = dim[choice];
state = STATE_NORMAL;
return 1;
}
- if (custom.HandleEvents(Event) == BUAC_LCLICK) {
+ if (custom.handleEvents(Event) == BUAC_LCLICK) {
state = STATE_NORMAL;
return 2;
}
- if (cancel.HandleEvents(Event) == BUAC_LCLICK)
+ if (cancel.handleEvents(Event) == BUAC_LCLICK)
state = STATE_NORMAL;
} break;
default:
@@ -126,26 +126,26 @@ int ResolutionMenu::HandleEvents(const Common::Event &Event) {
}
#if 0
-int ResolutionMenu::HandleEvents(const SDL_Event &Event) {
+int ResolutionMenu::handleEvents(const SDL_Event &Event) {
switch (state) {
case STATE_NORMAL:
- if (change.HandleEvents(Event) == BUAC_LCLICK)
+ if (change.handleEvents(Event) == BUAC_LCLICK)
state = STATE_CHANGE;
break;
case STATE_CHANGE: {
- int choice = Menu::HandleEvents(Event);
+ int choice = Menu::handleEvents(Event);
if (choice >= 0) {
g_engine->_screenSettings->cur = dim[choice];
state = STATE_NORMAL;
return 1;
}
- if (custom.HandleEvents(Event) == BUAC_LCLICK) {
+ if (custom.handleEvents(Event) == BUAC_LCLICK) {
state = STATE_NORMAL;
return 2;
}
- if (cancel.HandleEvents(Event) == BUAC_LCLICK)
+ if (cancel.handleEvents(Event) == BUAC_LCLICK)
state = STATE_NORMAL;
} break;
default:
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 7d569754935..3572e0da19a 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -72,9 +72,9 @@ public:
void draw();
// Return 1 if one of resolution buttons is pressed, 2 if custom button is pressed, 0 otherwise
- int HandleEvents(const Common::Event &Event);
+ int handleEvents(const Common::Event &Event);
#if 0
- int HandleEvents(const SDL_Event &Event);
+ int handleEvents(const SDL_Event &Event);
#endif
void SetInfo();
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index ad2f0c7f3ee..15d06b82a01 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -67,11 +67,11 @@ void GameSaveMenu::ScanDir() {
menu.AssignPaths();
}
-bool GameSaveMenu::HandleEvents(const Common::Event &Event) {
+bool GameSaveMenu::handleEvents(const Common::Event &Event) {
int choice = -1;
switch (state) {
case STATE_NORMAL:
- choice = menu.HandleEvents(Event);
+ choice = menu.handleEvents(Event);
if (choice >= 0) {
ta_name.x = menu.CurX(choice) + td_b[DATA_SAVENAME].x;
ta_name.y = menu.CurY(choice) + td_b[DATA_SAVENAME].y;
@@ -90,7 +90,7 @@ bool GameSaveMenu::HandleEvents(const Common::Event &Event) {
if (g_engine->_inputManager->GetKeyBindingMode() != input::KBM_UI)
g_engine->_inputManager->SetKeyBindingMode(KBM_UI);
- if (ta_name.HandleEvents(Event)) {
+ if (ta_name.handleEvents(Event)) {
if (index <= (int)slot_info.size() && index != 0)
g_engine->getSaveFileManager()->removeSavefile(slot_info[index].path);
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 7d09eb802e7..ecc6771ba99 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -65,9 +65,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- bool HandleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &Event);
#if 0
- bool HandleEvents(const SDL_Event &Event);
+ bool handleEvents(const SDL_Event &Event);
#endif
void draw();
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index b890fdce35f..3825ce1eb6f 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -77,34 +77,34 @@ void SlideShow::draw() {
next.draw();
}
-void SlideShow::HandleEvents(const Common::Event &Event) {
+void SlideShow::handleEvents(const Common::Event &Event) {
using namespace pyrodactyl::input;
if (index > 0)
- if (prev.HandleEvents(Event) == BUAC_LCLICK) {
+ if (prev.handleEvents(Event) == BUAC_LCLICK) {
index--;
Refresh();
}
if (index < path.size() - 1)
- if (next.HandleEvents(Event) == BUAC_LCLICK) {
+ if (next.handleEvents(Event) == BUAC_LCLICK) {
index++;
Refresh();
}
}
#if 0
-void SlideShow::HandleEvents(const SDL_Event &Event) {
+void SlideShow::handleEvents(const SDL_Event &Event) {
using namespace pyrodactyl::input;
if (index > 0)
- if (prev.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)) {
+ if (prev.handleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)) {
index--;
Refresh();
}
if (index < path.size() - 1)
- if (next.HandleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
+ if (next.handleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
index++;
Refresh();
}
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 43a40bf48a2..63b2ce3f881 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -71,9 +71,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- void HandleEvents(const Common::Event &Event);
+ void handleEvents(const Common::Event &Event);
#if 0
- void HandleEvents(const SDL_Event &Event);
+ void handleEvents(const SDL_Event &Event);
#endif
void draw();
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 1d478314d95..9c3a4e9e4d4 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -54,8 +54,8 @@ void ToggleButton::draw(const int &XOffset, const int &YOffset, Rect *clip) {
g_engine->_imageManager->draw(x + offset.x, y + offset.y, off);
}
-ButtonAction ToggleButton::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
- ButtonAction action = Button::HandleEvents(Event, XOffset, YOffset);
+ButtonAction ToggleButton::handleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ ButtonAction action = Button::handleEvents(Event, XOffset, YOffset);
if (action == BUAC_LCLICK)
state = !state;
@@ -64,8 +64,8 @@ ButtonAction ToggleButton::HandleEvents(const Common::Event &Event, const int &X
}
#if 0
-ButtonAction ToggleButton::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
- ButtonAction action = Button::HandleEvents(Event, XOffset, YOffset);
+ButtonAction ToggleButton::handleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
+ ButtonAction action = Button::handleEvents(Event, XOffset, YOffset);
if (action == BUAC_LCLICK)
state = !state;
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index 27fe817b30b..383d51fd66a 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -62,9 +62,9 @@ public:
void draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
#if 0
- ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
- ButtonAction HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ ButtonAction handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 2491ae68b86..a121be596af 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -84,8 +84,8 @@ void TraitMenu::draw(const pyrodactyl::people::Person *obj) {
i.draw();
}
-void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event) {
- int choice = menu.HandleEvents(Event);
+void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event) {
+ int choice = menu.handleEvents(Event);
if (choice >= 0) {
for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
i->State(false);
@@ -101,8 +101,8 @@ void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const Common::Even
}
#if 0
-void TraitMenu::HandleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event) {
- int choice = menu.HandleEvents(Event);
+void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event) {
+ int choice = menu.handleEvents(Event);
if (choice >= 0) {
for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
i->State(false);
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index e31734c8184..7e6e3f6ac6f 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -75,9 +75,9 @@ public:
void load(rapidxml::xml_node<char> *node);
void draw(const pyrodactyl::people::Person *obj);
- void HandleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event);
+ void handleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event);
#if 0
- void HandleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event);
+ void handleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event);
#endif
void Cache(const pyrodactyl::people::Person &obj);
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index a3b823f5274..cbcde3eaaab 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -145,7 +145,7 @@ void Button::HoverInfoOnlyDraw(const int &XOffset, const int &YOffset, Rect *cli
//------------------------------------------------------------------------
// Purpose: Handle input and stuff
//------------------------------------------------------------------------
-ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ButtonAction Button::handleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
Rect dim = *this;
dim.x += XOffset;
dim.y += YOffset;
@@ -183,7 +183,7 @@ ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset
} else if (Event.type == Common::EVENT_RBUTTONUP)
return BUAC_RCLICK;
}
- } else if (hotkey.HandleEvents(Event)) {
+ } else if (hotkey.handleEvents(Event)) {
g_engine->_musicManager->PlayEffect(se_click, 0);
return BUAC_LCLICK;
}
@@ -196,7 +196,7 @@ ButtonAction Button::HandleEvents(const Common::Event &Event, const int &XOffset
//------------------------------------------------------------------------
// Purpose: Handle input and stuff
//------------------------------------------------------------------------
-ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
+ButtonAction Button::handleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
Rect dim = *this;
dim.x += XOffset;
dim.y += YOffset;
@@ -234,7 +234,7 @@ ButtonAction Button::HandleEvents(const SDL_Event &Event, const int &XOffset, co
} else if (Event.button.button == SDL_BUTTON_RIGHT)
return BUAC_RCLICK;
}
- } else if (hotkey.HandleEvents(Event)) {
+ } else if (hotkey.handleEvents(Event)) {
g_engine->_musicManager->PlayEffect(se_click, 0);
return BUAC_LCLICK;
}
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index dd51518cddc..743aa167e5f 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -118,9 +118,9 @@ public:
void draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
- ButtonAction HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ ButtonAction handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
- ButtonAction HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
// Special functions to only draw parts of a button (used in special situations like world map)
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index ed505f99e19..a3e31d1bda7 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -82,16 +82,16 @@ void GameDialogBox::draw(pyrodactyl::event::Info &info, Common::String &message)
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
-bool GameDialogBox::HandleEvents(const Common::Event &Event) {
- return (button.HandleEvents(Event) == BUAC_LCLICK);
+bool GameDialogBox::handleEvents(const Common::Event &Event) {
+ return (button.handleEvents(Event) == BUAC_LCLICK);
}
#if 0
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
-bool GameDialogBox::HandleEvents(const SDL_Event &Event) {
- return (button.HandleEvents(Event) == BUAC_LCLICK);
+bool GameDialogBox::handleEvents(const SDL_Event &Event) {
+ return (button.handleEvents(Event) == BUAC_LCLICK);
}
#endif
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index 50dca5b8129..f1aa52af21d 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -72,10 +72,10 @@ public:
void draw(pyrodactyl::event::Info &info, Common::String &message);
void draw(const bool &player);
- bool HandleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &Event);
#if 0
- bool HandleEvents(const SDL_Event &Event);
+ bool handleEvents(const SDL_Event &Event);
#endif
void setUI();
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index b4c1ce5d7f7..ff5bf71b14d 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -121,10 +121,10 @@ void HUD::internalEvents(bool ShowMap) {
}
}
-HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
+HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
g_engine->_mouse->inside_hud = bg.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y);
- int choice = menu.HandleEvents(Event);
+ int choice = menu.handleEvents(Event);
if (choice == HS_JOURNAL)
info.unread.journal = false;
@@ -139,10 +139,10 @@ HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &
}
#if 0
-HUDSignal HUD::HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
+HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
g_engine->_mouse->inside_hud = bg.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y);
- int choice = menu.HandleEvents(Event);
+ int choice = menu.handleEvents(Event);
if (choice == HS_JOURNAL)
info.unread.journal = false;
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 5b130d499db..f7cd76e1b41 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -100,9 +100,9 @@ public:
void load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
- HUDSignal HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
+ HUDSignal handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
- HUDSignal HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
+ HUDSignal handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
void draw(pyrodactyl::event::Info &info, const Common::String &id);
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 1ed2a04bcf4..df51f16c519 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -128,8 +128,8 @@ void Journal::draw(const Common::String &id) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool Journal::HandleEvents(const Common::String &id, const Common::Event &Event) {
- int choice = category.HandleEvents(Event);
+bool Journal::handleEvents(const Common::String &id, const Common::Event &Event) {
+ int choice = category.handleEvents(Event);
if (choice >= 0 && (unsigned int)choice < category.element.size())
Select(id, choice);
@@ -138,7 +138,7 @@ bool Journal::HandleEvents(const Common::String &id, const Common::Event &Event)
// Always find valid journal group first
for (auto &jo : journal)
if (jo.id == id)
- return jo.menu[select].HandleEvents(bu_map, marker_title, Event);
+ return jo.menu[select].handleEvents(bu_map, marker_title, Event);
}
return false;
@@ -148,8 +148,8 @@ bool Journal::HandleEvents(const Common::String &id, const Common::Event &Event)
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool Journal::HandleEvents(const Common::String &id, const SDL_Event &Event) {
- int choice = category.HandleEvents(Event);
+bool Journal::handleEvents(const Common::String &id, const SDL_Event &Event) {
+ int choice = category.handleEvents(Event);
if (choice >= 0 && choice < category.element.size())
Select(id, choice);
@@ -158,7 +158,7 @@ bool Journal::HandleEvents(const Common::String &id, const SDL_Event &Event) {
// Always find valid journal group first
for (auto &jo : journal)
if (jo.id == id)
- return jo.menu[select].HandleEvents(bu_map, marker_title, Event);
+ return jo.menu[select].handleEvents(bu_map, marker_title, Event);
}
return false;
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index d9dc7e9f55e..e5539b14d1c 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -98,9 +98,9 @@ public:
void draw(const Common::String &id);
// Return true if "go to map" is selected
- bool HandleEvents(const Common::String &id, const Common::Event &Event);
+ bool handleEvents(const Common::String &id, const Common::Event &Event);
#if 0
- bool HandleEvents(const Common::String &id, const SDL_Event &Event);
+ bool handleEvents(const Common::String &id, const SDL_Event &Event);
#endif
void Add(const Common::String &id, const Common::String &Category, const Common::String &Title, const Common::String &Text);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 00ca51bb77b..d4309fc3c21 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -187,7 +187,7 @@ void Map::Move(const Common::Event &Event) {
vel.y = 0;
// We don't use the result, but this keeps the button states up to date
- scroll.HandleEvents(Event);
+ scroll.handleEvents(Event);
switch (Event.type) {
case Common::EVENT_LBUTTONDOWN:
@@ -263,7 +263,7 @@ void Map::Move(const SDL_Event &Event) {
vel.y = 0;
// We don't use the result, but this keeps the button states up to date
- scroll.HandleEvents(Event);
+ scroll.handleEvents(Event);
switch (Event.type) {
case SDL_MOUSEBUTTONDOWN: {
@@ -343,18 +343,18 @@ void Map::internalEvents(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-bool Map::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
- int choice = travel.HandleEvents(Event, -1 * camera.x, -1 * camera.y);
+bool Map::handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
+ int choice = travel.handleEvents(Event, -1 * camera.x, -1 * camera.y);
if (choice >= 0) {
cur_loc = travel.element[choice].loc;
pan = false;
return true;
}
- marker.HandleEvents(pos, player_pos, camera, Event);
+ marker.handleEvents(pos, player_pos, camera, Event);
Move(Event);
- if (bu_overlay.HandleEvents(Event) == BUAC_LCLICK)
+ if (bu_overlay.handleEvents(Event) == BUAC_LCLICK)
overlay = bu_overlay.state;
return false;
@@ -364,18 +364,18 @@ bool Map::HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-bool Map::HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
- int choice = travel.HandleEvents(Event, -1 * camera.x, -1 * camera.y);
+bool Map::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
+ int choice = travel.handleEvents(Event, -1 * camera.x, -1 * camera.y);
if (choice >= 0) {
cur_loc = travel.element[choice].loc;
pan = false;
return true;
}
- marker.HandleEvents(pos, player_pos, camera, Event);
+ marker.handleEvents(pos, player_pos, camera, Event);
Move(Event);
- if (bu_overlay.HandleEvents(Event) == BUAC_LCLICK)
+ if (bu_overlay.handleEvents(Event) == BUAC_LCLICK)
overlay = bu_overlay.state;
return false;
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index f296ebf8d53..a31f79112bb 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -121,9 +121,9 @@ public:
void load(const Common::String &filename, pyrodactyl::event::Info &info);
void draw(pyrodactyl::event::Info &info);
- bool HandleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
+ bool handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
- bool HandleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
+ bool handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
void internalEvents(pyrodactyl::event::Info &info);
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 59881affa84..9801f293948 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -256,7 +256,7 @@ public:
// The reason this function doesn't declare its own Event object is because
// a menu might not be the only object in a game state
//------------------------------------------------------------------------
- int HandleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
+ int handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
// The keyboard/joystick event handling bit
if (use_keyboard) {
int result = HandleKeyboard(Event);
@@ -281,7 +281,7 @@ public:
int i = 0;
for (auto it = element.begin(); it != element.end(); ++it, ++i) {
// We clicked on a button using the mouse
- if (it->HandleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
+ if (it->handleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
// Reset the menu state
reset();
g_engine->_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
@@ -313,7 +313,7 @@ public:
// The reason this function doesn't declare its own Event object is because
// a menu might not be the only object in a game state
//------------------------------------------------------------------------
- int HandleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
+ int handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
// The keyboard/joystick event handling bit
if (use_keyboard) {
int result = HandleKeyboard(Event);
@@ -337,7 +337,7 @@ public:
int i = 0;
for (auto it = element.begin(); it != element.end(); ++it, ++i) {
// We clicked on a button using the mouse
- if (it->HandleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
+ if (it->handleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
// Reset the menu state
reset();
return i;
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 34d217d601e..713d0ff0248 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -152,8 +152,8 @@ void QuestMenu::draw(Button &bu_map) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event) {
- int res = menu.HandleEvents(Event);
+bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event) {
+ int res = menu.handleEvents(Event);
if (res != -1) {
if (sel_bu >= 0 && sel_page >= 0)
menu.Image(sel_bu, sel_page, img_n);
@@ -170,13 +170,13 @@ bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const Co
if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
if (quest[sel_quest].marker)
- if (bu_map.HandleEvents(Event) == BUAC_LCLICK) {
+ if (bu_map.handleEvents(Event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
map_title = quest[sel_quest].title;
return true;
}
- text.HandleEvents(quest[sel_quest], Event);
+ text.handleEvents(quest[sel_quest], Event);
}
return false;
@@ -186,8 +186,8 @@ bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const Co
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event) {
- int res = menu.HandleEvents(Event);
+bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event) {
+ int res = menu.handleEvents(Event);
if (res != -1) {
if (sel_bu >= 0 && sel_page >= 0)
menu.Image(sel_bu, sel_page, img_n);
@@ -204,13 +204,13 @@ bool QuestMenu::HandleEvents(Button &bu_map, Common::String &map_title, const SD
if (sel_quest >= 0 && sel_quest < quest.size()) {
if (quest[sel_quest].marker)
- if (bu_map.HandleEvents(Event) == BUAC_LCLICK) {
+ if (bu_map.handleEvents(Event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
map_title = quest[sel_quest].title;
return true;
}
- text.HandleEvents(quest[sel_quest], Event);
+ text.handleEvents(quest[sel_quest], Event);
}
return false;
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 185541424a2..e495d0b06e9 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -77,9 +77,9 @@ public:
void load(rapidxml::xml_node<char> *node);
void draw(Button &bu_map);
- bool HandleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event);
+ bool handleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event);
#if 0
- bool HandleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event);
+ bool handleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event);
#endif
void UseKeyboard(const bool &val) { menu.UseKeyboard(val); }
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 8480ca3eaeb..52d4a086c85 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -57,9 +57,9 @@ void Slider::load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
CreateBackup();
}
-bool Slider::HandleEvents(const Common::Event &Event) {
+bool Slider::handleEvents(const Common::Event &Event) {
// A person is moving the knob
- if (knob.HandleEvents(Event) == BUAC_GRABBED) {
+ if (knob.handleEvents(Event) == BUAC_GRABBED) {
int dx = g_engine->_mouse->motion.x - bar.x;
if (dx < 0)
@@ -87,9 +87,9 @@ bool Slider::HandleEvents(const Common::Event &Event) {
}
#if 0
-bool Slider::HandleEvents(const SDL_Event &Event) {
+bool Slider::handleEvents(const SDL_Event &Event) {
// A person is moving the knob
- if (knob.HandleEvents(Event) == BUAC_GRABBED) {
+ if (knob.handleEvents(Event) == BUAC_GRABBED) {
int dx = g_engine->_mouse->motion.x - bar.x;
if (dx < 0)
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index ae95d7f1c3f..2dc8d1730dc 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -68,10 +68,10 @@ public:
void load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val);
- bool HandleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &Event);
#if 0
// Return true if volume changed
- bool HandleEvents(const SDL_Event &Event);
+ bool handleEvents(const SDL_Event &Event);
#endif
void draw();
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 44860e7f8e1..5661a7e808f 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -55,8 +55,8 @@ void TextArea::load(rapidxml::xml_node<char> *node) {
}
}
-bool TextArea::HandleEvents(const Common::Event &Event, bool numbers_only) {
- warning("STUB: TextArea::HandleEvents()");
+bool TextArea::handleEvents(const Common::Event &Event, bool numbers_only) {
+ warning("STUB: TextArea::handleEvents()");
if (Event.type == Common::EVENT_KEYDOWN && Event.kbd.ascii == Common::ASCII_BACKSPACE && text.size() != 0) {
// Now play the text erase sound
g_engine->_musicManager->PlayEffect(se_erase, 0);
@@ -92,7 +92,7 @@ bool TextArea::HandleEvents(const Common::Event &Event, bool numbers_only) {
#if 0
-bool TextArea::HandleEvents(const SDL_Event &Event, bool numbers_only) {
+bool TextArea::handleEvents(const SDL_Event &Event, bool numbers_only) {
// If a key was pressed
if (Event.type == SDL_TEXTINPUT) {
// If the string less than maximum size and does not contain invalid characters \ / : * ? " < > |
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 6454d21a2fb..486ed45abfd 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -68,9 +68,9 @@ public:
void load(rapidxml::xml_node<char> *node);
- bool HandleEvents(const Common::Event &Event, bool numbers_only = false);
+ bool handleEvents(const Common::Event &Event, bool numbers_only = false);
#if 0
- bool HandleEvents(const SDL_Event &Event, bool numbers_only = false);
+ bool handleEvents(const SDL_Event &Event, bool numbers_only = false);
#endif
void draw();
Commit: 0670044eaad1ab20410aecbdaab405f5d2a17a1e
https://github.com/scummvm/scummvm/commit/0670044eaad1ab20410aecbdaab405f5d2a17a1e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make GameEventStore and EventSequence follow code formatting conventions
Changed paths:
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/gameevent.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/ui/emotion.cpp
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 1093455a9a7..6b6ba24d1bb 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -45,16 +45,16 @@ void EventSeqGroup::addSeq(const unsigned int &id, Common::String &path) {
}
bool EventSeqGroup::eventInProgress(const unsigned int &id) {
- return _seq.contains(id) > 0 && _seq[id].EventInProgress();
+ return _seq.contains(id) > 0 && _seq[id].eventInProgress();
}
GameEvent *EventSeqGroup::curEvent(const unsigned int &id) {
- return _seq[id].CurrentEvent();
+ return _seq[id].currentEvent();
}
void EventSeqGroup::nextEvent(const unsigned int &id, Info &info, const Common::String &playerId,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq, const int choice) {
- return _seq[id].NextEvent(info, playerId, result, endSeq, choice);
+ return _seq[id].nextEvent(info, playerId, result, endSeq, choice);
}
void EventSeqGroup::internalEvents(Info &info) {
@@ -64,7 +64,7 @@ void EventSeqGroup::internalEvents(Info &info) {
bool EventSeqGroup::activeSeq(unsigned int &activeSeq) {
for (auto i = _seq.begin(); i != _seq.end(); ++i)
- if (i->_value.EventInProgress()) {
+ if (i->_value.eventInProgress()) {
activeSeq = i->_key;
return true;
}
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 53a9a235bf3..25c4258e92b 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -44,7 +44,7 @@ void EventSequence::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("events");
for (auto n = node->first_node("event"); n != NULL; n = n->next_sibling("event")) {
GameEvent e(n);
- events.push_back(e);
+ _events.push_back(e);
}
}
}
@@ -53,11 +53,11 @@ void EventSequence::load(const Common::String &filename) {
// Purpose: Check for events happening
//------------------------------------------------------------------------
void EventSequence::internalEvents(pyrodactyl::event::Info &info) {
- for (auto nxe = next.begin(); nxe != next.end(); ++nxe)
- if (*nxe < events.size()) {
- if (events[*nxe].trig.Evaluate(info)) {
- event_in_progress = true;
- cur = *nxe;
+ for (auto nxe = _next.begin(); nxe != _next.end(); ++nxe)
+ if (*nxe < _events.size()) {
+ if (_events[*nxe].trig.Evaluate(info)) {
+ _eventInProgress = true;
+ _cur = *nxe;
break;
}
}
@@ -66,13 +66,13 @@ void EventSequence::internalEvents(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
// Purpose: Go to next event
//------------------------------------------------------------------------
-void EventSequence::NextEvent(pyrodactyl::event::Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
+void EventSequence::nextEvent(pyrodactyl::event::Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
Common::Array<EventSeqInfo> &end_seq, int NextEventChoice) {
bool sync = false;
- event_in_progress = false;
+ _eventInProgress = false;
// Execute all effects associated with the event
- for (auto i = events[cur].effect.begin(); i != events[cur].effect.end(); ++i)
+ for (auto i = _events[_cur].effect.begin(); i != _events[_cur].effect.end(); ++i)
if (i->execute(info, player_id, result, end_seq))
sync = true;
@@ -97,14 +97,14 @@ void EventSequence::NextEvent(pyrodactyl::event::Info &info, const Common::Strin
}
// Clear the next event list
- next.clear();
+ _next.clear();
// Add the next event to the event list
if (NextEventChoice != -1)
- next.push_back(NextEventChoice);
+ _next.push_back(NextEventChoice);
else {
- for (auto i = events[cur].next.begin(); i != events[cur].next.end(); ++i)
- next.push_back(*i);
+ for (auto i = _events[_cur].next.begin(); i != _events[_cur].next.end(); ++i)
+ _next.push_back(*i);
}
}
@@ -116,12 +116,12 @@ void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
// Write current event id and name to node
seqnode->append_attribute(doc.allocate_attribute("name", name));
- seqnode->append_attribute(doc.allocate_attribute("current", gStrPool->Get(cur)));
+ seqnode->append_attribute(doc.allocate_attribute("current", gStrPool->Get(_cur)));
// Prepare strings of next events and write them
- for (unsigned int i = 0; i < next.size(); i++) {
+ for (unsigned int i = 0; i < _next.size(); i++) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "next");
- child->value(gStrPool->Get(next[i]));
+ child->value(gStrPool->Get(_next[i]));
seqnode->append_node(child);
}
@@ -134,14 +134,14 @@ void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
void EventSequence::loadState(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *curid = node->first_attribute("current");
if (curid != NULL)
- cur = StringToNumber<unsigned int>(curid->value());
+ _cur = StringToNumber<unsigned int>(curid->value());
- next.clear();
+ _next.clear();
for (auto n = node->first_node("next"); n != NULL; n = n->next_sibling("next"))
- next.push_back(StringToNumber<unsigned int>(n->value()));
+ _next.push_back(StringToNumber<unsigned int>(n->value()));
- if (next.empty())
- next.push_back(0);
+ if (_next.empty())
+ _next.push_back(0);
}
} // End of namespace Crab
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index 810d947bbad..e203473e31f 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -44,34 +44,42 @@ namespace Crab {
namespace pyrodactyl {
namespace event {
class EventSequence {
- Common::Array<GameEvent> events;
- bool event_in_progress;
+ Common::Array<GameEvent> _events;
+ bool _eventInProgress;
// The event currently in execution - updated only when all trigger conditions are met in InternalEvents
- unsigned int cur;
+ unsigned int _cur;
// The events that can happen next - these are updated when the cur event is over
// This means cur and next operate in an alternating way
// scan next until find event, make it cur, end cur and update next, repeat
- Common::Array<unsigned int> next;
+ Common::Array<unsigned int> _next;
public:
EventSequence() {
- event_in_progress = false;
- next.push_back(0);
- cur = 0;
+ _eventInProgress = false;
+ _next.push_back(0);
+ _cur = 0;
}
+
~EventSequence() {}
- GameEvent *CurrentEvent() { return &events[cur]; }
+ GameEvent *currentEvent() {
+ return &_events[_cur];
+ }
// See if we should trigger any event
void internalEvents(pyrodactyl::event::Info &info);
- void NextEvent(Info &info, const Common::String &player_id, Common::Array<EventResult> &result,
- Common::Array<EventSeqInfo> &end_seq, int NextEventChoice = -1);
+ void nextEvent(Info &info, const Common::String &playerId, Common::Array<EventResult> &result,
+ Common::Array<EventSeqInfo> &endSeq, int nextEventChoice = -1);
- bool EventInProgress() { return event_in_progress; }
- void EventInProgress(bool val) { event_in_progress = val; }
+ bool eventInProgress() {
+ return _eventInProgress;
+ }
+
+ void eventInProgress(bool val) {
+ _eventInProgress = val;
+ }
// Load and save
void load(const Common::String &filename);
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 1ea33aa1fcd..9d84c659c9b 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -185,7 +185,7 @@ void Info::VarDel(const Common::String &name) {
void Info::TraitAdd(const Common::String &per_id, const int &trait_id) {
if (PersonValid(per_id)) // Valid person id
{
- if (trait_id >= 0 && (unsigned int)trait_id < g_engine->_eventStore->trait.size()) // Valid trait id
+ if (trait_id >= 0 && (unsigned int)trait_id < g_engine->_eventStore->_trait.size()) // Valid trait id
{
// Check for duplicate traits, DONT award anything if duplicate found
Person *p = &PersonGet(per_id);
@@ -194,9 +194,9 @@ void Info::TraitAdd(const Common::String &per_id, const int &trait_id) {
if (i->id == trait_id)
return;
- p->trait.push_back(g_engine->_eventStore->trait[trait_id]);
+ p->trait.push_back(g_engine->_eventStore->_trait[trait_id]);
- g_engine->_eventStore->SetAchievement(g_engine->_eventStore->trait[trait_id].id);
+ g_engine->_eventStore->setAchievement(g_engine->_eventStore->_trait[trait_id].id);
}
}
}
@@ -204,7 +204,7 @@ void Info::TraitAdd(const Common::String &per_id, const int &trait_id) {
void Info::TraitDel(const Common::String &per_id, const int &trait_id) {
if (PersonValid(per_id)) // Valid person id
{
- if (trait_id > 0 && (unsigned int)trait_id < g_engine->_eventStore->trait.size()) // Valid trait id
+ if (trait_id > 0 && (unsigned int)trait_id < g_engine->_eventStore->_trait.size()) // Valid trait id
{
Person *p = &PersonGet(per_id);
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 501127115b2..c4b7ebe70e0 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -34,13 +34,13 @@ namespace Crab {
using namespace pyrodactyl::event;
-void GameEventStore::AddConv(rapidxml::xml_node<char> *node, unsigned int &index) {
+void GameEventStore::addConv(rapidxml::xml_node<char> *node, unsigned int &index) {
ConversationData c;
if (nodeValid("talk", node))
c.load(node->first_node("talk"));
- index = con.size();
- con.push_back(c);
+ index = _con.size();
+ _con.push_back(c);
}
void GameEventStore::load(const Common::String &filename) {
@@ -58,33 +58,33 @@ void GameEventStore::load(const Common::String &filename) {
if (nodeValid("animations", node)) {
rapidxml::xml_node<char> *animnode = node->first_node("animations");
for (auto n = animnode->first_node("anim"); n != NULL; n = n->next_sibling("anim"))
- anim.push_back(n);
+ _anim.push_back(n);
}
if (nodeValid("tones", node)) {
rapidxml::xml_node<char> *tonenode = node->first_node("tones");
for (auto n = tonenode->first_node("tone"); n != NULL; n = n->next_sibling("tone")) {
ToneData dat;
- loadStr(dat.text, "text", n);
- tone.push_back(dat);
+ loadStr(dat._text, "text", n);
+ _tone.push_back(dat);
}
}
if (nodeValid("images", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("images");
for (auto n = imgnode->first_node("img"); n != NULL; n = n->next_sibling("img"))
- img.push_back(n);
+ _img.push_back(n);
}
if (nodeValid("traits", node)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
for (auto n = traitnode->first_node("trait"); n != NULL; n = n->next_sibling("trait"))
- trait.push_back(n);
+ _trait.push_back(n);
}
}
}
-void GameEventStore::SetAchievement(const int &id) {
+void GameEventStore::setAchievement(const int &id) {
/*
if (m_pSteamUserStats != nullptr)
{
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 728f89bea2f..d835de99427 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -43,44 +43,45 @@ namespace event {
// This structure is responsible for storing the special data structures for events like replies, conversations
struct GameEventStore {
// Data related to conversation events
- Common::Array<ConversationData> con;
+ Common::Array<ConversationData> _con;
// Data related to animations
- Common::Array<pyrodactyl::anim::Animation> anim;
+ Common::Array<pyrodactyl::anim::Animation> _anim;
// Data related to the tones of a character
struct ToneData {
- Common::String text;
+ Common::String _text;
};
// This sets the text the player sees as "tone" during the reply menu
- Common::Array<ToneData> tone;
+ Common::Array<ToneData> _tone;
// We need to change player character images when switching between characters
- Common::Array<pyrodactyl::ui::StateButtonImage> img;
+ Common::Array<pyrodactyl::ui::StateButtonImage> _img;
// The set of traits for various characters
- Common::Array<pyrodactyl::people::Trait> trait;
+ Common::Array<pyrodactyl::people::Trait> _trait;
// Steam UserStats interface
// ISteamUserStats *m_pSteamUserStats;
GameEventStore() {
// Huge number to prevent lots of resizing and stuff
- con.reserve(9999);
+ _con.reserve(9999);
- trait.reserve(120);
- tone.reserve(120);
+ _trait.reserve(120);
+ _tone.reserve(120);
}
- void Clear() {
- con.clear();
- anim.clear();
+ void clear() {
+ _con.clear();
+ _anim.clear();
}
+
void load(const Common::String &filename);
- void AddConv(rapidxml::xml_node<char> *node, unsigned int &index);
- void SetAchievement(const int &id);
+ void addConv(rapidxml::xml_node<char> *node, unsigned int &index);
+ void setAchievement(const int &id);
};
} // End of namespace event
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index 3dd14ced84f..0f3784edccc 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -58,7 +58,7 @@ void GameEvent::load(rapidxml::xml_node<char> *node) {
special = 0;
} else if (Type == "reply") {
type = EVENT_REPLY;
- g_engine->_eventStore->AddConv(node, special);
+ g_engine->_eventStore->addConv(node, special);
} else if (Type == "animation") {
type = EVENT_ANIM;
loadNum(special, "anim", node);
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 8c755a3cfdc..fb6023b0cdd 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -140,7 +140,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
if (info.PersonValid(cur_event->title))
info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
- int choice = reply.handleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
+ int choice = reply.handleEvents(info, g_engine->_eventStore->_con[cur_event->special], cur_event->title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -280,7 +280,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
using namespace pyrodactyl::anim;
DrawType draw_val = DRAW_SAME;
- if (g_engine->_eventStore->anim[cur_event->special].internalEvents(draw_val))
+ if (g_engine->_eventStore->_anim[cur_event->special].internalEvents(draw_val))
event_map[info.CurLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
@@ -319,7 +319,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].eventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_ANIM:
- g_engine->_eventStore->anim[cur_event->special].draw();
+ g_engine->_eventStore->_anim[cur_event->special].draw();
break;
case EVENT_DIALOG:
g_engine->_imageManager->DimScreen();
@@ -373,10 +373,10 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
switch (cur_event->type) {
case EVENT_ANIM:
- g_engine->_eventStore->anim[cur_event->special].start();
+ g_engine->_eventStore->_anim[cur_event->special].start();
break;
case EVENT_REPLY:
- reply.Cache(info, g_engine->_eventStore->con[cur_event->special]);
+ reply.Cache(info, g_engine->_eventStore->_con[cur_event->special]);
break;
default:
break;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 2644ea9c775..8219577317e 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -57,7 +57,7 @@ void Game::LoadGame() {
void Game::Init(const Common::String &filename) {
g_engine->_loadingScreen->Dim();
- g_engine->_eventStore->Clear();
+ g_engine->_eventStore->clear();
game_over.Clear(false);
state = STATE_GAME;
savefile.auto_slot = false;
diff --git a/engines/crab/game.h b/engines/crab/game.h
index c01fb935d41..9deb0d26b37 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -120,7 +120,7 @@ private:
}
// Load the current player image
- void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->img[info.PlayerImg()]); }
+ void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->_img[info.PlayerImg()]); }
public:
Game() : _isInited(false) {}
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 514f604f055..8282cc09899 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -42,8 +42,8 @@ void EmotionIndicator::load(rapidxml::xml_node<char> *node) {
void EmotionIndicator::draw(const int &select) {
if (select >= 0 && (unsigned int)select < value.size())
- if (value[select] < g_engine->_eventStore->tone.size()) {
- text.draw(g_engine->_eventStore->tone[value[select]].text);
+ if (value[select] < g_engine->_eventStore->_tone.size()) {
+ text.draw(g_engine->_eventStore->_tone[value[select]]._text);
}
}
Commit: 73c5c049e190082e3c366e4102fc50a0032265c7
https://github.com/scummvm/scummvm/commit/73c5c049e190082e3c366e4102fc50a0032265c7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make GameEvent follow code formatting conventions
Changed paths:
engines/crab/event/EventSequence.cpp
engines/crab/event/gameevent.cpp
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.cpp
engines/crab/ui/PersonHandler.cpp
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 25c4258e92b..b4247ca35c1 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -55,7 +55,7 @@ void EventSequence::load(const Common::String &filename) {
void EventSequence::internalEvents(pyrodactyl::event::Info &info) {
for (auto nxe = _next.begin(); nxe != _next.end(); ++nxe)
if (*nxe < _events.size()) {
- if (_events[*nxe].trig.Evaluate(info)) {
+ if (_events[*nxe]._trig.Evaluate(info)) {
_eventInProgress = true;
_cur = *nxe;
break;
@@ -72,7 +72,7 @@ void EventSequence::nextEvent(pyrodactyl::event::Info &info, const Common::Strin
_eventInProgress = false;
// Execute all effects associated with the event
- for (auto i = _events[_cur].effect.begin(); i != _events[_cur].effect.end(); ++i)
+ for (auto i = _events[_cur]._effect.begin(); i != _events[_cur]._effect.end(); ++i)
if (i->execute(info, player_id, result, end_seq))
sync = true;
@@ -103,7 +103,7 @@ void EventSequence::nextEvent(pyrodactyl::event::Info &info, const Common::Strin
if (NextEventChoice != -1)
_next.push_back(NextEventChoice);
else {
- for (auto i = _events[_cur].next.begin(); i != _events[_cur].next.end(); ++i)
+ for (auto i = _events[_cur]._next.begin(); i != _events[_cur]._next.end(); ++i)
_next.push_back(*i);
}
}
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index 0f3784edccc..d03a99d86f5 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -36,55 +36,55 @@ using namespace pyrodactyl::event;
using namespace pyrodactyl::people;
GameEvent::GameEvent() {
- id = 0;
- type = EVENT_DIALOG;
- special = 0;
- state = PST_NORMAL;
+ _id = 0;
+ _type = EVENT_DIALOG;
+ _special = 0;
+ _state = PST_NORMAL;
}
void GameEvent::load(rapidxml::xml_node<char> *node) {
- if (!LoadEventID(id, "id", node))
- id = 0;
+ if (!LoadEventID(_id, "id", node))
+ _id = 0;
- loadStr(title, "title", node);
- loadStr(dialog, "dialog", node);
- loadEnum(state, "state", node, false);
+ loadStr(_title, "title", node);
+ loadStr(_dialog, "dialog", node);
+ loadEnum(_state, "state", node, false);
- Common::String Type;
- loadStr(Type, "type", node);
+ Common::String type;
+ loadStr(type, "type", node);
- if (Type == "dlg") {
- type = EVENT_DIALOG;
- special = 0;
- } else if (Type == "reply") {
- type = EVENT_REPLY;
- g_engine->_eventStore->addConv(node, special);
- } else if (Type == "animation") {
- type = EVENT_ANIM;
- loadNum(special, "anim", node);
- } else if (Type == "silent") {
- type = EVENT_SILENT;
- special = 0;
- } else if (Type == "text") {
- type = EVENT_TEXT;
- special = 0;
+ if (type == "dlg") {
+ _type = EVENT_DIALOG;
+ _special = 0;
+ } else if (type == "reply") {
+ _type = EVENT_REPLY;
+ g_engine->_eventStore->addConv(node, _special);
+ } else if (type == "animation") {
+ _type = EVENT_ANIM;
+ loadNum(_special, "anim", node);
+ } else if (type == "silent") {
+ _type = EVENT_SILENT;
+ _special = 0;
+ } else if (type == "text") {
+ _type = EVENT_TEXT;
+ _special = 0;
} else {
- type = EVENT_SPLASH;
- special = 0;
+ _type = EVENT_SPLASH;
+ _special = 0;
}
- trig.load(node);
+ _trig.load(node);
- next.clear();
+ _next.clear();
for (rapidxml::xml_node<char> *i = node->first_node("next"); i != NULL; i = i->next_sibling("next"))
if (i->first_attribute("id") != NULL)
- next.push_back(StringToNumber<EventID>(i->first_attribute("id")->value()));
+ _next.push_back(StringToNumber<EventID>(i->first_attribute("id")->value()));
- effect.clear();
+ _effect.clear();
for (rapidxml::xml_node<char> *it = node->first_node("effect"); it != NULL; it = it->next_sibling("effect")) {
Effect e;
e.load(it);
- effect.push_back(e);
+ _effect.push_back(e);
}
}
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index 30cb023af8c..3db5c8d8042 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -60,32 +60,36 @@ enum EventType {
struct GameEvent {
// The event identifier
- EventID id;
+ EventID _id;
// The heading for the dialog spoken
- Common::String title;
+ Common::String _title;
// The dialog spoken in the event
- Common::String dialog;
+ Common::String _dialog;
// The state decides which animation is drawn in the dialog box
- pyrodactyl::people::PersonState state;
+ pyrodactyl::people::PersonState _state;
// Event type and related data index
- EventType type;
- unsigned int special;
+ EventType _type;
+ unsigned int _special;
// The variables changed/added in the event
- Common::Array<Effect> effect;
+ Common::Array<Effect> _effect;
// The triggers for the event
- TriggerSet trig;
+ TriggerSet _trig;
// The id of the next event
- Common::Array<EventID> next;
+ Common::Array<EventID> _next;
GameEvent();
- GameEvent(rapidxml::xml_node<char> *node) : GameEvent() { load(node); }
+
+ GameEvent(rapidxml::xml_node<char> *node) : GameEvent() {
+ load(node);
+ }
+
~GameEvent() {}
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index fb6023b0cdd..02b5a9abc57 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -98,7 +98,7 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
void Manager::handleEvents(Info &info, const Common::String &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].eventInProgress(active_seq)) {
- switch (cur_event->type) {
+ switch (cur_event->_type) {
case EVENT_DIALOG:
if (oh.show_journal) {
info.journal.handleEvents(player_id, Event);
@@ -108,8 +108,8 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event)) {
- if (info.PersonValid(cur_event->title)) {
- Person &p = info.PersonGet(cur_event->title);
+ if (info.PersonValid(cur_event->_title)) {
+ Person &p = info.PersonGet(cur_event->_title);
if (p.alt_journal_name)
info.journal.Open(player_id, JE_PEOPLE, p.journal_name);
else
@@ -137,10 +137,10 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.PersonValid(cur_event->title))
- info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
+ if (info.PersonValid(cur_event->_title))
+ info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
- int choice = reply.handleEvents(info, g_engine->_eventStore->_con[cur_event->special], cur_event->title, oh, Event);
+ int choice = reply.handleEvents(info, g_engine->_eventStore->_con[cur_event->_special], cur_event->_title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -150,15 +150,15 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
case EVENT_TEXT:
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.PersonValid(cur_event->title))
- info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
+ if (info.PersonValid(cur_event->_title))
+ info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
if (textin.handleEvents(Event))
event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
- per.handleEvents(info, cur_event->title, Event);
+ per.handleEvents(info, cur_event->_title, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
intro.show_traits = false;
@@ -195,8 +195,8 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event)) {
- if (info.PersonValid(cur_event->title)) {
- Person &p = info.PersonGet(cur_event->title);
+ if (info.PersonValid(cur_event->_title)) {
+ Person &p = info.PersonGet(cur_event->_title);
if (p.alt_journal_name)
info.journal.Open(player_id, JE_PEOPLE, p.journal_name);
else
@@ -224,10 +224,10 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.PersonValid(cur_event->title))
- info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
+ if (info.PersonValid(cur_event->_title))
+ info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
- int choice = reply.handleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->title, oh, Event);
+ int choice = reply.handleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->_title, oh, Event);
if (choice >= 0) {
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
@@ -237,15 +237,15 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
case EVENT_TEXT:
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.PersonValid(cur_event->title))
- info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->title).name);
+ if (info.PersonValid(cur_event->_title))
+ info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
if (textin.handleEvents(Event))
event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
- per.handleEvents(info, cur_event->title, Event);
+ per.handleEvents(info, cur_event->_title, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
intro.show_traits = false;
@@ -272,7 +272,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
if (event_map.contains(info.CurLocID()) > 0) {
if (event_map[info.CurLocID()].eventInProgress(active_seq)) {
- switch (cur_event->type) {
+ switch (cur_event->_type) {
case EVENT_DIALOG:
UpdateDialogBox(info, level);
break;
@@ -280,7 +280,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
using namespace pyrodactyl::anim;
DrawType draw_val = DRAW_SAME;
- if (g_engine->_eventStore->_anim[cur_event->special].internalEvents(draw_val))
+ if (g_engine->_eventStore->_anim[cur_event->_special].internalEvents(draw_val))
event_map[info.CurLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
@@ -310,16 +310,16 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
}
void Manager::UpdateDialogBox(Info &info, Level &level) {
- oh.internalEvents(cur_event->state, cur_sp);
+ oh.internalEvents(cur_event->_state, cur_sp);
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
void Manager::draw(Info &info, HUD &hud, Level &level) {
if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].eventInProgress(active_seq)) {
- switch (cur_event->type) {
+ switch (cur_event->_type) {
case EVENT_ANIM:
- g_engine->_eventStore->_anim[cur_event->special].draw();
+ g_engine->_eventStore->_anim[cur_event->_special].draw();
break;
case EVENT_DIALOG:
g_engine->_imageManager->DimScreen();
@@ -327,7 +327,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
info.journal.draw(level.PlayerID());
hud.back.draw();
} else
- oh.draw(info, cur_event, cur_event->title, player, cur_sp);
+ oh.draw(info, cur_event, cur_event->_title, player, cur_sp);
break;
case EVENT_REPLY:
g_engine->_imageManager->DimScreen();
@@ -335,21 +335,21 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
info.journal.draw(level.PlayerID());
hud.back.draw();
} else {
- oh.draw(info, cur_event, cur_event->title, player, cur_sp);
+ oh.draw(info, cur_event, cur_event->_title, player, cur_sp);
reply.draw();
}
break;
case EVENT_TEXT:
- oh.draw(info, cur_event, cur_event->title, player, cur_sp);
+ oh.draw(info, cur_event, cur_event->_title, player, cur_sp);
textin.draw();
break;
case EVENT_SPLASH:
g_engine->_imageManager->DimScreen();
if (intro.show_traits) {
- per.draw(info, cur_event->title);
+ per.draw(info, cur_event->_title);
hud.back.draw();
} else
- intro.draw(info, cur_event->dialog, cur_sp, cur_event->state);
+ intro.draw(info, cur_event->_dialog, cur_sp, cur_event->_state);
break;
default:
@@ -365,18 +365,18 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
if (event_map[info.CurLocID()].activeSeq(active_seq)) {
// Set all the pointers to the new values
cur_event = event_map[info.CurLocID()].curEvent(active_seq);
- oh.reset(cur_event->title);
- cur_sp = level.GetSprite(cur_event->title);
+ oh.reset(cur_event->_title);
+ cur_sp = level.GetSprite(cur_event->_title);
// The player character's dialog is drawn a bit differently compared to others
- player = (cur_event->title == level.PlayerID());
+ player = (cur_event->_title == level.PlayerID());
- switch (cur_event->type) {
+ switch (cur_event->_type) {
case EVENT_ANIM:
- g_engine->_eventStore->_anim[cur_event->special].start();
+ g_engine->_eventStore->_anim[cur_event->_special].start();
break;
case EVENT_REPLY:
- reply.Cache(info, g_engine->_eventStore->_con[cur_event->special]);
+ reply.Cache(info, g_engine->_eventStore->_con[cur_event->_special]);
break;
default:
break;
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 6eb8388351d..f9faad8822d 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -75,7 +75,7 @@ void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
dlbox.draw(player);
if (s != NULL) {
- Rect r = s->dialogClip(Event->state);
+ Rect r = s->dialogClip(Event->_state);
int x = img.x, y = img.y;
if (sprite_align.x == ALIGN_CENTER)
@@ -105,7 +105,7 @@ void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
jb.draw();
// Draw the dialog box text
- dlbox.draw(info, Event->dialog);
+ dlbox.draw(info, Event->_dialog);
}
bool PersonHandler::HandleCommonEvents(const Common::Event &Event) {
Commit: 1f2055c88bbc6646e85855b7806451dd1e2e8769
https://github.com/scummvm/scummvm/commit/1f2055c88bbc6646e85855b7806451dd1e2e8769
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make GameEventInfo class follow code formatting conventions
Changed paths:
engines/crab/ai/spriteai.cpp
engines/crab/animation/sprite.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/effect.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/event/trigger.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/talknotify.cpp
engines/crab/ui/DevConsole.cpp
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/dialogbox.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 6a032a9ceb9..b72e75c202d 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -50,7 +50,7 @@ double Sprite::distSq(const Sprite &s) {
void Sprite::moveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
if (_aiData._dest._active) {
int num = 0;
- info.StatGet(_id, pyrodactyl::stat::STAT_SPEED, num);
+ info.statGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float playerSpeed = static_cast<float>(num);
@@ -65,7 +65,7 @@ void Sprite::moveToDest(pyrodactyl::event::Info &info, const SpriteConstant &sc)
void Sprite::moveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteConstant &sc) {
if (_aiData._dest._active) {
int num = 0;
- info.StatGet(_id, pyrodactyl::stat::STAT_SPEED, num);
+ info.statGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float playerSpeed = static_cast<float>(num);
@@ -188,7 +188,7 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
break;
} else {
int num = 0;
- info.StatGet(_id, pyrodactyl::stat::STAT_SPEED, num);
+ info.statGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float velocity = static_cast<float>(num);
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 8222dbdac56..026d1f64aca 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -337,7 +337,7 @@ void Sprite::drawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const Common::Event &Event) {
int num = 0;
- info.StatGet(_id, pyrodactyl::stat::STAT_SPEED, num);
+ info.statGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
float player_speed = static_cast<float>(num);
@@ -505,9 +505,9 @@ void Sprite::walk(const bool &reset) {
//------------------------------------------------------------------------
void Sprite::animate(Info &info) {
if (_input.Idle())
- walk(info.State(_id));
+ walk(info.state(_id));
else
- updateFrame(info.State(_id));
+ updateFrame(info.state(_id));
}
void Sprite::animate(const pyrodactyl::people::PersonState &pst) {
@@ -664,15 +664,15 @@ void Sprite::takeDamage(Info &info, Sprite &s) {
using namespace pyrodactyl::music;
FightMove f;
- if (s._animSet._fight.curMove(f) && info.PersonValid(s.id()) && info.PersonValid(_id)) {
- int dmg = -1 * (f._eff._dmg + info.PersonGet(s.id()).stat.val[STAT_ATTACK].cur - info.PersonGet(_id).stat.val[STAT_DEFENSE].cur);
+ if (s._animSet._fight.curMove(f) && info.personValid(s.id()) && info.personValid(_id)) {
+ int dmg = -1 * (f._eff._dmg + info.personGet(s.id()).stat.val[STAT_ATTACK].cur - info.personGet(_id).stat.val[STAT_DEFENSE].cur);
if (dmg >= 0)
dmg = -1;
- info.StatChange(_id, STAT_HEALTH, dmg);
+ info.statChange(_id, STAT_HEALTH, dmg);
int health = 1;
- info.StatGet(_id, STAT_HEALTH, health);
+ info.statGet(_id, STAT_HEALTH, health);
// Play death animation if dead, hurt animation otherwise
if (health <= 0 && f._eff._death != -1)
@@ -706,16 +706,16 @@ void Sprite::exchangeDamage(Info &info, Sprite &s, const SpriteConstant &sc) {
// We change the animation to dying in order to give time to the death animation to play out
int num = 0;
- info.StatGet(s.id(), STAT_HEALTH, num);
+ info.statGet(s.id(), STAT_HEALTH, num);
if (num <= 0) {
- info.State(s.id(), PST_DYING);
- info.StatChange(s.id(), STAT_HEALTH, 1);
+ info.state(s.id(), PST_DYING);
+ info.statChange(s.id(), STAT_HEALTH, 1);
}
- info.StatGet(_id, STAT_HEALTH, num);
+ info.statGet(_id, STAT_HEALTH, num);
if (num <= 0) {
- info.State(_id, PST_DYING);
- info.StatChange(_id, STAT_HEALTH, 1);
+ info.state(_id, PST_DYING);
+ info.statChange(_id, STAT_HEALTH, 1);
}
}
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index b4247ca35c1..b824f859d74 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -79,16 +79,16 @@ void EventSequence::nextEvent(pyrodactyl::event::Info &info, const Common::Strin
// Play a notification sound
using namespace pyrodactyl::music;
- if (info.sound.rep_dec)
+ if (info._sound._repDec)
g_engine->_musicManager->PlayEffect(g_engine->_musicManager->rep_dec, 0);
- else if (info.sound.rep_inc)
+ else if (info._sound._repInc)
g_engine->_musicManager->PlayEffect(g_engine->_musicManager->rep_inc, 0);
- else if (info.sound.notify)
+ else if (info._sound._notify)
g_engine->_musicManager->PlayEffect(g_engine->_musicManager->notify, 0);
- info.sound.notify = false;
- info.sound.rep_dec = false;
- info.sound.rep_inc = false;
+ info._sound._notify = false;
+ info._sound._repDec = false;
+ info._sound._repInc = false;
if (!result.empty() || sync) {
EventResult r;
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 9d84c659c9b..7b6f61569e8 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -53,7 +53,7 @@ void Info::load(rapidxml::xml_node<char> *node) {
if (nodeValid("people", node)) {
rapidxml::xml_node<char> *pnode = node->first_node("people");
- stem.load(pnode->first_attribute("templates")->value());
+ _stem.load(pnode->first_attribute("templates")->value());
XMLDoc conf(pnode->first_attribute("list")->value());
if (conf.ready()) {
@@ -63,24 +63,24 @@ void Info::load(rapidxml::xml_node<char> *node) {
loadNum(OPINION_MAX, "op_max", cnode);
for (auto n = cnode->first_node("group"); n != NULL; n = n->next_sibling("group"))
- LoadPeople(n->value());
+ loadPeople(n->value());
}
}
}
if (nodeValid("objective", node))
- journal.load(node->first_node("objective")->first_attribute("layout")->value());
+ _journal.load(node->first_node("objective")->first_attribute("layout")->value());
if (nodeValid("inventory", node)) {
rapidxml::xml_node<char> *inode = node->first_node("inventory");
- inv.load(inode->first_attribute("layout")->value());
+ _inv.load(inode->first_attribute("layout")->value());
}
- CurLocID(node->first_node("level")->first_attribute("start")->value());
- inv.ItemFile(node->first_node("item")->first_attribute("list")->value());
+ curLocID(node->first_node("level")->first_attribute("start")->value());
+ _inv.ItemFile(node->first_node("item")->first_attribute("list")->value());
}
-void Info::LoadPeople(const Common::String &filename) {
+void Info::loadPeople(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("people");
@@ -88,7 +88,7 @@ void Info::LoadPeople(const Common::String &filename) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
Common::String str;
loadStr(str, "id", n);
- people[str].load(n, stem);
+ _people[str].load(n, _stem);
}
}
}
@@ -97,14 +97,14 @@ void Info::LoadPeople(const Common::String &filename) {
//------------------------------------------------------------------------
// Purpose: Get/Set information about object type
//------------------------------------------------------------------------
-void Info::Type(const Common::String &id, const PersonType &val) {
- if (people.contains(id) > 0)
- people[id].type = val;
+void Info::type(const Common::String &id, const PersonType &val) {
+ if (_people.contains(id) > 0)
+ _people[id].type = val;
}
-PersonType Info::Type(const Common::String &id) {
- if (people.contains(id) > 0)
- return people[id].type;
+PersonType Info::type(const Common::String &id) {
+ if (_people.contains(id) > 0)
+ return _people[id].type;
return PE_NEUTRAL;
}
@@ -112,14 +112,14 @@ PersonType Info::Type(const Common::String &id) {
//------------------------------------------------------------------------
// Purpose: Get/Set information about object state
//------------------------------------------------------------------------
-void Info::State(const Common::String &id, const PersonState &val) {
- if (people.contains(id) > 0)
- people[id].state = val;
+void Info::state(const Common::String &id, const PersonState &val) {
+ if (_people.contains(id) > 0)
+ _people[id].state = val;
}
-PersonState Info::State(const Common::String &id) {
- if (people.contains(id) > 0)
- return people[id].state;
+PersonState Info::state(const Common::String &id) {
+ if (_people.contains(id) > 0)
+ return _people[id].state;
return PST_NORMAL;
}
@@ -127,89 +127,89 @@ PersonState Info::State(const Common::String &id) {
//------------------------------------------------------------------------
// Purpose: Get/Set information about variables
//------------------------------------------------------------------------
-bool Info::VarGet(const Common::String &name, int &val) {
- if (var.contains(name) == 0)
+bool Info::varGet(const Common::String &name, int &val) {
+ if (_var.contains(name) == 0)
return false;
else
- val = var[name];
+ val = _var[name];
return true;
}
-void Info::VarSet(const Common::String &name, const Common::String &val) {
- int var_val = 0;
- bool assign_to_var = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
+void Info::varSet(const Common::String &name, const Common::String &val) {
+ int varVal = 0;
+ bool assignToVar = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
- if (assign_to_var)
- VarGet(val, var_val);
+ if (assignToVar)
+ varGet(val, varVal);
else
- var_val = StringToNumber<int>(val);
+ varVal = StringToNumber<int>(val);
- var[name] = var_val;
+ _var[name] = varVal;
}
-void Info::VarAdd(const Common::String &name, const int &val) {
- if (var.contains(name) == 0)
- VarSet(name, 0);
+void Info::varAdd(const Common::String &name, const int &val) {
+ if (_var.contains(name) == 0)
+ varSet(name, 0);
- var[name] += val;
+ _var[name] += val;
}
-void Info::VarSub(const Common::String &name, const int &val) {
- if (var.contains(name) == 0)
- VarSet(name, 0);
+void Info::varSub(const Common::String &name, const int &val) {
+ if (_var.contains(name) == 0)
+ varSet(name, 0);
- var[name] -= val;
+ _var[name] -= val;
}
-void Info::VarMul(const Common::String &name, const int &val) {
- if (var.contains(name) == 0)
- VarSet(name, 0);
+void Info::varMul(const Common::String &name, const int &val) {
+ if (_var.contains(name) == 0)
+ varSet(name, 0);
- var[name] *= val;
+ _var[name] *= val;
}
-void Info::VarDiv(const Common::String &name, const int &val) {
- if (var.contains(name) == 0)
- VarSet(name, 0);
+void Info::varDiv(const Common::String &name, const int &val) {
+ if (_var.contains(name) == 0)
+ varSet(name, 0);
- var[name] /= val;
+ _var[name] /= val;
}
-void Info::VarDel(const Common::String &name) {
- var.erase(name);
+void Info::varDel(const Common::String &name) {
+ _var.erase(name);
}
//------------------------------------------------------------------------
// Purpose: Get/Set person traits
//------------------------------------------------------------------------
-void Info::TraitAdd(const Common::String &per_id, const int &trait_id) {
- if (PersonValid(per_id)) // Valid person id
+void Info::traitAdd(const Common::String &perId, const int &traitId) {
+ if (personValid(perId)) // Valid person id
{
- if (trait_id >= 0 && (unsigned int)trait_id < g_engine->_eventStore->_trait.size()) // Valid trait id
+ if (traitId >= 0 && (unsigned int)traitId < g_engine->_eventStore->_trait.size()) // Valid trait id
{
// Check for duplicate traits, DONT award anything if duplicate found
- Person *p = &PersonGet(per_id);
+ Person *p = &personGet(perId);
for (auto i = p->trait.begin(); i != p->trait.end(); ++i)
- if (i->id == trait_id)
+ if (i->id == traitId)
return;
- p->trait.push_back(g_engine->_eventStore->_trait[trait_id]);
+ p->trait.push_back(g_engine->_eventStore->_trait[traitId]);
- g_engine->_eventStore->setAchievement(g_engine->_eventStore->_trait[trait_id].id);
+ g_engine->_eventStore->setAchievement(g_engine->_eventStore->_trait[traitId].id);
}
}
}
-void Info::TraitDel(const Common::String &per_id, const int &trait_id) {
- if (PersonValid(per_id)) // Valid person id
+void Info::traitDel(const Common::String &perId, const int &traitId) {
+ if (personValid(perId)) // Valid person id
{
- if (trait_id > 0 && (unsigned int)trait_id < g_engine->_eventStore->_trait.size()) // Valid trait id
+ if (traitId > 0 && (unsigned int)traitId < g_engine->_eventStore->_trait.size()) // Valid trait id
{
- Person *p = &PersonGet(per_id);
+ Person *p = &personGet(perId);
for (auto j = p->trait.begin(); j != p->trait.end(); ++j) {
- if (j->id == trait_id) {
+ if (j->id == traitId) {
p->trait.erase(j);
break;
}
@@ -221,70 +221,70 @@ void Info::TraitDel(const Common::String &per_id, const int &trait_id) {
//------------------------------------------------------------------------
// Purpose: Get/Set information about object opinion
//------------------------------------------------------------------------
-bool Info::OpinionGet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int &val) {
- if (people.contains(name) == 0)
+bool Info::opinionGet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int &val) {
+ if (_people.contains(name) == 0)
return false;
- val = people[name].opinion.val[type];
+ val = _people[name].opinion.val[type];
return true;
}
-void Info::OpinionChange(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
- if (people.contains(name) > 0)
- people[name].opinion.Change(type, val);
+void Info::opinionChange(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
+ if (_people.contains(name) > 0)
+ _people[name].opinion.Change(type, val);
}
-void Info::OpinionSet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
- if (people.contains(name) > 0)
- people[name].opinion.Set(type, val);
+void Info::opinionSet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
+ if (_people.contains(name) > 0)
+ _people[name].opinion.Set(type, val);
}
//------------------------------------------------------------------------
// Purpose: Get/Set information about object stats
//------------------------------------------------------------------------
-bool Info::StatGet(const Common::String &name, const pyrodactyl::stat::StatType &type, int &num) {
- if (people.contains(name) == 0)
+bool Info::statGet(const Common::String &name, const pyrodactyl::stat::StatType &type, int &num) {
+ if (_people.contains(name) == 0)
return false;
- num = people[name].stat.val[type].cur;
+ num = _people[name].stat.val[type].cur;
return true;
}
-void Info::StatSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
- if (people.contains(name) > 0)
- people[name].stat.Set(type, num);
+void Info::statSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
+ if (_people.contains(name) > 0)
+ _people[name].stat.Set(type, num);
}
-void Info::StatChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
- if (people.contains(name) > 0)
- people[name].stat.Change(type, num);
+void Info::statChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
+ if (_people.contains(name) > 0)
+ _people[name].stat.Change(type, num);
}
//------------------------------------------------------------------------
// Purpose: Get person object
//------------------------------------------------------------------------
-bool Info::PersonGet(const Common::String &id, pyrodactyl::people::Person &p) {
- if (people.contains(id) == 0)
+bool Info::personGet(const Common::String &id, pyrodactyl::people::Person &p) {
+ if (_people.contains(id) == 0)
return false;
- p = people[id];
+ p = _people[id];
return true;
}
-bool Info::PersonValid(const Common::String &id) {
- return people.contains(id) > 0;
+bool Info::personValid(const Common::String &id) {
+ return _people.contains(id) > 0;
}
-pyrodactyl::people::Person &Info::PersonGet(const Common::String &id) {
+pyrodactyl::people::Person &Info::personGet(const Common::String &id) {
// Make sure to check PersonValid before doing this!
// Only use this to change parts of an object
- return people[id];
+ return _people[id];
}
-bool Info::CollideWithTrigger(const Common::String &id, int rect_index) {
- if (people.contains(id) > 0) {
- for (auto i = people[id].trig.begin(); i != people[id].trig.end(); ++i)
- if (*i == rect_index)
+bool Info::collideWithTrigger(const Common::String &id, int rectIndex) {
+ if (_people.contains(id) > 0) {
+ for (auto i = _people[id].trig.begin(); i != _people[id].trig.end(); ++i)
+ if (*i == rectIndex)
return true;
}
@@ -294,7 +294,7 @@ bool Info::CollideWithTrigger(const Common::String &id, int rect_index) {
//------------------------------------------------------------------------
// Purpose: Replace all #values with their appropriate names in a string
//------------------------------------------------------------------------
-void Info::InsertName(Common::String &msg) {
+void Info::insertName(Common::String &msg) {
// We scan the dialog for #id values, which we convert to actual NPC names
for (unsigned int i = 0; i < msg.size(); ++i) {
// The # symbol indicates that the next string until an end character needs to be replaced by the name
@@ -313,16 +313,16 @@ void Info::InsertName(Common::String &msg) {
Common::String s = msg.substr(start + 1, len);
// We use length+1 here because otherwise it lets the last character stay in dialog
- if (PersonValid(s))
- msg.replace(start, len + 1, PersonGet(s).name);
+ if (personValid(s))
+ msg.replace(start, len + 1, personGet(s).name);
}
}
}
}
-Common::String Info::GetName(const Common::String &id) {
- if (PersonValid(id))
- return PersonGet(id).name;
+Common::String Info::getName(const Common::String &id) {
+ if (personValid(id))
+ return personGet(id).name;
return id;
}
@@ -334,14 +334,14 @@ void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
warning("Info::saveState()");
#if 0
- for (auto v = var.begin(); v != var.end(); ++v) {
+ for (auto v = _var.begin(); v != _var.end(); ++v) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
child->append_attribute(doc.allocate_attribute("id", v->first.c_str()));
child->append_attribute(doc.allocate_attribute("val", gStrPool->Get(v->second)));
root->append_node(child);
}
- for (auto p = people.begin(); p != people.end(); ++p)
+ for (auto p = _people.begin(); p != _people.end(); ++p)
p->second.saveState(doc, root);
rapidxml::xml_node<char> *child_unr = doc.allocate_node(rapidxml::node_element, "unread");
@@ -361,45 +361,45 @@ void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
child_money->append_attribute(doc.allocate_attribute("var", money_var.c_str()));
root->append_node(child_money);
- journal.saveState(doc, root);
- inv.saveState(doc, root);
+ _journal.saveState(doc, root);
+ _inv.saveState(doc, root);
#endif
}
void Info::loadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *v = node->first_node("var"); v != NULL; v = v->next_sibling("var"))
- var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
+ _var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object")) {
Common::String id;
loadStr(id, "id", p);
- people[id].loadState(p);
+ _people[id].loadState(p);
}
if (nodeValid("unread", node)) {
rapidxml::xml_node<char> *unrnode = node->first_node("unread");
- loadBool(unread.inventory, "inventory", unrnode);
- loadBool(unread.journal, "journal", unrnode);
- loadBool(unread.trait, "trait", unrnode);
- loadBool(unread.map, "map", unrnode);
+ loadBool(_unread._inventory, "inventory", unrnode);
+ loadBool(_unread._journal, "journal", unrnode);
+ loadBool(_unread._trait, "trait", unrnode);
+ loadBool(_unread._map, "map", unrnode);
}
if (nodeValid("img", node))
- loadNum(player_img, "index", node->first_node("img"));
+ loadNum(_playerImg, "index", node->first_node("img"));
if (nodeValid("money", node))
- loadStr(money_var, "var", node->first_node("money"));
+ loadStr(_moneyVar, "var", node->first_node("money"));
- journal.loadState(node);
- inv.loadState(node);
+ _journal.loadState(node);
+ _inv.loadState(node);
}
//------------------------------------------------------------------------
// Purpose: Calculate UI positions after change in screen size
//------------------------------------------------------------------------
void Info::setUI() {
- journal.setUI();
- inv.setUI();
+ _journal.setUI();
+ _inv.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 19db826e025..71e9ecb3ba9 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -45,158 +45,191 @@ bool IsChar(char c);
class Info {
// The characters in the game
- pyrodactyl::people::PersonMap people;
+ pyrodactyl::people::PersonMap _people;
// The stat templates used in declaring person objects
- pyrodactyl::stat::StatTemplates stem;
+ pyrodactyl::stat::StatTemplates _stem;
// The variables set by the events so far
typedef Common::HashMap<Common::String, int> VarMap;
- VarMap var;
+ VarMap _var;
// The last object player interacted with
- Common::String lastobj;
+ Common::String _lastobj;
// Is the game Iron Man or not?
// Iron man means only one save - no reloading
- bool ironman;
+ bool _ironman;
// The player's current location
struct PlayerLoc {
// id of the player's current location
- Common::String id;
+ Common::String _id;
// The name of the player's current location
- Common::String name;
+ Common::String _name;
- PlayerLoc() : id(""), name("") {}
- } loc;
+ PlayerLoc() : _id(""), _name("") {}
+ } _loc;
// This image changes to reflect the playable character
- int player_img;
+ int _playerImg;
- void LoadPeople(const Common::String &filename);
+ void loadPeople(const Common::String &filename);
public:
// The player's one stop shop for objectives and lore
- pyrodactyl::ui::Journal journal;
+ pyrodactyl::ui::Journal _journal;
// The current player inventory
- pyrodactyl::ui::Inventory inv;
+ pyrodactyl::ui::Inventory _inv;
// This structure keeps track of unread indicators
struct UnreadData {
- bool inventory, journal, trait, map;
+ bool _inventory, _journal, _trait, _map;
UnreadData() {
- inventory = false;
- journal = false;
- trait = true;
- map = false;
+ _inventory = false;
+ _journal = false;
+ _trait = true;
+ _map = false;
}
- } unread;
+ } _unread;
// This is the variable corresponding to money that is drawn
- Common::String money_var;
+ Common::String _moneyVar;
// Has the player pressed the talk key
- bool TalkKeyDown;
+ bool _talkKeyDown;
// Used so we only play one sound per event
struct NotifySounds {
- bool notify, rep_inc, rep_dec;
+ bool _notify, _repInc, _repDec;
NotifySounds() {
- notify = false;
- rep_inc = false;
- rep_dec = false;
+ _notify = false;
+ _repInc = false;
+ _repDec = false;
}
- } sound;
+ } _sound;
+
+ Info() {
+ Init();
+ }
- Info() { Init(); }
~Info() {}
void Init() {
- lastobj = "";
- ironman = false;
- player_img = 0;
- TalkKeyDown = false;
+ _lastobj = "";
+ _ironman = false;
+ _playerImg = 0;
+ _talkKeyDown = false;
}
+
void load(rapidxml::xml_node<char> *node);
// Person related stuff
- void Type(const Common::String &id, const pyrodactyl::people::PersonType &val);
- pyrodactyl::people::PersonType Type(const Common::String &id);
+ void type(const Common::String &id, const pyrodactyl::people::PersonType &val);
+ pyrodactyl::people::PersonType type(const Common::String &id);
- void State(const Common::String &id, const pyrodactyl::people::PersonState &val);
- pyrodactyl::people::PersonState State(const Common::String &id);
+ void state(const Common::String &id, const pyrodactyl::people::PersonState &val);
+ pyrodactyl::people::PersonState state(const Common::String &id);
// Opinion
- bool OpinionGet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int &val);
- void OpinionSet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val);
- void OpinionChange(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val);
+ bool opinionGet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int &val);
+ void opinionSet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val);
+ void opinionChange(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val);
// Stats
- bool StatGet(const Common::String &name, const pyrodactyl::stat::StatType &type, int &num);
- void StatSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num);
- void StatChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num);
+ bool statGet(const Common::String &name, const pyrodactyl::stat::StatType &type, int &num);
+ void statSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num);
+ void statChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num);
// Variables
- bool VarGet(const Common::String &name, int &val);
- void VarSet(const Common::String &name, const Common::String &val);
- void VarAdd(const Common::String &name, const int &val);
- void VarSub(const Common::String &name, const int &val);
- void VarMul(const Common::String &name, const int &val);
- void VarDiv(const Common::String &name, const int &val);
- void VarDel(const Common::String &name);
+ bool varGet(const Common::String &name, int &val);
+ void varSet(const Common::String &name, const Common::String &val);
+ void varAdd(const Common::String &name, const int &val);
+ void varSub(const Common::String &name, const int &val);
+ void varMul(const Common::String &name, const int &val);
+ void varDiv(const Common::String &name, const int &val);
+ void varDel(const Common::String &name);
// The trait functions
- void TraitAdd(const Common::String &per_id, const int &trait_id);
- void TraitDel(const Common::String &per_id, const int &trait_id);
+ void traitAdd(const Common::String &perId, const int &traitId);
+ void traitDel(const Common::String &perId, const int &traitId);
// Player character button
- void PlayerImg(const int &val) { player_img = val; }
- int PlayerImg() { return player_img; }
+ void playerImg(const int &val) {
+ _playerImg = val;
+ }
- Common::String CurLocID() { return loc.id; }
- void CurLocID(const Common::String &id) { loc.id = id; }
+ int playerImg() {
+ return _playerImg;
+ }
- Common::String CurLocName() { return loc.name; }
- void CurLocName(const Common::String &name) { loc.name = name; }
+ Common::String curLocID() {
+ return _loc._id;
+ }
+
+ void curLocID(const Common::String &id) {
+ _loc._id = id;
+ }
+
+ Common::String curLocName() {
+ return _loc._name;
+ }
+
+ void curLocName(const Common::String &name) {
+ _loc._name = name;
+ }
// Player stuff
- Common::String LastPerson() { return lastobj; }
- void LastPerson(const Common::String &name) { lastobj = name; }
+ Common::String lastPerson() {
+ return _lastobj;
+ }
+
+ void lastPerson(const Common::String &name) {
+ _lastobj = name;
+ }
// Return the variable map for stuff like visibility checks
- VarMap &MapGet() { return var; }
- bool PersonGet(const Common::String &id, pyrodactyl::people::Person &p);
+ VarMap &mapGet() {
+ return _var;
+ }
- bool PersonValid(const Common::String &id);
- pyrodactyl::people::Person &PersonGet(const Common::String &id);
+ bool personGet(const Common::String &id, pyrodactyl::people::Person &p);
+
+ bool personValid(const Common::String &id);
+ pyrodactyl::people::Person &personGet(const Common::String &id);
// Is an object colliding with a trigger area
- bool CollideWithTrigger(const Common::String &id, int rect_index);
+ bool collideWithTrigger(const Common::String &id, int rectIndex);
// Replace all #values with their appropriate names in a string
- void InsertName(Common::String &msg);
- Common::String GetName(const Common::String &id);
+ void insertName(Common::String &msg);
+ Common::String getName(const Common::String &id);
// Draw the inventory
- void InvDraw(const Common::String &id) {
- if (var.contains(money_var))
- inv.draw(people[id], var[money_var]);
+ void invDraw(const Common::String &id) {
+ if (_var.contains(_moneyVar))
+ _inv.draw(_people[id], _var[_moneyVar]);
else
- inv.draw(people[id], 0);
+ _inv.draw(_people[id], 0);
}
// Get whether game is iron man or not
- bool IronMan() { return ironman; }
- void IronMan(const bool &val) { ironman = val; }
- void LoadIronMan(rapidxml::xml_node<char> *node) {
+ bool ironMan() {
+ return _ironman;
+ }
+
+ void ironMan(const bool &val) {
+ _ironman = val;
+ }
+
+ void loadIronMan(rapidxml::xml_node<char> *node) {
Common::String str;
loadStr(str, "diff", node);
- ironman = (str == "Iron Man");
+ _ironman = (str == "Iron Man");
}
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 92fe9960f95..5b7543a37db 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -110,21 +110,21 @@ void Effect::changeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::Op
int oldOp = 0;
// Only bother if the person exists and has a valid opinion
- if (info.OpinionGet(_subject, opType, oldOp)) {
+ if (info.opinionGet(_subject, opType, oldOp)) {
if (_operation == "=")
- info.OpinionSet(_subject, opType, StringToNumber<int>(_val));
+ info.opinionSet(_subject, opType, StringToNumber<int>(_val));
else if (_operation == "+")
- info.OpinionChange(_subject, opType, StringToNumber<int>(_val));
+ info.opinionChange(_subject, opType, StringToNumber<int>(_val));
else if (_operation == "-")
- info.OpinionChange(_subject, opType, -1 * StringToNumber<int>(_val));
+ info.opinionChange(_subject, opType, -1 * StringToNumber<int>(_val));
int newOp = 0;
- info.OpinionGet(_subject, opType, newOp);
+ info.opinionGet(_subject, opType, newOp);
if (newOp > oldOp)
- info.sound.rep_inc = true;
+ info._sound._repInc = true;
else if (newOp < oldOp)
- info.sound.rep_dec = true;
+ info._sound._repDec = true;
}
}
@@ -134,52 +134,52 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
switch (_type) {
case EFF_VAR:
if (_operation == "=")
- info.VarSet(_subject, _val);
+ info.varSet(_subject, _val);
else if (_operation == "del")
- info.VarDel(_subject);
+ info.varDel(_subject);
else if (_operation == "+")
- info.VarAdd(_subject, StringToNumber<int>(_val));
+ info.varAdd(_subject, StringToNumber<int>(_val));
else if (_operation == "-")
- info.VarSub(_subject, StringToNumber<int>(_val));
+ info.varSub(_subject, StringToNumber<int>(_val));
else if (_operation == "*")
- info.VarMul(_subject, StringToNumber<int>(_val));
+ info.varMul(_subject, StringToNumber<int>(_val));
else if (_operation == "/")
- info.VarDiv(_subject, StringToNumber<int>(_val));
+ info.varDiv(_subject, StringToNumber<int>(_val));
break;
case EFF_JOURNAL:
if (_subject == "finish")
- info.journal.Move(playerId, _operation, true);
+ info._journal.Move(playerId, _operation, true);
else if (_subject == "start")
- info.journal.Move(playerId, _operation, false);
+ info._journal.Move(playerId, _operation, false);
else
- info.journal.Add(playerId, _subject, _operation, _val);
+ info._journal.Add(playerId, _subject, _operation, _val);
// Update unread status of journal
- info.unread.journal = true;
+ info._unread._journal = true;
// used so we only play one notify sound per event
- info.sound.notify = true;
+ info._sound._notify = true;
break;
case EFF_OBJ:
if (_operation == "type")
- info.Type(_subject, pyrodactyl::people::StringToPersonType(_val));
+ info.type(_subject, pyrodactyl::people::StringToPersonType(_val));
else if (_operation == "state")
- info.State(_subject, pyrodactyl::people::StringToPersonState(_val));
+ info.state(_subject, pyrodactyl::people::StringToPersonState(_val));
break;
case EFF_ITEM:
if (_operation == "del")
- info.inv.DelItem(_subject, _val);
+ info._inv.DelItem(_subject, _val);
else
- info.inv.LoadItem(_subject, _val);
+ info._inv.LoadItem(_subject, _val);
// Update unread status of inventory
- info.unread.inventory = true;
+ info._unread._inventory = true;
// used so we only play one notify sound per event
- info.sound.notify = true;
+ info._sound._notify = true;
break;
case EFF_LIKE:
@@ -199,11 +199,11 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
int num = StringToNumber<int>(_val);
if (_operation == "=")
- info.StatSet(_subject, STAT_HEALTH, num);
+ info.statSet(_subject, STAT_HEALTH, num);
else if (_operation == "+")
- info.StatChange(_subject, STAT_HEALTH, num);
+ info.statChange(_subject, STAT_HEALTH, num);
else if (_operation == "-")
- info.StatChange(_subject, STAT_HEALTH, -1 * num);
+ info.statChange(_subject, STAT_HEALTH, -1 * num);
} break;
case EFF_SOUND:
@@ -222,7 +222,7 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
break;
case EFF_MONEY:
- info.money_var = _val;
+ info._moneyVar = _val;
break;
case EFF_END:
@@ -259,12 +259,12 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
break;
case EFF_IMG:
r._type = ER_IMG;
- info.PlayerImg(StringToNumber<int>(_val));
+ info.playerImg(StringToNumber<int>(_val));
break;
case EFF_TRAIT:
r._type = ER_TRAIT;
- info.unread.trait = true;
- info.sound.notify = true;
+ info._unread._trait = true;
+ info._sound._notify = true;
break;
case EFF_LEVEL:
r._type = ER_LEVEL;
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 02b5a9abc57..532ac5610ca 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -97,28 +97,28 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
void Manager::handleEvents(Info &info, const Common::String &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].eventInProgress(active_seq)) {
+ if (event_map.contains(info.curLocID()) > 0 && event_map[info.curLocID()].eventInProgress(active_seq)) {
switch (cur_event->_type) {
case EVENT_DIALOG:
if (oh.show_journal) {
- info.journal.handleEvents(player_id, Event);
+ info._journal.handleEvents(player_id, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event)) {
- if (info.PersonValid(cur_event->_title)) {
- Person &p = info.PersonGet(cur_event->_title);
+ if (info.personValid(cur_event->_title)) {
+ Person &p = info.personGet(cur_event->_title);
if (p.alt_journal_name)
- info.journal.Open(player_id, JE_PEOPLE, p.journal_name);
+ info._journal.Open(player_id, JE_PEOPLE, p.journal_name);
else
- info.journal.Open(player_id, JE_PEOPLE, p.name);
+ info._journal.Open(player_id, JE_PEOPLE, p.name);
}
}
if (oh.HandleDlboxEvents(Event)) {
- event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
oh.show_journal = false;
}
}
@@ -126,23 +126,23 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP)
- event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_REPLY:
if (oh.show_journal) {
- info.journal.handleEvents(player_id, Event);
+ info._journal.handleEvents(player_id, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.PersonValid(cur_event->_title))
- info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
+ if (info.personValid(cur_event->_title))
+ info._journal.Open(player_id, JE_PEOPLE, info.personGet(cur_event->_title).name);
int choice = reply.handleEvents(info, g_engine->_eventStore->_con[cur_event->_special], cur_event->_title, oh, Event);
if (choice >= 0) {
- event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq, choice);
+ event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
}
}
@@ -150,11 +150,11 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
case EVENT_TEXT:
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.PersonValid(cur_event->_title))
- info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
+ if (info.personValid(cur_event->_title))
+ info._journal.Open(player_id, JE_PEOPLE, info.personGet(cur_event->_title).name);
if (textin.handleEvents(Event))
- event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
@@ -164,7 +164,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
intro.show_traits = false;
} else {
if (intro.handleEvents(Event))
- event_map[info.CurLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
per.Cache(info, level.PlayerID(), level);
@@ -174,7 +174,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
break;
}
- EndSequence(info.CurLocID());
+ EndSequence(info.curLocID());
}
}
@@ -184,28 +184,28 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
//------------------------------------------------------------------------
void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].EventInProgress(active_seq)) {
+ if (event_map.contains(info.curLocID()) > 0 && event_map[info.curLocID()].EventInProgress(active_seq)) {
switch (cur_event->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
- info.journal.handleEvents(player_id, Event);
+ info._journal.handleEvents(player_id, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event)) {
- if (info.PersonValid(cur_event->_title)) {
+ if (info.personValid(cur_event->_title)) {
Person &p = info.PersonGet(cur_event->_title);
if (p.alt_journal_name)
- info.journal.Open(player_id, JE_PEOPLE, p.journal_name);
+ info._journal.Open(player_id, JE_PEOPLE, p._journal_name);
else
- info.journal.Open(player_id, JE_PEOPLE, p.name);
+ info._journal.Open(player_id, JE_PEOPLE, p.name);
}
}
if (oh.HandleDlboxEvents(Event)) {
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
oh.show_journal = false;
}
}
@@ -213,23 +213,23 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == SDL_KEYUP || Event.type == SDL_MOUSEBUTTONUP)
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_REPLY:
if (oh.show_journal) {
- info.journal.handleEvents(player_id, Event);
+ info._journal.handleEvents(player_id, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.PersonValid(cur_event->_title))
- info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
+ if (info.personValid(cur_event->_title))
+ info._journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
int choice = reply.handleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->_title, oh, Event);
if (choice >= 0) {
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
+ event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
oh.show_journal = false;
}
}
@@ -237,11 +237,11 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
case EVENT_TEXT:
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.PersonValid(cur_event->_title))
- info.journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
+ if (info.personValid(cur_event->_title))
+ info._journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
if (textin.handleEvents(Event))
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
@@ -251,7 +251,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
intro.show_traits = false;
} else {
if (intro.handleEvents(Event))
- event_map[info.CurLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
if (intro.show_traits)
per.Cache(info, level.PlayerID(), level);
@@ -261,7 +261,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
break;
}
- EndSequence(info.CurLocID());
+ EndSequence(info.curLocID());
}
}
#endif
@@ -270,8 +270,8 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
// Purpose: Internal Events
//------------------------------------------------------------------------
void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
- if (event_map.contains(info.CurLocID()) > 0) {
- if (event_map[info.CurLocID()].eventInProgress(active_seq)) {
+ if (event_map.contains(info.curLocID()) > 0) {
+ if (event_map[info.curLocID()].eventInProgress(active_seq)) {
switch (cur_event->_type) {
case EVENT_DIALOG:
UpdateDialogBox(info, level);
@@ -281,7 +281,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
DrawType draw_val = DRAW_SAME;
if (g_engine->_eventStore->_anim[cur_event->_special].internalEvents(draw_val))
- event_map[info.CurLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ event_map[info.curLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
if (draw_val == DRAW_STOP)
draw_game = false;
@@ -289,7 +289,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
draw_game = true;
} break;
case EVENT_SILENT:
- event_map[info.CurLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ event_map[info.curLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
break;
case EVENT_REPLY:
UpdateDialogBox(info, level);
@@ -301,9 +301,9 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
break;
}
- EndSequence(info.CurLocID());
+ EndSequence(info.curLocID());
} else {
- event_map[info.CurLocID()].internalEvents(info);
+ event_map[info.curLocID()].internalEvents(info);
CalcActiveSeq(info, level, level.Camera());
}
}
@@ -316,7 +316,7 @@ void Manager::UpdateDialogBox(Info &info, Level &level) {
// Purpose: Draw
//------------------------------------------------------------------------
void Manager::draw(Info &info, HUD &hud, Level &level) {
- if (event_map.contains(info.CurLocID()) > 0 && event_map[info.CurLocID()].eventInProgress(active_seq)) {
+ if (event_map.contains(info.curLocID()) > 0 && event_map[info.curLocID()].eventInProgress(active_seq)) {
switch (cur_event->_type) {
case EVENT_ANIM:
g_engine->_eventStore->_anim[cur_event->_special].draw();
@@ -324,7 +324,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
case EVENT_DIALOG:
g_engine->_imageManager->DimScreen();
if (oh.show_journal) {
- info.journal.draw(level.PlayerID());
+ info._journal.draw(level.PlayerID());
hud.back.draw();
} else
oh.draw(info, cur_event, cur_event->_title, player, cur_sp);
@@ -332,7 +332,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
case EVENT_REPLY:
g_engine->_imageManager->DimScreen();
if (oh.show_journal) {
- info.journal.draw(level.PlayerID());
+ info._journal.draw(level.PlayerID());
hud.back.draw();
} else {
oh.draw(info, cur_event, cur_event->_title, player, cur_sp);
@@ -362,9 +362,9 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
// Purpose: Calculate the current sequence in progress
//------------------------------------------------------------------------
void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
- if (event_map[info.CurLocID()].activeSeq(active_seq)) {
+ if (event_map[info.curLocID()].activeSeq(active_seq)) {
// Set all the pointers to the new values
- cur_event = event_map[info.CurLocID()].curEvent(active_seq);
+ cur_event = event_map[info.curLocID()].curEvent(active_seq);
oh.reset(cur_event->_title);
cur_sp = level.GetSprite(cur_event->_title);
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 041bc07d9c7..f64ec285c5a 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -109,19 +109,19 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
switch (type) {
case TRIG_OBJ:
if (operation == "p") {
- if (info.TalkKeyDown && info.LastPerson() == val)
+ if (info._talkKeyDown && info.lastPerson() == val)
return true;
else
return false;
} else if (operation == "status") {
PersonType ty = StringToPersonType(val);
- if (info.Type(subject) == ty)
+ if (info.type(subject) == ty)
return true;
else
return false;
} else if (operation == "state") {
PersonState st = StringToPersonState(val);
- if (info.State(subject) == st)
+ if (info.state(subject) == st)
return true;
else
return false;
@@ -130,7 +130,7 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
case TRIG_OPINION: {
Person p;
- if (info.PersonGet(subject, p)) {
+ if (info.personGet(subject, p)) {
if (target == "like")
return Evaluate(p.opinion.val[OPI_LIKE], StringToNumber<int>(val));
else if (target == "fear")
@@ -141,24 +141,24 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
} break;
case TRIG_LOC:
- return (info.CurLocID() == val);
+ return (info.curLocID() == val);
break;
case TRIG_ITEM:
- return info.inv.HasItem(target, subject, val);
+ return info._inv.HasItem(target, subject, val);
break;
case TRIG_RECT:
- return info.CollideWithTrigger(subject, StringToNumber<int>(val));
+ return info.collideWithTrigger(subject, StringToNumber<int>(val));
case TRIG_STAT: {
StatType ty = StringToStatType(target);
int sub = 0, value = 0;
bool compare_to_var = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
- info.StatGet(subject, ty, sub);
+ info.statGet(subject, ty, sub);
if (compare_to_var)
- info.StatGet(val, ty, value);
+ info.statGet(val, ty, value);
else
value = StringToNumber<int>(val);
@@ -166,11 +166,11 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
} break;
case TRIG_DIFF:
- return Evaluate(info.IronMan(), StringToNumber<int>(val));
+ return Evaluate(info.ironMan(), StringToNumber<int>(val));
case TRIG_TRAIT:
- if (info.PersonValid(target)) {
- Person *p = &info.PersonGet(target);
+ if (info.personValid(target)) {
+ Person *p = &info.personGet(target);
for (auto &i : p->trait)
if (i.name == val)
@@ -182,9 +182,9 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
int var_sub = 0, var_val = 0;
bool compare_to_var = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
- info.VarGet(subject, var_sub);
+ info.varGet(subject, var_sub);
if (compare_to_var)
- info.VarGet(val, var_val);
+ info.varGet(val, var_val);
else
var_val = StringToNumber<int>(val);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 8219577317e..1aaabad1208 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -42,11 +42,11 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
void Game::StartNewGame() {
Init(g_engine->_filePath->mod_cur);
- LoadLevel(info.CurLocID());
- info.IronMan(g_engine->_tempData->ironman);
+ LoadLevel(info.curLocID());
+ info.ironMan(g_engine->_tempData->ironman);
savefile.ironman = g_engine->_tempData->filename;
clock.Start();
- hud.pause.UpdateMode(info.IronMan());
+ hud.pause.UpdateMode(info.ironMan());
CreateSaveGame(SAVEGAME_EVENT);
}
@@ -129,8 +129,8 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
level.load(g_engine->_filePath->level[id].layout, info, game_over, player_x, player_y);
// Set the current location
- info.CurLocID(id);
- info.CurLocName(g_engine->_filePath->level[id].name);
+ info.curLocID(id);
+ info.curLocName(g_engine->_filePath->level[id].name);
map.player_pos = level.map_loc;
// Update and center the world map to the player current position
@@ -141,10 +141,10 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
map.RevealAdd(level.map_clip.id, level.map_clip.rect);
// Initialize inventory
- info.inv.Init(level.PlayerID());
+ info._inv.Init(level.PlayerID());
// Initialize journal
- info.journal.Init(level.PlayerID());
+ info._journal.Init(level.PlayerID());
level.PreDraw();
return true;
@@ -214,7 +214,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
- info.TalkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.LastPerson(), Event);
+ info._talkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.lastPerson(), Event);
level.handleEvents(info, Event);
@@ -285,10 +285,10 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
break;
case STATE_JOURNAL:
- if (info.journal.handleEvents(level.PlayerID(), Event)) {
+ if (info._journal.handleEvents(level.PlayerID(), Event)) {
// This means we selected the "find on map" button, so we need to:
// switch to the world map, and highlight the appropriate quest marker
- map.SelectDest(info.journal.marker_title);
+ map.SelectDest(info._journal.marker_title);
ToggleState(STATE_MAP);
}
break;
@@ -296,7 +296,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
gem.per.handleEvents(info, level.PlayerID(), Event);
break;
case STATE_INVENTORY:
- info.inv.handleEvents(level.PlayerID(), Event);
+ info._inv.handleEvents(level.PlayerID(), Event);
break;
case STATE_HELP:
g_engine->_helpScreen->handleEvents(Event);
@@ -480,7 +480,7 @@ void Game::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
}
gem.internalEvents(info, level, event_res);
- info.TalkKeyDown = false;
+ info._talkKeyDown = false;
if (ApplyResult())
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
@@ -524,7 +524,7 @@ void Game::draw() {
break;
case STATE_JOURNAL:
g_engine->_imageManager->DimScreen();
- info.journal.draw(level.PlayerID());
+ info._journal.draw(level.PlayerID());
hud.draw(info, level.PlayerID());
hud.back.draw();
break;
@@ -536,7 +536,7 @@ void Game::draw() {
break;
case STATE_INVENTORY:
g_engine->_imageManager->DimScreen();
- info.InvDraw(level.PlayerID());
+ info.invDraw(level.PlayerID());
hud.draw(info, level.PlayerID());
hud.back.draw();
break;
@@ -580,12 +580,12 @@ bool Game::ApplyResult() {
break;
case ER_DEST:
if (i->_x < 0 || i->_y < 0) {
- info.journal.Marker(level.PlayerID(), i->_val, false);
+ info._journal.Marker(level.PlayerID(), i->_val, false);
map.DestDel(i->_val);
} else {
map.DestAdd(i->_val, i->_x, i->_y);
- info.journal.Marker(level.PlayerID(), i->_val, true);
- info.unread.map = true;
+ info._journal.Marker(level.PlayerID(), i->_val, true);
+ info._unread._map = true;
}
break;
case ER_IMG:
@@ -593,9 +593,9 @@ bool Game::ApplyResult() {
break;
case ER_TRAIT:
if (i->_x == 42)
- info.TraitDel(i->_val, i->_y);
+ info.traitDel(i->_val, i->_y);
else
- info.TraitAdd(i->_val, i->_y);
+ info.traitAdd(i->_val, i->_y);
break;
case ER_LEVEL:
if (i->_val == "Map")
@@ -681,9 +681,9 @@ void Game::loadState(Common::SeekableReadStream *stream) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("save");
if (nodeValid(node)) {
- info.LoadIronMan(node);
+ info.loadIronMan(node);
loadStr(savefile.ironman, "file", node);
- hud.pause.UpdateMode(info.IronMan());
+ hud.pause.UpdateMode(info.ironMan());
if (nodeValid("events", node))
gem.loadState(node->first_node("events"));
@@ -728,22 +728,22 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
doc.append_node(root);
// Save location id
- Common::String loc = info.CurLocID();
+ Common::String loc = info.curLocID();
root->append_attribute(doc.allocate_attribute("loc_id", loc.c_str()));
// Save location name
- Common::String loc_name = info.CurLocName();
+ Common::String loc_name = info.curLocName();
root->append_attribute(doc.allocate_attribute("loc_name", loc_name.c_str()));
// Save player character name
Common::String char_name;
- if (info.PersonValid(level.PlayerID()))
- char_name = info.PersonGet(level.PlayerID()).name;
+ if (info.personValid(level.PlayerID()))
+ char_name = info.personGet(level.PlayerID()).name;
root->append_attribute(doc.allocate_attribute("char_name", char_name.c_str()));
// Difficulty
Common::String diff = "Normal";
- if (info.IronMan())
+ if (info.ironMan())
diff = "Iron Man";
root->append_attribute(doc.allocate_attribute("diff", diff.c_str()));
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 9deb0d26b37..7d394f58317 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -120,7 +120,7 @@ private:
}
// Load the current player image
- void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->_img[info.PlayerImg()]); }
+ void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->_img[info.playerImg()]); }
public:
Game() : _isInited(false) {}
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 345352c9012..c1f3c13e8f8 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -72,11 +72,11 @@ LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result
Think(info, result, end_seq, l_result.val);
if (l_result.val != "")
- info.LastPerson(l_result.val);
+ info.lastPerson(l_result.val);
else if (CollidingWithObject(info, l_result.val))
- info.LastPerson(l_result.val);
+ info.lastPerson(l_result.val);
else
- info.LastPerson("");
+ info.lastPerson("");
return l_result;
}
@@ -95,14 +95,14 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
i->_pathing.initialize(&pathfindingGrid);
// If a sprite is dead, nothing else matters
- if (info.State(i->id()) == PST_DYING) {
+ if (info.state(i->id()) == PST_DYING) {
if (i->lastFrame()) {
- info.StatSet(i->id(), STAT_HEALTH, 0);
- info.State(i->id(), PST_KO);
+ info.statSet(i->id(), STAT_HEALTH, 0);
+ info.state(i->id(), PST_KO);
i->effectImg(false);
i->inputStop();
}
- } else if (info.State(i->id()) != PST_KO) {
+ } else if (info.state(i->id()) != PST_KO) {
Rect boundRect = i->boundRect();
i->_pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
@@ -110,10 +110,10 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
// For the AI sprites
if (index != player_index) {
- switch (info.State(i->id())) {
+ switch (info.state(i->id())) {
case PST_FIGHT: {
// Only attack if the player is alive
- if (info.State(objects[player_index].id()) < PST_KO)
+ if (info.state(objects[player_index].id()) < PST_KO)
i->attack(info, objects[player_index], sc_default);
} break;
case PST_FLEE:
@@ -134,7 +134,7 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
}
// Only do this if the player is alive
- if (info.State(objects[player_index].id()) < PST_KO)
+ if (info.state(objects[player_index].id()) < PST_KO)
objects[player_index].exchangeDamage(info, *i, sc_default);
} else {
// For the player sprite
@@ -172,14 +172,14 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
void Level::BattleAlert(Info &info) {
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
- if (index != player_index && i->visible() && info.State(i->id()) != PST_KO) {
- switch (info.Type(i->id())) {
+ if (index != player_index && i->visible() && info.state(i->id()) != PST_KO) {
+ switch (info.type(i->id())) {
case PE_NEUTRAL:
case PE_HOSTILE:
- info.State(i->id(), PST_FIGHT);
+ info.state(i->id(), PST_FIGHT);
break;
case PE_COWARD:
- info.State(i->id(), PST_FLEE);
+ info.state(i->id(), PST_FLEE);
break;
default:
break;
@@ -210,7 +210,7 @@ void Level::MoveObject(Info &info, pyrodactyl::anim::Sprite &s) {
bool Level::PlayerInCombat(Info &info) {
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index)
- if (index != player_index && info.State(i->id()) == PST_FIGHT && i->visible())
+ if (index != player_index && info.state(i->id()) == PST_FIGHT && i->visible())
return true;
return false;
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 80df6ab9e11..04b7a2a26cb 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -134,8 +134,8 @@ bool Level::LayerVisible(Sprite *obj) {
//------------------------------------------------------------------------
void Level::CalcTrigCollide(Info &info) {
for (auto i = objects.begin(); i != objects.end(); ++i)
- if (info.PersonValid(i->id()))
- terrain.CollideWithTrigger(i->boundRect(), info.PersonGet(i->id()).trig);
+ if (info.personValid(i->id()))
+ terrain.CollideWithTrigger(i->boundRect(), info.personGet(i->id()).trig);
}
//------------------------------------------------------------------------
@@ -148,7 +148,7 @@ bool Level::CollidingWithObject(Info &info, Common::String &id) {
unsigned int index = 0;
for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
- if (i->visible() && player_index != index && info.State(i->id()) == PST_NORMAL) {
+ if (i->visible() && player_index != index && info.state(i->id()) == PST_NORMAL) {
// Clip and bounding rectangles for the NPC sprite
Rect i_pos = i->posRect(), i_bound = i->boundRect();
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index fcbe1e74b20..d37e9b60db3 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -125,7 +125,7 @@ void Level::draw(pyrodactyl::event::Info &info) {
// Only draw their name if they are
//(a) hovered over by the mouse, OR
//(b) are in talk range and don't have popup text over their head
- if (i._hover || (info.LastPerson() == i.id() && !i.popupShow()))
+ if (i._hover || (info.lastPerson() == i.id() && !i.popupShow()))
talk_notify.draw(info, i, camera);
}
}
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index 6d9af8dc09b..8b91c08ff3d 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -52,7 +52,7 @@ void TalkNotify::draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s
pos.y = rect.y + offset.y;
// Find the sprite name
- Common::String text = info.GetName(s.id());
+ Common::String text = info.getName(s.id());
g_engine->_textManager->draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
}
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 0da0a2a858f..ce047443558 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -77,7 +77,7 @@ void DebugConsole::draw(pyrodactyl::event::Info &info) {
{
int temp = 0;
- if (info.VarGet(var_name, temp))
+ if (info.varGet(var_name, temp))
value.draw(NumberToString(temp));
else
value.draw("Does not exist.");
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index f9faad8822d..023bd2b4731 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -91,13 +91,13 @@ void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
g_engine->_imageManager->draw(x, y, s->img(), &r);
}
- if (info.PersonValid(person_id)) {
- name.draw(info.PersonGet(person_id).name);
+ if (info.personValid(person_id)) {
+ name.draw(info.personGet(person_id).name);
if (!player) {
- opinion[OPI_LIKE].draw(info.PersonGet(person_id).opinion.val[OPI_LIKE], OPINION_MAX);
- opinion[OPI_RESPECT].draw(info.PersonGet(person_id).opinion.val[OPI_RESPECT], OPINION_MAX);
- opinion[OPI_FEAR].draw(info.PersonGet(person_id).opinion.val[OPI_FEAR], OPINION_MAX);
+ opinion[OPI_LIKE].draw(info.personGet(person_id).opinion.val[OPI_LIKE], OPINION_MAX);
+ opinion[OPI_RESPECT].draw(info.personGet(person_id).opinion.val[OPI_RESPECT], OPINION_MAX);
+ opinion[OPI_FEAR].draw(info.personGet(person_id).opinion.val[OPI_FEAR], OPINION_MAX);
}
}
@@ -152,17 +152,17 @@ void PersonHandler::internalEvents(const pyrodactyl::people::PersonState &state,
}
void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const Common::String &id, const pyrodactyl::people::OpinionType &type, const int &val) {
- if (info.PersonValid(id)) {
+ if (info.personValid(id)) {
// First, get the value of the object's opinion
int old = 0;
- info.OpinionGet(id, type, old);
+ info.opinionGet(id, type, old);
// Update the opinion value to the new one
- info.OpinionChange(id, type, val);
+ info.opinionChange(id, type, val);
// Then get the current value of the object's opinion
int value = 0;
- info.OpinionGet(id, type, value);
+ info.opinionGet(id, type, value);
// Now, send the new and old value of the object's opinion for drawing the change effect
opinion[type].Effect(value, old);
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 059de550aba..61d85e68447 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -58,8 +58,8 @@ void PersonScreen::load(const Common::String &filename) {
}
void PersonScreen::handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event) {
- if (info.PersonValid(id))
- menu.handleEvents(&info.PersonGet(id), Event);
+ if (info.personValid(id))
+ menu.handleEvents(&info.personGet(id), Event);
else
menu.handleEvents(nullptr, Event);
}
@@ -81,9 +81,9 @@ void PersonScreen::internalEvents() {
void PersonScreen::draw(pyrodactyl::event::Info &info, const Common::String &id) {
bg.draw();
- if (info.PersonValid(id)) {
- name.draw(info.PersonGet(id).name);
- menu.draw(&info.PersonGet(id));
+ if (info.personValid(id)) {
+ name.draw(info.personGet(id).name);
+ menu.draw(&info.personGet(id));
} else
menu.draw(nullptr);
@@ -96,8 +96,8 @@ void PersonScreen::draw(pyrodactyl::event::Info &info, const Common::String &id)
void PersonScreen::Cache(Info &info, const Common::String &id, pyrodactyl::level::Level &level) {
cur_sp = level.GetSprite(id);
- if (info.PersonValid(id))
- menu.Cache(info.PersonGet(id));
+ if (info.personValid(id))
+ menu.Cache(info.personGet(id));
else
menu.Clear();
}
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 9c52b56336c..76d05157217 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -75,9 +75,9 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
oh.OpinionChange(info, i._id, OPI_FEAR, i._val[OPI_FEAR]);
play_sound = true;
} else {
- info.OpinionChange(i._id, OPI_LIKE, i._val[OPI_LIKE]);
- info.OpinionChange(i._id, OPI_RESPECT, i._val[OPI_RESPECT]);
- info.OpinionChange(i._id, OPI_FEAR, i._val[OPI_FEAR]);
+ info.opinionChange(i._id, OPI_LIKE, i._val[OPI_LIKE]);
+ info.opinionChange(i._id, OPI_RESPECT, i._val[OPI_RESPECT]);
+ info.opinionChange(i._id, OPI_FEAR, i._val[OPI_FEAR]);
play_sound = true;
}
}
@@ -161,7 +161,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
const InputType type = static_cast<InputType>(IU_REPLY_0 + element_count);
Common::String text = g_engine->_inputManager->GetAssociatedKey(type);
text += ". " + i->_text;
- info.InsertName(text);
+ info.insertName(text);
if (element_count == 0)
element[element_count].Cache(text, spacing, 0, &bg);
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index a3e31d1bda7..4c3d76a63e4 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -73,7 +73,7 @@ void GameDialogBox::draw(const bool &player) {
void GameDialogBox::draw(pyrodactyl::event::Info &info, Common::String &message) {
// Create a copy of the string
Common::String msg = message;
- info.InsertName(msg);
+ info.insertName(msg);
text.draw(message);
button.draw();
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index ff5bf71b14d..225e819a883 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -86,22 +86,22 @@ void HUD::draw(pyrodactyl::event::Info &info, const Common::String &id) {
bg.draw();
menu.draw();
- if (info.unread.journal) {
+ if (info._unread._journal) {
g_engine->_imageManager->draw(menu.element[HS_JOURNAL].x + menu.element[HS_JOURNAL].w - clip.w / 2,
menu.element[HS_JOURNAL].y - clip.h / 2, notify_anim, &clip);
}
- if (info.unread.inventory) {
+ if (info._unread._inventory) {
g_engine->_imageManager->draw(menu.element[HS_INV].x + menu.element[HS_INV].w - clip.w / 2,
menu.element[HS_INV].y - clip.h / 2, notify_anim, &clip);
}
- if (info.unread.trait) {
+ if (info._unread._trait) {
g_engine->_imageManager->draw(menu.element[HS_CHAR].x + menu.element[HS_CHAR].w - clip.w / 2,
menu.element[HS_CHAR].y - clip.h / 2, notify_anim, &clip);
}
- if (info.unread.map) {
+ if (info._unread._map) {
g_engine->_imageManager->draw(menu.element[HS_MAP].x + menu.element[HS_MAP].w - clip.w / 2,
menu.element[HS_MAP].y - clip.h / 2, notify_anim, &clip);
}
@@ -127,13 +127,13 @@ HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const Common::Event &
int choice = menu.handleEvents(Event);
if (choice == HS_JOURNAL)
- info.unread.journal = false;
+ info._unread._journal = false;
else if (choice == HS_INV)
- info.unread.inventory = false;
+ info._unread._inventory = false;
else if (choice == HS_CHAR)
- info.unread.trait = false;
+ info._unread._trait = false;
else if (choice == HS_MAP)
- info.unread.map = false;
+ info._unread._map = false;
return static_cast<HUDSignal>(choice);
}
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index d4309fc3c21..aa12a7f70ec 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -136,7 +136,7 @@ void Map::draw(pyrodactyl::event::Info &info) {
fg.draw();
bu_overlay.draw();
- title.text = info.CurLocName();
+ title.text = info.curLocName();
title.draw();
marker.draw(pos, player_pos, camera);
Commit: 2507b59aab525d2d627fec6f228709be3ce50eb5
https://github.com/scummvm/scummvm/commit/2507b59aab525d2d627fec6f228709be3ce50eb5
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: random should be _random
Changed paths:
engines/crab/animation/animframe.cpp
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index 6308df5e660..1a2b7e06515 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -86,7 +86,7 @@ void AnimationFrames::load(rapidxml::xml_node<char> *node) {
}
}
- if (random)
+ if (_random)
_currentClip = g_engine->getRandomNumber(_frame.size() - 1);
else
_currentClip = 0;
Commit: 321f1379be280b241ca22230a27705b82e116308
https://github.com/scummvm/scummvm/commit/321f1379be280b241ca22230a27705b82e116308
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make GameEventManager class follow code formatting conventions
Changed paths:
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/game.cpp
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 532ac5610ca..a62be5d1043 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -38,13 +38,13 @@ using namespace pyrodactyl::level;
using namespace pyrodactyl::image;
using namespace pyrodactyl::ui;
-void Manager::Init() {
- event_map.clear();
- active_seq = UINT_MAX;
- cur_sp = nullptr;
- player = false;
- cur_event = nullptr;
- draw_game = true;
+void Manager::init() {
+ _eventMap.clear();
+ _activeSeq = UINT_MAX;
+ _curSp = nullptr;
+ _player = false;
+ _curEvent = nullptr;
+ _drawGame = true;
}
//------------------------------------------------------------------------
@@ -56,125 +56,125 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
if (conf.ready()) {
rapidxml::xml_node<char> *lnode = conf.doc()->first_node("event_list");
for (rapidxml::xml_node<char> *loc = lnode->first_node("loc"); loc != NULL; loc = loc->next_sibling("loc")) {
- Common::String loc_name;
- loadStr(loc_name, "name", loc);
+ Common::String locName;
+ loadStr(locName, "name", loc);
for (auto n = loc->first_node("file"); n != NULL; n = n->next_sibling("file")) {
unsigned int id;
Common::String path;
loadNum(id, "name", n);
loadStr(path, "path", n);
- event_map[loc_name].addSeq(id, path);
+ _eventMap[locName].addSeq(id, path);
}
}
}
- active_seq = UINT_MAX;
+ _activeSeq = UINT_MAX;
conf.load(node->first_attribute("layout")->value());
if (conf.ready()) {
rapidxml::xml_node<char> *layout = conf.doc()->first_node("layout");
if (nodeValid(layout)) {
if (nodeValid("character", layout))
- oh.load(layout->first_node("character"));
+ _oh.load(layout->first_node("character"));
if (nodeValid("popup", layout))
popup.load(layout->first_node("popup"));
if (nodeValid("intro", layout))
- intro.load(layout->first_node("intro"));
+ _intro.load(layout->first_node("intro"));
}
}
- reply.load(node->first_attribute("conversation")->value());
+ _reply.load(node->first_attribute("conversation")->value());
- per.load(node->first_attribute("char")->value());
+ _per.load(node->first_attribute("char")->value());
}
}
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Manager::handleEvents(Info &info, const Common::String &player_id, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
+void Manager::handleEvents(Info &info, const Common::String &playerId, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.contains(info.curLocID()) > 0 && event_map[info.curLocID()].eventInProgress(active_seq)) {
- switch (cur_event->_type) {
+ if (_eventMap.contains(info.curLocID()) > 0 && _eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
+ switch (_curEvent->_type) {
case EVENT_DIALOG:
- if (oh.show_journal) {
- info._journal.handleEvents(player_id, Event);
+ if (_oh.show_journal) {
+ info._journal.handleEvents(playerId, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
- oh.show_journal = false;
+ _oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (oh.HandleCommonEvents(Event)) {
- if (info.personValid(cur_event->_title)) {
- Person &p = info.personGet(cur_event->_title);
+ if (_oh.HandleCommonEvents(Event)) {
+ if (info.personValid(_curEvent->_title)) {
+ Person &p = info.personGet(_curEvent->_title);
if (p.alt_journal_name)
- info._journal.Open(player_id, JE_PEOPLE, p.journal_name);
+ info._journal.Open(playerId, JE_PEOPLE, p.journal_name);
else
- info._journal.Open(player_id, JE_PEOPLE, p.name);
+ info._journal.Open(playerId, JE_PEOPLE, p.name);
}
}
- if (oh.HandleDlboxEvents(Event)) {
- event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
- oh.show_journal = false;
+ if (_oh.HandleDlboxEvents(Event)) {
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
+ _oh.show_journal = false;
}
}
break;
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP)
- event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
break;
case EVENT_REPLY:
- if (oh.show_journal) {
- info._journal.handleEvents(player_id, Event);
+ if (_oh.show_journal) {
+ info._journal.handleEvents(playerId, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
- oh.show_journal = false;
+ _oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (oh.HandleCommonEvents(Event))
- if (info.personValid(cur_event->_title))
- info._journal.Open(player_id, JE_PEOPLE, info.personGet(cur_event->_title).name);
+ if (_oh.HandleCommonEvents(Event))
+ if (info.personValid(_curEvent->_title))
+ info._journal.Open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title).name);
- int choice = reply.handleEvents(info, g_engine->_eventStore->_con[cur_event->_special], cur_event->_title, oh, Event);
+ int choice = _reply.handleEvents(info, g_engine->_eventStore->_con[_curEvent->_special], _curEvent->_title, _oh, Event);
if (choice >= 0) {
- event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq, choice);
- oh.show_journal = false;
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq, choice);
+ _oh.show_journal = false;
}
}
break;
case EVENT_TEXT:
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (oh.HandleCommonEvents(Event))
- if (info.personValid(cur_event->_title))
- info._journal.Open(player_id, JE_PEOPLE, info.personGet(cur_event->_title).name);
+ if (_oh.HandleCommonEvents(Event))
+ if (info.personValid(_curEvent->_title))
+ info._journal.Open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title).name);
- if (textin.handleEvents(Event))
- event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
+ if (_textin.handleEvents(Event))
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
break;
case EVENT_SPLASH:
- if (intro.show_traits) {
- per.handleEvents(info, cur_event->_title, Event);
+ if (_intro.show_traits) {
+ _per.handleEvents(info, _curEvent->_title, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
- intro.show_traits = false;
+ _intro.show_traits = false;
} else {
- if (intro.handleEvents(Event))
- event_map[info.curLocID()].nextEvent(active_seq, info, player_id, result, end_seq);
+ if (_intro.handleEvents(Event))
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
- if (intro.show_traits)
- per.Cache(info, level.PlayerID(), level);
+ if (_intro.show_traits)
+ _per.Cache(info, level.PlayerID(), level);
}
break;
default:
break;
}
- EndSequence(info.curLocID());
+ endSequence(info.curLocID());
}
}
@@ -184,8 +184,8 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, Common::
//------------------------------------------------------------------------
void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (event_map.contains(info.curLocID()) > 0 && event_map[info.curLocID()].EventInProgress(active_seq)) {
- switch (cur_event->type) {
+ if (eventMap.contains(info.curLocID()) > 0 && eventMap[info.curLocID()].EventInProgress(activeSeq)) {
+ switch (_curEvent->type) {
case EVENT_DIALOG:
if (oh.show_journal) {
info._journal.handleEvents(player_id, Event);
@@ -195,8 +195,8 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event)) {
- if (info.personValid(cur_event->_title)) {
- Person &p = info.PersonGet(cur_event->_title);
+ if (info.personValid(_curEvent->_title)) {
+ Person &p = info.PersonGet(_curEvent->_title);
if (p.alt_journal_name)
info._journal.Open(player_id, JE_PEOPLE, p._journal_name);
else
@@ -205,7 +205,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
}
if (oh.HandleDlboxEvents(Event)) {
- event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq);
oh.show_journal = false;
}
}
@@ -213,7 +213,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
if (Event.type == SDL_KEYUP || Event.type == SDL_MOUSEBUTTONUP)
- event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq);
break;
case EVENT_REPLY:
if (oh.show_journal) {
@@ -224,12 +224,12 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.personValid(cur_event->_title))
- info._journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
+ if (info.personValid(_curEvent->_title))
+ info._journal.Open(player_id, JE_PEOPLE, info.PersonGet(_curEvent->_title).name);
- int choice = reply.handleEvents(info, g_engine->_eventStore->con[cur_event->special], cur_event->_title, oh, Event);
+ int choice = reply.handleEvents(info, g_engine->_eventStore->con[_curEvent->special], _curEvent->_title, oh, Event);
if (choice >= 0) {
- event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq, choice);
+ eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq, choice);
oh.show_journal = false;
}
}
@@ -237,21 +237,21 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
case EVENT_TEXT:
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (oh.HandleCommonEvents(Event))
- if (info.personValid(cur_event->_title))
- info._journal.Open(player_id, JE_PEOPLE, info.PersonGet(cur_event->_title).name);
+ if (info.personValid(_curEvent->_title))
+ info._journal.Open(player_id, JE_PEOPLE, info.PersonGet(_curEvent->_title).name);
- if (textin.handleEvents(Event))
- event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ if (_textin.handleEvents(Event))
+ eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq);
break;
case EVENT_SPLASH:
if (intro.show_traits) {
- per.handleEvents(info, cur_event->_title, Event);
+ per.handleEvents(info, _curEvent->_title, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
intro.show_traits = false;
} else {
if (intro.handleEvents(Event))
- event_map[info.curLocID()].NextEvent(active_seq, info, player_id, result, end_seq);
+ eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq);
if (intro.show_traits)
per.Cache(info, level.PlayerID(), level);
@@ -270,86 +270,86 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
// Purpose: Internal Events
//------------------------------------------------------------------------
void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
- if (event_map.contains(info.curLocID()) > 0) {
- if (event_map[info.curLocID()].eventInProgress(active_seq)) {
- switch (cur_event->_type) {
+ if (_eventMap.contains(info.curLocID()) > 0) {
+ if (_eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
+ switch (_curEvent->_type) {
case EVENT_DIALOG:
- UpdateDialogBox(info, level);
+ updateDialogBox(info, level);
break;
case EVENT_ANIM: {
using namespace pyrodactyl::anim;
- DrawType draw_val = DRAW_SAME;
- if (g_engine->_eventStore->_anim[cur_event->_special].internalEvents(draw_val))
- event_map[info.curLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ DrawType drawVal = DRAW_SAME;
+ if (g_engine->_eventStore->_anim[_curEvent->_special].internalEvents(drawVal))
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, level.PlayerID(), result, _endSeq);
- if (draw_val == DRAW_STOP)
- draw_game = false;
- else if (draw_val == DRAW_START)
- draw_game = true;
+ if (drawVal == DRAW_STOP)
+ _drawGame = false;
+ else if (drawVal == DRAW_START)
+ _drawGame = true;
} break;
case EVENT_SILENT:
- event_map[info.curLocID()].nextEvent(active_seq, info, level.PlayerID(), result, end_seq);
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, level.PlayerID(), result, _endSeq);
break;
case EVENT_REPLY:
- UpdateDialogBox(info, level);
+ updateDialogBox(info, level);
break;
case EVENT_SPLASH:
- UpdateDialogBox(info, level);
+ updateDialogBox(info, level);
break;
default:
break;
}
- EndSequence(info.curLocID());
+ endSequence(info.curLocID());
} else {
- event_map[info.curLocID()].internalEvents(info);
- CalcActiveSeq(info, level, level.Camera());
+ _eventMap[info.curLocID()].internalEvents(info);
+ calcActiveSeq(info, level, level.Camera());
}
}
}
-void Manager::UpdateDialogBox(Info &info, Level &level) {
- oh.internalEvents(cur_event->_state, cur_sp);
+void Manager::updateDialogBox(Info &info, pyrodactyl::level::Level &level) {
+ _oh.internalEvents(_curEvent->_state, _curSp);
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
void Manager::draw(Info &info, HUD &hud, Level &level) {
- if (event_map.contains(info.curLocID()) > 0 && event_map[info.curLocID()].eventInProgress(active_seq)) {
- switch (cur_event->_type) {
+ if (_eventMap.contains(info.curLocID()) > 0 && _eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
+ switch (_curEvent->_type) {
case EVENT_ANIM:
- g_engine->_eventStore->_anim[cur_event->_special].draw();
+ g_engine->_eventStore->_anim[_curEvent->_special].draw();
break;
case EVENT_DIALOG:
g_engine->_imageManager->DimScreen();
- if (oh.show_journal) {
+ if (_oh.show_journal) {
info._journal.draw(level.PlayerID());
hud.back.draw();
} else
- oh.draw(info, cur_event, cur_event->_title, player, cur_sp);
+ _oh.draw(info, _curEvent, _curEvent->_title, _player, _curSp);
break;
case EVENT_REPLY:
g_engine->_imageManager->DimScreen();
- if (oh.show_journal) {
+ if (_oh.show_journal) {
info._journal.draw(level.PlayerID());
hud.back.draw();
} else {
- oh.draw(info, cur_event, cur_event->_title, player, cur_sp);
- reply.draw();
+ _oh.draw(info, _curEvent, _curEvent->_title, _player, _curSp);
+ _reply.draw();
}
break;
case EVENT_TEXT:
- oh.draw(info, cur_event, cur_event->_title, player, cur_sp);
- textin.draw();
+ _oh.draw(info, _curEvent, _curEvent->_title, _player, _curSp);
+ _textin.draw();
break;
case EVENT_SPLASH:
g_engine->_imageManager->DimScreen();
- if (intro.show_traits) {
- per.draw(info, cur_event->_title);
+ if (_intro.show_traits) {
+ _per.draw(info, _curEvent->_title);
hud.back.draw();
} else
- intro.draw(info, cur_event->_dialog, cur_sp, cur_event->_state);
+ _intro.draw(info, _curEvent->_dialog, _curSp, _curEvent->_state);
break;
default:
@@ -361,22 +361,22 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
//------------------------------------------------------------------------
// Purpose: Calculate the current sequence in progress
//------------------------------------------------------------------------
-void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
- if (event_map[info.curLocID()].activeSeq(active_seq)) {
+void Manager::calcActiveSeq(Info &info, pyrodactyl::level::Level &level, const Rect &camera) {
+ if (_eventMap[info.curLocID()].activeSeq(_activeSeq)) {
// Set all the pointers to the new values
- cur_event = event_map[info.curLocID()].curEvent(active_seq);
- oh.reset(cur_event->_title);
- cur_sp = level.GetSprite(cur_event->_title);
+ _curEvent = _eventMap[info.curLocID()].curEvent(_activeSeq);
+ _oh.reset(_curEvent->_title);
+ _curSp = level.GetSprite(_curEvent->_title);
// The player character's dialog is drawn a bit differently compared to others
- player = (cur_event->_title == level.PlayerID());
+ _player = (_curEvent->_title == level.PlayerID());
- switch (cur_event->_type) {
+ switch (_curEvent->_type) {
case EVENT_ANIM:
- g_engine->_eventStore->_anim[cur_event->_special].start();
+ g_engine->_eventStore->_anim[_curEvent->_special].start();
break;
case EVENT_REPLY:
- reply.Cache(info, g_engine->_eventStore->_con[cur_event->_special]);
+ _reply.Cache(info, g_engine->_eventStore->_con[_curEvent->_special]);
break;
default:
break;
@@ -387,21 +387,21 @@ void Manager::CalcActiveSeq(Info &info, Level &level, const Rect &camera) {
//------------------------------------------------------------------------
// Purpose: Get/set info
//------------------------------------------------------------------------
-void Manager::EndSequence(const Common::String &curloc) {
- if (end_seq.empty() == false) {
- for (auto i = end_seq.begin(); i != end_seq.end(); ++i)
+void Manager::endSequence(const Common::String &curloc) {
+ if (_endSeq.empty() == false) {
+ for (auto i = _endSeq.begin(); i != _endSeq.end(); ++i)
if (i->_cur)
- event_map[curloc].endSeq(active_seq);
- else if (event_map.contains(i->_loc) > 0)
- event_map[i->_loc].endSeq(StringToNumber<unsigned int>(i->_val));
+ _eventMap[curloc].endSeq(_activeSeq);
+ else if (_eventMap.contains(i->_loc) > 0)
+ _eventMap[i->_loc].endSeq(StringToNumber<unsigned int>(i->_val));
- active_seq = UINT_MAX;
- end_seq.clear();
+ _activeSeq = UINT_MAX;
+ _endSeq.clear();
}
}
-bool Manager::EventInProgress() {
- if (active_seq == UINT_MAX)
+bool Manager::eventInProgress() {
+ if (_activeSeq == UINT_MAX)
return false;
return true;
}
@@ -410,7 +410,7 @@ bool Manager::EventInProgress() {
// Purpose: Save the state of the object
//------------------------------------------------------------------------
void Manager::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto i = event_map.begin(); i != event_map.end(); ++i) {
+ for (auto i = _eventMap.begin(); i != _eventMap.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "loc");
child->append_attribute(doc.allocate_attribute("name", i->_key.c_str()));
i->_value.saveState(doc, child);
@@ -425,8 +425,8 @@ void Manager::loadState(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
if (n->first_attribute("name") != NULL) {
Common::String name = n->first_attribute("name")->value();
- if (event_map.contains(name) > 0)
- event_map[name].loadState(n);
+ if (_eventMap.contains(name) > 0)
+ _eventMap[name].loadState(n);
}
}
}
@@ -435,10 +435,10 @@ void Manager::loadState(rapidxml::xml_node<char> *node) {
// Purpose: Function called when window size is changed to adjust UI
//------------------------------------------------------------------------
void Manager::setUI() {
- oh.setUI();
- reply.setUI();
- textin.setUI();
- per.setUI();
+ _oh.setUI();
+ _reply.setUI();
+ _textin.setUI();
+ _per.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 95e1ecd2dfb..f1c1fdc2cc9 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -31,15 +31,15 @@
#ifndef CRAB_GAMEEVENTMANAGER_H
#define CRAB_GAMEEVENTMANAGER_H
-#include "crab/ui/ChapterIntro.h"
+#include "crab/common_header.h"
#include "crab/event/EventSeqGroup.h"
+#include "crab/level/level.h"
+#include "crab/ui/ChapterIntro.h"
#include "crab/ui/PersonHandler.h"
#include "crab/ui/PersonScreen.h"
#include "crab/ui/ReplyMenu.h"
-#include "crab/common_header.h"
#include "crab/ui/hud.h"
#include "crab/ui/journal.h"
-#include "crab/level/level.h"
#include "crab/ui/textarea.h"
namespace Crab {
@@ -49,45 +49,48 @@ namespace event {
class Manager {
protected:
// All the events in the game
- Common::HashMap<Common::String, EventSeqGroup> event_map;
+ Common::HashMap<Common::String, EventSeqGroup> _eventMap;
// The currently happening or active sequence
- unsigned int active_seq;
+ unsigned int _activeSeq;
// THIS IS NOT THE DEFINITIVE LIST OF ENDED SEQUENCES
// JUST A TEMPORARY LIST OF EVENT SEQUENCES TO PASS AROUND
- Common::Array<EventSeqInfo> end_seq;
+ Common::Array<EventSeqInfo> _endSeq;
// The objects used to draw the dialog box and opinion bars
- pyrodactyl::ui::PersonHandler oh;
+ pyrodactyl::ui::PersonHandler _oh;
- // The reply menu and the colors and font of the text
- pyrodactyl::ui::ReplyMenu reply;
+ // The _reply menu and the colors and font of the text
+ pyrodactyl::ui::ReplyMenu _reply;
// The field for text input
- pyrodactyl::ui::TextArea textin;
+ pyrodactyl::ui::TextArea _textin;
// The info for intro events
- pyrodactyl::ui::ChapterIntro intro;
+ pyrodactyl::ui::ChapterIntro _intro;
// Store the current event data temporarily
- GameEvent *cur_event;
- bool player;
- pyrodactyl::anim::Sprite *cur_sp;
+ GameEvent *_curEvent;
+ bool _player;
+ pyrodactyl::anim::Sprite *_curSp;
- void UpdateDialogBox(Info &info, pyrodactyl::level::Level &level);
+ void updateDialogBox(Info &info, pyrodactyl::level::Level &level);
public:
// The object used to draw the character screen
- pyrodactyl::ui::PersonScreen per;
+ pyrodactyl::ui::PersonScreen _per;
// A flag used to stop drawing the game for a better fade in/fade out experience
- bool draw_game;
+ bool _drawGame;
+
+ Manager() {
+ init();
+ }
- Manager() { Init(); }
~Manager() {}
- void Init();
+ void init();
void load(rapidxml::xml_node<char> *node, pyrodactyl::ui::ParagraphData &popup);
void draw(Info &info, pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level);
@@ -95,17 +98,17 @@ public:
// cur_per is also updated here
void internalEvents(Info &info, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
- void handleEvents(Info &info, const Common::String &player_id, Common::Event &Event,
+ void handleEvents(Info &info, const Common::String &playerId, Common::Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
#if 0
void handleEvents(Info &info, const Common::String &player_id, SDL_Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
#endif
- void CalcActiveSeq(Info &info, pyrodactyl::level::Level &level, const Rect &camera);
+ void calcActiveSeq(Info &info, pyrodactyl::level::Level &level, const Rect &camera);
- void EndSequence(const Common::String &curloc);
- bool EventInProgress();
+ void endSequence(const Common::String &curloc);
+ bool eventInProgress();
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 1aaabad1208..3d91af59563 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -61,7 +61,7 @@ void Game::Init(const Common::String &filename) {
game_over.Clear(false);
state = STATE_GAME;
savefile.auto_slot = false;
- gem.Init();
+ gem.init();
info.Init();
XMLDoc conf(filename);
@@ -184,7 +184,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
if (hud.pausekey.handleEvents(Event) || hud.back.handleEvents(Event) == BUAC_LCLICK)
state = STATE_LOSE_MENU;
} else {
- if (!gem.EventInProgress() && !hud.pause.DisableHotkeys()) {
+ if (!gem.eventInProgress() && !hud.pause.DisableHotkeys()) {
switch (hud.handleEvents(info, Event)) {
case HS_MAP:
ToggleState(STATE_MAP);
@@ -194,7 +194,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
break;
case HS_CHAR:
ToggleState(STATE_CHARACTER);
- gem.per.Cache(info, level.PlayerID(), level);
+ gem._per.Cache(info, level.PlayerID(), level);
break;
case HS_JOURNAL:
ToggleState(STATE_JOURNAL);
@@ -208,7 +208,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
if (state == STATE_GAME) {
- if (gem.EventInProgress()) {
+ if (gem.eventInProgress()) {
gem.handleEvents(info, level.PlayerID(), Event, hud, level, event_res);
if (ApplyResult())
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
@@ -293,7 +293,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
break;
case STATE_CHARACTER:
- gem.per.handleEvents(info, level.PlayerID(), Event);
+ gem._per.handleEvents(info, level.PlayerID(), Event);
break;
case STATE_INVENTORY:
info._inv.handleEvents(level.PlayerID(), Event);
@@ -476,7 +476,7 @@ void Game::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
// HACK: Since sequences can only be ended in GameEventManager, we use this empty array
// to get effects to work for levels
Common::Array<pyrodactyl::event::EventSeqInfo> end_seq;
- ApplyResult(level.internalEvents(info, event_res, end_seq, gem.EventInProgress()));
+ ApplyResult(level.internalEvents(info, event_res, end_seq, gem.eventInProgress()));
}
gem.internalEvents(info, level, event_res);
@@ -490,7 +490,7 @@ void Game::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
map.internalEvents(info);
break;
case STATE_CHARACTER:
- gem.per.internalEvents();
+ gem._per.internalEvents();
break;
default:
break;
@@ -500,13 +500,13 @@ void Game::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
// Purpose: Draw
//------------------------------------------------------------------------
void Game::draw() {
- if (gem.draw_game)
+ if (gem._drawGame)
level.draw(info);
else
g_engine->_imageManager->BlackScreen();
switch (state) {
case STATE_GAME:
- if (gem.EventInProgress())
+ if (gem.eventInProgress())
gem.draw(info, hud, level);
else
hud.draw(info, level.PlayerID());
@@ -530,7 +530,7 @@ void Game::draw() {
break;
case STATE_CHARACTER:
g_engine->_imageManager->DimScreen();
- gem.per.draw(info, level.PlayerID());
+ gem._per.draw(info, level.PlayerID());
hud.draw(info, level.PlayerID());
hud.back.draw();
break;
@@ -637,7 +637,7 @@ bool Game::ApplyResult() {
}
}
- gem.per.Cache(info, level.PlayerID(), level);
+ gem._per.Cache(info, level.PlayerID(), level);
event_res.clear();
return false;
}
@@ -703,7 +703,7 @@ void Game::loadState(Common::SeekableReadStream *stream) {
if (nodeValid("level", node))
level.loadState(node->first_node("level"));
- gem.per.Cache(info, level.PlayerID(), level);
+ gem._per.Cache(info, level.PlayerID(), level);
Common::String playtime;
loadStr(playtime, "time", node);
Commit: 0c7668ce277ea6572a258ea21102ea9f7baf415c
https://github.com/scummvm/scummvm/commit/0c7668ce277ea6572a258ea21102ea9f7baf415c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make rest of the event component follow code formatting conventions
Changed paths:
engines/crab/ai/spriteai.cpp
engines/crab/animation/PopUp.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/event/EventSequence.cpp
engines/crab/event/quest.cpp
engines/crab/event/quest.h
engines/crab/event/trigger.cpp
engines/crab/event/trigger.h
engines/crab/event/triggerset.cpp
engines/crab/event/triggerset.h
engines/crab/game.cpp
engines/crab/level/level_load.cpp
engines/crab/ui/QuestText.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/ui/questmenu.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index b72e75c202d..ac6c8d4ad0b 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -197,7 +197,7 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
}
} break;
case FLEESTATE_DISAPPEAR:
- _visible.Result(false);
+ _visible.result(false);
break;
default:
break;
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 123982d56dc..a837d53d713 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -70,7 +70,7 @@ void PopUpCollection::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
bool PopUp::internalEvents(pyrodactyl::event::Info &info, const Common::String &playerId,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq) {
- if (_visible.Evaluate(info) || _startedShow) {
+ if (_visible.evaluate(info) || _startedShow) {
if (_delay.TargetReached()) {
if (_duration.TargetReached(g_engine->_screenSettings->text_speed)) {
_show = false;
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 5586ffb6559..79cc9518ac8 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -157,7 +157,7 @@ bool FightMoves::forceUpdate(const unsigned int &index, pyrodactyl::input::Fight
_cur = index;
if ((unsigned int)_cur < _move.size()) {
- if (_move[_cur]._unlock.Result()) {
+ if (_move[_cur]._unlock.result()) {
_frameTotal = _move[_cur]._frames[d]._frame.size();
if (_frameTotal > 0) {
input = _move[_cur]._input;
@@ -182,7 +182,7 @@ bool FightMoves::forceUpdate(const unsigned int &index, pyrodactyl::input::Fight
//------------------------------------------------------------------------
void FightMoves::evaluate(pyrodactyl::event::Info &info) {
for (auto i = _move.begin(); i != _move.end(); ++i)
- i->_unlock.Evaluate(info);
+ i->_unlock.evaluate(info);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 026d1f64aca..2df0e83b273 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -635,7 +635,7 @@ bool Sprite::damageValid(Sprite &s, const SpriteConstant &sc) {
// Purpose: Checks about dealing damage to sprite
//------------------------------------------------------------------------
void Sprite::calcProperties(Info &info) {
- _visible.Evaluate(info);
+ _visible.evaluate(info);
_animSet._fight.evaluate(info);
}
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 0df7edabacc..73dd1aa3268 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -127,11 +127,11 @@ public:
}
void visible(bool val) {
- _visible.Result(val);
+ _visible.result(val);
}
bool visible() {
- return _visible.Result();
+ return _visible.result();
}
void calcProperties(pyrodactyl::event::Info &info);
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index b824f859d74..f3cf3185b83 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -55,7 +55,7 @@ void EventSequence::load(const Common::String &filename) {
void EventSequence::internalEvents(pyrodactyl::event::Info &info) {
for (auto nxe = _next.begin(); nxe != _next.end(); ++nxe)
if (*nxe < _events.size()) {
- if (_events[*nxe]._trig.Evaluate(info)) {
+ if (_events[*nxe]._trig.evaluate(info)) {
_eventInProgress = true;
_cur = *nxe;
break;
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index 0601a65c3d6..926ffa563c9 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -34,29 +34,29 @@ namespace Crab {
using namespace pyrodactyl::event;
-Quest::Quest(const Common::String &Title, const Common::String &Text, const bool &Unread, const bool &Marker) : title(Title) {
- text.insert_at(0, Text);
- unread = Unread;
- marker = Marker;
+Quest::Quest(const Common::String &title, const Common::String &text, const bool &unread, const bool &marker) : _title(title) {
+ _text.insert_at(0, text);
+ _unread = unread;
+ _marker = marker;
}
void Quest::loadState(rapidxml::xml_node<char> *node) {
- loadStr(title, "title", node);
- loadBool(unread, "unread", node);
- loadBool(marker, "marker", node);
+ loadStr(_title, "title", node);
+ loadBool(_unread, "unread", node);
+ loadBool(_marker, "marker", node);
for (rapidxml::xml_node<char> *n = node->first_node("info"); n != NULL; n = n->next_sibling("info"))
- text.push_back(n->value());
+ _text.push_back(n->value());
}
void Quest::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "quest");
- child->append_attribute(doc.allocate_attribute("title", title.c_str()));
+ child->append_attribute(doc.allocate_attribute("title", _title.c_str()));
- saveBool(unread, "unread", doc, child);
- saveBool(marker, "marker", doc, child);
+ saveBool(_unread, "unread", doc, child);
+ saveBool(_marker, "marker", doc, child);
- for (auto i = text.begin(); i != text.end(); ++i) {
+ for (auto i = _text.begin(); i != _text.end(); ++i) {
rapidxml::xml_node<char> *grandchild = doc.allocate_node(rapidxml::node_element, "info");
grandchild->value(i->c_str());
child->append_node(grandchild);
diff --git a/engines/crab/event/quest.h b/engines/crab/event/quest.h
index 0929ae93975..4078bd8b92f 100644
--- a/engines/crab/event/quest.h
+++ b/engines/crab/event/quest.h
@@ -40,22 +40,23 @@ namespace pyrodactyl {
namespace event {
struct Quest {
// The title of the quest
- Common::String title;
+ Common::String _title;
// The objective text, the last one being the current objective
- Common::Array<Common::String> text;
+ Common::Array<Common::String> _text;
// Keep track of which quests the player has read
- bool unread;
+ bool _unread;
// Does this quest have an associated destination marker
- bool marker;
+ bool _marker;
Quest() {
- unread = true;
- marker = false;
+ _unread = true;
+ _marker = false;
}
- Quest(const Common::String &Title, const Common::String &Text, const bool &Unread, const bool &Marker);
+
+ Quest(const Common::String &title, const Common::String &text, const bool &unread, const bool &marker);
void loadState(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index f64ec285c5a..6d18024ec2e 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -39,89 +39,89 @@ void Trigger::load(rapidxml::xml_node<char> *node) {
loadStr(ty, "type", node);
// Should we throw a warning about missing fields? Depends on the type of trigger
- bool echo_op = true, echo_tar = false, echo_sub = true;
+ bool echoOp = true, echoTar = false, echoSub = true;
if (ty == "obj")
- type = TRIG_OBJ;
+ _type = TRIG_OBJ;
else if (ty == "opinion") {
- type = TRIG_OPINION;
- echo_tar = true;
+ _type = TRIG_OPINION;
+ echoTar = true;
} else if (ty == "loc") {
- type = TRIG_LOC;
- echo_op = false;
+ _type = TRIG_LOC;
+ echoOp = false;
} else if (ty == "item") {
- type = TRIG_ITEM;
- echo_op = false;
+ _type = TRIG_ITEM;
+ echoOp = false;
} else if (ty == "rect") {
- type = TRIG_RECT;
- echo_op = false;
+ _type = TRIG_RECT;
+ echoOp = false;
} else if (ty == "stat") {
- type = TRIG_STAT;
- echo_tar = true;
+ _type = TRIG_STAT;
+ echoTar = true;
} else if (ty == "diff") {
- type = TRIG_DIFF;
- echo_sub = false;
+ _type = TRIG_DIFF;
+ echoSub = false;
} else if (ty == "trait") {
- type = TRIG_TRAIT;
+ _type = TRIG_TRAIT;
} else
- type = TRIG_VAR;
+ _type = TRIG_VAR;
- loadStr(target, "target", node, echo_tar);
- loadStr(subject, "subject", node, echo_sub);
- loadStr(operation, "operation", node, echo_op);
- loadStr(val, "val", node);
+ loadStr(_target, "target", node, echoTar);
+ loadStr(_subject, "subject", node, echoSub);
+ loadStr(_operation, "operation", node, echoOp);
+ loadStr(_val, "val", node);
Common::String str;
loadStr(str, "rel", node, false);
if (str == "or")
- rel = OP_OR;
+ _rel = OP_OR;
else
- rel = OP_AND;
+ _rel = OP_AND;
loadStr(str, "prefix", node, false);
if (str == "!")
- negate = true;
+ _negate = true;
else
- negate = false;
+ _negate = false;
}
-bool Trigger::Evaluate(int lhs, int rhs) {
- if (operation == ">" && lhs > rhs)
+bool Trigger::evaluate(int lhs, int rhs) {
+ if (_operation == ">" && lhs > rhs)
return true;
- else if (operation == "=" && lhs == rhs)
+ else if (_operation == "=" && lhs == rhs)
return true;
- else if (operation == "<" && lhs < rhs)
+ else if (_operation == "<" && lhs < rhs)
return true;
- else if (operation == "!=" && lhs != rhs)
+ else if (_operation == "!=" && lhs != rhs)
return true;
- else if (operation == "<=" && lhs <= rhs)
+ else if (_operation == "<=" && lhs <= rhs)
return true;
- else if (operation == ">=" && lhs >= rhs)
+ else if (_operation == ">=" && lhs >= rhs)
return true;
return false;
}
-bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
+bool Trigger::evaluate(pyrodactyl::event::Info &info) {
using namespace pyrodactyl::people;
using namespace pyrodactyl::stat;
- switch (type) {
+ switch (_type) {
case TRIG_OBJ:
- if (operation == "p") {
- if (info._talkKeyDown && info.lastPerson() == val)
+ if (_operation == "p") {
+ if (info._talkKeyDown && info.lastPerson() == _val)
return true;
else
return false;
- } else if (operation == "status") {
- PersonType ty = StringToPersonType(val);
- if (info.type(subject) == ty)
+ } else if (_operation == "status") {
+ PersonType ty = StringToPersonType(_val);
+ if (info.type(_subject) == ty)
return true;
else
return false;
- } else if (operation == "state") {
- PersonState st = StringToPersonState(val);
- if (info.state(subject) == st)
+ } else if (_operation == "state") {
+ PersonState st = StringToPersonState(_val);
+ if (info.state(_subject) == st)
return true;
else
return false;
@@ -130,66 +130,69 @@ bool Trigger::Evaluate(pyrodactyl::event::Info &info) {
case TRIG_OPINION: {
Person p;
- if (info.personGet(subject, p)) {
- if (target == "like")
- return Evaluate(p.opinion.val[OPI_LIKE], StringToNumber<int>(val));
- else if (target == "fear")
- return Evaluate(p.opinion.val[OPI_FEAR], StringToNumber<int>(val));
- else if (target == "respect")
- return Evaluate(p.opinion.val[OPI_RESPECT], StringToNumber<int>(val));
+ if (info.personGet(_subject, p)) {
+ if (_target == "like")
+ return evaluate(p.opinion.val[OPI_LIKE], StringToNumber<int>(_val));
+ else if (_target == "fear")
+ return evaluate(p.opinion.val[OPI_FEAR], StringToNumber<int>(_val));
+ else if (_target == "respect")
+ return evaluate(p.opinion.val[OPI_RESPECT], StringToNumber<int>(_val));
}
- } break;
+ }
+ break;
case TRIG_LOC:
- return (info.curLocID() == val);
+ return (info.curLocID() == _val);
break;
case TRIG_ITEM:
- return info._inv.HasItem(target, subject, val);
+ return info._inv.HasItem(_target, _subject, _val);
break;
case TRIG_RECT:
- return info.collideWithTrigger(subject, StringToNumber<int>(val));
+ return info.collideWithTrigger(_subject, StringToNumber<int>(_val));
case TRIG_STAT: {
- StatType ty = StringToStatType(target);
+ StatType ty = StringToStatType(_target);
int sub = 0, value = 0;
- bool compare_to_var = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
+ bool compareToVar = Common::find_if(_val.begin(), _val.end(), IsChar) != _val.end();
- info.statGet(subject, ty, sub);
- if (compare_to_var)
- info.statGet(val, ty, value);
+ info.statGet(_subject, ty, sub);
+ if (compareToVar)
+ info.statGet(_val, ty, value);
else
- value = StringToNumber<int>(val);
+ value = StringToNumber<int>(_val);
- return Evaluate(sub, value);
- } break;
+ return evaluate(sub, value);
+ }
+ break;
case TRIG_DIFF:
- return Evaluate(info.ironMan(), StringToNumber<int>(val));
+ return evaluate(info.ironMan(), StringToNumber<int>(_val));
case TRIG_TRAIT:
- if (info.personValid(target)) {
- Person *p = &info.personGet(target);
+ if (info.personValid(_target)) {
+ Person *p = &info.personGet(_target);
for (auto &i : p->trait)
- if (i.name == val)
+ if (i.name == _val)
return true;
}
break;
case TRIG_VAR: {
int var_sub = 0, var_val = 0;
- bool compare_to_var = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
+ bool compare_to_var = Common::find_if(_val.begin(), _val.end(), IsChar) != _val.end();
- info.varGet(subject, var_sub);
+ info.varGet(_subject, var_sub);
if (compare_to_var)
- info.varGet(val, var_val);
+ info.varGet(_val, var_val);
else
- var_val = StringToNumber<int>(val);
+ var_val = StringToNumber<int>(_val);
- return Evaluate(var_sub, var_val);
- } break;
+ return evaluate(var_sub, var_val);
+ }
+ break;
default:
break;
diff --git a/engines/crab/event/trigger.h b/engines/crab/event/trigger.h
index 192d862784b..9e36aedcde6 100644
--- a/engines/crab/event/trigger.h
+++ b/engines/crab/event/trigger.h
@@ -37,8 +37,10 @@ namespace Crab {
namespace pyrodactyl {
namespace event {
-enum RelOp { OP_AND,
- OP_OR };
+enum RelOp {
+ OP_AND,
+ OP_OR
+};
enum TriggerType {
TRIG_OBJ, // Interacting with an object, status of character (hostile, coward etc), state (stand, fight, flee, KO)
@@ -53,26 +55,29 @@ enum TriggerType {
};
struct Trigger {
- TriggerType type;
- Common::String target, subject, operation, val;
+ TriggerType _type;
+ Common::String _target, _subject, _operation, _val;
// Relation to the next trigger
- RelOp rel;
+ RelOp _rel;
// Represents the Boolean ! operator
- bool negate;
+ bool _negate;
Trigger() {
- type = TRIG_VAR;
- rel = OP_AND;
- negate = false;
+ _type = TRIG_VAR;
+ _rel = OP_AND;
+ _negate = false;
+ }
+
+ Trigger(rapidxml::xml_node<char> *node) {
+ load(node);
}
- Trigger(rapidxml::xml_node<char> *node) { load(node); }
void load(rapidxml::xml_node<char> *node);
- bool Evaluate(pyrodactyl::event::Info &info);
+ bool evaluate(pyrodactyl::event::Info &info);
- bool Evaluate(int lhs, int rhs);
+ bool evaluate(int lhs, int rhs);
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/event/triggerset.cpp b/engines/crab/event/triggerset.cpp
index 00decbb6a7b..d4ca418fb0b 100644
--- a/engines/crab/event/triggerset.cpp
+++ b/engines/crab/event/triggerset.cpp
@@ -38,39 +38,39 @@ using namespace pyrodactyl::event;
void TriggerSet::load(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *n = node->first_node("trigger"); n != NULL; n = n->next_sibling("trigger")) {
Trigger t(n);
- statement.push_back(t);
+ _statement.push_back(t);
}
}
-void TriggerSet::Add(const Trigger &t) {
- statement.push_back(t);
+void TriggerSet::add(const Trigger &t) {
+ _statement.push_back(t);
}
-bool TriggerSet::Evaluate(pyrodactyl::event::Info &info) {
- result = true;
+bool TriggerSet::evaluate(pyrodactyl::event::Info &info) {
+ _result = true;
- if (statement.empty() == false) {
- RelOp next_op = OP_AND;
- result = true;
- bool cur_result = false;
+ if (_statement.empty() == false) {
+ RelOp nextOp = OP_AND;
+ _result = true;
+ bool curResult = false;
- for (auto i = statement.begin(); i != statement.end(); ++i) {
- if (i->negate)
- cur_result = !i->Evaluate(info);
+ for (auto i = _statement.begin(); i != _statement.end(); ++i) {
+ if (i->_negate)
+ curResult = !i->evaluate(info);
else
- cur_result = i->Evaluate(info);
+ curResult = i->evaluate(info);
- if (next_op == OP_AND)
- result = cur_result && result;
+ if (nextOp == OP_AND)
+ _result = curResult && _result;
else
- result = cur_result || result;
+ _result = curResult || _result;
- next_op = i->rel;
+ nextOp = i->_rel;
}
} else
- result = true;
+ _result = true;
- return result;
+ return _result;
}
} // End of namespace Crab
diff --git a/engines/crab/event/triggerset.h b/engines/crab/event/triggerset.h
index e2efe87f99b..c93823148f9 100644
--- a/engines/crab/event/triggerset.h
+++ b/engines/crab/event/triggerset.h
@@ -41,26 +41,36 @@ namespace event {
class TriggerSet {
// The conditions needed to unlock whatever we want
// Places where this is used - events, levels, fighting moves
- Common::Array<Trigger> statement;
+ Common::Array<Trigger> _statement;
// Is the thing unlocked or not?
- bool result;
+ bool _result;
public:
- TriggerSet() { result = true; }
+ TriggerSet() {
+ _result = true;
+ }
void load(rapidxml::xml_node<char> *node);
- bool Evaluate(pyrodactyl::event::Info &info);
- void Add(const Trigger &t);
+ bool evaluate(pyrodactyl::event::Info &info);
+ void add(const Trigger &t);
+
+ bool result() {
+ return _result;
+ }
- bool Result() { return result; }
- void Result(bool val) { result = val; }
+ void result(bool val) {
+ _result = val;
+ }
+
+ void clear(const bool &val = true) {
+ _statement.clear();
+ _result = val;
+ }
- void Clear(const bool &val = true) {
- statement.clear();
- result = val;
+ bool empty() {
+ return _statement.empty();
}
- bool Empty() { return statement.empty(); }
};
} // End of namespace event
} // End of namespace pyrodactyl
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 3d91af59563..db48f1ef38b 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -58,7 +58,7 @@ void Game::LoadGame() {
void Game::Init(const Common::String &filename) {
g_engine->_loadingScreen->Dim();
g_engine->_eventStore->clear();
- game_over.Clear(false);
+ game_over.clear(false);
state = STATE_GAME;
savefile.auto_slot = false;
gem.init();
@@ -218,7 +218,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
level.handleEvents(info, Event);
- if (!game_over.Empty() && game_over.Evaluate(info)) {
+ if (!game_over.empty() && game_over.evaluate(info)) {
state = STATE_LOSE_MENU;
hud.gom.reset();
return;
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index ceea94765fd..8611e1fbe09 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -149,19 +149,19 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
if (nodeValid("popup", node, false))
pop.load(node->first_node("popup"));
- game_over.Clear();
+ game_over.clear();
if (nodeValid("game_over", node, false))
game_over.load(node->first_node("game_over"));
else if (player_index < objects.size()) {
// The default lose condition is the death of the player
using namespace pyrodactyl::event;
Trigger t;
- t.type = TRIG_STAT;
- t.target = STATNAME_HEALTH;
- t.subject = objects[player_index].id();
- t.operation = "<";
- t.val = "1";
- game_over.Add(t);
+ t._type = TRIG_STAT;
+ t._target = STATNAME_HEALTH;
+ t._subject = objects[player_index].id();
+ t._operation = "<";
+ t._val = "1";
+ game_over.add(t);
}
CalcProperties(info);
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 6d2e72883d0..65437b234e4 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -69,15 +69,15 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
// Assign default values to start and stop
start = 0;
- stop = q.text.size();
+ stop = q._text.size();
// Keep count of lines and pages - remember a single entry can take more than one line
unsigned int page_count = 0, page_start = 0;
// Start from line 0, page 0 and scan the list of entries
- for (unsigned int i = 0, line_count = 0; i < q.text.size(); ++i) {
+ for (unsigned int i = 0, line_count = 0; i < q._text.size(); ++i) {
// Increment the number of lines by one text entry
- line_count += (q.text[i].size() / line.x) + 1;
+ line_count += (q._text[i].size() / line.x) + 1;
// If we go over the quota for lines per page, go to next page and reset line counter to 0
if (line_count > lines_per_page) {
@@ -98,7 +98,7 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
// Used for the final page, because the page count won't be incremented for the last one
if (page_count == current_page) {
start = page_start;
- stop = q.text.size();
+ stop = q._text.size();
}
// Find out how many pages the lines need
@@ -117,7 +117,7 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
next.draw();
// Draw the current page of quest text
- if (!q.text.empty()) {
+ if (!q._text.empty()) {
// Count the number of lines, because a single entry can take more than one line
int count = 0;
@@ -126,12 +126,12 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
// Draw first entry in selected color, and older quest entries in standard color
if (i == 0)
- g_engine->_textManager->draw(x, y, q.text[i], col_s, font, align, line.x, line.y);
+ g_engine->_textManager->draw(x, y, q._text[i], col_s, font, align, line.x, line.y);
else
- ParagraphData::draw(q.text[i], inc.x * count, inc.y * count);
+ ParagraphData::draw(q._text[i], inc.x * count, inc.y * count);
// Count is reduced extra by the amount of lines it takes for the message to be drawn
- count += (q.text[i].size() / line.x) + 1;
+ count += (q._text[i].size() / line.x) + 1;
}
}
}
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 76d05157217..67d58c27a0f 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -152,7 +152,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
unsigned int reply_count = 0, element_count = 0;
for (auto i = dat._reply.begin(); i != dat._reply.end() && reply_count < dat._reply.size(); ++i, ++reply_count) {
- if (i->_unlock.Evaluate(info)) {
+ if (i->_unlock.evaluate(info)) {
element[element_count].visible = true;
element[element_count].index = reply_count;
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index df51f16c519..a36afb43ba5 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -219,7 +219,7 @@ void Journal::Move(const Common::String &id, const Common::String &Title, const
// Find the quest chain in the source menu
unsigned int index = 0;
for (auto i = jo.menu[source].quest.begin(); i != jo.menu[source].quest.end(); ++i, ++index)
- if (i->title == Title)
+ if (i->_title == Title)
break;
if (index < jo.menu[source].quest.size()) {
@@ -246,7 +246,7 @@ void Journal::Open(const Common::String &id, const JournalCategory &Category, co
if (select > 0 && select < JE_TOTAL) {
// Search for the title with same name
for (unsigned int num = 0; num < jo.menu[select].quest.size(); ++num)
- if (jo.menu[select].quest[num].title == Title) {
+ if (jo.menu[select].quest[num]._title == Title) {
// Found it, switch to this
jo.menu[select].Select(num);
break;
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index aa12a7f70ec..a80220a77f9 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -415,8 +415,8 @@ void Map::SelectDest(const Common::String &name) {
//------------------------------------------------------------------------
void Map::Update(pyrodactyl::event::Info &info) {
for (auto &i : travel.element) {
- i.unlock.Evaluate(info);
- i.visible = i.unlock.Result();
+ i.unlock.evaluate(info);
+ i.visible = i.unlock.result();
}
}
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 713d0ff0248..93862614ff5 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -85,10 +85,10 @@ void QuestMenu::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void QuestMenu::Add(const Common::String &title, const Common::String &txt) {
for (auto i = quest.begin(); i != quest.end(); ++i)
- if (i->title == title) // We already have the quest entry
+ if (i->_title == title) // We already have the quest entry
{
- i->text.insert_at(0, txt); // Just add the new string to the start of the quest messages and return
- i->unread = true;
+ i->_text.insert_at(0, txt); // Just add the new string to the start of the quest messages and return
+ i->_unread = true;
return;
}
@@ -116,8 +116,8 @@ void QuestMenu::Erase(const int &index) {
//------------------------------------------------------------------------
void QuestMenu::Marker(const Common::String &title, const bool &val) {
for (auto i = quest.begin(); i != quest.end(); ++i)
- if (i->title == title)
- i->marker = val;
+ if (i->_title == title)
+ i->_marker = val;
}
//------------------------------------------------------------------------
// Purpose: Draw
@@ -131,11 +131,11 @@ void QuestMenu::draw(Button &bu_map) {
// Only draw in _s color if we are on the same button and page
if ((unsigned int)sel_bu == count && (unsigned int)sel_page == menu.CurrentPage())
- g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_s, font, align);
+ g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i]._title, col_s, font, align);
else
- g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i].title, col_n, font, align);
+ g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i]._title, col_n, font, align);
- if (quest[i].unread) {
+ if (quest[i]._unread) {
using namespace pyrodactyl::image;
g_engine->_imageManager->draw(base_x + off_unread.x, base_y + off_unread.y, g_engine->_imageManager->notify);
}
@@ -144,7 +144,7 @@ void QuestMenu::draw(Button &bu_map) {
if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
text.draw(quest[sel_quest]);
- if (quest[sel_quest].marker)
+ if (quest[sel_quest]._marker)
bu_map.draw();
}
}
@@ -162,17 +162,17 @@ bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const Co
sel_page = menu.CurrentPage();
sel_quest = menu.Index() + sel_bu;
- quest[sel_quest].unread = false;
+ quest[sel_quest]._unread = false;
text.reset();
menu.Image(sel_bu, sel_page, img_s);
}
if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
- if (quest[sel_quest].marker)
+ if (quest[sel_quest]._marker)
if (bu_map.handleEvents(Event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
- map_title = quest[sel_quest].title;
+ map_title = quest[sel_quest]._title;
return true;
}
@@ -233,7 +233,7 @@ void QuestMenu::Select(const int &quest_index) {
sel_bu = quest_index % menu.ElementsPerPage();
- quest[quest_index].unread = false;
+ quest[quest_index]._unread = false;
text.reset();
menu.Image(sel_bu, sel_page, img_s);
Commit: e3581221b22212de897cec3fe1dc9c00253e2a59
https://github.com/scummvm/scummvm/commit/e3581221b22212de897cec3fe1dc9c00253e2a59
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Image class follow code formatting conventions
Changed paths:
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/animation/shadow.h
engines/crab/animation/sprite.cpp
engines/crab/image/Image.cpp
engines/crab/image/Image.h
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
engines/crab/level/level.cpp
engines/crab/level/level_objects.cpp
engines/crab/splash.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/ClipButton.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/StateButton.cpp
engines/crab/ui/element.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/slider.cpp
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index f72f7bdfa24..d7db75b9031 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -60,7 +60,7 @@ void LoadingScreen::draw() {
screen[cur].draw();
// Draw the loading text
- text.draw((g_engine->_screenSettings->cur.w - text.W()) / 2, (g_engine->_screenSettings->cur.h - text.H()) / 2);
+ text.draw((g_engine->_screenSettings->cur.w - text.w()) / 2, (g_engine->_screenSettings->cur.h - text.h()) / 2);
g_engine->_screen->update();
@@ -82,7 +82,7 @@ void LoadingScreen::Dim() {
}
void LoadingScreen::Quit() {
- text.Delete();
+ text.deleteImage();
for (auto i = screen.begin(); i != screen.end(); ++i)
i->Delete();
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index e9fa82b26bb..fb01ec6ca87 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -44,8 +44,8 @@ class LoadingScreen {
pyrodactyl::image::Image bg;
Screen(rapidxml::xml_node<char> *node) { bg.load(node, "bg"); }
- void Delete() { bg.Delete(); }
- void draw() { bg.draw((g_engine->_screenSettings->cur.w - bg.W()) / 2, (g_engine->_screenSettings->cur.h - bg.H()) / 2); }
+ void Delete() { bg.deleteImage(); }
+ void draw() { bg.draw((g_engine->_screenSettings->cur.w - bg.w()) / 2, (g_engine->_screenSettings->cur.h - bg.h()) / 2); }
};
// The different loading screens
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 330d895fd35..3171aebcb1c 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -53,8 +53,8 @@ void TileSet::load(const Common::String &path, rapidxml::xml_node<char> *node) {
loc = path + filename;
img.load(loc);
- total_rows = img.H() / tile_h;
- total_cols = img.W() / tile_w;
+ total_rows = img.h() / tile_h;
+ total_cols = img.w() / tile_w;
warning("Total rows : %d Total cols: %d gid: %d", total_rows, total_cols, first_gid);
}
@@ -67,7 +67,7 @@ void TileSet::load(const Common::String &path, rapidxml::xml_node<char> *node) {
void TileSetGroup::reset() {
for (auto i = tileset.begin(); i != tileset.end(); ++i)
- i->img.Delete();
+ i->img.deleteImage();
tileset.clear();
}
@@ -250,7 +250,7 @@ void TileSetGroup::draw(MapLayer &layer, const Rect &camera, const Vector2i &til
end.y = camera.y + g_engine->_screen->h;
Rect clip(v.x, v.y, end.x - v.x, end.y - v.y);
- img.FastDraw(0, 0, &clip);
+ img.fastDraw(0, 0, &clip);
}
}
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index 8286e4fe473..617c33db375 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -60,8 +60,8 @@ struct ShadowData {
using namespace pyrodactyl::image;
Image dat;
g_engine->_imageManager->GetTexture(_img, dat);
- _size.x = dat.W() / 2;
- _size.y = dat.H() / 2;
+ _size.x = dat.w() / 2;
+ _size.y = dat.h() / 2;
}
};
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 2df0e83b273..d4f3553d5f2 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -74,8 +74,8 @@ void Sprite::load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
Image dat;
g_engine->_imageManager->GetTexture(_image, dat);
- _imgSize.x = dat.W();
- _imgSize.y = dat.H();
+ _imgSize.x = dat.w();
+ _imgSize.y = dat.h();
unsigned int index = 0;
loadNum(index, "moveset", node);
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index cff275bac5a..e86375fcf6b 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -40,44 +40,44 @@ using namespace pyrodactyl::image;
// Purpose: Load a texture
//------------------------------------------------------------------------
bool Image::load(Graphics::Surface *surface) {
- Delete();
+ deleteImage();
- texture->create(surface->w, surface->h, surface->format);
- texture->copyFrom(*surface);
- w = surface->w;
- h = surface->h;
+ _texture->create(surface->w, surface->h, surface->format);
+ _texture->copyFrom(*surface);
+ _w = surface->w;
+ _h = surface->h;
return true;
}
bool Image::load(Graphics::ManagedSurface *surface) {
- Delete();
- texture = new Graphics::ManagedSurface(*surface);
- w = surface->w;
- h = surface->h;
+ deleteImage();
+ _texture = new Graphics::ManagedSurface(*surface);
+ _w = surface->w;
+ _h = surface->h;
return true;
}
bool Image::load(const Common::String &path) {
// Get rid of preexisting texture
- Delete();
+ deleteImage();
// Load image at specified path
Common::File file;
ImageDecoder decoder;
if (FileOpen(path, &file) && decoder.loadStream(file)) {
- texture = new Graphics::ManagedSurface(decoder.getSurface()->w, decoder.getSurface()->h, *g_engine->_format);
- texture->blitFrom(decoder.getSurface());
- w = texture->w;
- h = texture->h;
+ _texture = new Graphics::ManagedSurface(decoder.getSurface()->w, decoder.getSurface()->h, *g_engine->_format);
+ _texture->blitFrom(decoder.getSurface());
+ _w = _texture->w;
+ _h = _texture->h;
file.close();
- warning("Image::load() Image Texture(%s): w: %d h: %d", path.c_str(), w, h);
+ warning("Image::load() Image Texture(%s): w: %d h: %d", path.c_str(), _w, _h);
}
- return texture != nullptr;
+ return _texture != nullptr;
}
bool Image::load(rapidxml::xml_node<char> *node, const char *name) {
@@ -88,30 +88,30 @@ bool Image::load(rapidxml::xml_node<char> *node, const char *name) {
}
bool Image::load(const Image &image, Rect *clip, const TextureFlipType &flip) {
- Delete();
+ deleteImage();
- Common::Rect srcRect(0, 0, w, h);
+ Common::Rect srcRect(0, 0, _w, _h);
if (clip)
srcRect = Common::Rect(clip->x, clip->y, clip->x + clip->w, clip->y + clip->h);
- texture = new Graphics::ManagedSurface();
- texture->copyFrom(image.texture->getSubArea(srcRect));
+ _texture = new Graphics::ManagedSurface();
+ _texture->copyFrom(image._texture->getSubArea(srcRect));
switch (flip) {
case FLIP_NONE:
break;
case FLIP_X:
- texture->surfacePtr()->flipHorizontal(Common::Rect(texture->w, texture->h));
+ _texture->surfacePtr()->flipHorizontal(Common::Rect(_texture->w, _texture->h));
break;
default:
warning("Flipped texture: %d", flip);
}
- w = texture->w;
- h = texture->h;
+ _w = _texture->w;
+ _h = _texture->h;
return true;
}
@@ -125,17 +125,17 @@ void Image::draw(const int &x, const int &y, Common::Rect *clip, const TextureFl
if (clip != NULL) {
srcRect = *clip;
} else {
- srcRect = Common::Rect(x, y, w + x, h + y);
+ srcRect = Common::Rect(x, y, _w + x, _h + y);
}
- Common::Rect destRect(x, y, w + x, h + y);
+ Common::Rect destRect(x, y, _w + x, _h + y);
if (clip != NULL) {
destRect.right = clip->right;
destRect.bottom = clip->bottom;
}
// TODO: Do proper clipping
- g_engine->_screen->blitFrom(*texture, Common::Point(static_cast<int16>(x), static_cast<int16>(y)));
+ g_engine->_screen->blitFrom(*_texture, Common::Point(static_cast<int16>(x), static_cast<int16>(y)));
}
Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, ImageRotateDegrees rotation) {
@@ -190,8 +190,8 @@ void Image::draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
if (surf == NULL)
surf = g_engine->_screen;
- Common::Rect srcRect(0, 0, w, h);
- Common::Rect destRect(x, y, w + x, h + y);
+ Common::Rect srcRect(0, 0, _w, _h);
+ Common::Rect destRect(x, y, _w + x, _h + y);
if (clip) {
srcRect = Common::Rect(clip->x, clip->y, clip->x + clip->w, clip->y + clip->h);
@@ -200,7 +200,7 @@ void Image::draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
}
Graphics::ManagedSurface s;
- s.copyFrom(texture->getSubArea(srcRect));
+ s.copyFrom(_texture->getSubArea(srcRect));
if (s.w < 1 || s.h < 1)
return;
@@ -253,8 +253,8 @@ void Image::draw(const int &x, const int &y, Rect *clip, const TextureFlipType &
surf->blitFrom(s, Common::Rect(s.w, s.h), destRect);
}
-void Image::FastDraw(const int &x, const int &y, Rect *clip) {
- Common::Rect destRect(x, y, w + x, h + y);
+void Image::fastDraw(const int &x, const int &y, Rect *clip) {
+ Common::Rect destRect(x, y, _w + x, _h + y);
int in_y = 0, in_x = 0;
if (clip) {
@@ -267,10 +267,10 @@ void Image::FastDraw(const int &x, const int &y, Rect *clip) {
const int he = destRect.height();
const int destW = destRect.width();
uint32 *out = (uint32*)g_engine->_screen->getBasePtr(destRect.left, destRect.top);
- uint32 *in = (uint32*)texture->getBasePtr(in_x, in_y);
+ uint32 *in = (uint32*)_texture->getBasePtr(in_x, in_y);
const uint32 outPitch = g_engine->_screen->pitch / sizeof(uint32);
- const uint32 inPitch = texture->pitch / sizeof(uint32);
+ const uint32 inPitch = _texture->pitch / sizeof(uint32);
for (int y_ = 0; y_ < he; y_++) {
memcpy(out, in, destW * 4);
@@ -285,13 +285,13 @@ void Image::FastDraw(const int &x, const int &y, Rect *clip) {
//------------------------------------------------------------------------
// Purpose: Delete texture data
//------------------------------------------------------------------------
-void Image::Delete() {
- if (texture != nullptr && w > 0 && h > 0) {
- texture->free();
- delete texture;
- texture = nullptr;
- w = 0;
- h = 0;
+void Image::deleteImage() {
+ if (_texture != nullptr && _w > 0 && _h > 0) {
+ _texture->free();
+ delete _texture;
+ _texture = nullptr;
+ _w = 0;
+ _h = 0;
}
}
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index add482c5c18..220b0fee99f 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -44,10 +44,7 @@ namespace image {
// Image data used in Asset Manager
class Image {
// The dimensions of the image
- int w, h;
-
- // The actual hardware texture
- //SDL_Texture *texture;
+ int _w, _h;
enum ImageRotateDegrees {
kImageRotateBy90,
@@ -56,15 +53,15 @@ class Image {
};
public:
- Graphics::ManagedSurface *texture;
+ Graphics::ManagedSurface *_texture;
- Image() : texture(nullptr), w(0), h(0) {}
+ Image() : _texture(nullptr), _w(0), _h(0) {}
~Image() {}
Graphics::Surface* rotate(const Graphics::ManagedSurface &src, ImageRotateDegrees rotation);
// Set color modulation
- void Color(const uint8 &r, const uint8 &g, const uint8 &b) {
+ void color(const uint8 &r, const uint8 &g, const uint8 &b) {
#if 0
SDL_SetTextureColorMod(texture, r, g, b);
#endif
@@ -77,7 +74,7 @@ public:
#endif
// Set alpha modulation
- int Alpha(const uint8 &alpha) {
+ int alpha(const uint8 &alpha) {
#if 0
return SDL_SetTextureAlphaMod(texture, alpha);
#endif
@@ -86,7 +83,7 @@ public:
}
// Get alpha modulation
- uint8 Alpha() {
+ uint8 alpha() {
uint8 res = 255;
#if 0
SDL_GetTextureAlphaMod(texture, &res);
@@ -105,14 +102,22 @@ public:
// Draw the openGL texture
void draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
void draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE, Graphics::ManagedSurface *surf = NULL);
- void FastDraw(const int &x, const int &y, Rect *clip = NULL);
+ void fastDraw(const int &x, const int &y, Rect *clip = NULL);
// Delete the openGL texture
- void Delete();
+ void deleteImage();
+
+ int w() {
+ return _w;
+ }
- int W() { return w; }
- int H() { return h; }
- bool Valid() { return texture != nullptr; }
+ int h() {
+ return _h;
+ }
+
+ bool valid() {
+ return _texture != nullptr;
+ }
};
} // End of namespace image
} // End of namespace pyrodactyl
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 321b8e0934d..88e42bed196 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -45,7 +45,7 @@ using namespace pyrodactyl::image;
//------------------------------------------------------------------------
void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
for (auto it = map[mapid].begin(); it != map[mapid].end(); ++it)
- it->_value.Delete();
+ it->_value.deleteImage();
map[mapid].clear();
XMLDoc image_list(filename);
@@ -185,7 +185,7 @@ void ImageManager::BlackScreen() {
void ImageManager::Quit() {
for (int i = 0; i < MAP_TOTAL; i++) {
for (auto it = map[i].begin(); it != map[i].end(); ++it)
- it->_value.Delete();
+ it->_value.deleteImage();
map[i].clear();
}
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index 7a87d8565bb..855e9acf68f 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -92,7 +92,7 @@ public:
void LoadMap(const Common::String &filename, const MapID &mapid = MAP_CURRENT);
void AddTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex = MAP_COMMON);
- void FreeTexture(const ImageKey &id, int mapindex = MAP_COMMON) { map[mapindex][id].Delete(); }
+ void FreeTexture(const ImageKey &id, int mapindex = MAP_COMMON) { map[mapindex][id].deleteImage(); }
void GetTexture(const ImageKey &id, Image &data);
Image &GetTexture(const ImageKey &id);
bool ValidTexture(const ImageKey &id);
@@ -108,7 +108,7 @@ public:
// Draw the notification icon
void NotifyDraw(const int &x, const int &y) {
auto *k = &GetTexture(notify);
- draw(x - k->W() / 2, y - k->H() / 2, notify);
+ draw(x - k->w() / 2, y - k->h() / 2, notify);
}
};
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index f1ffb9942d6..49e0e8aefe5 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -128,14 +128,14 @@ void Cursor::draw() {
if (state != oldState) {
if (hover) {
if (pressed)
- CursorMan.replaceCursor(img_hover_s.texture->rawSurface(), 0, 0, 0);
+ CursorMan.replaceCursor(img_hover_s._texture->rawSurface(), 0, 0, 0);
else
- CursorMan.replaceCursor(img_hover.texture->rawSurface(), 0, 0, 0);
+ CursorMan.replaceCursor(img_hover._texture->rawSurface(), 0, 0, 0);
} else {
if (pressed)
- CursorMan.replaceCursor(img_s.texture->rawSurface(), 0, 0, 0);
+ CursorMan.replaceCursor(img_s._texture->rawSurface(), 0, 0, 0);
else
- CursorMan.replaceCursor(img.texture->rawSurface(), 0, 0, 0);
+ CursorMan.replaceCursor(img._texture->rawSurface(), 0, 0, 0);
}
}
}
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index 856da71e713..15860974bc4 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -74,10 +74,10 @@ public:
~Cursor() {}
void Quit() {
- img.Delete();
- img_s.Delete();
- img_hover.Delete();
- img_hover_s.Delete();
+ img.deleteImage();
+ img_s.deleteImage();
+ img_hover.deleteImage();
+ img_hover_s.deleteImage();
}
void reset();
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index e00b37dbd93..965f241153f 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -65,7 +65,7 @@ void Level::reset() {
music.id = -1;
preview_path.clear();
- img.Delete();
+ img.deleteImage();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index dba8e655b08..4e45822877b 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -38,8 +38,8 @@ using namespace pyrodactyl::level;
void PlayerDestMarker::load(rapidxml::xml_node<char> *node) {
loadImgKey(img, "dest", node);
- size.x = g_engine->_imageManager->GetTexture(img).W();
- size.y = g_engine->_imageManager->GetTexture(img).H();
+ size.x = g_engine->_imageManager->GetTexture(img).w();
+ size.y = g_engine->_imageManager->GetTexture(img).h();
}
void PlayerDestMarker::draw(const Vector2i &pos, const Rect &camera) {
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index aaded90fd40..38e73788126 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -53,7 +53,7 @@ Splash::Splash() {
// Purpose: Destructor
//------------------------------------------------------------------------
Splash::~Splash() {
- background.Delete();
+ background.deleteImage();
}
//------------------------------------------------------------------------
@@ -88,8 +88,8 @@ void Splash::draw() {
//------------------------------------------------------------------------
void Splash::setUI() {
warning("ScreenSettings cur w : %d h : %d", g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h);
- x = (g_engine->_screenSettings->cur.w - background.W()) / 2;
- y = (g_engine->_screenSettings->cur.h - background.H()) / 2;
+ x = (g_engine->_screenSettings->cur.w - background.w()) / 2;
+ y = (g_engine->_screenSettings->cur.h - background.h()) / 2;
}
}
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 8b81677db7a..0bba4a928a1 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -156,7 +156,7 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
SDL_Surface *surf = RenderTextBlended(font, text, color);
#endif
Graphics::ManagedSurface *surf = RenderTextBlended(fontk, text, color);
- cache[pos].img.Delete();
+ cache[pos].img.deleteImage();
cache[pos].empty = false;
cache[pos].text = text;
@@ -172,8 +172,8 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
}
if (background) {
- rect.w = cache[pos].img.W() + (2 * pad_bg.x);
- rect.h = cache[pos].img.H() + (2 * pad_bg.y);
+ rect.w = cache[pos].img.w() + (2 * pad_bg.x);
+ rect.h = cache[pos].img.h() + (2 * pad_bg.y);
uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
Graphics::Surface surf;
@@ -195,23 +195,23 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
#endif
cache[pos].img.draw(x, y);
} else if (align == ALIGN_CENTER) {
- rect.x = x - cache[pos].img.W() / 2 - pad_bg.x;
- rect.y = y - cache[pos].img.H() / 2 - pad_bg.y;
+ rect.x = x - cache[pos].img.w() / 2 - pad_bg.x;
+ rect.y = y - cache[pos].img.h() / 2 - pad_bg.y;
g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- cache[pos].img.draw(x - cache[pos].img.W() / 2, y - cache[pos].img.H() / 2);
+ cache[pos].img.draw(x - cache[pos].img.w() / 2, y - cache[pos].img.h() / 2);
} else {
- rect.x = x - cache[pos].img.W() - pad_bg.x;
+ rect.x = x - cache[pos].img.w() - pad_bg.x;
rect.y = y - pad_bg.y;
g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- cache[pos].img.draw(x - cache[pos].img.W(), y);
+ cache[pos].img.draw(x - cache[pos].img.w(), y);
}
surf.free();
@@ -220,9 +220,9 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
if (align == ALIGN_LEFT)
cache[pos].img.draw(x, y);
else if (align == ALIGN_CENTER)
- cache[pos].img.draw(x - cache[pos].img.W() / 2, y - cache[pos].img.H() / 2);
+ cache[pos].img.draw(x - cache[pos].img.w() / 2, y - cache[pos].img.h() / 2);
else
- cache[pos].img.draw(x - cache[pos].img.W(), y);
+ cache[pos].img.draw(x - cache[pos].img.w(), y);
}
}
@@ -272,7 +272,7 @@ void TextManager::Quit() {
for (auto i = cache.begin(); i != cache.end(); ++i) {
if (i->empty == false) {
- i->img.Delete();
+ i->img.deleteImage();
i->empty = true;
}
}
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index f833a46d446..a185ce780c8 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -71,7 +71,7 @@ class TextManager {
col = 0;
font = 0;
}
- ~TextCacheUnit() { img.Delete(); }
+ ~TextCacheUnit() { img.deleteImage(); }
bool EqualCol(int color) { return col == color; }
};
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 3611a6665b1..04ec5aba0ef 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -64,7 +64,7 @@ void AlphaImage::internalEvents() {
}
if (g_engine->_imageManager->ValidTexture(img))
- g_engine->_imageManager->GetTexture(img).Alpha(alpha.cur);
+ g_engine->_imageManager->GetTexture(img).alpha(alpha.cur);
}
void AlphaImage::draw(const int &XOffset, const int &YOffset) {
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index a2fc69fbb6d..0d80f1d81a9 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -44,8 +44,8 @@ void ClipButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
else {
clip.x = 0;
clip.y = 0;
- clip.w = g_engine->_imageManager->GetTexture(img.normal).W();
- clip.h = g_engine->_imageManager->GetTexture(img.normal).H();
+ clip.w = g_engine->_imageManager->GetTexture(img.normal).w();
+ clip.h = g_engine->_imageManager->GetTexture(img.normal).h();
}
}
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index da3a1646e96..e054f015445 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -99,11 +99,11 @@ public:
~FileMenu() {
if (img.loaded)
- img.preview.Delete();
+ img.preview.deleteImage();
}
void reset() {
if (img.loaded)
- img.preview.Delete();
+ img.preview.deleteImage();
img.loaded = false;
hover = false;
}
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 78ce5dccab4..b1d915bfa93 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -55,7 +55,7 @@ void HealthIndicator::draw(int num) {
if (num == i->val) {
using namespace pyrodactyl::image;
g_engine->_imageManager->draw(x, y, i->normal);
- g_engine->_imageManager->GetTexture(i->glow).Alpha(alpha);
+ g_engine->_imageManager->GetTexture(i->glow).alpha(alpha);
g_engine->_imageManager->draw(x, y, i->glow);
if (inc) {
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index a576f949069..f0a3ca82f25 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -67,10 +67,10 @@ void ProgressBar::draw(const int &value, const int &max) {
// If we don't have to draw animations for changing value, just draw the bar
if (!changed) {
- clip.w = (g_engine->_imageManager->GetTexture(img.normal).W() * value) / max;
+ clip.w = (g_engine->_imageManager->GetTexture(img.normal).w() * value) / max;
ClipButton::draw();
} else {
- clip.w = (g_engine->_imageManager->GetTexture(img.normal).W() * cur) / max;
+ clip.w = (g_engine->_imageManager->GetTexture(img.normal).w() * cur) / max;
ClipButton::draw();
switch (type) {
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index dd6f03bd079..dc6757e75f6 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -52,23 +52,23 @@ void SectionHeader::load(rapidxml::xml_node<char> *node) {
Graphics::ManagedSurface *surf = g_engine->_textManager->RenderTextBlended(font, text, col);
if (align == ALIGN_CENTER) {
- left.x = x - surf->w / 2 - g_engine->_imageManager->GetTexture(img).W();
- left.y = y - surf->h / 2 + g_engine->_imageManager->GetTexture(img).H() / 2;
+ left.x = x - surf->w / 2 - g_engine->_imageManager->GetTexture(img).w();
+ left.y = y - surf->h / 2 + g_engine->_imageManager->GetTexture(img).h() / 2;
right.x = x + surf->w / 2;
- right.y = y - surf->h / 2 + g_engine->_imageManager->GetTexture(img).H() / 2;
+ right.y = y - surf->h / 2 + g_engine->_imageManager->GetTexture(img).h() / 2;
} else if (align == ALIGN_LEFT) {
- left.x = x - g_engine->_imageManager->GetTexture(img).W();
- left.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
+ left.x = x - g_engine->_imageManager->GetTexture(img).w();
+ left.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).h() / 2;
right.x = x + surf->w;
- right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
+ right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).h() / 2;
} else {
- left.x = x - surf->w - g_engine->_imageManager->GetTexture(img).W();
- left.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
+ left.x = x - surf->w - g_engine->_imageManager->GetTexture(img).w();
+ left.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).h() / 2;
right.x = x;
- right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).H() / 2;
+ right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).h() / 2;
}
delete surf;
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 63b2ce3f881..0d60ae03f58 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -67,7 +67,7 @@ public:
~SlideShow() { Clear(); }
void Refresh();
- void Clear() { img.Delete(); }
+ void Clear() { img.deleteImage(); }
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index fcf258c8740..40d6cf36d81 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -75,8 +75,8 @@ void StateButton::State(const bool val) {
}
// Images might be different in size
- w = g_engine->_imageManager->GetTexture(img.normal).W();
- h = g_engine->_imageManager->GetTexture(img.normal).H();
+ w = g_engine->_imageManager->GetTexture(img.normal).w();
+ h = g_engine->_imageManager->GetTexture(img.normal).h();
}
void StateButton::Img(const StateButtonImage &sbi) {
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 981c9f82ddb..d0462fb7889 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -47,8 +47,8 @@ void Element::Init(const int &X, const int &Y, const Align &align_x, const Align
h = H;
} else {
Image dat = g_engine->_imageManager->GetTexture(img);
- w = dat.W();
- h = dat.H();
+ w = dat.w();
+ h = dat.h();
}
}
@@ -62,12 +62,12 @@ void Element::load(rapidxml::xml_node<char> *node, ImageKey img, const bool &ech
Basicload(node, echo);
if (node->first_attribute("w") == NULL)
- w = g_engine->_imageManager->GetTexture(img).W();
+ w = g_engine->_imageManager->GetTexture(img).w();
else
loadNum(w, "w", node);
if (node->first_attribute("h") == NULL)
- h = g_engine->_imageManager->GetTexture(img).H();
+ h = g_engine->_imageManager->GetTexture(img).h();
else
loadNum(h, "h", node);
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 225e819a883..2b819cfab19 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -114,7 +114,7 @@ void HUD::internalEvents(bool ShowMap) {
if (timer.TargetReached()) {
clip.x += clip.w;
- if (clip.x >= g_engine->_imageManager->GetTexture(notify_anim).W())
+ if (clip.x >= g_engine->_imageManager->GetTexture(notify_anim).w())
clip.x = 0;
timer.Start();
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index a80220a77f9..93cd0481355 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -386,14 +386,14 @@ void Map::SetImage(const unsigned int &val, const bool &force) {
if (force || (cur != val && val < map.size())) {
cur = val;
- img_bg.Delete();
- img_overlay.Delete();
+ img_bg.deleteImage();
+ img_overlay.deleteImage();
img_bg.load(map[cur].path_bg);
img_overlay.load(map[cur].path_overlay);
- size.x = img_bg.W();
- size.y = img_bg.H();
+ size.x = img_bg.w();
+ size.y = img_bg.h();
marker.Clear();
for (auto &i : map[cur].dest)
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index a31f79112bb..d8c77e47184 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -114,8 +114,8 @@ public:
overlay = true;
}
~Map() {
- img_bg.Delete();
- img_overlay.Delete();
+ img_bg.deleteImage();
+ img_overlay.deleteImage();
}
void load(const Common::String &filename, pyrodactyl::event::Info &info);
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 52d4a086c85..3d997ac4fb1 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -43,8 +43,8 @@ void Slider::load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
bar.load(node->first_node("bar"));
knob.y = bar.y;
- knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).W();
- knob.h = g_engine->_imageManager->GetTexture(knob.img.normal).H();
+ knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).w();
+ knob.h = g_engine->_imageManager->GetTexture(knob.img.normal).h();
knob.canmove = true;
min = Min;
@@ -141,8 +141,8 @@ void Slider::setUI() {
knob.x = bar.x + ((bar.w - knob.w) * value / (max - min));
knob.y = bar.y;
- knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).W();
- knob.h = g_engine->_imageManager->GetTexture(knob.img.normal).H();
+ knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).w();
+ knob.h = g_engine->_imageManager->GetTexture(knob.img.normal).h();
}
} // End of namespace Crab
Commit: 1b6150c2c8d21707871087d3f3b049085ac985c2
https://github.com/scummvm/scummvm/commit/1b6150c2c8d21707871087d3f3b049085ac985c2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make ImageManager class follow code formatting conventions
Changed paths:
engines/crab/TMX/TMXMap.cpp
engines/crab/animation/shadow.h
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
engines/crab/item/ItemSlot.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_objects.cpp
engines/crab/splash.cpp
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/ClipButton.cpp
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/StateButton.cpp
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/element.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/questmenu.cpp
engines/crab/ui/slider.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 974a981f5d2..78a85c25540 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -99,7 +99,7 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
path_rows = (int)ceil((float)w / (float)path_size.x + .5f); // Adding .5 before casting in order to round up (SZ)
path_cols = (int)ceil((float)h / (float)path_size.y + .5f);
- g_engine->_imageManager->tileset.load(path, node);
+ g_engine->_imageManager->_tileset.load(path, node);
// Reset the layer at which sprites are drawn
sprite_layer = 0;
@@ -232,7 +232,7 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
// Purpose: Clear all data from the level
//------------------------------------------------------------------------
void TMXMap::reset() {
- g_engine->_imageManager->tileset.reset();
+ g_engine->_imageManager->_tileset.reset();
layer.clear();
area_nowalk.clear();
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index 617c33db375..5000e0871bf 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -59,7 +59,7 @@ struct ShadowData {
using namespace pyrodactyl::image;
Image dat;
- g_engine->_imageManager->GetTexture(_img, dat);
+ g_engine->_imageManager->getTexture(_img, dat);
_size.x = dat.w() / 2;
_size.y = dat.h() / 2;
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index d4f3553d5f2..ded9e3a505e 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -73,7 +73,7 @@ void Sprite::load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
loadNum(_layer, "layer", node, false);
Image dat;
- g_engine->_imageManager->GetTexture(_image, dat);
+ g_engine->_imageManager->getTexture(_image, dat);
_imgSize.x = dat.w();
_imgSize.y = dat.h();
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index d55401fede3..a0afb4bb46f 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -322,7 +322,7 @@ void App::LoadSettings(const Common::String &filename) {
}
App::~App() {
- g_engine->_imageManager->Quit();
+ g_engine->_imageManager->quit();
g_engine->_musicManager->Quit();
g_engine->_textManager->Quit();
g_engine->_inputManager->Quit();
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index a62be5d1043..feacea66378 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -322,7 +322,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
g_engine->_eventStore->_anim[_curEvent->_special].draw();
break;
case EVENT_DIALOG:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
if (_oh.show_journal) {
info._journal.draw(level.PlayerID());
hud.back.draw();
@@ -330,7 +330,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
_oh.draw(info, _curEvent, _curEvent->_title, _player, _curSp);
break;
case EVENT_REPLY:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
if (_oh.show_journal) {
info._journal.draw(level.PlayerID());
hud.back.draw();
@@ -344,7 +344,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
_textin.draw();
break;
case EVENT_SPLASH:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
if (_intro.show_traits) {
_per.draw(info, _curEvent->_title);
hud.back.draw();
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index db48f1ef38b..766522b94fc 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -121,7 +121,7 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
// If the filename is same as the previous one, skip loading
if (g_engine->_filePath->current_r != g_engine->_filePath->level[id].asset) {
g_engine->_filePath->current_r = g_engine->_filePath->level[id].asset;
- g_engine->_imageManager->LoadMap(g_engine->_filePath->level[id].asset);
+ g_engine->_imageManager->loadMap(g_engine->_filePath->level[id].asset);
}
// Load the level itself
@@ -503,7 +503,7 @@ void Game::draw() {
if (gem._drawGame)
level.draw(info);
else
- g_engine->_imageManager->BlackScreen();
+ g_engine->_imageManager->blackScreen();
switch (state) {
case STATE_GAME:
if (gem.eventInProgress())
@@ -512,36 +512,36 @@ void Game::draw() {
hud.draw(info, level.PlayerID());
break;
case STATE_PAUSE:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
hud.pause.draw(hud.back);
hud.draw(info, level.PlayerID());
break;
case STATE_MAP:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
map.draw(info);
hud.draw(info, level.PlayerID());
hud.back.draw();
break;
case STATE_JOURNAL:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
info._journal.draw(level.PlayerID());
hud.draw(info, level.PlayerID());
hud.back.draw();
break;
case STATE_CHARACTER:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
gem._per.draw(info, level.PlayerID());
hud.draw(info, level.PlayerID());
hud.back.draw();
break;
case STATE_INVENTORY:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
info.invDraw(level.PlayerID());
hud.draw(info, level.PlayerID());
hud.back.draw();
break;
case STATE_HELP:
- g_engine->_imageManager->DimScreen();
+ g_engine->_imageManager->dimScreen();
g_engine->_helpScreen->draw();
hud.back.draw();
hud.draw(info, level.PlayerID());
@@ -817,7 +817,7 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
void Game::Quit(bool &ShouldChangeState, GameStateID &NewStateID, const GameStateID &NewStateVal) {
ShouldChangeState = true;
NewStateID = NewStateVal;
- g_engine->_imageManager->LoadMap(g_engine->_filePath->mainmenu_r);
+ g_engine->_imageManager->loadMap(g_engine->_filePath->mainmenu_r);
}
//------------------------------------------------------------------------
// Purpose: Change our internal state
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 88e42bed196..f92cbae7b8b 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -43,14 +43,14 @@ using namespace pyrodactyl::image;
//------------------------------------------------------------------------
// Purpose: Load assets here.
//------------------------------------------------------------------------
-void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
- for (auto it = map[mapid].begin(); it != map[mapid].end(); ++it)
+void ImageManager::loadMap(const Common::String &filename, const MapID &mapid) {
+ for (auto it = _map[mapid].begin(); it != _map[mapid].end(); ++it)
it->_value.deleteImage();
- map[mapid].clear();
- XMLDoc image_list(filename);
- if (image_list.ready()) {
- rapidxml::xml_node<char> *node = image_list.doc()->first_node("res");
+ _map[mapid].clear();
+ XMLDoc imageList(filename);
+ if (imageList.ready()) {
+ rapidxml::xml_node<char> *node = imageList.doc()->first_node("res");
for (auto n = node->first_node("image"); n != NULL; n = n->next_sibling("image")) {
ImageKey key;
if (loadImgKey(key, "name", n)) {
@@ -68,9 +68,9 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
valid = loadStr(path, "path", n, false);
if (valid)
- map[mapid][key].load(path);
+ _map[mapid][key].load(path);
else
- error("ImageManager::LoadMap : Unable to load image id %u from %s!", key, path.c_str());
+ error("ImageManager::loadMap : Unable to load image id %u from %s!", key, path.c_str());
#if 0
fprintf(stderr, "Unable to load image id %u from %s! SDL Error: %s\n", key, path.c_str(), SDL_GetError());
#endif
@@ -85,17 +85,17 @@ void ImageManager::LoadMap(const Common::String &filename, const MapID &mapid) {
}
}
-bool ImageManager::Init() {
+bool ImageManager::init() {
// First, delete everything that exists
- Quit();
+ quit();
// Load common assets
- LoadMap(g_engine->_filePath->common, MAP_COMMON);
+ loadMap(g_engine->_filePath->common, MAP_COMMON);
// Load main menu assets
- LoadMap(g_engine->_filePath->current_r, MAP_CURRENT);
+ loadMap(g_engine->_filePath->current_r, MAP_CURRENT);
- invalid_img = map[MAP_COMMON][0];
+ _invalidImg = _map[MAP_COMMON][0];
return true;
}
@@ -103,11 +103,11 @@ bool ImageManager::Init() {
//------------------------------------------------------------------------
// Purpose: Add texture to image map
//------------------------------------------------------------------------
-void ImageManager::AddTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex) {
- if (map[mapindex].contains(id))
- FreeTexture(id, mapindex);
+void ImageManager::addTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex) {
+ if (_map[mapindex].contains(id))
+ freeTexture(id, mapindex);
- map[mapindex][id].load(surface);
+ _map[mapindex][id].load(surface);
#if 0
SDL_FreeSurface(surface);
#endif
@@ -116,26 +116,26 @@ void ImageManager::AddTexture(const ImageKey &id, Graphics::Surface *surface, in
//------------------------------------------------------------------------
// Purpose: Get texture for a particular id
//------------------------------------------------------------------------
-void ImageManager::GetTexture(const ImageKey &id, Image &data) {
- if (map[MAP_CURRENT].contains(id))
- data = map[MAP_CURRENT][id];
- else if (map[MAP_COMMON].contains(id))
- data = map[MAP_COMMON][id];
+void ImageManager::getTexture(const ImageKey &id, Image &data) {
+ if (_map[MAP_CURRENT].contains(id))
+ data = _map[MAP_CURRENT][id];
+ else if (_map[MAP_COMMON].contains(id))
+ data = _map[MAP_COMMON][id];
else
- data = invalid_img;
+ data = _invalidImg;
}
-Image &ImageManager::GetTexture(const ImageKey &id) {
- if (map[MAP_CURRENT].contains(id))
- return map[MAP_CURRENT][id];
- else if (map[MAP_COMMON].contains(id))
- return map[MAP_COMMON][id];
+Image &ImageManager::getTexture(const ImageKey &id) {
+ if (_map[MAP_CURRENT].contains(id))
+ return _map[MAP_CURRENT][id];
+ else if (_map[MAP_COMMON].contains(id))
+ return _map[MAP_COMMON][id];
- return invalid_img;
+ return _invalidImg;
}
-bool ImageManager::ValidTexture(const ImageKey &id) {
- if (id != 0 && (map[MAP_CURRENT].contains(id) || map[MAP_COMMON].contains(id)))
+bool ImageManager::validTexture(const ImageKey &id) {
+ if (id != 0 && (_map[MAP_CURRENT].contains(id) || _map[MAP_COMMON].contains(id)))
return true;
return false;
@@ -146,7 +146,7 @@ bool ImageManager::ValidTexture(const ImageKey &id) {
//------------------------------------------------------------------------
void ImageManager::draw(const int &x, const int &y, const ImageKey &id, Common::Rect *clip,
const TextureFlipType &flip) {
- GetTexture(id).draw(x, y, clip, flip);
+ getTexture(id).draw(x, y, clip, flip);
}
//------------------------------------------------------------------------
@@ -154,13 +154,13 @@ void ImageManager::draw(const int &x, const int &y, const ImageKey &id, Common::
//------------------------------------------------------------------------
void ImageManager::draw(const int &x, const int &y, const ImageKey &id, Rect *clip,
const TextureFlipType &flip) {
- GetTexture(id).draw(x, y, clip, flip);
+ getTexture(id).draw(x, y, clip, flip);
}
//------------------------------------------------------------------------
// Purpose: Dim the screen by drawing a 128 alpha black rectangle over it
//------------------------------------------------------------------------
-void ImageManager::DimScreen() {
+void ImageManager::dimScreen() {
warning("STUB: ImageManger::DimScreen()");
#if 0
@@ -170,8 +170,8 @@ void ImageManager::DimScreen() {
#endif
}
-void ImageManager::BlackScreen() {
- warning("STUB: ImageManger::BlackScreen()");
+void ImageManager::blackScreen() {
+ warning("STUB: ImageManger::blackScreen()");
#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
@@ -182,12 +182,12 @@ void ImageManager::BlackScreen() {
//------------------------------------------------------------------------
// Purpose: free resources
//------------------------------------------------------------------------
-void ImageManager::Quit() {
+void ImageManager::quit() {
for (int i = 0; i < MAP_TOTAL; i++) {
- for (auto it = map[i].begin(); it != map[i].end(); ++it)
+ for (auto it = _map[i].begin(); it != _map[i].end(); ++it)
it->_value.deleteImage();
- map[i].clear();
+ _map[i].clear();
}
}
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index 855e9acf68f..e9fdb48694f 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -66,49 +66,55 @@ enum MapID {
class ImageManager {
// Assets are stored in images
// Common is stuff used everywhere - this is only loaded once
- TextureMap map[MAP_TOTAL];
+ TextureMap _map[MAP_TOTAL];
// The default image for all invalid image names
- Image invalid_img;
+ Image _invalidImg;
public:
// The tile sets used in the level
- TMX::TileSetGroup tileset;
+ TMX::TileSetGroup _tileset;
// This image is used to notify player about changes to quests and inventory
- ImageKey notify;
+ ImageKey _notify;
+
+ ImageManager() {
+ _notify = 0;
+ }
- ImageManager() { notify = 0; }
~ImageManager() {}
- void Quit();
+ void quit();
- bool Init();
- void LoadPaths();
+ bool init();
+ void loadPaths();
// image related stuff
// Load all images specified in an xml file in a map
- void LoadMap(const Common::String &filename, const MapID &mapid = MAP_CURRENT);
+ void loadMap(const Common::String &filename, const MapID &mapid = MAP_CURRENT);
+
+ void addTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex = MAP_COMMON);
+ void freeTexture(const ImageKey &id, int mapindex = MAP_COMMON) {
+ _map[mapindex][id].deleteImage();
+ }
- void AddTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex = MAP_COMMON);
- void FreeTexture(const ImageKey &id, int mapindex = MAP_COMMON) { map[mapindex][id].deleteImage(); }
- void GetTexture(const ImageKey &id, Image &data);
- Image &GetTexture(const ImageKey &id);
- bool ValidTexture(const ImageKey &id);
+ void getTexture(const ImageKey &id, Image &data);
+ Image &getTexture(const ImageKey &id);
+ bool validTexture(const ImageKey &id);
void draw(const int &x, const int &y, const ImageKey &id,
Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
void draw(const int &x, const int &y, const ImageKey &id,
Rect *clip, const TextureFlipType &flip = FLIP_NONE);
- void DimScreen();
- void BlackScreen();
+ void dimScreen();
+ void blackScreen();
// Draw the notification icon
- void NotifyDraw(const int &x, const int &y) {
- auto *k = &GetTexture(notify);
- draw(x - k->w() / 2, y - k->h() / 2, notify);
+ void notifyDraw(const int &x, const int &y) {
+ auto *k = &getTexture(_notify);
+ draw(x - k->w() / 2, y - k->h() / 2, _notify);
}
};
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 710181c51e3..15be136b169 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -110,7 +110,7 @@ void ItemSlot::draw() {
item.draw(x, y);
if (unread)
- g_engine->_imageManager->NotifyDraw(x + w, y);
+ g_engine->_imageManager->notifyDraw(x + w, y);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index d37e9b60db3..1e4c5443e53 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -45,7 +45,7 @@ void Level::PreDraw() {
Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(terrain.W(), terrain.H(), *g_engine->_format);
unsigned int layer_count = 0u;
for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
- g_engine->_imageManager->tileset.PreDraw(*l, terrain.tile_size, surf);
+ g_engine->_imageManager->_tileset.PreDraw(*l, terrain.tile_size, surf);
// Draw the normal sprites if this is the layer for it
if (layer_count == terrain.sprite_layer)
@@ -73,7 +73,7 @@ void Level::draw(pyrodactyl::event::Info &info) {
unsigned int layer_count = 0u;
// Draw the terrain layer
- g_engine->_imageManager->tileset.draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].posRect(), img);
+ g_engine->_imageManager->_tileset.draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].posRect(), img);
Vector2i pos = objects[player_index]._aiData._dest;
Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
@@ -93,7 +93,7 @@ void Level::draw(pyrodactyl::event::Info &info) {
DrawObjects(info);
// Draw the terrain layer
- g_engine->_imageManager->tileset.ForceDraw(*l, camera, terrain.tile_size, objects[player_index].posRect());
+ g_engine->_imageManager->_tileset.ForceDraw(*l, camera, terrain.tile_size, objects[player_index].posRect());
}
// Draw the background sprites
@@ -161,11 +161,11 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
for (auto &i : a->boundRect) {
i.draw(-camera.x, -camera.y, 128, 128, 0, 255);
if (i.Collide(objects[player_index].posRect())) {
- g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].posRect());
+ g_engine->_imageManager->_tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].posRect());
}
if (i.Contains(objects[player_index]._aiData._dest)) {
- g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
+ g_engine->_imageManager->_tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
}
}
++a;
@@ -187,11 +187,11 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
for (auto &i : a->boundRect) {
i.draw(-camera.x, -camera.y, 128, 128, 0, 255);
if (i.Collide(objects[player_index].posRect())) {
- g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].posRect());
+ g_engine->_imageManager->_tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].posRect());
}
if (i.Contains(objects[player_index]._aiData._dest)) {
- g_engine->_imageManager->tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
+ g_engine->_imageManager->_tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
}
}
}
@@ -209,7 +209,7 @@ void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
while (a != terrain.prop.end() && b != obj_seq.end()) {
auto obj = b->second;
if (a->pos.y + a->pos.h < obj->y() + obj->h()) {
- g_engine->_imageManager->tileset.PreDraw(*a, terrain.tile_size, surf);
+ g_engine->_imageManager->_tileset.PreDraw(*a, terrain.tile_size, surf);
++a;
} else {
++b;
@@ -219,7 +219,7 @@ void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
if (a == terrain.prop.end()) {
} else if (b == obj_seq.end()) {
for (; a != terrain.prop.end(); ++a)
- g_engine->_imageManager->tileset.PreDraw(*a, terrain.tile_size, surf);
+ g_engine->_imageManager->_tileset.PreDraw(*a, terrain.tile_size, surf);
}
}
}
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index 4e45822877b..6c384953e5d 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -38,8 +38,8 @@ using namespace pyrodactyl::level;
void PlayerDestMarker::load(rapidxml::xml_node<char> *node) {
loadImgKey(img, "dest", node);
- size.x = g_engine->_imageManager->GetTexture(img).w();
- size.y = g_engine->_imageManager->GetTexture(img).h();
+ size.x = g_engine->_imageManager->getTexture(img).w();
+ size.y = g_engine->_imageManager->getTexture(img).h();
}
void PlayerDestMarker::draw(const Vector2i &pos, const Rect &camera) {
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 38e73788126..5cccc9461ec 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -62,7 +62,7 @@ Splash::~Splash() {
void Splash::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
g_engine->_loadingScreen->load();
- g_engine->_imageManager->Init();
+ g_engine->_imageManager->init();
g_engine->_textManager->Init();
load_complete = true;
}
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 04ec5aba0ef..ad61de772af 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -63,13 +63,13 @@ void AlphaImage::internalEvents() {
}
}
- if (g_engine->_imageManager->ValidTexture(img))
- g_engine->_imageManager->GetTexture(img).alpha(alpha.cur);
+ if (g_engine->_imageManager->validTexture(img))
+ g_engine->_imageManager->getTexture(img).alpha(alpha.cur);
}
void AlphaImage::draw(const int &XOffset, const int &YOffset) {
- if (g_engine->_imageManager->ValidTexture(img))
- g_engine->_imageManager->GetTexture(img).draw(pos.x + XOffset, pos.y + YOffset);
+ if (g_engine->_imageManager->validTexture(img))
+ g_engine->_imageManager->getTexture(img).draw(pos.x + XOffset, pos.y + YOffset);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index 0d80f1d81a9..2610903a68d 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -44,8 +44,8 @@ void ClipButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
else {
clip.x = 0;
clip.y = 0;
- clip.w = g_engine->_imageManager->GetTexture(img.normal).w();
- clip.h = g_engine->_imageManager->GetTexture(img.normal).h();
+ clip.w = g_engine->_imageManager->getTexture(img.normal).w();
+ clip.h = g_engine->_imageManager->getTexture(img.normal).h();
}
}
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index b1d915bfa93..28417cfd048 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -55,7 +55,7 @@ void HealthIndicator::draw(int num) {
if (num == i->val) {
using namespace pyrodactyl::image;
g_engine->_imageManager->draw(x, y, i->normal);
- g_engine->_imageManager->GetTexture(i->glow).alpha(alpha);
+ g_engine->_imageManager->getTexture(i->glow).alpha(alpha);
g_engine->_imageManager->draw(x, y, i->glow);
if (inc) {
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index f0a3ca82f25..4bd05a4e812 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -67,10 +67,10 @@ void ProgressBar::draw(const int &value, const int &max) {
// If we don't have to draw animations for changing value, just draw the bar
if (!changed) {
- clip.w = (g_engine->_imageManager->GetTexture(img.normal).w() * value) / max;
+ clip.w = (g_engine->_imageManager->getTexture(img.normal).w() * value) / max;
ClipButton::draw();
} else {
- clip.w = (g_engine->_imageManager->GetTexture(img.normal).w() * cur) / max;
+ clip.w = (g_engine->_imageManager->getTexture(img.normal).w() * cur) / max;
ClipButton::draw();
switch (type) {
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index dc6757e75f6..241faae4dc6 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -52,23 +52,23 @@ void SectionHeader::load(rapidxml::xml_node<char> *node) {
Graphics::ManagedSurface *surf = g_engine->_textManager->RenderTextBlended(font, text, col);
if (align == ALIGN_CENTER) {
- left.x = x - surf->w / 2 - g_engine->_imageManager->GetTexture(img).w();
- left.y = y - surf->h / 2 + g_engine->_imageManager->GetTexture(img).h() / 2;
+ left.x = x - surf->w / 2 - g_engine->_imageManager->getTexture(img).w();
+ left.y = y - surf->h / 2 + g_engine->_imageManager->getTexture(img).h() / 2;
right.x = x + surf->w / 2;
- right.y = y - surf->h / 2 + g_engine->_imageManager->GetTexture(img).h() / 2;
+ right.y = y - surf->h / 2 + g_engine->_imageManager->getTexture(img).h() / 2;
} else if (align == ALIGN_LEFT) {
- left.x = x - g_engine->_imageManager->GetTexture(img).w();
- left.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).h() / 2;
+ left.x = x - g_engine->_imageManager->getTexture(img).w();
+ left.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(img).h() / 2;
right.x = x + surf->w;
- right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).h() / 2;
+ right.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(img).h() / 2;
} else {
- left.x = x - surf->w - g_engine->_imageManager->GetTexture(img).w();
- left.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).h() / 2;
+ left.x = x - surf->w - g_engine->_imageManager->getTexture(img).w();
+ left.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(img).h() / 2;
right.x = x;
- right.y = y + surf->h / 2 - g_engine->_imageManager->GetTexture(img).h() / 2;
+ right.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(img).h() / 2;
}
delete surf;
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index 40d6cf36d81..a55d74f51b8 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -75,8 +75,8 @@ void StateButton::State(const bool val) {
}
// Images might be different in size
- w = g_engine->_imageManager->GetTexture(img.normal).w();
- h = g_engine->_imageManager->GetTexture(img.normal).h();
+ w = g_engine->_imageManager->getTexture(img.normal).w();
+ h = g_engine->_imageManager->getTexture(img.normal).h();
}
void StateButton::Img(const StateButtonImage &sbi) {
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index a121be596af..666ed138e60 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -71,7 +71,7 @@ void TraitMenu::draw(const pyrodactyl::people::Person *obj) {
for (auto t = obj->trait.begin(); t != obj->trait.end() && i != menu.element.end(); ++t, ++i) {
i->draw();
if (t->unread)
- g_engine->_imageManager->NotifyDraw(i->x + i->w, i->y);
+ g_engine->_imageManager->notifyDraw(i->x + i->w, i->y);
}
for (; i != menu.element.end(); ++i)
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index d0462fb7889..5385f2517f1 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -46,7 +46,7 @@ void Element::Init(const int &X, const int &Y, const Align &align_x, const Align
w = W;
h = H;
} else {
- Image dat = g_engine->_imageManager->GetTexture(img);
+ Image dat = g_engine->_imageManager->getTexture(img);
w = dat.w();
h = dat.h();
}
@@ -62,12 +62,12 @@ void Element::load(rapidxml::xml_node<char> *node, ImageKey img, const bool &ech
Basicload(node, echo);
if (node->first_attribute("w") == NULL)
- w = g_engine->_imageManager->GetTexture(img).w();
+ w = g_engine->_imageManager->getTexture(img).w();
else
loadNum(w, "w", node);
if (node->first_attribute("h") == NULL)
- h = g_engine->_imageManager->GetTexture(img).h();
+ h = g_engine->_imageManager->getTexture(img).h();
else
loadNum(h, "h", node);
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 2b819cfab19..2db46df77c8 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -59,7 +59,7 @@ void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
if (nodeValid("notify", node)) {
rapidxml::xml_node<char> *notifynode = node->first_node("notify");
- loadImgKey(g_engine->_imageManager->notify, "img", notifynode);
+ loadImgKey(g_engine->_imageManager->_notify, "img", notifynode);
tn.load(notifynode);
pdm.load(notifynode);
@@ -114,7 +114,7 @@ void HUD::internalEvents(bool ShowMap) {
if (timer.TargetReached()) {
clip.x += clip.w;
- if (clip.x >= g_engine->_imageManager->GetTexture(notify_anim).w())
+ if (clip.x >= g_engine->_imageManager->getTexture(notify_anim).w())
clip.x = 0;
timer.Start();
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index a36afb43ba5..839b76d2ead 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -116,7 +116,7 @@ void Journal::draw(const Common::String &id) {
int count = 0;
for (auto i = category.element.begin(); i != category.element.end() && count < JE_TOTAL; ++i, ++count)
if (jo.menu[count].unread)
- g_engine->_imageManager->NotifyDraw(i->x + i->w, i->y);
+ g_engine->_imageManager->notifyDraw(i->x + i->w, i->y);
if (select >= 0 && select < JE_TOTAL)
jo.menu[select].draw(bu_map);
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 93862614ff5..141e2230a7c 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -137,7 +137,7 @@ void QuestMenu::draw(Button &bu_map) {
if (quest[i]._unread) {
using namespace pyrodactyl::image;
- g_engine->_imageManager->draw(base_x + off_unread.x, base_y + off_unread.y, g_engine->_imageManager->notify);
+ g_engine->_imageManager->draw(base_x + off_unread.x, base_y + off_unread.y, g_engine->_imageManager->_notify);
}
}
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 3d997ac4fb1..9c0aa360a25 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -43,8 +43,8 @@ void Slider::load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
bar.load(node->first_node("bar"));
knob.y = bar.y;
- knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).w();
- knob.h = g_engine->_imageManager->GetTexture(knob.img.normal).h();
+ knob.w = g_engine->_imageManager->getTexture(knob.img.normal).w();
+ knob.h = g_engine->_imageManager->getTexture(knob.img.normal).h();
knob.canmove = true;
min = Min;
@@ -141,8 +141,8 @@ void Slider::setUI() {
knob.x = bar.x + ((bar.w - knob.w) * value / (max - min));
knob.y = bar.y;
- knob.w = g_engine->_imageManager->GetTexture(knob.img.normal).w();
- knob.h = g_engine->_imageManager->GetTexture(knob.img.normal).h();
+ knob.w = g_engine->_imageManager->getTexture(knob.img.normal).w();
+ knob.h = g_engine->_imageManager->getTexture(knob.img.normal).h();
}
} // End of namespace Crab
Commit: 0e500aaa8161e7ddb722acec756487959b08f511
https://github.com/scummvm/scummvm/commit/0e500aaa8161e7ddb722acec756487959b08f511
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make cursor class follow code formatting conventions
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
engines/crab/level/level.cpp
engines/crab/level/level_collide.cpp
engines/crab/ui/button.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
engines/crab/ui/slider.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index ded9e3a505e..4197208e333 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -343,7 +343,7 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!_aiData._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
+ if (!_aiData._dest._active && !g_engine->_mouse->_insideHud && !g_engine->_mouse->_hover && g_engine->_mouse->pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
int x = _pos.x - camera.x - _animSet.anchorX(_dir), y = _pos.y - camera.y - _animSet.anchorY(_dir);
@@ -352,17 +352,17 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
int w = b.w, h = b.h;
// X axis
- if (g_engine->_mouse->motion.x > x + w)
+ if (g_engine->_mouse->_motion.x > x + w)
xVel(player_speed * sc._walkVelMod.x);
- else if (g_engine->_mouse->motion.x < x)
+ else if (g_engine->_mouse->_motion.x < x)
xVel(-player_speed * sc._walkVelMod.x);
else
xVel(0.0f);
// Y axis
- if (g_engine->_mouse->motion.y > y + h)
+ if (g_engine->_mouse->_motion.y > y + h)
yVel(player_speed * sc._walkVelMod.y);
- else if (g_engine->_mouse->motion.y < y)
+ else if (g_engine->_mouse->_motion.y < y)
yVel(-player_speed * sc._walkVelMod.y);
else
yVel(0.0f);
@@ -409,7 +409,7 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!_aiData._dest._active && !g_engine->_mouse->inside_hud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
+ if (!_aiData._dest._active && !g_engine->_mouse->_insideHud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
// To find where the click is w.r.t sprite, we need to see where it is being drawn
int x = _pos.x - camera.x - _animSet.anchorX(_dir), y = _pos.y - camera.y - _animSet.anchorY(_dir);
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 49e0e8aefe5..6c44fc2fb53 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -42,17 +42,17 @@ using namespace pyrodactyl::input;
// Purpose: Reset all values
//------------------------------------------------------------------------
void Cursor::reset() {
- motion.x = 0;
- motion.y = 0;
+ _motion.x = 0;
+ _motion.y = 0;
- button.x = 0;
- button.y = 0;
+ _button.x = 0;
+ _button.y = 0;
- rel.x = 0;
- rel.y = 0;
+ _rel.x = 0;
+ _rel.y = 0;
// set to -1, so its set to 0 on first update
- state = -1;
+ _state = -1;
}
//------------------------------------------------------------------------
@@ -61,17 +61,17 @@ void Cursor::reset() {
void Cursor::load(rapidxml::xml_node<char> *node) {
if (nodeValid("normal", node)) {
rapidxml::xml_node<char> *nornode = node->first_node("normal");
- img.load(nornode, "img");
- img_s.load(nornode, "img_s");
+ _img.load(nornode, "img");
+ _imgS.load(nornode, "img_s");
}
if (nodeValid("hover", node)) {
rapidxml::xml_node<char> *hovnode = node->first_node("hover");
- img_hover.load(hovnode, "img");
- img_hover_s.load(hovnode, "img_s");
+ _imgHover.load(hovnode, "img");
+ _imgHoverS.load(hovnode, "img_s");
if (nodeValid("offset", hovnode))
- hover_offset.load(hovnode->first_node("offset"));
+ _hoverOffset.load(hovnode->first_node("offset"));
}
}
@@ -79,7 +79,7 @@ void Cursor::load(rapidxml::xml_node<char> *node) {
// Purpose: Handle Events
//------------------------------------------------------------------------
void Cursor::handleEvents(const Common::Event &event) {
- g_engine->_mouse->hover = false;
+ g_engine->_mouse->_hover = false;
#if 0
if (event.type == SDL_MOUSEMOTION) {
@@ -100,21 +100,21 @@ void Cursor::handleEvents(const Common::Event &event) {
#endif
if (event.type == Common::EVENT_MOUSEMOVE) {
- motion.x = event.mouse.x;
- motion.y = event.mouse.y;
+ _motion.x = event.mouse.x;
+ _motion.y = event.mouse.y;
- rel.x = event.relMouse.x;
- rel.y = event.relMouse.y;
+ _rel.x = event.relMouse.x;
+ _rel.y = event.relMouse.y;
} else if (event.type == Common::EVENT_LBUTTONDOWN) {
- pressed = true;
+ _pressed = true;
- button.x = event.mouse.x;
- button.y = event.mouse.y;
+ _button.x = event.mouse.x;
+ _button.y = event.mouse.y;
} else if (event.type == Common::EVENT_LBUTTONUP) {
- pressed = false;
+ _pressed = false;
- button.x = event.mouse.x;
- button.y = event.mouse.y;
+ _button.x = event.mouse.x;
+ _button.y = event.mouse.y;
}
}
@@ -122,20 +122,20 @@ void Cursor::handleEvents(const Common::Event &event) {
// Purpose: Draw
//------------------------------------------------------------------------
void Cursor::draw() {
- uint8 oldState = state;
- state = (hover ? 1 : 0) | (pressed << 1);
+ uint8 oldState = _state;
+ _state = (_hover ? 1 : 0) | (_pressed << 1);
- if (state != oldState) {
- if (hover) {
- if (pressed)
- CursorMan.replaceCursor(img_hover_s._texture->rawSurface(), 0, 0, 0);
+ if (_state != oldState) {
+ if (_hover) {
+ if (_pressed)
+ CursorMan.replaceCursor(_imgHoverS._texture->rawSurface(), 0, 0, 0);
else
- CursorMan.replaceCursor(img_hover._texture->rawSurface(), 0, 0, 0);
+ CursorMan.replaceCursor(_imgHover._texture->rawSurface(), 0, 0, 0);
} else {
- if (pressed)
- CursorMan.replaceCursor(img_s._texture->rawSurface(), 0, 0, 0);
+ if (_pressed)
+ CursorMan.replaceCursor(_imgS._texture->rawSurface(), 0, 0, 0);
else
- CursorMan.replaceCursor(img._texture->rawSurface(), 0, 0, 0);
+ CursorMan.replaceCursor(_img._texture->rawSurface(), 0, 0, 0);
}
}
}
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index 15860974bc4..ab9f3182cb9 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -46,38 +46,38 @@ namespace pyrodactyl {
namespace input {
class Cursor {
// Mouse images
- pyrodactyl::image::Image img, img_s, img_hover, img_hover_s;
+ pyrodactyl::image::Image _img, _imgS, _imgHover, _imgHoverS;
// The hover mouse cursor is drawn at a slight offset to the normal cursor
- Vector2i hover_offset;
+ Vector2i _hoverOffset;
// Mouse image changes slightly if left click button is pressed
- bool pressed;
+ bool _pressed;
- uint8 state;
+ uint8 _state;
public:
// Various coordinates
- Vector2i motion, button, rel;
+ Vector2i _motion, _button, _rel;
// Is the mouse inside the HUD? Used to disable level mouse movement if true
- bool inside_hud;
+ bool _insideHud;
// Was the last click on an NPC?
- bool hover;
+ bool _hover;
Cursor() {
- pressed = false;
- inside_hud = false;
- hover = false;
+ _pressed = false;
+ _insideHud = false;
+ _hover = false;
}
~Cursor() {}
void Quit() {
- img.deleteImage();
- img_s.deleteImage();
- img_hover.deleteImage();
- img_hover_s.deleteImage();
+ _img.deleteImage();
+ _imgS.deleteImage();
+ _imgHover.deleteImage();
+ _imgHoverS.deleteImage();
}
void reset();
@@ -86,7 +86,9 @@ public:
void handleEvents(const Common::Event &event);
void draw();
- bool Pressed() { return pressed; }
+ bool pressed() {
+ return _pressed;
+ }
};
} // End of namespace input
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 965f241153f..ca80c844e5f 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -92,12 +92,12 @@ void Level::CalcProperties(Info &info) {
// Purpose: Handle the level movement
//------------------------------------------------------------------------
void Level::handleEvents(Info &info, const Common::Event &Event) {
- if (!g_engine->_mouse->inside_hud) {
+ if (!g_engine->_mouse->_insideHud) {
if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
// Only go to path if our mouse is a normal walking cursor
- if (!g_engine->_mouse->hover) {
+ if (!g_engine->_mouse->_hover) {
// The destination coordinate is set by adding camera position to click position
- Vector2i dest = g_engine->_mouse->button;
+ Vector2i dest = g_engine->_mouse->_button;
dest.x += camera.x;
dest.y += camera.y;
@@ -120,7 +120,7 @@ void Level::handleEvents(Info &info, const Common::Event &Event) {
// Purpose: Handle the level movement
//------------------------------------------------------------------------
void Level::handleEvents(Info &info, const SDL_Event &Event) {
- if (!g_engine->_mouse->inside_hud) {
+ if (!g_engine->_mouse->_insideHud) {
if (Event.type == SDL_MOUSEBUTTONDOWN) {
// Only go to path if our mouse is a normal walking cursor
if (!g_engine->_mouse->hover) {
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 04b7a2a26cb..8cdb67572b8 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -51,24 +51,24 @@ bool Level::ContainsClick(const Common::String &id, const Common::Event &Event)
for (auto &i : objects) {
Rect r = i.posRect();
- if (r.Contains(g_engine->_mouse->motion.x + camera.x, g_engine->_mouse->motion.y + camera.y)) {
+ if (r.Contains(g_engine->_mouse->_motion.x + camera.x, g_engine->_mouse->_motion.y + camera.y)) {
// This is to show the sprite's name on top of their head
i._hover = true;
// This is to update the mouse cursor only if we're in talking range of a sprite
if (i.id() == id)
- g_engine->_mouse->hover = true;
+ g_engine->_mouse->_hover = true;
} else
i._hover = false;
}
return false;
- } else if (g_engine->_mouse->Pressed()) {
+ } else if (g_engine->_mouse->pressed()) {
for (auto &i : objects) {
if (i.id() == id) {
Rect r = i.posRect();
- if (r.Contains(g_engine->_mouse->button.x + camera.x, g_engine->_mouse->button.y + camera.y)) {
- g_engine->_mouse->hover = true;
+ if (r.Contains(g_engine->_mouse->_button.x + camera.x, g_engine->_mouse->_button.y + camera.y)) {
+ g_engine->_mouse->_hover = true;
return true;
}
}
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index cbcde3eaaab..8383b426683 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -151,7 +151,7 @@ ButtonAction Button::handleEvents(const Common::Event &Event, const int &XOffset
dim.y += YOffset;
if (visible) {
- if (dim.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y)) {
+ if (dim.Contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y)) {
hover_mouse = true;
if (!hover_prev) {
@@ -165,17 +165,17 @@ ButtonAction Button::handleEvents(const Common::Event &Event, const int &XOffset
if (Event.type == Common::EVENT_MOUSEMOVE) {
if (canmove && mousepressed) {
- x += g_engine->_mouse->rel.x;
- y += g_engine->_mouse->rel.y;
+ x += g_engine->_mouse->_rel.x;
+ y += g_engine->_mouse->_rel.y;
return BUAC_GRABBED;
}
} else if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
// The g_engine->_mouse button pressed, then released, comprises of a click action
- if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y))
+ if (dim.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y))
mousepressed = true;
} else if ((Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP) && mousepressed) {
reset();
- if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
+ if (dim.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
mousepressed = false;
if (Event.type == Common::EVENT_LBUTTONUP) {
g_engine->_musicManager->PlayEffect(se_click, 0);
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 2db46df77c8..f2482d397db 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -122,7 +122,7 @@ void HUD::internalEvents(bool ShowMap) {
}
HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
- g_engine->_mouse->inside_hud = bg.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y);
+ g_engine->_mouse->_insideHud = bg.Contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y);
int choice = menu.handleEvents(Event);
@@ -140,7 +140,7 @@ HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const Common::Event &
#if 0
HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
- g_engine->_mouse->inside_hud = bg.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y);
+ g_engine->_mouse->_insideHud = bg.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y);
int choice = menu.handleEvents(Event);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 93cd0481355..d1f0873f316 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -195,7 +195,7 @@ void Map::Move(const Common::Event &Event) {
bool click = false;
int count = 0;
for (auto &i : scroll.element) {
- if (i.Contains(g_engine->_mouse->button)) {
+ if (i.Contains(g_engine->_mouse->_button)) {
if (count == DIRECTION_UP)
vel.y = -1 * speed;
else if (count == DIRECTION_DOWN)
@@ -225,8 +225,8 @@ void Map::Move(const Common::Event &Event) {
case Common::EVENT_MOUSEMOVE:
if (pan) {
- camera.x -= g_engine->_mouse->rel.x;
- camera.y -= g_engine->_mouse->rel.y;
+ camera.x -= g_engine->_mouse->_rel.x;
+ camera.y -= g_engine->_mouse->_rel.y;
Validate();
}
break;
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 9c0aa360a25..d0fcc6c602a 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -60,7 +60,7 @@ void Slider::load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
bool Slider::handleEvents(const Common::Event &Event) {
// A person is moving the knob
if (knob.handleEvents(Event) == BUAC_GRABBED) {
- int dx = g_engine->_mouse->motion.x - bar.x;
+ int dx = g_engine->_mouse->_motion.x - bar.x;
if (dx < 0)
dx = 0;
@@ -75,8 +75,8 @@ bool Slider::handleEvents(const Common::Event &Event) {
}
// If a person clicks on the slider bar, the knob needs to travel there
- if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && bar.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
- knob.x = g_engine->_mouse->button.x;
+ if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && bar.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
+ knob.x = g_engine->_mouse->_button.x;
knob.y = bar.y;
value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
Commit: a82d514065af117ced98a1541392a7c70ddd03bb
https://github.com/scummvm/scummvm/commit/a82d514065af117ced98a1541392a7c70ddd03bb
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make FightInput and Hotkey class follow code formatting conventions
Changed paths:
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
engines/crab/input/fightinput.cpp
engines/crab/input/fightinput.h
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/ui/PageMenu.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 79cc9518ac8..6ce2c233f1b 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -127,12 +127,12 @@ FrameUpdateResult FightMoves::updateFrame(const Direction &d) {
unsigned int FightMoves::findMove(const pyrodactyl::input::FightAnimationType &type, const int &state) {
unsigned int pos = 0;
for (auto i = _move.begin(); i != _move.end(); ++i, ++pos)
- if (i->_input.type == type && i->_input.state == (unsigned int)state)
+ if (i->_input._type == type && i->_input._state == (unsigned int)state)
return pos;
pos = 0;
for (auto i = _move.begin(); i != _move.end(); ++i, ++pos)
- if (i->_input.type == type && i->_input.state == SPRITE_STATE_OVERRIDE)
+ if (i->_input._type == type && i->_input._state == SPRITE_STATE_OVERRIDE)
return pos;
return SPRITE_STATE_OVERRIDE;
@@ -161,7 +161,7 @@ bool FightMoves::forceUpdate(const unsigned int &index, pyrodactyl::input::Fight
_frameTotal = _move[_cur]._frames[d]._frame.size();
if (_frameTotal > 0) {
input = _move[_cur]._input;
- input.state = _move[_cur]._frames[d]._frame[0]._state;
+ input._state = _move[_cur]._frames[d]._frame[0]._state;
} else
input.reset();
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 4197208e333..0c6b96f7ffd 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -504,7 +504,7 @@ void Sprite::walk(const bool &reset) {
// Purpose: Decide which animation to play
//------------------------------------------------------------------------
void Sprite::animate(Info &info) {
- if (_input.Idle())
+ if (_input.idle())
walk(info.state(_id));
else
updateFrame(info.state(_id));
@@ -563,7 +563,7 @@ void Sprite::assignFrame() {
_pos.x += faf._delta.x;
_pos.y += faf._delta.y;
- _input.state = faf._state;
+ _input._state = faf._state;
}
}
@@ -572,7 +572,7 @@ void Sprite::assignFrame() {
//------------------------------------------------------------------------
void Sprite::updateMove(const FightAnimationType &combo) {
if (combo != FA_IDLE) {
- if (_input.Idle())
+ if (_input.idle())
forceUpdateMove(combo);
else {
FightAnimFrame faf;
@@ -584,7 +584,7 @@ void Sprite::updateMove(const FightAnimationType &combo) {
}
void Sprite::forceUpdateMove(const FightAnimationType &combo) {
- unsigned int index = _animSet._fight.findMove(combo, _input.state);
+ unsigned int index = _animSet._fight.findMove(combo, _input._state);
forceUpdateMove(index);
}
@@ -592,7 +592,7 @@ void Sprite::forceUpdateMove(const FightAnimationType &combo) {
// Purpose: Update the move info of the AI or player sprite
//------------------------------------------------------------------------
void Sprite::updateMove(const unsigned int &index) {
- if (_input.Idle())
+ if (_input.idle())
forceUpdateMove(index);
}
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index 7fbaa2d3aa5..c3a7d34c9e1 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -36,11 +36,11 @@ namespace Crab {
using namespace pyrodactyl::input;
void FightInput::load(rapidxml::xml_node<char> *node) {
- loadEnum(type, "type", node);
- loadNum(state, "state", node);
+ loadEnum(_type, "type", node);
+ loadNum(_state, "state", node);
}
-FightAnimationType FightInput::handleEvents(const Common::Event &Event) {
+FightAnimationType FightInput::handleEvents(const Common::Event &event) {
if (g_engine->_inputManager->State(IG_ATTACK))
return FA_ATTACK;
else if (g_engine->_inputManager->State(IG_BLOCK))
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index d7150bf63b2..2dc5da331f8 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -59,23 +59,31 @@ enum FightAnimationType {
// The input necessary to launch a move
struct FightInput {
// The state needed to execute this move
- FightAnimationType type;
+ FightAnimationType _type;
// The sprite state, used to have different moves trigger from the same move
- unsigned int state;
+ unsigned int _state;
+
+ FightInput() {
+ reset();
+ }
- FightInput() { reset(); }
void reset() {
- type = FA_IDLE;
- state = 0;
+ _type = FA_IDLE;
+ _state = 0;
}
- bool operator==(const FightInput &input) { return type == input.type && state == input.state; }
- bool Idle() { return type == FA_IDLE; }
+ bool operator==(const FightInput &input) {
+ return _type == input._type && _state == input._state;
+ }
+
+ bool idle() {
+ return _type == FA_IDLE;
+ }
void load(rapidxml::xml_node<char> *node);
- FightAnimationType handleEvents(const Common::Event &Event);
+ FightAnimationType handleEvents(const Common::Event &event);
#if 0
FightAnimationType handleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index 1a61ca2b84f..16ebf91d9b6 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -36,9 +36,9 @@ namespace Crab {
using namespace pyrodactyl::input;
void HotKey::load(rapidxml::xml_node<char> *node) {
- loadEnum(input, "input", node);
+ loadEnum(_input, "input", node);
- name = g_engine->_inputManager->GetAssociatedKey(input);
+ _name = g_engine->_inputManager->GetAssociatedKey(_input);
}
#if 0
@@ -61,15 +61,15 @@ bool HotKey::handleEvents(const SDL_Event &Event) {
bool HotKey::handleEvents(const Common::Event &Event) {
//warning("STUB: HotKey::handleEvents()");
- if (input > IT_NONE && input < IT_TOTAL) {
- return g_engine->_inputManager->State(input);
+ if (_input > IT_NONE && _input < IT_TOTAL) {
+ return g_engine->_inputManager->State(_input);
}
return false;
}
-const char *HotKey::Name() {
- return name.c_str();
+const char *HotKey::name() {
+ return _name.c_str();
#if 0
if (input > IT_NONE && input < IT_TOTAL)
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index e02a1177db2..57543ebb8bd 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -42,26 +42,26 @@ namespace input {
// This class is built to integrate the input check for hotkeys bound to buttons
class HotKey {
// The type of input the hotkey is checking for
- InputType input;
+ InputType _input;
// Has the key been pressed?
- bool keydown;
+ bool _keydown;
// Description of the key associated with the Input
- Common::String name;
+ Common::String _name;
public:
HotKey() {
- input = IT_NONE;
- keydown = false;
+ _input = IT_NONE;
+ _keydown = false;
}
- void Set(const InputType &val) {
- input = val;
- name = g_engine->_inputManager->GetAssociatedKey(input);
+ void set(const InputType &val) {
+ _input = val;
+ _name = g_engine->_inputManager->GetAssociatedKey(_input);
}
- const char *Name();
+ const char *name();
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 41388acb491..7b7ac7b30b5 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -144,12 +144,12 @@ public:
if (nodeValid(node)) {
if (nodeValid("prev", node)) {
prev.load(node->first_node("prev"));
- prev.hotkey.Set(IU_PREV);
+ prev.hotkey.set(IU_PREV);
}
if (nodeValid("next", node)) {
next.load(node->first_node("next"));
- next.hotkey.Set(IU_NEXT);
+ next.hotkey.set(IU_NEXT);
}
if (nodeValid("reference", node))
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 65437b234e4..6c74acf090e 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -52,12 +52,12 @@ void QuestText::load(rapidxml::xml_node<char> *node) {
if (nodeValid("prev", node)) {
prev.load(node->first_node("prev"));
- prev.hotkey.Set(IU_PAGE_PREV);
+ prev.hotkey.set(IU_PAGE_PREV);
}
if (nodeValid("next", node)) {
next.load(node->first_node("next"));
- next.hotkey.Set(IU_PAGE_NEXT);
+ next.hotkey.set(IU_PAGE_NEXT);
}
if (nodeValid("status", node))
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 3825ce1eb6f..cbcbd949127 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -45,12 +45,12 @@ void SlideShow::load(rapidxml::xml_node<char> *node) {
if (nodeValid("prev", node)) {
prev.load(node->first_node("prev"));
- prev.hotkey.Set(IU_PREV);
+ prev.hotkey.set(IU_PREV);
}
if (nodeValid("next", node)) {
next.load(node->first_node("next"));
- next.hotkey.Set(IU_NEXT);
+ next.hotkey.set(IU_NEXT);
}
path.clear();
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index f2482d397db..e44b3d2ea01 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -166,7 +166,7 @@ void HUD::State(const int &val) {
void HUD::SetTooltip() {
unsigned int count = 0;
for (auto i = menu.element.begin(); i != menu.element.end() && count < tooltip.size(); ++i, ++count)
- i->tooltip.text = tooltip[count] + " (" + i->hotkey.Name() + ")";
+ i->tooltip.text = tooltip[count] + " (" + i->hotkey.name() + ")";
menu.element[HS_PAUSE].tooltip.text = tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->GetAssociatedKey(IG_PAUSE) + ")";
}
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index f7cd76e1b41..4fc8b2a8fa0 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -88,7 +88,7 @@ public:
Button back;
HUD() {
- pausekey.Set(pyrodactyl::input::IG_PAUSE);
+ pausekey.set(pyrodactyl::input::IG_PAUSE);
notify_anim = 0;
}
~HUD() {}
Commit: e0d27c9e0b8df850a0f169beb415f724078159ec
https://github.com/scummvm/scummvm/commit/e0d27c9e0b8df850a0f169beb415f724078159ec
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make InputManager class follow code formatting conventions
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/game.cpp
engines/crab/input/fightinput.cpp
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/metaengine.cpp
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/menu.h
engines/crab/ui/textarea.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 0c6b96f7ffd..31a97c4dee4 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -370,20 +370,20 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
{
// Disable destination as soon as player presses a direction key
// X axis
- if (g_engine->_inputManager->State(IG_LEFT)) {
+ if (g_engine->_inputManager->state(IG_LEFT)) {
_aiData._dest._active = false;
xVel(-player_speed * sc._walkVelMod.x);
- } else if (g_engine->_inputManager->State(IG_RIGHT)) {
+ } else if (g_engine->_inputManager->state(IG_RIGHT)) {
_aiData._dest._active = false;
xVel(player_speed * sc._walkVelMod.x);
} else if (!_aiData._dest._active)
xVel(0.0f);
// Y axis
- if (g_engine->_inputManager->State(IG_UP)) {
+ if (g_engine->_inputManager->state(IG_UP)) {
_aiData._dest._active = false;
yVel(-player_speed * sc._walkVelMod.y);
- } else if (g_engine->_inputManager->State(IG_DOWN)) {
+ } else if (g_engine->_inputManager->state(IG_DOWN)) {
_aiData._dest._active = false;
yVel(player_speed * sc._walkVelMod.y);
} else if (!_aiData._dest._active)
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index a0afb4bb46f..2125d5820f9 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -325,7 +325,7 @@ App::~App() {
g_engine->_imageManager->quit();
g_engine->_musicManager->Quit();
g_engine->_textManager->Quit();
- g_engine->_inputManager->Quit();
+ g_engine->_inputManager->quit();
g_engine->_loadingScreen->Quit();
g_engine->_mouse->Quit();
#if 0
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 49d3fa36db0..5ad88313a9c 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -132,9 +132,9 @@ Common::Error CrabEngine::run() {
CursorMan.showMouse(true);
_mouse->reset();
- _inputManager->Init();
- _inputManager->PopulateKeyTable();
- _inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
+ _inputManager->init();
+ _inputManager->populateKeyTable();
+ _inputManager->setKeyBindingMode(pyrodactyl::input::KBM_GAME);
// Set the engine's debugger console
setDebugger(new Console());
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 766522b94fc..c789a801043 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -214,7 +214,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
- info._talkKeyDown = g_engine->_inputManager->State(IG_TALK) || level.ContainsClick(info.lastPerson(), Event);
+ info._talkKeyDown = g_engine->_inputManager->state(IG_TALK) || level.ContainsClick(info.lastPerson(), Event);
level.handleEvents(info, Event);
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index c3a7d34c9e1..1bd21bb0596 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -41,9 +41,9 @@ void FightInput::load(rapidxml::xml_node<char> *node) {
}
FightAnimationType FightInput::handleEvents(const Common::Event &event) {
- if (g_engine->_inputManager->State(IG_ATTACK))
+ if (g_engine->_inputManager->state(IG_ATTACK))
return FA_ATTACK;
- else if (g_engine->_inputManager->State(IG_BLOCK))
+ else if (g_engine->_inputManager->state(IG_BLOCK))
return FA_BLOCK;
return FA_IDLE;
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index 16ebf91d9b6..3f9f618fd2b 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -38,7 +38,7 @@ using namespace pyrodactyl::input;
void HotKey::load(rapidxml::xml_node<char> *node) {
loadEnum(_input, "input", node);
- _name = g_engine->_inputManager->GetAssociatedKey(_input);
+ _name = g_engine->_inputManager->getAssociatedKey(_input);
}
#if 0
@@ -62,7 +62,7 @@ bool HotKey::handleEvents(const Common::Event &Event) {
//warning("STUB: HotKey::handleEvents()");
if (_input > IT_NONE && _input < IT_TOTAL) {
- return g_engine->_inputManager->State(_input);
+ return g_engine->_inputManager->state(_input);
}
return false;
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 57543ebb8bd..8cfc9addeb2 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -58,7 +58,7 @@ public:
void set(const InputType &val) {
_input = val;
- _name = g_engine->_inputManager->GetAssociatedKey(_input);
+ _name = g_engine->_inputManager->getAssociatedKey(_input);
}
const char *name();
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 3e2b33142ac..d41b2798e56 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
// Purpose: Return pressed/depressed state of key
//------------------------------------------------------------------------
-bool InputManager::State(const InputType &val) {
+bool InputManager::state(const InputType &val) {
return _ivState[val];
#if 0
@@ -106,7 +106,7 @@ const int InputManager::Equals(const InputType &val, const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Load from file
//------------------------------------------------------------------------
-void InputManager::Init() {
+void InputManager::init() {
const Common::String DEFAULT_FILENAME = "res/controls.xml";
load(DEFAULT_FILENAME);
@@ -154,15 +154,15 @@ void InputManager::Init() {
// Purpose: Load key & controller binding settings from file
//------------------------------------------------------------------------
void InputManager::load(const Common::String &filename) {
- XMLDoc control_list(filename);
- if (control_list.ready()) {
- rapidxml::xml_node<char> *node = control_list.doc()->first_node("controls");
+ XMLDoc controlList(filename);
+ if (controlList.ready()) {
+ rapidxml::xml_node<char> *node = controlList.doc()->first_node("controls");
if (nodeValid(node)) {
- loadNum(version, "version", node);
+ loadNum(_version, "version", node);
int i = 0;
for (auto n = node->first_node(); n != NULL && i < IT_TOTAL; n = n->next_sibling(), ++i)
- iv[i].loadState(n);
+ _iv[i].loadState(n);
}
}
}
@@ -170,8 +170,8 @@ void InputManager::load(const Common::String &filename) {
//------------------------------------------------------------------------
// Purpose: Initialize the controller if it is plugged in
//------------------------------------------------------------------------
-void InputManager::AddController() {
- warning("STUB: InputManager::AddController()");
+void InputManager::addController() {
+ warning("STUB: InputManager::addController()");
#if 0
if (SDL_NumJoysticks() > 0) {
@@ -196,39 +196,39 @@ void InputManager::HandleController(const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Create and restore backup
//------------------------------------------------------------------------
-void InputManager::CreateBackup() {
+void InputManager::createBackup() {
for (int i = 0; i < IT_TOTAL; ++i)
- backup[i] = iv[i];
+ _backup[i] = _iv[i];
}
-void InputManager::RestoreBackup() {
+void InputManager::restoreBackup() {
for (int i = 0; i < IT_TOTAL; ++i)
- iv[i] = backup[i];
+ _iv[i] = _backup[i];
}
-void InputManager::PopulateKeyTable() {
+void InputManager::populateKeyTable() {
for (unsigned int type = IG_START; type < IT_TOTAL; type++) {
_keyDescs[type] = '\0';
}
- SetKeyBindingMode(KBM_GAME);
+ setKeyBindingMode(KBM_GAME);
for (unsigned int i = IG_START; i < IG_SIZE + IG_START; i++) {
- GetAssociatedKey((InputType)i);
+ getAssociatedKey((InputType)i);
}
- SetKeyBindingMode(KBM_UI);
+ setKeyBindingMode(KBM_UI);
for (unsigned int i = IU_START; i < IU_SIZE + IU_START; i++) {
- GetAssociatedKey((InputType)i);
+ getAssociatedKey((InputType)i);
}
}
-Common::String InputManager::GetAssociatedKey(const InputType &type) {
+Common::String InputManager::getAssociatedKey(const InputType &type) {
// Return cached copy if available
if (_keyDescs[type].size() > 0)
return _keyDescs[type];
- Common::KeymapArray keymaparr = g_system->getEventManager()->getKeymapper()->getKeymaps();
- for(Common::Keymap *keymap : keymaparr) {
+ Common::KeymapArray keymapArr = g_system->getEventManager()->getKeymapper()->getKeymaps();
+ for(Common::Keymap *keymap : keymapArr) {
if (keymap->getType() != Common::Keymap::kKeymapTypeGame)
continue;
@@ -248,7 +248,7 @@ Common::String InputManager::GetAssociatedKey(const InputType &type) {
//------------------------------------------------------------------------
// Purpose: Save to file
//------------------------------------------------------------------------
-void InputManager::Save() {
+void InputManager::save() {
warning("STUB: InputManager::Save()");
#if 0
@@ -284,7 +284,7 @@ void InputManager::Save() {
#endif
}
-Common::Keymap* InputManager::GetDefaultKeyMapsForGame() {
+Common::Keymap* InputManager::getDefaultKeyMapsForGame() {
using namespace Common;
Keymap *keymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest-Game", "Keymappings for Game");
@@ -324,7 +324,7 @@ Common::Keymap* InputManager::GetDefaultKeyMapsForGame() {
return keymap;
}
-Common::Keymap* InputManager::GetDefaultKeyMapsForUI() {
+Common::Keymap* InputManager::getDefaultKeyMapsForUI() {
using namespace Common;
Keymap *uiKeymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest-UI", "Keymappings for UI");
@@ -394,7 +394,7 @@ Common::Keymap* InputManager::GetDefaultKeyMapsForUI() {
return uiKeymap;
}
-Common::Keymap* InputManager::GetDefaultKeyMapsForHUD() {
+Common::Keymap* InputManager::getDefaultKeyMapsForHUD() {
using namespace Common;
Keymap *hudKeymap = new Keymap(Keymap::kKeymapTypeGame, "Unrest-HUD", "Keymappings for HUD");
@@ -424,7 +424,7 @@ Common::Keymap* InputManager::GetDefaultKeyMapsForHUD() {
return hudKeymap;
}
-void InputManager::SetKeyBindingMode(KeyBindingMode mode) {
+void InputManager::setKeyBindingMode(KeyBindingMode mode) {
_keyMode = mode;
Common::Keymapper *const mapper = g_engine->getEventManager()->getKeymapper();
@@ -444,7 +444,7 @@ void InputManager::SetKeyBindingMode(KeyBindingMode mode) {
}
// Clear All inputs
- ClearInputs();
+ clearInputs();
}
} // End of namespace Crab
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index b74c45aff45..e281847fcaa 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -95,13 +95,13 @@ const int IU_START = IU_UP, IU_SIZE = IT_TOTAL - IU_START;
class InputManager {
// The backups used to restore in case of the user pressing cancel
- InputVal backup[IT_TOTAL];
+ InputVal _backup[IT_TOTAL];
// Load key configuration from file
void load(const Common::String &filename);
// The current version of the input scheme
- unsigned int version;
+ unsigned int _version;
// The current mode of keymap applied
KeyBindingMode _keyMode;
@@ -112,29 +112,29 @@ class InputManager {
public:
InputManager() {
//controller = nullptr;
- version = 0;
+ _version = 0;
- ClearInputs();
+ clearInputs();
}
~InputManager() {}
- static Common::Keymap* GetDefaultKeyMapsForGame();
- static Common::Keymap* GetDefaultKeyMapsForUI();
- static Common::Keymap* GetDefaultKeyMapsForHUD();
+ static Common::Keymap *getDefaultKeyMapsForGame();
+ static Common::Keymap *getDefaultKeyMapsForUI();
+ static Common::Keymap *getDefaultKeyMapsForHUD();
- void ClearInputs() {
+ void clearInputs() {
for (int i = 0; i < IT_TOTAL; i++)
_ivState[i] = false;
}
- void PopulateKeyTable();
+ void populateKeyTable();
- void SetKeyBindingMode(KeyBindingMode mode);
+ void setKeyBindingMode(KeyBindingMode mode);
- KeyBindingMode GetKeyBindingMode() const { return _keyMode; }
+ KeyBindingMode getKeyBindingMode() const { return _keyMode; }
- void Quit() {
+ void quit() {
warning("STUB: InputManager::Quit()");
#if 0
@@ -147,7 +147,7 @@ public:
// Ex. UI and Fight can have buttons in common, but not two keys within UI
// Inputs used in the game
- InputVal iv[IT_TOTAL];
+ InputVal _iv[IT_TOTAL];
bool _ivState[IT_TOTAL];
// Our controller object
@@ -160,15 +160,15 @@ public:
#endif
// These functions return true if key is pressed, false otherwise
- bool State(const InputType &val);
+ bool state(const InputType &val);
- void CreateBackup();
- void RestoreBackup();
+ void createBackup();
+ void restoreBackup();
// Initialize the controller if it is plugged in
- void AddController();
+ void addController();
- Common::String GetAssociatedKey(const InputType &type);
+ Common::String getAssociatedKey(const InputType &type);
#if 0
// Handle plugging and unplugging of controllers on the fly
@@ -176,9 +176,9 @@ public:
#endif
// Initialize the input system
- void Init();
+ void init();
- void Save();
+ void save();
};
} // End of namespace input
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index e08014fd144..32cb7a86100 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -91,9 +91,9 @@ Common::KeymapArray CrabMetaEngine::initKeymaps(const char *target) const {
KeymapArray arr;
- Keymap *gameKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForGame();
- Keymap *uiKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForUI();
- Keymap *hudKeymaps = Crab::pyrodactyl::input::InputManager::GetDefaultKeyMapsForHUD();
+ Keymap *gameKeymaps = Crab::pyrodactyl::input::InputManager::getDefaultKeyMapsForGame();
+ Keymap *uiKeymaps = Crab::pyrodactyl::input::InputManager::getDefaultKeyMapsForUI();
+ Keymap *hudKeymaps = Crab::pyrodactyl::input::InputManager::getDefaultKeyMapsForHUD();
arr.push_back(gameKeymaps);
arr.push_back(uiKeymaps);
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index b39e9aed023..949f019cef3 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -119,7 +119,7 @@ void KeyBindMenu::DrawDesc(const int &type) {
int xoffset = inc.x * i + divide.x * (i / dim.x);
int yoffset = inc.y * (i % dim.x) + divide.y * (i / dim.x);
- desc.draw(g_engine->_inputManager->iv[i + start].name, xoffset, yoffset);
+ desc.draw(g_engine->_inputManager->_iv[i + start].name, xoffset, yoffset);
}
}
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 67d58c27a0f..e359bff301e 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -159,7 +159,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
tone.value[element_count] = dat._reply[reply_count]._tone;
const InputType type = static_cast<InputType>(IU_REPLY_0 + element_count);
- Common::String text = g_engine->_inputManager->GetAssociatedKey(type);
+ Common::String text = g_engine->_inputManager->getAssociatedKey(type);
text += ". " + i->_text;
info.insertName(text);
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 15d06b82a01..b4099fda39c 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -87,8 +87,8 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
}
break;
case STATE_NAME:
- if (g_engine->_inputManager->GetKeyBindingMode() != input::KBM_UI)
- g_engine->_inputManager->SetKeyBindingMode(KBM_UI);
+ if (g_engine->_inputManager->getKeyBindingMode() != input::KBM_UI)
+ g_engine->_inputManager->setKeyBindingMode(KBM_UI);
if (ta_name.handleEvents(Event)) {
if (index <= (int)slot_info.size() && index != 0)
@@ -97,11 +97,11 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
selected = ta_name.text;
state = STATE_NORMAL;
reset();
- g_engine->_inputManager->SetKeyBindingMode(KBM_GAME);
+ g_engine->_inputManager->setKeyBindingMode(KBM_GAME);
return true;
}
- if (g_engine->_inputManager->State(IU_BACK)) {
+ if (g_engine->_inputManager->state(IU_BACK)) {
ta_name.text = "New Save";
state = STATE_NORMAL;
}
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index e44b3d2ea01..4a303272fd2 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -168,7 +168,7 @@ void HUD::SetTooltip() {
for (auto i = menu.element.begin(); i != menu.element.end() && count < tooltip.size(); ++i, ++count)
i->tooltip.text = tooltip[count] + " (" + i->hotkey.name() + ")";
- menu.element[HS_PAUSE].tooltip.text = tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->GetAssociatedKey(IG_PAUSE) + ")";
+ menu.element[HS_PAUSE].tooltip.text = tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->getAssociatedKey(IG_PAUSE) + ")";
}
void HUD::setUI() {
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 9801f293948..56fbc676828 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -127,32 +127,32 @@ protected:
int HandleKeyboard(const Common::Event &Event) {
using namespace pyrodactyl::input;
- if (g_engine->_inputManager->GetKeyBindingMode() != KBM_UI) {
- g_engine->_inputManager->SetKeyBindingMode(KBM_UI);
+ if (g_engine->_inputManager->getKeyBindingMode() != KBM_UI) {
+ g_engine->_inputManager->setKeyBindingMode(KBM_UI);
}
if (!element.empty()) {
if (path_type != PATH_HORIZONTAL) {
- if (g_engine->_inputManager->State(IU_DOWN)) {
+ if (g_engine->_inputManager->state(IU_DOWN)) {
Next();
latest_input = KEYBOARD;
- } else if (g_engine->_inputManager->State(IU_UP)) {
+ } else if (g_engine->_inputManager->state(IU_UP)) {
Prev();
latest_input = KEYBOARD;
}
}
if (path_type != PATH_VERTICAL) {
- if (g_engine->_inputManager->State(IU_RIGHT)) {
+ if (g_engine->_inputManager->state(IU_RIGHT)) {
Next();
latest_input = KEYBOARD;
- } else if (g_engine->_inputManager->State(IU_LEFT)) {
+ } else if (g_engine->_inputManager->state(IU_LEFT)) {
Prev();
latest_input = KEYBOARD;
}
}
- if (g_engine->_inputManager->State(IU_ACCEPT) && hover_index != -1)
+ if (g_engine->_inputManager->state(IU_ACCEPT) && hover_index != -1)
return hover_index;
// We pressed a key, which means we have to update the hovering status
@@ -265,7 +265,7 @@ public:
if (result != -1) {
// Reset the menu state
reset();
- g_engine->_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
+ g_engine->_inputManager->setKeyBindingMode(pyrodactyl::input::KBM_GAME);
return result;
}
}
@@ -284,7 +284,7 @@ public:
if (it->handleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
// Reset the menu state
reset();
- g_engine->_inputManager->SetKeyBindingMode(pyrodactyl::input::KBM_GAME);
+ g_engine->_inputManager->setKeyBindingMode(pyrodactyl::input::KBM_GAME);
return i;
}
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 5661a7e808f..1c62a02bab0 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -80,7 +80,7 @@ bool TextArea::handleEvents(const Common::Event &Event, bool numbers_only) {
// Append the character to string
text += Event.kbd.ascii;
}
- } else if (g_engine->_inputManager->State(IU_ACCEPT) && text.size() != 0) {
+ } else if (g_engine->_inputManager->state(IU_ACCEPT) && text.size() != 0) {
// Now play the accept sound
g_engine->_musicManager->PlayEffect(se_accept, 0);
Commit: 71bc6577a472e6eaccbda5f6b107d399a7b298c3
https://github.com/scummvm/scummvm/commit/71bc6577a472e6eaccbda5f6b107d399a7b298c3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Item and ItemCollection classes follow code formatting conventions
Changed paths:
engines/crab/item/Item.cpp
engines/crab/item/Item.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/item/StatPreview.cpp
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/ItemDesc.h
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 5d6b3f567c5..419fc7f1fe3 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -43,42 +43,42 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
void Item::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- loadStr(id, "id", node);
- loadStr(name, "name", node);
- loadStr(type, "type", node);
- loadStr(desc, "desc", node);
- loadImgKey(img, "img", node);
+ loadStr(_id, "id", node);
+ loadStr(_name, "name", node);
+ loadStr(_type, "type", node);
+ loadStr(_desc, "desc", node);
+ loadImgKey(_img, "img", node);
- bonus.clear();
+ _bonus.clear();
for (auto n = node->first_node("bonus"); n != NULL; n = n->next_sibling("bonus")) {
Bonus b;
b.load(n);
- bonus.push_back(b);
+ _bonus.push_back(b);
}
}
}
-void Item::Clear() {
- id = "";
- name = "";
- type = "";
- desc = "";
- img = 0;
- bonus.clear();
- value = 0;
+void Item::clear() {
+ _id = "";
+ _name = "";
+ _type = "";
+ _desc = "";
+ _img = 0;
+ _bonus.clear();
+ _value = 0;
}
//------------------------------------------------------------------------
// Purpose: Save and load state
//------------------------------------------------------------------------
void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("id", id.c_str()));
- root->append_attribute(doc.allocate_attribute("name", name.c_str()));
- root->append_attribute(doc.allocate_attribute("type", type.c_str()));
- root->append_attribute(doc.allocate_attribute("img", gStrPool->Get(img)));
- root->append_attribute(doc.allocate_attribute("desc", desc.c_str()));
+ root->append_attribute(doc.allocate_attribute("id", _id.c_str()));
+ root->append_attribute(doc.allocate_attribute("name", _name.c_str()));
+ root->append_attribute(doc.allocate_attribute("type", _type.c_str()));
+ root->append_attribute(doc.allocate_attribute("img", gStrPool->Get(_img)));
+ root->append_attribute(doc.allocate_attribute("desc", _desc.c_str()));
- for (auto i = bonus.begin(); i != bonus.end(); ++i) {
+ for (auto i = _bonus.begin(); i != _bonus.end(); ++i) {
auto n = doc.allocate_node(rapidxml::node_element, "bonus");
switch (i->type) {
case STAT_HEALTH:
@@ -107,8 +107,8 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
//------------------------------------------------------------------------
// Purpose: Calculate effect of item on stats
//------------------------------------------------------------------------
-void Item::StatChange(Person &obj, bool increase) {
- for (auto i = bonus.begin(); i != bonus.end(); ++i)
+void Item::statChange(pyrodactyl::people::Person &obj, bool increase) {
+ for (auto i = _bonus.begin(); i != _bonus.end(); ++i)
if (increase)
obj.stat.Change(i->type, i->val);
else
@@ -116,7 +116,7 @@ void Item::StatChange(Person &obj, bool increase) {
}
void Item::draw(const int &x, const int &y) {
- g_engine->_imageManager->draw(x, y, img);
+ g_engine->_imageManager->draw(x, y, _img);
}
} // End of namespace Crab
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index a32a8770aca..e005365687f 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -42,25 +42,28 @@ namespace pyrodactyl {
namespace item {
struct Item {
// The id, name and description of the item
- Common::String id, name, desc;
+ Common::String _id, _name, _desc;
// The image for the item
- ImageKey img;
+ ImageKey _img;
// The type of item
- Common::String type;
+ Common::String _type;
// The stat bonuses provided by the item
- Common::Array<pyrodactyl::stat::Bonus> bonus;
+ Common::Array<pyrodactyl::stat::Bonus> _bonus;
// The price
- unsigned int value;
+ unsigned int _value;
+
+ Item() {
+ clear();
+ }
- Item() { Clear(); }
~Item() {}
- void Clear();
- void StatChange(pyrodactyl::people::Person &obj, bool increase);
+ void clear();
+ void statChange(pyrodactyl::people::Person &obj, bool increase);
void load(rapidxml::xml_node<char> *node);
void draw(const int &x, const int &y);
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 25fa939053f..469e4948162 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -41,37 +41,37 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
void ItemCollection::load(rapidxml::xml_node<char> *node) {
if (nodeValid("info", node))
- item_info.load(node->first_node("info"));
+ _itemInfo.load(node->first_node("info"));
if (nodeValid("ref", node))
- ref.load(node->first_node("ref"));
+ _ref.load(node->first_node("ref"));
if (nodeValid("inc", node))
- inc.load(node->first_node("inc"));
+ _inc.load(node->first_node("inc"));
if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
- loadNum(rows, "rows", dimnode);
- loadNum(cols, "cols", dimnode);
+ loadNum(_rows, "rows", dimnode);
+ loadNum(_cols, "cols", dimnode);
}
- loadBool(usekeyboard, "keyboard", node);
+ loadBool(_useKeyboard, "keyboard", node);
}
//------------------------------------------------------------------------
// Purpose: Add a character's inventory if not added already
//------------------------------------------------------------------------
-void ItemCollection::Init(const Common::String &char_id) {
- if (item.contains(char_id) == 0)
- item[char_id].Init(ref, inc, rows, cols, usekeyboard);
+void ItemCollection::init(const Common::String &charId) {
+ if (_item.contains(charId) == 0)
+ _item[charId].Init(_ref, _inc, _rows, _cols, _useKeyboard);
}
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void ItemCollection::handleEvents(const Common::String &char_id, const Common::Event &Event) {
- if (item.contains(char_id) > 0)
- item[char_id].handleEvents(Event);
+void ItemCollection::handleEvents(const Common::String &charId, const Common::Event &event) {
+ if (_item.contains(charId) > 0)
+ _item[charId].handleEvents(event);
}
#if 0
@@ -87,36 +87,36 @@ void ItemCollection::handleEvents(const Common::String &char_id, const SDL_Event
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void ItemCollection::draw(const Common::String &char_id) {
- if (item.contains(char_id) > 0)
- item[char_id].draw(item_info);
+void ItemCollection::draw(const Common::String &charId) {
+ if (_item.contains(charId) > 0)
+ _item[charId].draw(_itemInfo);
}
//------------------------------------------------------------------------
// Purpose: Delete an item from a character's inventory
//------------------------------------------------------------------------
-void ItemCollection::Del(const Common::String &char_id, const Common::String &item_id) {
- if (item.contains(char_id) > 0)
- item[char_id].Del(item_id);
+void ItemCollection::del(const Common::String &charId, const Common::String &itemId) {
+ if (_item.contains(charId) > 0)
+ _item[charId].Del(itemId);
}
//------------------------------------------------------------------------
// Purpose: Add an item to a character's inventory
//------------------------------------------------------------------------
-void ItemCollection::Add(const Common::String &char_id, Item &item_data) {
+void ItemCollection::add(const Common::String &charId, Item &itemData) {
// We might want to give a player character not yet encountered an item before we ever meet them
// Which is why we add a new inventory in case the character inventory does not exist yet
- Init(char_id);
+ init(charId);
- item[char_id].Equip(item_data);
+ _item[charId].Equip(itemData);
}
//------------------------------------------------------------------------
// Purpose: Find if a character has an item
//------------------------------------------------------------------------
-bool ItemCollection::Has(const Common::String &char_id, const Common::String &container, const Common::String &item_id) {
- if (item.contains(char_id) > 0)
- return item[char_id].Has(container, item_id);
+bool ItemCollection::has(const Common::String &charId, const Common::String &container, const Common::String &itemId) {
+ if (_item.contains(charId) > 0)
+ return _item[charId].Has(container, itemId);
return false;
}
@@ -127,8 +127,8 @@ bool ItemCollection::Has(const Common::String &char_id, const Common::String &co
void ItemCollection::loadState(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
// Add all characters in the save file, whether we have them in the inventory or not
- Init(n->name());
- item[n->name()].loadState(n);
+ init(n->name());
+ _item[n->name()].loadState(n);
}
}
@@ -136,7 +136,7 @@ void ItemCollection::loadState(rapidxml::xml_node<char> *node) {
// Purpose: Write items to save file
//------------------------------------------------------------------------
void ItemCollection::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto i = item.begin(); i != item.end(); ++i) {
+ for (auto i = _item.begin(); i != _item.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, i->_key.c_str());
i->_value.saveState(doc, child);
root->append_node(child);
@@ -147,9 +147,9 @@ void ItemCollection::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node
// Purpose: Reset UI elements when resolution changes
//------------------------------------------------------------------------
void ItemCollection::setUI() {
- item_info.setUI();
+ _itemInfo.setUI();
- for (auto i = item.begin(); i != item.end(); ++i)
+ for (auto i = _item.begin(); i != _item.end(); ++i)
i->_value.setUI();
}
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 2b5db140ddf..396f6ef1877 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -42,51 +42,52 @@ namespace item {
// All the items owned by characters controlled by the player
class ItemCollection {
// The items for all player characters
- Common::HashMap<Common::String, ItemMenu> item;
+ Common::HashMap<Common::String, ItemMenu> _item;
// The reference information for these menus used to display these items
// The reference item slot
- ItemSlot ref;
+ ItemSlot _ref;
// This vector stores the increments in x,y for each new slot
- Vector2i inc;
+ Vector2i _inc;
// The dimensions of the menu
- unsigned int rows, cols;
+ unsigned int _rows, _cols;
// Draw item description when user clicks an item to select it
- pyrodactyl::ui::ItemDesc item_info;
+ pyrodactyl::ui::ItemDesc _itemInfo;
// Should we enable keyboard for the menus
- bool usekeyboard;
+ bool _useKeyboard;
public:
ItemCollection() {
- rows = 1;
- cols = 1;
- usekeyboard = true;
+ _rows = 1;
+ _cols = 1;
+ _useKeyboard = true;
}
+
~ItemCollection() {}
void load(rapidxml::xml_node<char> *node);
- void handleEvents(const Common::String &char_id, const Common::Event &Event);
+ void handleEvents(const Common::String &charId, const Common::Event &event);
#if 0
void handleEvents(const Common::String &char_id, const SDL_Event &Event);
#endif
- void Init(const Common::String &char_id);
- void draw(const Common::String &char_id);
+ void init(const Common::String &charId);
+ void draw(const Common::String &charId);
// Requires: id of the character, the item information
- void Add(const Common::String &char_id, Item &item_data);
+ void add(const Common::String &charId, Item &itemData);
// Requires: id of the character from which to remove the item, and id of the item
- void Del(const Common::String &char_id, const Common::String &item_id);
+ void del(const Common::String &charId, const Common::String &itemId);
// Requires: id of the character, the name of the container and name of the item
- bool Has(const Common::String &char_id, const Common::String &container, const Common::String &item_id);
+ bool has(const Common::String &charId, const Common::String &container, const Common::String &itemId);
void loadState(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index c2d49729e6e..e77e114b6cd 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -124,9 +124,9 @@ bool ItemMenu::Del(const Common::String &id) {
bool result = false;
for (auto &i : element)
- if (i.item.id == id) {
+ if (i.item._id == id) {
i.empty = true;
- i.item.Clear();
+ i.item.clear();
i.unread = false;
result = true;
break;
@@ -140,7 +140,7 @@ bool ItemMenu::Del(const Common::String &id) {
//------------------------------------------------------------------------
bool ItemMenu::Has(const Common::String &container, const Common::String &id) {
for (auto i = element.begin(); i != element.end(); ++i)
- if (i->item.id == id) {
+ if (i->item._id == id) {
if (container == "equip") {
if (i->category == SLOT_EQUIP)
return true;
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 15be136b169..0dbd88f329f 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -94,7 +94,7 @@ void ItemSlot::loadState(rapidxml::xml_node<char> *node) {
item.load(node);
loadBool(unread, "unread", node);
- if (item.id == "")
+ if (item._id == "")
empty = true;
else
empty = false;
@@ -161,7 +161,7 @@ bool ItemSlot::Swap(ItemSlot &target) {
// Purpose: Equip an item
//------------------------------------------------------------------------
bool ItemSlot::Equip(Item &i) {
- if ((item_type == i.type || no_type) && empty) {
+ if ((item_type == i._type || no_type) && empty) {
item = i;
empty = false;
unread = true;
@@ -176,7 +176,7 @@ bool ItemSlot::Equip(Item &i) {
//------------------------------------------------------------------------
void ItemSlot::StatChange(Person &obj, bool increase) {
if (enabled)
- item.StatChange(obj, increase);
+ item.statChange(obj, increase);
}
} // End of namespace Crab
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index f7bb72e55eb..d7d4e7813fe 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -85,7 +85,7 @@ public:
pyrodactyl::ui::ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
- bool CanSwap(ItemSlot &target) { return target.no_type || item.type == target.item_type; }
+ bool CanSwap(ItemSlot &target) { return target.no_type || item._type == target.item_type; }
bool Swap(ItemSlot &target);
bool Equip(Item &i);
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index 4eb8a9fbe50..cb73049fd2c 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -56,7 +56,7 @@ void StatPreview::load(rapidxml::xml_node<char> *node) {
void StatPreview::draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
if (enabled) {
int count = 0;
- for (auto i = item.bonus.begin(); i != item.bonus.end(); ++i, ++count) {
+ for (auto i = item._bonus.begin(); i != item._bonus.end(); ++i, ++count) {
stat.draw(helper.Name(i->type), inc_s.x * count, inc_s.y * count);
unit.draw(gStrPool->Get(i->val), inc_u.x * count, inc_u.y * count);
}
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index af576c264b7..fbb99bbf1ac 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -76,15 +76,15 @@ void Inventory::LoadItem(const Common::String &char_id, const Common::String &id
}
void Inventory::DelItem(const Common::String &char_id, const Common::String &item_id) {
- collection.Del(char_id, item_id);
+ collection.del(char_id, item_id);
}
void Inventory::AddItem(const Common::String &char_id, Item &item) {
- collection.Add(char_id, item);
+ collection.add(char_id, item);
}
bool Inventory::HasItem(const Common::String &char_id, const Common::String &container, const Common::String &item_id) {
- return collection.Has(char_id, container, item_id);
+ return collection.has(char_id, container, item_id);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index acd1f436210..a9a8c2e52dd 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -62,7 +62,7 @@ public:
Inventory() {}
~Inventory() {}
- void Init(const Common::String &char_id) { collection.Init(char_id); }
+ void Init(const Common::String &char_id) { collection.init(char_id); }
void LoadItem(const Common::String &char_id, const Common::String &name);
void AddItem(const Common::String &char_id, pyrodactyl::item::Item &item);
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index 17c1335340e..6647fdf924b 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -59,8 +59,8 @@ public:
}
void draw(pyrodactyl::item::Item &item) {
- name.draw(item.name);
- desc.draw(item.desc);
+ name.draw(item._name);
+ desc.draw(item._desc);
}
void setUI() {
Commit: 0f9564a9e962f74dd96b1a2467787a9280de66da
https://github.com/scummvm/scummvm/commit/0f9564a9e962f74dd96b1a2467787a9280de66da
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make button and element realted UI classes follow code formatting conventions
Changed paths:
engines/crab/item/ItemSlot.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/ClipButton.cpp
engines/crab/ui/ClipButton.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/QuestText.cpp
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/StateButton.cpp
engines/crab/ui/StateButton.h
engines/crab/ui/TraitButton.cpp
engines/crab/ui/button.cpp
engines/crab/ui/button.h
engines/crab/ui/element.cpp
engines/crab/ui/element.h
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
engines/crab/ui/menu.h
engines/crab/ui/slider.cpp
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 0dbd88f329f..2ee5f4b47fa 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -64,7 +64,7 @@ void ItemSlot::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset) {
StateButton::Init(ref, XOffset, YOffset);
- canmove = ref.canmove;
+ _canmove = ref._canmove;
no_type = ref.no_type;
category = ref.category;
unread = ref.unread;
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index c3b77461cd0..90a1cc53e5b 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -463,11 +463,11 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
me_main.UseKeyboard((state == STATE_NORMAL));
// Continue button is only enabled if there is a save to load
- me_main.element[0].visible = !g_engine->_loadMenu->Empty();
+ me_main.element[0]._visible = !g_engine->_loadMenu->Empty();
// Enable credits and quit button if outside all menus, otherwise disable it
- me_main.element[6].visible = (state == STATE_NORMAL);
- me_main.element[7].visible = (state == STATE_NORMAL);
+ me_main.element[6]._visible = (state == STATE_NORMAL);
+ me_main.element[7]._visible = (state == STATE_NORMAL);
// If switching to help screen, load latest image otherwise remove it from memory
if (state == STATE_HELP)
diff --git a/engines/crab/ui/ClipButton.cpp b/engines/crab/ui/ClipButton.cpp
index 2610903a68d..687e19faab4 100644
--- a/engines/crab/ui/ClipButton.cpp
+++ b/engines/crab/ui/ClipButton.cpp
@@ -40,17 +40,17 @@ void ClipButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
Button::load(node, echo);
if (nodeValid("clip", node, false))
- clip.load(node->first_node("clip"));
+ _clip.load(node->first_node("clip"));
else {
- clip.x = 0;
- clip.y = 0;
- clip.w = g_engine->_imageManager->getTexture(img.normal).w();
- clip.h = g_engine->_imageManager->getTexture(img.normal).h();
+ _clip.x = 0;
+ _clip.y = 0;
+ _clip.w = g_engine->_imageManager->getTexture(_img._normal).w();
+ _clip.h = g_engine->_imageManager->getTexture(_img._normal).h();
}
}
-void ClipButton::draw(const int &XOffset, const int &YOffset) {
- Button::draw(XOffset, YOffset, &clip);
+void ClipButton::draw(const int &xOffset, const int &yOffset) {
+ Button::draw(xOffset, yOffset, &_clip);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ClipButton.h b/engines/crab/ui/ClipButton.h
index 0edcd7e3d4e..ead753df23b 100644
--- a/engines/crab/ui/ClipButton.h
+++ b/engines/crab/ui/ClipButton.h
@@ -41,13 +41,13 @@ namespace ui {
class ClipButton : public Button {
public:
// The clip rectangle
- Rect clip;
+ Rect _clip;
ClipButton() {}
~ClipButton() {}
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index fbb99bbf1ac..99ce8cee67d 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -95,7 +95,7 @@ void Inventory::draw(Person &obj, const int &money_val) {
// helper.DrawInfo(obj);
collection.draw(obj.id /*, helper*/);
- money.caption.text = NumberToString(money_val);
+ money._caption.text = NumberToString(money_val);
money.draw();
}
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 824bdc2a01e..43eb97e237b 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -66,16 +66,16 @@ void MapMarkerMenu::draw(const Element &pos, const Vector2i &player_pos, const R
Vector2i offset_m(pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
// Only draw the image - captions drawn later to prevent drawing another button over caption
- player.ImageCaptionOnlyDraw(offset_p.x, offset_p.y);
+ player.imageCaptionOnlyDraw(offset_p.x, offset_p.y);
for (auto &i : menu.element)
- i.ImageCaptionOnlyDraw(offset_m.x, offset_m.y);
+ i.imageCaptionOnlyDraw(offset_m.x, offset_m.y);
// Now draw the tool-tips for everything combined
- player.HoverInfoOnlyDraw(offset_p.x, offset_p.y);
+ player.hoverInfoOnlyDraw(offset_p.x, offset_p.y);
for (auto &i : menu.element)
- i.HoverInfoOnlyDraw(offset_m.x, offset_m.y);
+ i.hoverInfoOnlyDraw(offset_m.x, offset_m.y);
}
//------------------------------------------------------------------------
@@ -133,7 +133,7 @@ void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &player_po
player.w + offset.marker.x,
player.h + offset.marker.y);
- player.visible = bounds.Contains(r);
+ player._visible = bounds.Contains(r);
}
// Redefine p for marker buttons
@@ -144,7 +144,7 @@ void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &player_po
Rect r(i.x + p.x - offset.marker.x, i.y + p.y - offset.marker.y,
i.w + offset.marker.x, i.h + offset.marker.y);
- i.visible = bounds.Contains(r);
+ i._visible = bounds.Contains(r);
}
}
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index fa408f0f637..f5d12b964e8 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -61,7 +61,7 @@ public:
void AddButton(const Common::String &name, const int &x, const int &y) {
StateButton b;
b.Init(ref, x, y);
- b.tooltip.text = name;
+ b._tooltip.text = name;
menu.element.push_back(b);
}
@@ -70,12 +70,12 @@ public:
void SelectDest(const Common::String &name) {
for (auto &i : menu.element)
- i.State(i.tooltip.text == name);
+ i.State(i._tooltip.text == name);
}
void Erase(const Common::String &name) {
for (auto i = menu.element.begin(); i != menu.element.end(); ++i) {
- if (i->tooltip.text == name) {
+ if (i->_tooltip.text == name) {
menu.element.erase(i);
AssignPaths();
break;
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 7b7ac7b30b5..8752536f61c 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -111,7 +111,7 @@ public:
const int &CurX(const int &count) { return menu[current_page].element[count].x; }
const int &CurY(const int &count) { return menu[current_page].element[count].y; }
- void Image(const int &slot, const int &page, ButtonImage &bi) { menu[page].element[slot].Img(bi); }
+ void Image(const int &slot, const int &page, ButtonImage &bi) { menu[page].element[slot].img(bi); }
void AssignPaths() {
for (auto m = menu.begin(); m != menu.end(); ++m)
@@ -144,12 +144,12 @@ public:
if (nodeValid(node)) {
if (nodeValid("prev", node)) {
prev.load(node->first_node("prev"));
- prev.hotkey.set(IU_PREV);
+ prev._hotkey.set(IU_PREV);
}
if (nodeValid("next", node)) {
next.load(node->first_node("next"));
- next.hotkey.set(IU_NEXT);
+ next._hotkey.set(IU_NEXT);
}
if (nodeValid("reference", node))
@@ -179,7 +179,7 @@ public:
}
T b;
- b.Init(ref, inc.x * (slot % cols), inc.y * (slot / cols));
+ b.init(ref, inc.x * (slot % cols), inc.y * (slot / cols));
menu[page].element.push_back(b);
++slot;
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 69efda87345..2ee2ff9eae3 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -64,7 +64,7 @@ PauseSignal PauseMenu::handleEvents(const Common::Event &Event, Button &back) {
case STATE_NORMAL:
choice = menu.handleEvents(Event);
if (choice == -1) {
- if (back.hotkey.handleEvents(Event))
+ if (back._hotkey.handleEvents(Event))
return PS_RESUME;
} else {
switch (choice) {
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index c4d6b2aa029..fd178d4be78 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -79,8 +79,8 @@ public:
~PauseMenu(void) {}
void UpdateMode(const bool &ironman) {
- menu.element[PS_SAVE - 1].visible = !ironman;
- menu.element[PS_LOAD - 1].visible = !ironman;
+ menu.element[PS_SAVE - 1]._visible = !ironman;
+ menu.element[PS_LOAD - 1]._visible = !ironman;
}
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index 4bd05a4e812..2cfeccc2a96 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -61,28 +61,28 @@ void ProgressBar::draw(const int &value, const int &max) {
// Figure out which text to draw as caption
for (auto &i : ct)
if (value > i.val) {
- caption.text = i.text;
+ _caption.text = i.text;
break;
}
// If we don't have to draw animations for changing value, just draw the bar
if (!changed) {
- clip.w = (g_engine->_imageManager->getTexture(img.normal).w() * value) / max;
+ _clip.w = (g_engine->_imageManager->getTexture(_img._normal).w() * value) / max;
ClipButton::draw();
} else {
- clip.w = (g_engine->_imageManager->getTexture(img.normal).w() * cur) / max;
+ _clip.w = (g_engine->_imageManager->getTexture(_img._normal).w() * cur) / max;
ClipButton::draw();
switch (type) {
case INCREASE:
- g_engine->_imageManager->draw(x + clip.w + offset.x, y + offset.y, inc);
+ g_engine->_imageManager->draw(x + _clip.w + offset.x, y + offset.y, inc);
if (timer.TargetReached()) {
cur++;
timer.Start();
}
break;
case DECREASE:
- g_engine->_imageManager->draw(x + clip.w + offset.x, y + offset.y, dec);
+ g_engine->_imageManager->draw(x + _clip.w + offset.x, y + offset.y, dec);
if (timer.TargetReached()) {
cur--;
timer.Start();
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 6c74acf090e..9406569bfd4 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -52,12 +52,12 @@ void QuestText::load(rapidxml::xml_node<char> *node) {
if (nodeValid("prev", node)) {
prev.load(node->first_node("prev"));
- prev.hotkey.set(IU_PAGE_PREV);
+ prev._hotkey.set(IU_PAGE_PREV);
}
if (nodeValid("next", node)) {
next.load(node->first_node("next"));
- next.hotkey.set(IU_PAGE_NEXT);
+ next._hotkey.set(IU_PAGE_NEXT);
}
if (nodeValid("status", node))
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 9aaa29671db..9c3f3c52fb2 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -56,10 +56,10 @@ void ReplyButton::load(rapidxml::xml_node<char> *node) {
}
void ReplyButton::draw(const int &XOffset, const int &YOffset) {
- if (visible) {
- if (mousepressed)
+ if (_visible) {
+ if (_mousePressed)
g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_s, font, align, line_size.x, line_size.y);
- else if (hover_mouse || hover_key)
+ else if (_hoverMouse || _hoverKey)
g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_h, font, align, line_size.x, line_size.y);
else
g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_b, font, align, line_size.x, line_size.y);
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index e359bff301e..50c09795378 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -153,7 +153,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
for (auto i = dat._reply.begin(); i != dat._reply.end() && reply_count < dat._reply.size(); ++i, ++reply_count) {
if (i->_unlock.evaluate(info)) {
- element[element_count].visible = true;
+ element[element_count]._visible = true;
element[element_count].index = reply_count;
tone.value[element_count] = dat._reply[reply_count]._tone;
@@ -177,7 +177,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
// Unused element buttons are hidden
for (; element_count < element.size(); element_count++)
- element[element_count].visible = false;
+ element[element_count]._visible = false;
}
void ReplyMenu::setUI() {
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index b93db457f4a..0862746a4e7 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -64,10 +64,10 @@ void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
if (g_engine->_screenSettings->ValidDimension(d)) {
dim.push_back(d);
Button b;
- b.Init(ref, inc.x * (count_slot % columns), inc.y * (count_slot / columns));
- b.caption.text = NumberToString(d.w);
- b.caption.text += " x ";
- b.caption.text += NumberToString(d.h);
+ b.init(ref, inc.x * (count_slot % columns), inc.y * (count_slot / columns));
+ b._caption.text = NumberToString(d.w);
+ b._caption.text += " x ";
+ b._caption.text += NumberToString(d.h);
element.push_back(b);
}
}
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index cbcbd949127..b0555aae350 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -45,12 +45,12 @@ void SlideShow::load(rapidxml::xml_node<char> *node) {
if (nodeValid("prev", node)) {
prev.load(node->first_node("prev"));
- prev.hotkey.set(IU_PREV);
+ prev._hotkey.set(IU_PREV);
}
if (nodeValid("next", node)) {
next.load(node->first_node("next"));
- next.hotkey.set(IU_NEXT);
+ next._hotkey.set(IU_NEXT);
}
path.clear();
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index a55d74f51b8..74e434cfffa 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
void StateButton::Init(const StateButton &ref, const int &XOffset, const int &YOffset) {
- Button::Init(ref, XOffset, YOffset);
+ Button::init(ref, XOffset, YOffset);
img_set = ref.img_set;
col_normal = ref.col_normal;
col_select = ref.col_select;
@@ -46,9 +46,9 @@ void StateButton::Init(const StateButton &ref, const int &XOffset, const int &YO
void StateButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
Button::load(node, echo);
- img_set.normal = img;
- col_normal.col = caption.col;
- col_normal.col_s = caption.col_s;
+ img_set.normal = _img;
+ col_normal.col = _caption.col;
+ col_normal.col_s = _caption.col_s;
if (nodeValid("select", node, false)) {
rapidxml::xml_node<char> *selnode = node->first_node("select");
@@ -57,34 +57,34 @@ void StateButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
loadNum(col_select.col, "color", selnode);
loadNum(col_select.col_s, "color_s", selnode);
} else {
- img_set.select = img;
- col_select.col = caption.col;
- col_select.col_s = caption.col_s;
+ img_set.select = _img;
+ col_select.col = _caption.col;
+ col_select.col_s = _caption.col_s;
}
}
void StateButton::State(const bool val) {
if (val) {
- img = img_set.select;
- caption.col = col_select.col;
- caption.col_s = col_select.col_s;
+ _img = img_set.select;
+ _caption.col = col_select.col;
+ _caption.col_s = col_select.col_s;
} else {
- img = img_set.normal;
- caption.col = col_normal.col;
- caption.col_s = col_normal.col_s;
+ _img = img_set.normal;
+ _caption.col = col_normal.col;
+ _caption.col_s = col_normal.col_s;
}
// Images might be different in size
- w = g_engine->_imageManager->getTexture(img.normal).w();
- h = g_engine->_imageManager->getTexture(img.normal).h();
+ w = g_engine->_imageManager->getTexture(_img._normal).w();
+ h = g_engine->_imageManager->getTexture(_img._normal).h();
}
void StateButton::Img(const StateButtonImage &sbi) {
// Find which is the current image and set it
- if (img == img_set.normal)
- img = sbi.normal;
+ if (_img == img_set.normal)
+ _img = sbi.normal;
else
- img = sbi.select;
+ _img = sbi.select;
img_set = sbi;
}
diff --git a/engines/crab/ui/StateButton.h b/engines/crab/ui/StateButton.h
index 9a3eb6675ee..7e2b071b95f 100644
--- a/engines/crab/ui/StateButton.h
+++ b/engines/crab/ui/StateButton.h
@@ -80,7 +80,7 @@ public:
// The state of the button - false is original image, true is second image
void State(const bool val);
- bool State() { return (img == img_set.select); }
+ bool State() { return (_img == img_set.select); }
// Set the image
void Img(const StateButtonImage &sbi);
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index c8e92c528e4..a6da5a22f18 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -58,12 +58,12 @@ void TraitButton::draw(const int &XOffset, const int &YOffset, Rect *clip) {
void TraitButton::Cache(const pyrodactyl::people::Trait &trait) {
trait_img = trait.img;
- caption.text = trait.name;
+ _caption.text = trait.name;
}
void TraitButton::Empty() {
trait_img = 0;
- caption.text = "";
+ _caption.text = "";
}
} // End of namespace Crab
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 8383b426683..4c3b720c634 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -47,124 +47,124 @@ using namespace pyrodactyl::text;
// Purpose: Constructor
//------------------------------------------------------------------------
Button::Button() {
- visible = false;
- canmove = false;
- se_click = -1;
- se_hover = -1;
- hover_prev = false;
+ _visible = false;
+ _canmove = false;
+ _seClick = -1;
+ _seHover = -1;
+ _hoverPrev = false;
reset();
}
//------------------------------------------------------------------------
// Purpose: Load a new Button from a file
//------------------------------------------------------------------------
void Button::load(rapidxml::xml_node<char> *node, const bool &echo) {
- img.load(node, echo);
- Element::load(node, img.normal, echo);
+ _img.load(node, echo);
+ Element::load(node, _img._normal, echo);
- loadNum(se_click, "click", node, echo);
- loadNum(se_hover, "hover", node, echo);
+ loadNum(_seClick, "click", node, echo);
+ loadNum(_seHover, "hover", node, echo);
if (nodeValid("hotkey", node, false))
- hotkey.load(node->first_node("hotkey"));
+ _hotkey.load(node->first_node("hotkey"));
- tooltip.load(node->first_node("tooltip"), this);
- caption.load(node->first_node("caption"), this);
+ _tooltip.load(node->first_node("tooltip"), this);
+ _caption.load(node->first_node("caption"), this);
- visible = true;
- canmove = false;
+ _visible = true;
+ _canmove = false;
reset();
}
//------------------------------------------------------------------------
// Purpose: Load a new Button
//------------------------------------------------------------------------
-void Button::Init(const Button &ref, const int &XOffset, const int &YOffset) {
- img = ref.img;
- Element::Init(ref, img.normal, XOffset, YOffset);
- se_click = ref.se_click;
- se_hover = ref.se_hover;
+void Button::init(const Button &ref, const int &xOffset, const int &yOffset) {
+ _img = ref._img;
+ Element::init(ref, _img._normal, xOffset, yOffset);
+ _seClick = ref._seClick;
+ _seHover = ref._seHover;
- caption.Init(ref.caption, XOffset, YOffset);
- tooltip.Init(ref.tooltip, XOffset, YOffset);
+ _caption.Init(ref._caption, xOffset, yOffset);
+ _tooltip.Init(ref._tooltip, xOffset, yOffset);
- visible = true;
- canmove = false;
+ _visible = true;
+ _canmove = false;
reset();
}
//------------------------------------------------------------------------
// Purpose: Reset the button
//------------------------------------------------------------------------
void Button::reset() {
- mousepressed = false;
- hover_mouse = false;
- hover_key = false;
+ _mousePressed = false;
+ _hoverMouse = false;
+ _hoverKey = false;
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Button::draw(const int &XOffset, const int &YOffset, Rect *clip) {
- if (visible) {
- if (mousepressed) {
- g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.select, clip);
-
- tooltip.draw(XOffset, YOffset);
- caption.draw(true, XOffset, YOffset);
- } else if (hover_mouse || hover_key) {
- g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.hover, clip);
-
- tooltip.draw(XOffset, YOffset);
- caption.draw(true, XOffset, YOffset);
+void Button::draw(const int &xOffset, const int &yOffset, Rect *clip) {
+ if (_visible) {
+ if (_mousePressed) {
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _img._select, clip);
+
+ _tooltip.draw(xOffset, yOffset);
+ _caption.draw(true, xOffset, yOffset);
+ } else if (_hoverMouse || _hoverKey) {
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _img._hover, clip);
+
+ _tooltip.draw(xOffset, yOffset);
+ _caption.draw(true, xOffset, yOffset);
} else {
- g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.normal, clip);
- caption.draw(false, XOffset, YOffset);
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _img._normal, clip);
+ _caption.draw(false, xOffset, yOffset);
}
}
}
-void Button::ImageCaptionOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
- if (visible) {
- if (mousepressed) {
- g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.select, clip);
- caption.draw(true, XOffset, YOffset);
- } else if (hover_mouse || hover_key) {
- g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.hover, clip);
- caption.draw(true, XOffset, YOffset);
+void Button::imageCaptionOnlyDraw(const int &xOffset, const int &yOffset, Rect *clip) {
+ if (_visible) {
+ if (_mousePressed) {
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _img._select, clip);
+ _caption.draw(true, xOffset, yOffset);
+ } else if (_hoverMouse || _hoverKey) {
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _img._hover, clip);
+ _caption.draw(true, xOffset, yOffset);
} else {
- g_engine->_imageManager->draw(x + XOffset, y + YOffset, img.normal, clip);
- caption.draw(false, XOffset, YOffset);
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _img._normal, clip);
+ _caption.draw(false, xOffset, yOffset);
}
}
}
-void Button::HoverInfoOnlyDraw(const int &XOffset, const int &YOffset, Rect *clip) {
- if (visible) {
- if (mousepressed || hover_mouse || hover_key)
- tooltip.draw(XOffset, YOffset);
+void Button::hoverInfoOnlyDraw(const int &xOffset, const int &yOffset, Rect *clip) {
+ if (_visible) {
+ if (_mousePressed || _hoverMouse || _hoverKey)
+ _tooltip.draw(xOffset, yOffset);
}
}
//------------------------------------------------------------------------
// Purpose: Handle input and stuff
//------------------------------------------------------------------------
-ButtonAction Button::handleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
+ButtonAction Button::handleEvents(const Common::Event &Event, const int &xOffset, const int &yOffset) {
Rect dim = *this;
- dim.x += XOffset;
- dim.y += YOffset;
+ dim.x += xOffset;
+ dim.y += yOffset;
- if (visible) {
+ if (_visible) {
if (dim.Contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y)) {
- hover_mouse = true;
+ _hoverMouse = true;
- if (!hover_prev) {
- hover_prev = true;
- g_engine->_musicManager->PlayEffect(se_hover, 0);
+ if (!_hoverPrev) {
+ _hoverPrev = true;
+ g_engine->_musicManager->PlayEffect(_seHover, 0);
}
} else {
- hover_prev = false;
- hover_mouse = false;
+ _hoverPrev = false;
+ _hoverMouse = false;
}
if (Event.type == Common::EVENT_MOUSEMOVE) {
- if (canmove && mousepressed) {
+ if (_canmove && _mousePressed) {
x += g_engine->_mouse->_rel.x;
y += g_engine->_mouse->_rel.y;
return BUAC_GRABBED;
@@ -172,19 +172,19 @@ ButtonAction Button::handleEvents(const Common::Event &Event, const int &XOffset
} else if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
// The g_engine->_mouse button pressed, then released, comprises of a click action
if (dim.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y))
- mousepressed = true;
- } else if ((Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP) && mousepressed) {
+ _mousePressed = true;
+ } else if ((Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP) && _mousePressed) {
reset();
if (dim.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
- mousepressed = false;
+ _mousePressed = false;
if (Event.type == Common::EVENT_LBUTTONUP) {
- g_engine->_musicManager->PlayEffect(se_click, 0);
+ g_engine->_musicManager->PlayEffect(_seClick, 0);
return BUAC_LCLICK;
} else if (Event.type == Common::EVENT_RBUTTONUP)
return BUAC_RCLICK;
}
- } else if (hotkey.handleEvents(Event)) {
- g_engine->_musicManager->PlayEffect(se_click, 0);
+ } else if (_hotkey.handleEvents(Event)) {
+ g_engine->_musicManager->PlayEffect(_seClick, 0);
return BUAC_LCLICK;
}
}
@@ -247,8 +247,8 @@ ButtonAction Button::handleEvents(const SDL_Event &Event, const int &XOffset, co
void Button::setUI(Rect *parent) {
Element::setUI(parent);
- tooltip.setUI(this);
- caption.setUI(this);
+ _tooltip.setUI(this);
+ _caption.setUI(this);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index 743aa167e5f..835e522f727 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -48,84 +48,97 @@ namespace Crab {
namespace pyrodactyl {
namespace ui {
-enum ButtonAction { BUAC_IGNORE,
- BUAC_LCLICK,
- BUAC_RCLICK,
- BUAC_GRABBED };
+enum ButtonAction {
+ BUAC_IGNORE,
+ BUAC_LCLICK,
+ BUAC_RCLICK,
+ BUAC_GRABBED
+};
struct ButtonImage {
- ImageKey normal, select, hover;
+ ImageKey _normal, _select, _hover;
+
+ bool operator==(const ButtonImage &img) {
+ return _normal == img._normal && _select == img._select && _hover == img._hover; }
- bool operator==(const ButtonImage &img) { return normal == img.normal && select == img.select && hover == img.hover; }
ButtonImage() {
- normal = 0;
- select = 0;
- hover = 0;
+ _normal = 0;
+ _select = 0;
+ _hover = 0;
}
void load(rapidxml::xml_node<char> *node, const bool &echo = true) {
if (nodeValid(node)) {
- loadImgKey(normal, "img_b", node, echo);
- loadImgKey(select, "img_s", node, echo);
- loadImgKey(hover, "img_h", node, echo);
+ loadImgKey(_normal, "img_b", node, echo);
+ loadImgKey(_select, "img_s", node, echo);
+ loadImgKey(_hover, "img_h", node, echo);
}
}
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("img_b", gStrPool->Get(normal)));
- root->append_attribute(doc.allocate_attribute("img_s", gStrPool->Get(select)));
- root->append_attribute(doc.allocate_attribute("img_h", gStrPool->Get(hover)));
+ root->append_attribute(doc.allocate_attribute("img_b", gStrPool->Get(_normal)));
+ root->append_attribute(doc.allocate_attribute("img_s", gStrPool->Get(_select)));
+ root->append_attribute(doc.allocate_attribute("img_h", gStrPool->Get(_hover)));
}
};
class Button : public Element {
public:
- bool visible, mousepressed;
+ bool _visible, _mousePressed;
// We need to keep track of keyboard and mouse hovering separately
- bool hover_mouse, hover_key, hover_prev;
+ bool _hoverMouse, _hoverKey, _hoverPrev;
// Can the player move this button?
- bool canmove;
+ bool _canmove;
// The button images
- ButtonImage img;
+ ButtonImage _img;
// The sound effect played when button is clicked
- pyrodactyl::music::ChunkKey se_click, se_hover;
+ pyrodactyl::music::ChunkKey _seClick, _seHover;
// Text shown when mouse is hovered over the button
- HoverInfo tooltip;
+ HoverInfo _tooltip;
// Text shown all times on the button
- Caption caption;
+ Caption _caption;
// A hotkey is a keyboard key(s) that are equivalent to pressing a button
- pyrodactyl::input::HotKey hotkey;
+ pyrodactyl::input::HotKey _hotkey;
Button();
~Button() {}
void reset();
+
void setUI(Rect *parent = NULL);
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void Init(const Button &ref, const int &XOffset = 0, const int &YOffset = 0);
+ void init(const Button &ref, const int &xOffset = 0, const int &yOffset = 0);
+
+ void img(Button &b) {
+ _img = b._img;
+ }
+
+ void img(ButtonImage &image) {
+ _img = image;
+ }
- void Img(Button &b) { img = b.img; }
- void Img(ButtonImage &image) { img = image; }
- ButtonImage Img() { return img; }
+ ButtonImage img() {
+ return _img;
+ }
- void draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+ void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
- ButtonAction handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ ButtonAction handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
#if 0
ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
// Special functions to only draw parts of a button (used in special situations like world map)
- void ImageCaptionOnlyDraw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
- void HoverInfoOnlyDraw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+ void imageCaptionOnlyDraw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
+ void hoverInfoOnlyDraw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 5385f2517f1..e2b301e0751 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -35,16 +35,16 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void Element::Init(const int &X, const int &Y, const Align &align_x, const Align &align_y,
- const ImageKey img, const int &W, const int &H) {
- x = X;
- y = Y;
- align.x = align_x;
- align.y = align_y;
+void Element::init(const int &xCord, const int &yCord, const Align &alignX, const Align &alignY,
+ const ImageKey img, const int &width, const int &height) {
+ x = xCord;
+ y = yCord;
+ _align.x = alignX;
+ _align.y = alignY;
if (img == 0) {
- w = W;
- h = H;
+ w = width;
+ h = height;
} else {
Image dat = g_engine->_imageManager->getTexture(img);
w = dat.w();
@@ -52,14 +52,14 @@ void Element::Init(const int &X, const int &Y, const Align &align_x, const Align
}
}
-void Element::Basicload(rapidxml::xml_node<char> *node, const bool &echo) {
- raw.load(node, echo);
- loadAlign(align.x, node, echo, "align_x");
- loadAlign(align.y, node, echo, "align_y");
+void Element::basicload(rapidxml::xml_node<char> *node, const bool &echo) {
+ _raw.load(node, echo);
+ loadAlign(_align.x, node, echo, "align_x");
+ loadAlign(_align.y, node, echo, "align_y");
}
void Element::load(rapidxml::xml_node<char> *node, ImageKey img, const bool &echo) {
- Basicload(node, echo);
+ basicload(node, echo);
if (node->first_attribute("w") == NULL)
w = g_engine->_imageManager->getTexture(img).w();
@@ -75,7 +75,7 @@ void Element::load(rapidxml::xml_node<char> *node, ImageKey img, const bool &ech
}
void Element::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
- Basicload(node, echo);
+ basicload(node, echo);
loadNum(w, "w", node, false);
loadNum(h, "h", node, false);
setUI(parent);
@@ -83,51 +83,51 @@ void Element::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &ech
void Element::setUI(Rect *parent) {
if (parent == NULL) {
- switch (align.x) {
+ switch (_align.x) {
case ALIGN_CENTER:
- x = g_engine->_screenSettings->cur.w / 2 - w / 2 + raw.x;
+ x = g_engine->_screenSettings->cur.w / 2 - w / 2 + _raw.x;
break;
case ALIGN_RIGHT:
- x = g_engine->_screenSettings->cur.w - w + raw.x;
+ x = g_engine->_screenSettings->cur.w - w + _raw.x;
break;
default:
- x = raw.x;
+ x = _raw.x;
break;
}
- switch (align.y) {
+ switch (_align.y) {
case ALIGN_CENTER:
- y = g_engine->_screenSettings->cur.h / 2 - h / 2 + raw.y;
+ y = g_engine->_screenSettings->cur.h / 2 - h / 2 + _raw.y;
break;
case ALIGN_RIGHT:
- y = g_engine->_screenSettings->cur.h - h + raw.y;
+ y = g_engine->_screenSettings->cur.h - h + _raw.y;
break;
default:
- y = raw.y;
+ y = _raw.y;
break;
}
} else {
- switch (align.x) {
+ switch (_align.x) {
case ALIGN_CENTER:
- x = parent->x + parent->w / 2 - w / 2 + raw.x;
+ x = parent->x + parent->w / 2 - w / 2 + _raw.x;
break;
case ALIGN_RIGHT:
- x = parent->x + parent->w - w + raw.x;
+ x = parent->x + parent->w - w + _raw.x;
break;
default:
- x = parent->x + raw.x;
+ x = parent->x + _raw.x;
break;
}
- switch (align.y) {
+ switch (_align.y) {
case ALIGN_CENTER:
- y = parent->y + parent->h / 2 - h / 2 + raw.y;
+ y = parent->y + parent->h / 2 - h / 2 + _raw.y;
break;
case ALIGN_RIGHT:
- y = parent->y + parent->h - h + raw.y;
+ y = parent->y + parent->h - h + _raw.y;
break;
default:
- y = parent->y + raw.y;
+ y = parent->y + _raw.y;
break;
}
}
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index c633a7be226..f54fef38cd2 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -43,31 +43,31 @@ namespace pyrodactyl {
namespace ui {
class Element : public Rect {
// The position loaded directly from xml
- Vector2i raw;
+ Vector2i _raw;
// Which side of the screen is this object aligned to?
struct {
Align x, y;
- } align;
+ } _align;
- void Basicload(rapidxml::xml_node<char> *node, const bool &echo = true);
+ void basicload(rapidxml::xml_node<char> *node, const bool &echo = true);
public:
Element() {
- align.x = ALIGN_LEFT;
- align.y = ALIGN_LEFT;
+ _align.x = ALIGN_LEFT;
+ _align.y = ALIGN_LEFT;
}
~Element() {}
// Initialize an element without loading it from file
- void Init(const int &X, const int &Y, const Align &align_x, const Align &align_y,
- const ImageKey image = 0, const int &W = 0, const int &H = 0);
+ void init(const int &x, const int &y, const Align &alignX, const Align &alignY,
+ const ImageKey image = 0, const int &w = 0, const int &h = 0);
// Initialize an element from another
- void Init(const Element &e, ImageKey img = 0, const int &XOffset = 0, const int &YOffset = 0) {
- raw.x = e.raw.x + XOffset;
- raw.y = e.raw.y + YOffset;
- Init(e.x + XOffset, e.y + YOffset, e.align.x, e.align.y, img, e.w, e.h);
+ void init(const Element &e, ImageKey img = 0, const int &xOffset = 0, const int &yOffset = 0) {
+ _raw.x = e._raw.x + xOffset;
+ _raw.y = e._raw.y + yOffset;
+ init(e.x + xOffset, e.y + yOffset, e._align.x, e._align.y, img, e.w, e.h);
}
// The parent is the object inside which the element exists
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 4a303272fd2..20a264ceab9 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -76,7 +76,7 @@ void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
// Create a copy of all the tooltips
for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
- tooltip.push_back(i->tooltip.text);
+ tooltip.push_back(i->_tooltip.text);
SetTooltip();
}
@@ -109,7 +109,7 @@ void HUD::draw(pyrodactyl::event::Info &info, const Common::String &id) {
}
void HUD::internalEvents(bool ShowMap) {
- menu.element[HS_MAP].visible = ShowMap;
+ menu.element[HS_MAP]._visible = ShowMap;
if (timer.TargetReached()) {
clip.x += clip.w;
@@ -166,9 +166,9 @@ void HUD::State(const int &val) {
void HUD::SetTooltip() {
unsigned int count = 0;
for (auto i = menu.element.begin(); i != menu.element.end() && count < tooltip.size(); ++i, ++count)
- i->tooltip.text = tooltip[count] + " (" + i->hotkey.name() + ")";
+ i->_tooltip.text = tooltip[count] + " (" + i->_hotkey.name() + ")";
- menu.element[HS_PAUSE].tooltip.text = tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->getAssociatedKey(IG_PAUSE) + ")";
+ menu.element[HS_PAUSE]._tooltip.text = tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->getAssociatedKey(IG_PAUSE) + ")";
}
void HUD::setUI() {
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index d1f0873f316..5d74fd2d338 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -159,7 +159,7 @@ void Map::Center(const Vector2i &vec) {
void Map::Validate() {
// Make all scroll buttons visible first
for (auto &i : scroll.element)
- i.visible = true;
+ i._visible = true;
// Keep camera in bounds
if (camera.x + camera.w > size.x)
@@ -172,10 +172,10 @@ void Map::Validate() {
camera.y = 0;
// decide visibility of scroll buttons
- scroll.element[DIRECTION_RIGHT].visible = !(camera.x == size.x - camera.w);
- scroll.element[DIRECTION_DOWN].visible = !(camera.y == size.y - camera.h);
- scroll.element[DIRECTION_LEFT].visible = !(camera.x == 0);
- scroll.element[DIRECTION_UP].visible = !(camera.y == 0);
+ scroll.element[DIRECTION_RIGHT]._visible = !(camera.x == size.x - camera.w);
+ scroll.element[DIRECTION_DOWN]._visible = !(camera.y == size.y - camera.h);
+ scroll.element[DIRECTION_LEFT]._visible = !(camera.x == 0);
+ scroll.element[DIRECTION_UP]._visible = !(camera.y == 0);
}
//------------------------------------------------------------------------
@@ -335,7 +335,7 @@ void Map::internalEvents(pyrodactyl::event::Info &info) {
Validate();
for (auto &i : travel.element)
- i.visible = i.x >= camera.x && i.y >= camera.y;
+ i._visible = i.x >= camera.x && i.y >= camera.y;
marker.internalEvents(pos, player_pos, camera, bounds);
}
@@ -416,7 +416,7 @@ void Map::SelectDest(const Common::String &name) {
void Map::Update(pyrodactyl::event::Info &info) {
for (auto &i : travel.element) {
i.unlock.evaluate(info);
- i.visible = i.unlock.result();
+ i._visible = i.unlock.result();
}
}
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 56fbc676828..415507840ce 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -72,7 +72,7 @@ protected:
void Next() {
if (hover_index == -1) {
for (unsigned int pos = 0; pos < path.size(); pos++)
- if (element[path[pos]].visible == true) {
+ if (element[path[pos]]._visible == true) {
hover_index = path[pos];
break;
}
@@ -83,7 +83,7 @@ protected:
break;
for (unsigned int nextloc = (curpos + 1) % element.size(); nextloc != curpos; nextloc = (nextloc + 1) % element.size())
- if (element[nextloc].visible == true) {
+ if (element[nextloc]._visible == true) {
hover_index = path[nextloc];
break;
}
@@ -96,7 +96,7 @@ protected:
void Prev() {
if (hover_index == -1) {
for (unsigned int pos = 0; pos < path.size(); pos++)
- if (element[path[pos]].visible == true) {
+ if (element[path[pos]]._visible == true) {
hover_index = path[pos];
break;
}
@@ -111,7 +111,7 @@ protected:
if (nextloc < 0)
nextloc = element.size() - 1;
- if (element[nextloc].visible == true) {
+ if (element[nextloc]._visible == true) {
hover_index = path[nextloc];
break;
}
@@ -160,7 +160,7 @@ protected:
// Update hover status of keys according to the current index
int i = 0;
for (auto it = element.begin(); it != element.end(); ++it, ++i)
- it->hover_key = (i == hover_index);
+ it->_hoverKey = (i == hover_index);
}
}
@@ -290,19 +290,19 @@ public:
// We did not click a button, however we did hover over the button
// However if we are use keyboard to browse through the menu, hovering is forgotten until we move the mouse again
- if (it->hover_mouse && latest_input == MOUSE) {
+ if (it->_hoverMouse && latest_input == MOUSE) {
hover_index = i;
// The latest input is the mouse, which means we have to forget the keyboard hover states
for (auto e = element.begin(); e != element.end(); ++e)
- e->hover_key = false;
+ e->_hoverKey = false;
}
}
if (latest_input == KEYBOARD) {
// The latest input is the keyboard, which means we have to forget the mouse hover states
for (auto it = element.begin(); it != element.end(); ++it)
- it->hover_mouse = false;
+ it->_hoverMouse = false;
}
return -1;
}
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index d0fcc6c602a..a6c6d0f77e3 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -43,9 +43,9 @@ void Slider::load(rapidxml::xml_node<char> *node, const int &Min, const int &Max
bar.load(node->first_node("bar"));
knob.y = bar.y;
- knob.w = g_engine->_imageManager->getTexture(knob.img.normal).w();
- knob.h = g_engine->_imageManager->getTexture(knob.img.normal).h();
- knob.canmove = true;
+ knob.w = g_engine->_imageManager->getTexture(knob._img._normal).w();
+ knob.h = g_engine->_imageManager->getTexture(knob._img._normal).h();
+ knob._canmove = true;
min = Min;
max = Max;
@@ -141,8 +141,8 @@ void Slider::setUI() {
knob.x = bar.x + ((bar.w - knob.w) * value / (max - min));
knob.y = bar.y;
- knob.w = g_engine->_imageManager->getTexture(knob.img.normal).w();
- knob.h = g_engine->_imageManager->getTexture(knob.img.normal).h();
+ knob.w = g_engine->_imageManager->getTexture(knob._img._normal).w();
+ knob.h = g_engine->_imageManager->getTexture(knob._img._normal).h();
}
} // End of namespace Crab
Commit: fd61c1f2ae2c58a87ee70714364263f606cc7810
https://github.com/scummvm/scummvm/commit/fd61c1f2ae2c58a87ee70714364263f606cc7810
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make some misc. UI classes follow code formatting conventions
Changed paths:
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemSlot.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/AlphaImage.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/RadioButton.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/StateButton.cpp
engines/crab/ui/StateButton.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitButton.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index e77e114b6cd..ff2088e7f00 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -77,7 +77,7 @@ void ItemMenu::handleEvents(const Common::Event &Event, const int &XOffset, cons
if (result != -1) {
select_index = result;
for (unsigned int i = 0; i < element.size(); ++i)
- element[i].State(i == (unsigned int)select_index);
+ element[i].state(i == (unsigned int)select_index);
}
}
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 2ee5f4b47fa..14edb638217 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -63,7 +63,7 @@ void ItemSlot::load(rapidxml::xml_node<char> *node) {
// Purpose: Initialize from reference item slot
//------------------------------------------------------------------------
void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset) {
- StateButton::Init(ref, XOffset, YOffset);
+ StateButton::init(ref, XOffset, YOffset);
_canmove = ref._canmove;
no_type = ref.no_type;
category = ref.category;
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 90a1cc53e5b..00d5b74c2e8 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -161,7 +161,7 @@ void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
int choice = me_main.handleEvents(Event);
if (choice >= 0) {
for (unsigned i = 0; i < me_main.element.size(); ++i)
- me_main.element[i].State(i == (unsigned int)choice);
+ me_main.element[i].state(i == (unsigned int)choice);
switch (choice) {
case 0:
@@ -456,7 +456,7 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
// We are entering the normal state, i.e outside all menus - reset color of menu items
if (state == STATE_NORMAL) {
for (unsigned i = 0; i < me_main.element.size(); ++i)
- me_main.element[i].State(false);
+ me_main.element[i].state(false);
}
// Enable keyboard navigation if outside all menus, otherwise disable it
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index ad61de772af..bac911d89c0 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -38,38 +38,38 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
void AlphaImage::load(rapidxml::xml_node<char> *node, const bool &echo) {
- pos.load(node, echo);
- loadImgKey(img, "img", node, echo);
+ _pos.load(node, echo);
+ loadImgKey(_img, "img", node, echo);
- loadNum(alpha.min, "min", node);
- loadNum(alpha.max, "max", node);
- loadNum(alpha.change, "inc", node);
+ loadNum(alpha._min, "min", node);
+ loadNum(alpha._max, "max", node);
+ loadNum(alpha._change, "inc", node);
- alpha.cur = alpha.max; //alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
+ alpha._cur = alpha._max; //alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
}
void AlphaImage::internalEvents() {
- if (alpha.inc) {
- alpha.cur += alpha.change;
- if (alpha.cur >= alpha.max) {
- alpha.cur = alpha.max;
- alpha.inc = false;
+ if (alpha._inc) {
+ alpha._cur += alpha._change;
+ if (alpha._cur >= alpha._max) {
+ alpha._cur = alpha._max;
+ alpha._inc = false;
}
} else {
- alpha.cur -= alpha.change;
- if (alpha.cur <= alpha.min) {
- alpha.cur = alpha.min;
- alpha.inc = true;
+ alpha._cur -= alpha._change;
+ if (alpha._cur <= alpha._min) {
+ alpha._cur = alpha._min;
+ alpha._inc = true;
}
}
- if (g_engine->_imageManager->validTexture(img))
- g_engine->_imageManager->getTexture(img).alpha(alpha.cur);
+ if (g_engine->_imageManager->validTexture(_img))
+ g_engine->_imageManager->getTexture(_img).alpha(alpha._cur);
}
-void AlphaImage::draw(const int &XOffset, const int &YOffset) {
- if (g_engine->_imageManager->validTexture(img))
- g_engine->_imageManager->getTexture(img).draw(pos.x + XOffset, pos.y + YOffset);
+void AlphaImage::draw(const int &xOffset, const int &yOffset) {
+ if (g_engine->_imageManager->validTexture(_img))
+ g_engine->_imageManager->getTexture(_img).draw(_pos.x + xOffset, _pos.y + yOffset);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/AlphaImage.h b/engines/crab/ui/AlphaImage.h
index 0e2909aa7a9..48870fdbbe6 100644
--- a/engines/crab/ui/AlphaImage.h
+++ b/engines/crab/ui/AlphaImage.h
@@ -42,44 +42,48 @@ namespace ui {
class AlphaImage {
// The image used - we don't use the image manager
// because we don't change the alpha for those images
- ImageKey img;
+ ImageKey _img;
// The information for drawing the image
- Element pos;
+ Element _pos;
// The information related to alpha modulation of the image
struct AlphaVal {
- int cur, min, max;
+ int _cur, _min, _max;
// Are we increasing or decreasing the alpha
- bool inc;
+ bool _inc;
// By how much do we change the alpha every update
- int change;
+ int _change;
AlphaVal() {
- cur = 255;
- min = 255;
- max = 255;
- inc = true;
- change = 0;
+ _cur = 255;
+ _min = 255;
+ _max = 255;
+ _inc = true;
+ _change = 0;
}
} alpha;
public:
AlphaImage() {}
- AlphaImage(rapidxml::xml_node<char> *node) { load(node); }
+ AlphaImage(rapidxml::xml_node<char> *node) {
+ load(node);
+ }
~AlphaImage() {}
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &xOffset = 0, const int &yOffset = 0);
// This is used to vary the alpha
void internalEvents();
- void setUI() { pos.setUI(); }
+ void setUI() {
+ _pos.setUI();
+ }
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 7cb264e23ee..cfffe3265a0 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -65,7 +65,7 @@ void GeneralSettingMenu::load(rapidxml::xml_node<char> *node) {
// Sync popup text value with actual value
for (auto &i : text_speed.element)
- i.state = (i.val == g_engine->_screenSettings->text_speed);
+ i._state = (i._val == g_engine->_screenSettings->text_speed);
}
//------------------------------------------------------------------------
@@ -89,7 +89,7 @@ void GeneralSettingMenu::handleEvents(const Common::Event &Event) {
int result = text_speed.handleEvents(Event);
if (result >= 0)
- g_engine->_screenSettings->text_speed = text_speed.element[result].val;
+ g_engine->_screenSettings->text_speed = text_speed.element[result]._val;
}
#if 0
@@ -122,8 +122,8 @@ void GeneralSettingMenu::handleEvents(const SDL_Event &Event) {
// Purpose: Sync our buttons with screen settings
//------------------------------------------------------------------------
void GeneralSettingMenu::internalEvents() {
- save_on_exit.state = g_engine->_screenSettings->save_on_exit;
- mouse_trap.state = g_engine->_screenSettings->mouse_trap;
+ save_on_exit._state = g_engine->_screenSettings->save_on_exit;
+ mouse_trap._state = g_engine->_screenSettings->mouse_trap;
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 9f486d2cff5..670185edb58 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -165,10 +165,10 @@ int GfxSettingMenu::handleEvents(const SDL_Event &Event) {
// Purpose: Keep button settings synced with our screen settings
//------------------------------------------------------------------------
void GfxSettingMenu::internalEvents() {
- fullscreen.state = g_engine->_screenSettings->fullscreen;
- vsync.state = g_engine->_screenSettings->vsync;
- border.state = g_engine->_screenSettings->border;
- quality.state = g_engine->_screenSettings->quality;
+ fullscreen._state = g_engine->_screenSettings->fullscreen;
+ vsync._state = g_engine->_screenSettings->vsync;
+ border._state = g_engine->_screenSettings->border;
+ quality._state = g_engine->_screenSettings->quality;
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 43eb97e237b..bc5400cb8d2 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -90,9 +90,9 @@ void MapMarkerMenu::handleEvents(const Element &pos, const Vector2i &player_pos,
int c = 0;
for (auto &i : menu.element) {
if (c == choice) // For an already selected marker, clicking it toggles the selection state
- i.State(!i.State());
+ i.state(!i.state());
else
- i.State(false);
+ i.state(false);
++c;
}
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index f5d12b964e8..a9df9a350a9 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -60,7 +60,7 @@ public:
void AddButton(const Common::String &name, const int &x, const int &y) {
StateButton b;
- b.Init(ref, x, y);
+ b.init(ref, x, y);
b._tooltip.text = name;
menu.element.push_back(b);
}
@@ -70,7 +70,7 @@ public:
void SelectDest(const Common::String &name) {
for (auto &i : menu.element)
- i.State(i._tooltip.text == name);
+ i.state(i._tooltip.text == name);
}
void Erase(const Common::String &name) {
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 6354e9544d2..3538807d96e 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -49,7 +49,7 @@ void OptionMenu::load(const Common::String &filename) {
menu.load(node->first_node("state"));
if (!menu.element.empty())
- menu.element[0].State(true);
+ menu.element[0].state(true);
}
if (nodeValid("keybind", node))
@@ -100,7 +100,7 @@ void OptionMenu::reset() {
state = STATE_GENERAL;
for (unsigned i = 0; i < menu.element.size(); ++i)
- menu.element[i].State(i == STATE_GENERAL);
+ menu.element[i].state(i == STATE_GENERAL);
}
void OptionMenu::draw(Button &back) {
diff --git a/engines/crab/ui/RadioButton.h b/engines/crab/ui/RadioButton.h
index 13e6052af4b..3e823f84680 100644
--- a/engines/crab/ui/RadioButton.h
+++ b/engines/crab/ui/RadioButton.h
@@ -40,14 +40,17 @@ namespace ui {
class RadioButton : public ToggleButton {
public:
// The value associated with the radio button
- float val;
+ float _val;
- RadioButton() { val = 0.0f; }
+ RadioButton() {
+ _val = 0.0f;
+ }
+
~RadioButton() {}
void load(rapidxml::xml_node<char> *node) {
ToggleButton::load(node);
- loadNum(val, "val", node);
+ loadNum(_val, "val", node);
}
};
} // End of namespace ui
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index 81908e29fb8..9012367c7b5 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -69,7 +69,7 @@ public:
select = result;
for (int i = 0; i < (int)element.size(); ++i)
- element[i].state = (i == result);
+ element[i]._state = (i == result);
}
return result;
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 9c3f3c52fb2..06133a1fd96 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -39,55 +39,55 @@ using namespace pyrodactyl::image;
void ReplyButton::load(rapidxml::xml_node<char> *node) {
Button::load(node);
- orig = *this;
+ _orig = *this;
if (nodeValid("text", node)) {
rapidxml::xml_node<char> *tenode = node->first_node("text");
- loadColor(col_b, tenode->first_node("col_b"));
- loadColor(col_s, tenode->first_node("col_s"));
- loadColor(col_h, tenode->first_node("col_h"));
- loadNum(font, "font", tenode);
- loadAlign(align, tenode);
+ loadColor(_colB, tenode->first_node("col_b"));
+ loadColor(_colS, tenode->first_node("col_s"));
+ loadColor(_colH, tenode->first_node("col_h"));
+ loadNum(_font, "font", tenode);
+ loadAlign(_replyAlign, tenode);
if (nodeValid("line_size", tenode))
- line_size.load(tenode->first_node("line_size"));
+ _lineSize.load(tenode->first_node("line_size"));
}
}
-void ReplyButton::draw(const int &XOffset, const int &YOffset) {
+void ReplyButton::draw(const int &xOffset, const int &yOffset) {
if (_visible) {
if (_mousePressed)
- g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_s, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->draw(x + xOffset, y + yOffset, _text, _colS, _font, _replyAlign, _lineSize.x, _lineSize.y);
else if (_hoverMouse || _hoverKey)
- g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_h, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->draw(x + xOffset, y + yOffset, _text, _colH, _font, _replyAlign, _lineSize.x, _lineSize.y);
else
- g_engine->_textManager->draw(x + XOffset, y + YOffset, text, col_b, font, align, line_size.x, line_size.y);
+ g_engine->_textManager->draw(x + xOffset, y + yOffset, _text, _colB, _font, _replyAlign, _lineSize.x, _lineSize.y);
}
}
-void ReplyButton::Cache(const Common::String &val, const int &spacing, const int &bottom_edge, Rect *parent) {
- text = val;
+void ReplyButton::Cache(const Common::String &val, const int &spacing, const int &bottomEdge, Rect *parent) {
+ _text = val;
// Find out about the font
int width = 0, height = 0;
#if 0
TTF_SizeText(g_engine->_textManager->GetFont(font), val, &width, &height);
#endif
- width = g_engine->_textManager->GetFont(font)->getStringWidth(val);
- height = g_engine->_textManager->GetFont(font)->getFontHeight();
+ width = g_engine->_textManager->GetFont(_font)->getStringWidth(val);
+ height = g_engine->_textManager->GetFont(_font)->getFontHeight();
// Find out how many line sizes will the text take
- int lines = ((text.size() - 1) / line_size.x) + 1;
+ int lines = ((_text.size() - 1) / _lineSize.x) + 1;
- x = orig.x;
- y = orig.y;
+ x = _orig.x;
+ y = _orig.y;
w = width;
h = height * lines;
setUI(parent);
- if (orig.y < bottom_edge)
- y = bottom_edge + spacing;
+ if (_orig.y < bottomEdge)
+ y = bottomEdge + spacing;
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index 41163e4939b..68db40c649d 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -41,38 +41,38 @@ namespace ui {
// This button is used to draw multiple lines of text instead of an image
class ReplyButton : public Button {
// Information about drawing reply options
- int col_b, col_s, col_h;
- FontKey font;
- Align align;
- Vector2D<unsigned int> line_size;
+ int _colB, _colS, _colH;
+ FontKey _font;
+ Align _replyAlign;
+ Vector2D<unsigned int> _lineSize;
// Reply options get moved around a lot, this remembers their actual position
- Rect orig;
+ Rect _orig;
// The text for this button
- Common::String text;
+ Common::String _text;
public:
// The object it points to
- int index;
+ int _index;
ReplyButton() {
- index = 0;
- col_b = 0;
- col_s = 0;
- col_h = 0;
- font = 0;
- align = ALIGN_LEFT;
+ _index = 0;
+ _colB = 0;
+ _colS = 0;
+ _colH = 0;
+ _font = 0;
+ _replyAlign = ALIGN_LEFT;
}
~ReplyButton() {}
void load(rapidxml::xml_node<char> *node);
- void draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &xOffset = 0, const int &yOffset = 0);
// Used to calculate size and set the string
// Spacing is the minimum space between buttons added in case of overflow
// Bottom edge is the y+h value of the previous choice
- void Cache(const Common::String &val, const int &spacing, const int &bottom_edge, Rect *parent);
+ void Cache(const Common::String &val, const int &spacing, const int &bottomEdge, Rect *parent);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 50c09795378..bbaff76aaf8 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -67,7 +67,7 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
bool play_sound = false;
// Loop through any opinion changes required
- for (auto &i : dat._reply[element[choice].index]._change) {
+ for (auto &i : dat._reply[element[choice]._index]._change) {
if (i._id == cur_id) {
// This is a special case because we also need to update the opinion bars
oh.OpinionChange(info, i._id, OPI_LIKE, i._val[OPI_LIKE]);
@@ -94,7 +94,7 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
}
#endif
- return dat._reply[element[choice].index]._nextid;
+ return dat._reply[element[choice]._index]._nextid;
}
return -1;
@@ -154,7 +154,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
for (auto i = dat._reply.begin(); i != dat._reply.end() && reply_count < dat._reply.size(); ++i, ++reply_count) {
if (i->_unlock.evaluate(info)) {
element[element_count]._visible = true;
- element[element_count].index = reply_count;
+ element[element_count]._index = reply_count;
tone.value[element_count] = dat._reply[reply_count]._tone;
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index 74e434cfffa..373d9c495df 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -36,42 +36,42 @@ namespace Crab {
using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
-void StateButton::Init(const StateButton &ref, const int &XOffset, const int &YOffset) {
+void StateButton::init(const StateButton &ref, const int &XOffset, const int &YOffset) {
Button::init(ref, XOffset, YOffset);
- img_set = ref.img_set;
- col_normal = ref.col_normal;
- col_select = ref.col_select;
+ _imgSet = ref._imgSet;
+ _colNormal = ref._colNormal;
+ _colSelect = ref._colSelect;
}
void StateButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
Button::load(node, echo);
- img_set.normal = _img;
- col_normal.col = _caption.col;
- col_normal.col_s = _caption.col_s;
+ _imgSet._normal = _img;
+ _colNormal._col = _caption.col;
+ _colNormal._colS = _caption.col_s;
if (nodeValid("select", node, false)) {
rapidxml::xml_node<char> *selnode = node->first_node("select");
- img_set.select.load(selnode, echo);
- loadNum(col_select.col, "color", selnode);
- loadNum(col_select.col_s, "color_s", selnode);
+ _imgSet._select.load(selnode, echo);
+ loadNum(_colSelect._col, "color", selnode);
+ loadNum(_colSelect._colS, "color_s", selnode);
} else {
- img_set.select = _img;
- col_select.col = _caption.col;
- col_select.col_s = _caption.col_s;
+ _imgSet._select = _img;
+ _colSelect._col = _caption.col;
+ _colSelect._colS = _caption.col_s;
}
}
-void StateButton::State(const bool val) {
+void StateButton::state(const bool val) {
if (val) {
- _img = img_set.select;
- _caption.col = col_select.col;
- _caption.col_s = col_select.col_s;
+ _img = _imgSet._select;
+ _caption.col = _colSelect._col;
+ _caption.col_s = _colSelect._colS;
} else {
- _img = img_set.normal;
- _caption.col = col_normal.col;
- _caption.col_s = col_normal.col_s;
+ _img = _imgSet._normal;
+ _caption.col = _colNormal._col;
+ _caption.col_s = _colNormal._colS;
}
// Images might be different in size
@@ -79,14 +79,14 @@ void StateButton::State(const bool val) {
h = g_engine->_imageManager->getTexture(_img._normal).h();
}
-void StateButton::Img(const StateButtonImage &sbi) {
+void StateButton::img(const StateButtonImage &sbi) {
// Find which is the current image and set it
- if (_img == img_set.normal)
- _img = sbi.normal;
+ if (_img == _imgSet._normal)
+ _img = sbi._normal;
else
- _img = sbi.select;
+ _img = sbi._select;
- img_set = sbi;
+ _imgSet = sbi;
}
} // End of namespace Crab
diff --git a/engines/crab/ui/StateButton.h b/engines/crab/ui/StateButton.h
index 7e2b071b95f..7fd2bbfce7b 100644
--- a/engines/crab/ui/StateButton.h
+++ b/engines/crab/ui/StateButton.h
@@ -39,26 +39,26 @@ namespace Crab {
namespace pyrodactyl {
namespace ui {
struct StateButtonImage {
- ButtonImage normal, select;
+ ButtonImage _normal, _select;
StateButtonImage() {}
StateButtonImage(rapidxml::xml_node<char> *node) {
if (nodeValid("normal", node))
- normal.load(node->first_node("normal"));
+ _normal.load(node->first_node("normal"));
if (nodeValid("select", node, false))
- select.load(node->first_node("select"));
+ _select.load(node->first_node("select"));
else
- select = normal;
+ _select = _normal;
}
};
struct StateButtonColor {
- int col, col_s;
+ int _col, _colS;
StateButtonColor() {
- col = 0;
- col_s = 0;
+ _col = 0;
+ _colS = 0;
}
};
@@ -66,24 +66,26 @@ struct StateButtonColor {
// Similar to the checkbox UI element in windows/web
class StateButton : public Button {
// The two images
- StateButtonImage img_set;
+ StateButtonImage _imgSet;
// The color for the caption when the image is selected
- StateButtonColor col_normal, col_select;
+ StateButtonColor _colNormal, _colSelect;
public:
StateButton() {}
~StateButton() {}
- void Init(const StateButton &ref, const int &XOffset = 0, const int &YOffset = 0);
+ void init(const StateButton &ref, const int &xOffset = 0, const int &yOffset = 0);
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
// The state of the button - false is original image, true is second image
- void State(const bool val);
- bool State() { return (_img == img_set.select); }
+ void state(const bool val);
+ bool state() {
+ return (_img == _imgSet._select);
+ }
// Set the image
- void Img(const StateButtonImage &sbi);
+ void img(const StateButtonImage &sbi);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 9c3a4e9e4d4..251ee81727c 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -38,27 +38,27 @@ using namespace pyrodactyl::image;
void ToggleButton::load(rapidxml::xml_node<char> *node) {
Button::load(node);
- loadImgKey(on, "on", node);
- loadImgKey(off, "off", node);
+ loadImgKey(_on, "on", node);
+ loadImgKey(_off, "off", node);
if (nodeValid("offset", node))
- offset.load(node->first_node("offset"));
+ _offset.load(node->first_node("offset"));
}
-void ToggleButton::draw(const int &XOffset, const int &YOffset, Rect *clip) {
- Button::draw(XOffset, YOffset, clip);
+void ToggleButton::draw(const int &xOffset, const int &yOffset, Rect *clip) {
+ Button::draw(xOffset, yOffset, clip);
- if (state)
- g_engine->_imageManager->draw(x + offset.x, y + offset.y, on);
+ if (_state)
+ g_engine->_imageManager->draw(x + _offset.x, y + _offset.y, _on);
else
- g_engine->_imageManager->draw(x + offset.x, y + offset.y, off);
+ g_engine->_imageManager->draw(x + _offset.x, y + _offset.y, _off);
}
-ButtonAction ToggleButton::handleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
- ButtonAction action = Button::handleEvents(Event, XOffset, YOffset);
+ButtonAction ToggleButton::handleEvents(const Common::Event &event, const int &xOffset, const int &yOffset) {
+ ButtonAction action = Button::handleEvents(event, xOffset, yOffset);
if (action == BUAC_LCLICK)
- state = !state;
+ _state = !_state;
return action;
}
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index 383d51fd66a..bc44bc5e255 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -42,29 +42,30 @@ namespace ui {
// Similar to the radio button / checkbox UI element in windows/web
class ToggleButton : public Button {
// The images corresponding to the state
- ImageKey on, off;
+ ImageKey _on, _off;
// The offset at which the on/off image is drawn
- Vector2i offset;
+ Vector2i _offset;
public:
// The state of the button - true is on, false is off
- bool state;
+ bool _state;
ToggleButton() {
- state = false;
- on = 0;
- off = 0;
+ _state = false;
+ _on = 0;
+ _off = 0;
}
+
~ToggleButton() {}
void load(rapidxml::xml_node<char> *node);
- void draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+ void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
#if 0
ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
- ButtonAction handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ ButtonAction handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index a6da5a22f18..4be02a2cd60 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -37,32 +37,32 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::people;
-void TraitButton::Init(const TraitButton &ref, const int &XOffset, const int &YOffset) {
- StateButton::Init(ref, XOffset, YOffset);
- offset = ref.offset;
+void TraitButton::init(const TraitButton &ref, const int &xOffset, const int &yOffset) {
+ StateButton::init(ref, xOffset, yOffset);
+ _offset = ref._offset;
}
void TraitButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
StateButton::load(node, echo);
if (nodeValid("offset", node))
- offset.load(node->first_node("offset"), echo);
+ _offset.load(node->first_node("offset"), echo);
}
-void TraitButton::draw(const int &XOffset, const int &YOffset, Rect *clip) {
- if (trait_img != 0)
- g_engine->_imageManager->draw(x + offset.x, y + offset.y, trait_img);
+void TraitButton::draw(const int &xOffset, const int &yOffset, Rect *clip) {
+ if (_traitImg != 0)
+ g_engine->_imageManager->draw(x + _offset.x, y + _offset.y, _traitImg);
- StateButton::draw(XOffset, YOffset, clip);
+ StateButton::draw(xOffset, yOffset, clip);
}
-void TraitButton::Cache(const pyrodactyl::people::Trait &trait) {
- trait_img = trait.img;
+void TraitButton::cache(const pyrodactyl::people::Trait &trait) {
+ _traitImg = trait.img;
_caption.text = trait.name;
}
-void TraitButton::Empty() {
- trait_img = 0;
+void TraitButton::empty() {
+ _traitImg = 0;
_caption.text = "";
}
diff --git a/engines/crab/ui/TraitButton.h b/engines/crab/ui/TraitButton.h
index ba71c0dba49..d32d9fee180 100644
--- a/engines/crab/ui/TraitButton.h
+++ b/engines/crab/ui/TraitButton.h
@@ -41,22 +41,25 @@ namespace pyrodactyl {
namespace ui {
class TraitButton : public StateButton {
// The offset for drawing the trait image
- Vector2i offset;
+ Vector2i _offset;
// The trait image
- ImageKey trait_img;
+ ImageKey _traitImg;
public:
- TraitButton() { trait_img = 0; }
+ TraitButton() {
+ _traitImg = 0;
+ }
+
~TraitButton() {}
- void Init(const TraitButton &ref, const int &XOffset = 0, const int &YOffset = 0);
+ void init(const TraitButton &ref, const int &xOffset = 0, const int &yOffset = 0);
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void draw(const int &XOffset = 0, const int &YOffset = 0, Rect *clip = NULL);
+ void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
- void Cache(const pyrodactyl::people::Trait &trait);
- void Empty();
+ void cache(const pyrodactyl::people::Trait &trait);
+ void empty();
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 666ed138e60..5d77784dccd 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -54,7 +54,7 @@ void TraitMenu::load(rapidxml::xml_node<char> *node) {
for (unsigned int i = 0; i < size; ++i) {
TraitButton b;
- b.Init(ref, inc.x * (i % cols), inc.y * (i / cols));
+ b.init(ref, inc.x * (i % cols), inc.y * (i / cols));
menu.element.push_back(b);
}
@@ -88,9 +88,9 @@ void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const Common::Even
int choice = menu.handleEvents(Event);
if (choice >= 0) {
for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
- i->State(false);
+ i->state(false);
- menu.element[choice].State(true);
+ menu.element[choice].state(true);
select = choice;
if (obj != nullptr) {
@@ -122,15 +122,15 @@ void TraitMenu::Cache(const pyrodactyl::people::Person &obj) {
auto e = menu.element.begin();
for (auto i = obj.trait.begin(); i != obj.trait.end() && e != menu.element.end(); ++i, ++e)
- e->Cache(*i);
+ e->cache(*i);
for (; e != menu.element.end(); ++e)
- e->Empty();
+ e->empty();
}
void TraitMenu::Clear() {
for (auto e = menu.element.begin(); e != menu.element.end(); ++e)
- e->Empty();
+ e->empty();
}
void TraitMenu::setUI() {
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 20a264ceab9..0ccf83016a1 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -160,7 +160,7 @@ HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Even
void HUD::State(const int &val) {
int count = 0;
for (auto i = menu.element.begin(); i != menu.element.end(); ++i, ++count)
- i->State(val == count);
+ i->state(val == count);
}
void HUD::SetTooltip() {
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 4fc8b2a8fa0..3e66553dd27 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -94,7 +94,7 @@ public:
~HUD() {}
void internalEvents(bool ShowMap);
- void PlayerImg(const StateButtonImage &img) { menu.element[HS_CHAR].Img(img); }
+ void PlayerImg(const StateButtonImage &img) { menu.element[HS_CHAR].img(img); }
void State(const int &val);
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 839b76d2ead..9d21b5e1959 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -90,9 +90,9 @@ void Journal::Init(const Common::String &id) {
//------------------------------------------------------------------------
void Journal::Select(const Common::String &id, const int &choice) {
for (unsigned int i = 0; i < category.element.size(); ++i)
- category.element[i].State(false);
+ category.element[i].state(false);
- category.element[choice].State(true);
+ category.element[choice].state(true);
select = choice;
// Always find valid journal group first
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 5d74fd2d338..cfae5bab071 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -328,7 +328,7 @@ void Map::Move(const SDL_Event &Event) {
//------------------------------------------------------------------------
void Map::internalEvents(pyrodactyl::event::Info &info) {
// The map overlay and button state should be in sync
- bu_overlay.state = overlay;
+ bu_overlay._state = overlay;
camera.x += vel.x;
camera.y += vel.y;
@@ -355,7 +355,7 @@ bool Map::handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event
Move(Event);
if (bu_overlay.handleEvents(Event) == BUAC_LCLICK)
- overlay = bu_overlay.state;
+ overlay = bu_overlay._state;
return false;
}
Commit: fd0055fcc3e8790aac9a16bc0bc928f389147710
https://github.com/scummvm/scummvm/commit/fd0055fcc3e8790aac9a16bc0bc928f389147710
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make misc. classes follow code formatting conventions
Changed paths:
engines/crab/animation/PopUp.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/mainmenu.cpp
engines/crab/numstr.h
engines/crab/ui/Caption.cpp
engines/crab/ui/Caption.h
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/HealthIndicator.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/QuestText.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/SectionHeader.h
engines/crab/ui/StateButton.cpp
engines/crab/ui/TextData.h
engines/crab/ui/TraitButton.cpp
engines/crab/ui/button.cpp
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/emotion.cpp
engines/crab/ui/emotion.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
engines/crab/ui/textdata.cpp
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index a837d53d713..9237169b733 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -116,11 +116,11 @@ void PopUpCollection::internalEvents(pyrodactyl::event::Info &info, const Common
void PopUp::draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
if (_show) {
if (x + pop.x < camera.w / 3)
- g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop.col, pop.font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
else if (x + pop.x > (2 * camera.w) / 3)
- g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop.col, pop.font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
else
- g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop.col, pop.font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
}
}
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index feacea66378..17e9a073970 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -157,16 +157,16 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
break;
case EVENT_SPLASH:
- if (_intro.show_traits) {
+ if (_intro._showTraits) {
_per.handleEvents(info, _curEvent->_title, Event);
if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
- _intro.show_traits = false;
+ _intro._showTraits = false;
} else {
if (_intro.handleEvents(Event))
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
- if (_intro.show_traits)
+ if (_intro._showTraits)
_per.Cache(info, level.PlayerID(), level);
}
break;
@@ -345,7 +345,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
break;
case EVENT_SPLASH:
g_engine->_imageManager->dimScreen();
- if (_intro.show_traits) {
+ if (_intro._showTraits) {
_per.draw(info, _curEvent->_title);
hud.back.draw();
} else
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index ff2088e7f00..44b921df4cb 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -44,7 +44,7 @@ void ItemMenu::Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int
unsigned int size = rows * cols;
for (unsigned int i = 0; i < size; ++i) {
ItemSlot b;
- b.Init(ref, inc.x * (i % cols), inc.y * (i / cols));
+ b.init(ref, inc.x * (i % cols), inc.y * (i / cols));
element.push_back(b);
}
@@ -100,7 +100,7 @@ void ItemMenu::handleEvents(const SDL_Event &Event, const int &XOffset, const in
//------------------------------------------------------------------------
void ItemMenu::draw(ItemDesc &item_info) {
if (select_index != -1)
- item_info.draw(element[select_index].item);
+ item_info.draw(element[select_index]._item);
for (auto i = element.begin(); i != element.end(); ++i)
i->draw();
@@ -111,7 +111,7 @@ void ItemMenu::draw(ItemDesc &item_info) {
//------------------------------------------------------------------------
bool ItemMenu::Equip(Item &item) {
for (auto i = element.begin(); i != element.end(); ++i)
- if (i->category == SLOT_STORAGE && i->Equip(item))
+ if (i->_category == SLOT_STORAGE && i->equip(item))
return true;
return false;
@@ -124,10 +124,10 @@ bool ItemMenu::Del(const Common::String &id) {
bool result = false;
for (auto &i : element)
- if (i.item._id == id) {
- i.empty = true;
- i.item.clear();
- i.unread = false;
+ if (i._item._id == id) {
+ i._empty = true;
+ i._item.clear();
+ i._unread = false;
result = true;
break;
}
@@ -140,12 +140,12 @@ bool ItemMenu::Del(const Common::String &id) {
//------------------------------------------------------------------------
bool ItemMenu::Has(const Common::String &container, const Common::String &id) {
for (auto i = element.begin(); i != element.end(); ++i)
- if (i->item._id == id) {
+ if (i->_item._id == id) {
if (container == "equip") {
- if (i->category == SLOT_EQUIP)
+ if (i->_category == SLOT_EQUIP)
return true;
} else if (container == "storage") {
- if (i->category == SLOT_STORAGE)
+ if (i->_category == SLOT_STORAGE)
return true;
} else
return true;
@@ -164,16 +164,16 @@ bool ItemMenu::Swap(ItemMenu &target, int index) {
int found_index = -1, cur_index = 0;
for (auto i = element.begin(); i != element.end(); ++i, ++cur_index)
- if (i->item_type == target.element[index].item_type) {
- if (i->empty) {
- i->Swap(target.element[index]);
+ if (i->_itemType == target.element[index]._itemType) {
+ if (i->_empty) {
+ i->swap(target.element[index]);
return true;
} else
found_index = cur_index;
}
if (found_index != -1) {
- element[found_index].Swap(target.element[index]);
+ element[found_index].swap(target.element[index]);
return true;
}
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 14edb638217..71aa08af978 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -46,28 +46,28 @@ void ItemSlot::load(rapidxml::xml_node<char> *node) {
StateButton::load(node);
if (node->first_attribute("slot") == NULL)
- no_type = true;
+ _noType = true;
else {
- loadStr(item_type, "slot", node);
- no_type = false;
+ loadStr(_itemType, "slot", node);
+ _noType = false;
}
Common::String name = node->name();
if (name == "equip")
- category = SLOT_EQUIP;
+ _category = SLOT_EQUIP;
else
- category = SLOT_STORAGE;
+ _category = SLOT_STORAGE;
}
//------------------------------------------------------------------------
// Purpose: Initialize from reference item slot
//------------------------------------------------------------------------
-void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset) {
- StateButton::init(ref, XOffset, YOffset);
+void ItemSlot::init(const ItemSlot &ref, const int &xOffset, const int &YOffset) {
+ StateButton::init(ref, xOffset, YOffset);
_canmove = ref._canmove;
- no_type = ref.no_type;
- category = ref.category;
- unread = ref.unread;
+ _noType = ref._noType;
+ _category = ref._category;
+ _unread = ref._unread;
}
//------------------------------------------------------------------------
@@ -76,13 +76,13 @@ void ItemSlot::Init(const ItemSlot &ref, const int &XOffset, const int &YOffset)
void ItemSlot::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child;
- if (category == SLOT_EQUIP)
+ if (_category == SLOT_EQUIP)
child = doc.allocate_node(rapidxml::node_element, "equip");
else
child = doc.allocate_node(rapidxml::node_element, "storage");
- item.saveState(doc, child);
- saveBool(unread, "unread", doc, child);
+ _item.saveState(doc, child);
+ saveBool(_unread, "unread", doc, child);
root->append_node(child);
}
@@ -91,13 +91,13 @@ void ItemSlot::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
// Purpose: Load state from file
//------------------------------------------------------------------------
void ItemSlot::loadState(rapidxml::xml_node<char> *node) {
- item.load(node);
- loadBool(unread, "unread", node);
+ _item.load(node);
+ loadBool(_unread, "unread", node);
- if (item._id == "")
- empty = true;
+ if (_item._id == "")
+ _empty = true;
else
- empty = false;
+ _empty = false;
}
//------------------------------------------------------------------------
@@ -106,20 +106,20 @@ void ItemSlot::loadState(rapidxml::xml_node<char> *node) {
void ItemSlot::draw() {
StateButton::draw();
- if (!empty)
- item.draw(x, y);
+ if (!_empty)
+ _item.draw(x, y);
- if (unread)
+ if (_unread)
g_engine->_imageManager->notifyDraw(x + w, y);
}
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-ButtonAction ItemSlot::handleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
- ButtonAction ac = StateButton::handleEvents(Event, XOffset, YOffset);
+ButtonAction ItemSlot::handleEvents(const Common::Event &event, const int &xOffset, const int &yOffset) {
+ ButtonAction ac = StateButton::handleEvents(event, xOffset, yOffset);
if (ac == BUAC_LCLICK || ac == BUAC_RCLICK)
- unread = false;
+ _unread = false;
return ac;
}
@@ -141,15 +141,15 @@ ButtonAction ItemSlot::handleEvents(const SDL_Event &Event, const int &XOffset,
// Purpose: Exchange items with another slot
// this object is the current slot, parameter object is target slot
//------------------------------------------------------------------------
-bool ItemSlot::Swap(ItemSlot &target) {
- if (CanSwap(target)) {
- Item temp = item;
- item = target.item;
- target.item = temp;
+bool ItemSlot::swap(ItemSlot &target) {
+ if (canSwap(target)) {
+ Item temp = _item;
+ _item = target._item;
+ target._item = temp;
- bool val = empty;
- empty = target.empty;
- target.empty = val;
+ bool val = _empty;
+ _empty = target._empty;
+ target._empty = val;
return true;
}
@@ -160,11 +160,11 @@ bool ItemSlot::Swap(ItemSlot &target) {
//------------------------------------------------------------------------
// Purpose: Equip an item
//------------------------------------------------------------------------
-bool ItemSlot::Equip(Item &i) {
- if ((item_type == i._type || no_type) && empty) {
- item = i;
- empty = false;
- unread = true;
+bool ItemSlot::equip(Item &i) {
+ if ((_itemType == i._type || _noType) && _empty) {
+ _item = i;
+ _empty = false;
+ _unread = true;
return true;
}
@@ -174,9 +174,9 @@ bool ItemSlot::Equip(Item &i) {
//------------------------------------------------------------------------
// Purpose: Change stats based on item
//------------------------------------------------------------------------
-void ItemSlot::StatChange(Person &obj, bool increase) {
- if (enabled)
- item.statChange(obj, increase);
+void ItemSlot::statChange(pyrodactyl::people::Person &obj, bool increase) {
+ if (_enabled)
+ _item.statChange(obj, increase);
}
} // End of namespace Crab
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index d7d4e7813fe..78fc5f964a8 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -40,56 +40,61 @@ namespace Crab {
namespace pyrodactyl {
namespace item {
-enum SlotType { SLOT_EQUIP,
- SLOT_STORAGE };
+enum SlotType {
+ SLOT_EQUIP,
+ SLOT_STORAGE
+};
class ItemSlot : public pyrodactyl::ui::StateButton {
// Ignore the type of item check
- bool no_type;
+ bool _noType;
public:
// The type of item allowed in this slot (can be overridden by item_type)
- Common::String item_type;
+ Common::String _itemType;
// Is the slot empty?
- bool empty;
+ bool _empty;
// Is the slot enabled? (used for stat calculation)
- bool enabled;
+ bool _enabled;
// Is this a new item? Draw the unread notification icon if so
- bool unread;
+ bool _unread;
// The type of the item slot
- SlotType category;
+ SlotType _category;
// The item contained in the slot
- Item item;
+ Item _item;
ItemSlot() {
- empty = true;
- enabled = true;
- category = SLOT_STORAGE;
- no_type = false;
- unread = false;
+ _empty = true;
+ _enabled = true;
+ _category = SLOT_STORAGE;
+ _noType = false;
+ _unread = false;
}
~ItemSlot() {}
- void Init(const ItemSlot &ref, const int &XOffset = 0, const int &YOffset = 0);
+ void init(const ItemSlot &ref, const int &xOffset = 0, const int &yOffset = 0);
void load(rapidxml::xml_node<char> *node);
void draw();
- pyrodactyl::ui::ButtonAction handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ pyrodactyl::ui::ButtonAction handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
#if 0
pyrodactyl::ui::ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
- bool CanSwap(ItemSlot &target) { return target.no_type || item._type == target.item_type; }
- bool Swap(ItemSlot &target);
- bool Equip(Item &i);
+ bool canSwap(ItemSlot &target) {
+ return target._noType || _item._type == target._itemType;
+ }
+
+ bool swap(ItemSlot &target);
+ bool equip(Item &i);
- void StatChange(pyrodactyl::people::Person &obj, bool increase);
+ void statChange(pyrodactyl::people::Person &obj, bool increase);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 00d5b74c2e8..123c3ec9ac8 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -259,8 +259,8 @@ void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
case STATE_SAVENAME:
if (save.handleEvents(Event) || accept.handleEvents(Event)) {
- if (save.text != "") {
- g_engine->_tempData->filename = save.text;
+ if (save._text != "") {
+ g_engine->_tempData->filename = save._text;
g_engine->_tempData->ironman = true;
ShouldChangeState = true;
NewStateID = GAMESTATE_NEW_GAME;
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index c25c456b2a3..79fa25b5805 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -96,8 +96,8 @@ template<typename T>
void GetPoint(T &v, Common::String &coords) {
int comma = coords.findFirstOf(',');
- v.x = StringToNumber<int>(coords.substr(0, comma));
- v.y = StringToNumber<int>(coords.substr(comma + 1));
+ v._x = StringToNumber<int>(coords.substr(0, comma));
+ v._y = StringToNumber<int>(coords.substr(comma + 1));
}
} // End of namespace Crab
diff --git a/engines/crab/ui/Caption.cpp b/engines/crab/ui/Caption.cpp
index 91a511ab572..3e21387e97c 100644
--- a/engines/crab/ui/Caption.cpp
+++ b/engines/crab/ui/Caption.cpp
@@ -36,26 +36,26 @@ namespace Crab {
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
-void Caption::Init(const Caption &c, const int &XOffset, const int &YOffset) {
+void Caption::init(const Caption &c, const int &xOffset, const int &yOffset) {
*this = c;
- x += XOffset;
- y += YOffset;
+ x += xOffset;
+ y += yOffset;
}
void Caption::load(rapidxml::xml_node<char> *node, Rect *parent) {
if (TextData::load(node, parent, false)) {
- loadStr(text, "text", node);
- loadNum(col_s, "color_s", node, false);
- enabled = true;
+ loadStr(_text, "text", node);
+ loadNum(_colS, "color_s", node, false);
+ _enabled = true;
}
}
-void Caption::draw(bool selected, const int &XOffset, const int &YOffset) {
- if (enabled) {
+void Caption::draw(bool selected, const int &xOffset, const int &yOffset) {
+ if (_enabled) {
if (selected)
- TextData::DrawColor(text, col_s, XOffset, YOffset);
+ TextData::drawColor(_text, _colS, xOffset, yOffset);
else
- TextData::draw(text, XOffset, YOffset);
+ TextData::draw(_text, xOffset, yOffset);
}
}
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index cfb8145475a..480550cf12d 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -41,21 +41,21 @@ namespace ui {
// Caption for buttons
class Caption : public TextData {
public:
- bool enabled;
- int col_s;
+ bool _enabled;
+ int _colS;
- Common::String text;
+ Common::String _text;
Caption(void) {
- col_s = 0;
- enabled = false;
+ _colS = 0;
+ _enabled = false;
}
~Caption(void) {}
- void Init(const Caption &c, const int &XOffset = 0, const int &YOffset = 0);
+ void init(const Caption &c, const int &xOffset = 0, const int &yOffset = 0);
void load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
- void draw(bool selected, const int &XOffset = 0, const int &YOffset = 0);
+ void draw(bool selected, const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 4524fe057d8..950a1fbad4a 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -36,20 +36,20 @@ using namespace pyrodactyl::image;
void ChapterIntro::load(rapidxml::xml_node<char> *node) {
if (nodeValid("dialog", node))
- dialog.load(node->first_node("dialog"));
+ _dialog.load(node->first_node("dialog"));
if (nodeValid("image", node))
- pos.load(node->first_node("image"));
+ _pos.load(node->first_node("image"));
if (nodeValid("trait", node))
- traits.load(node->first_node("trait"));
+ _traits.load(node->first_node("trait"));
}
-bool ChapterIntro::handleEvents(Common::Event &Event) {
- if (traits.handleEvents(Event))
- show_traits = true;
+bool ChapterIntro::handleEvents(Common::Event &event) {
+ if (_traits.handleEvents(event))
+ _showTraits = true;
- return dialog.handleEvents(Event);
+ return _dialog.handleEvents(event);
}
#if 0
@@ -62,15 +62,15 @@ bool ChapterIntro::handleEvents(SDL_Event &Event) {
#endif
void ChapterIntro::draw(pyrodactyl::event::Info &info, Common::String &text,
- pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state) {
- dialog.draw(false);
- dialog.draw(info, text);
+ pyrodactyl::anim::Sprite *curSp, const pyrodactyl::people::PersonState &state) {
+ _dialog.draw(false);
+ _dialog.draw(info, text);
- traits.draw();
+ _traits.draw();
- if (cur_sp != nullptr) {
- Rect clip = cur_sp->dialogClip(state);
- g_engine->_imageManager->draw(pos.x, pos.y, cur_sp->img(), &clip);
+ if (curSp != nullptr) {
+ Rect clip = curSp->dialogClip(state);
+ g_engine->_imageManager->draw(_pos.x, _pos.y, curSp->img(), &clip);
}
}
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index 38d2a950518..f0330175c2b 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -42,29 +42,31 @@ namespace pyrodactyl {
namespace ui {
class ChapterIntro {
// This contains the background image info and start button
- GameDialogBox dialog;
+ GameDialogBox _dialog;
// This is where the sprite is drawn
- Element pos;
+ Element _pos;
// The traits button
- Button traits;
+ Button _traits;
public:
// Should we show the traits screen
- bool show_traits;
+ bool _showTraits;
- ChapterIntro() { show_traits = false; }
+ ChapterIntro() {
+ _showTraits = false;
+ }
void load(rapidxml::xml_node<char> *node);
- bool handleEvents(Common::Event &Event);
+ bool handleEvents(Common::Event &event);
#if 0
bool handleEvents(SDL_Event &Event);
#endif
void draw(pyrodactyl::event::Info &info, Common::String &text,
- pyrodactyl::anim::Sprite *cur_sp, const pyrodactyl::people::PersonState &state);
+ pyrodactyl::anim::Sprite *curSp, const pyrodactyl::people::PersonState &state);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 28417cfd048..11f6c3f445c 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -37,35 +37,35 @@ using namespace pyrodactyl::ui;
void HealthIndicator::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- loadXY(x, y, node);
+ loadXY(_x, _y, node);
for (auto n = node->first_node("img"); n != NULL; n = n->next_sibling("img")) {
HealthImage hi;
- loadImgKey(hi.normal, "normal", n);
- loadImgKey(hi.glow, "glow", n);
- loadNum(hi.val, "val", n);
+ loadImgKey(hi._normal, "normal", n);
+ loadImgKey(hi._glow, "glow", n);
+ loadNum(hi._val, "val", n);
- img.push_back(hi);
+ _img.push_back(hi);
}
}
}
void HealthIndicator::draw(int num) {
- for (auto i = img.begin(); i != img.end(); ++i)
- if (num == i->val) {
+ for (auto i = _img.begin(); i != _img.end(); ++i)
+ if (num == i->_val) {
using namespace pyrodactyl::image;
- g_engine->_imageManager->draw(x, y, i->normal);
- g_engine->_imageManager->getTexture(i->glow).alpha(alpha);
- g_engine->_imageManager->draw(x, y, i->glow);
+ g_engine->_imageManager->draw(_x, _y, i->_normal);
+ g_engine->_imageManager->getTexture(i->_glow).alpha(_alpha);
+ g_engine->_imageManager->draw(_x, _y, i->_glow);
- if (inc) {
- alpha += 2;
- if (alpha >= 250)
- inc = false;
+ if (_inc) {
+ _alpha += 2;
+ if (_alpha >= 250)
+ _inc = false;
} else {
- alpha -= 2;
- if (alpha < 4)
- inc = true;
+ _alpha -= 2;
+ if (_alpha < 4)
+ _inc = true;
}
break;
diff --git a/engines/crab/ui/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
index 72a15ffa87e..a54c2b0723e 100644
--- a/engines/crab/ui/HealthIndicator.h
+++ b/engines/crab/ui/HealthIndicator.h
@@ -40,24 +40,25 @@ namespace pyrodactyl {
namespace ui {
class HealthIndicator {
struct HealthImage {
- ImageKey normal, glow;
- int val;
+ ImageKey _normal, _glow;
+ int _val;
};
- int x, y;
- Common::Array<HealthImage> img;
+ int _x, _y;
+ Common::Array<HealthImage> _img;
// Related to the pulse effect
- uint8 alpha;
- bool inc;
+ uint8 _alpha;
+ bool _inc;
public:
HealthIndicator() {
- x = 0;
- y = 0;
- alpha = 0;
- inc = true;
+ _x = 0;
+ _y = 0;
+ _alpha = 0;
+ _inc = true;
}
+
~HealthIndicator() {}
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 99ce8cee67d..d30ce8c945b 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -95,7 +95,7 @@ void Inventory::draw(Person &obj, const int &money_val) {
// helper.DrawInfo(obj);
collection.draw(obj.id /*, helper*/);
- money._caption.text = NumberToString(money_val);
+ money._caption._text = NumberToString(money_val);
money.draw();
}
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 85f48e3915b..24e926ccbec 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -90,9 +90,9 @@ class KeyBindMenu {
}
void Swap(Caption &c) {
- col_prev = c.col;
- c.text = text;
- c.col = col;
+ col_prev = c._col;
+ c._text = text;
+ c._col = col;
}
} prompt;
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 3538807d96e..655eb1b9329 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -181,7 +181,7 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &Event) {
switch (state) {
case STATE_ENTER_W:
if (prompt_w.handleEvents(Event, true) || accept.handleEvents(Event) == BUAC_LCLICK) {
- g_engine->_screenSettings->cur.w = StringToNumber<int>(prompt_w.text);
+ g_engine->_screenSettings->cur.w = StringToNumber<int>(prompt_w._text);
state = STATE_ENTER_H;
} else if (cancel.handleEvents(Event) == BUAC_LCLICK) {
g_engine->_screenSettings->RestoreBackup();
@@ -191,7 +191,7 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &Event) {
break;
case STATE_ENTER_H:
if (prompt_h.handleEvents(Event, true) || accept.handleEvents(Event) == BUAC_LCLICK) {
- g_engine->_screenSettings->cur.h = StringToNumber<int>(prompt_h.text);
+ g_engine->_screenSettings->cur.h = StringToNumber<int>(prompt_h._text);
state = STATE_CONFIRM;
timer.Start();
g_engine->_screenSettings->SetResolution();
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index 383fd5dd883..65038fa515e 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -43,7 +43,7 @@ bool ParagraphData::load(rapidxml::xml_node<char> *node, Rect *parent, const boo
}
void ParagraphData::draw(const Common::String &val, const int &XOffset, const int &YOffset) {
- g_engine->_textManager->draw(x + XOffset, y + YOffset, val, col, font, align, line.x, line.y);
+ g_engine->_textManager->draw(x + XOffset, y + YOffset, val, _col, _font, _align, line.x, line.y);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index 2cfeccc2a96..31f9659c2af 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -61,7 +61,7 @@ void ProgressBar::draw(const int &value, const int &max) {
// Figure out which text to draw as caption
for (auto &i : ct)
if (value > i.val) {
- _caption.text = i.text;
+ _caption._text = i.text;
break;
}
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 9406569bfd4..fb46e45394b 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -126,7 +126,7 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
// Draw first entry in selected color, and older quest entries in standard color
if (i == 0)
- g_engine->_textManager->draw(x, y, q._text[i], col_s, font, align, line.x, line.y);
+ g_engine->_textManager->draw(x, y, q._text[i], col_s, _font, _align, line.x, line.y);
else
ParagraphData::draw(q._text[i], inc.x * count, inc.y * count);
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index bbaff76aaf8..38b5879571d 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -51,7 +51,7 @@ void ReplyMenu::load(const Common::String &filename) {
if (nodeValid("reply", node)) {
rapidxml::xml_node<char> *replynode = node->first_node("reply");
Menu<ReplyButton>::load(replynode->first_node("menu"));
- tone.value.resize(element.size());
+ tone._value.resize(element.size());
bg.load(replynode->first_node("bg"));
loadNum(spacing, "spacing", replynode);
@@ -156,7 +156,7 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
element[element_count]._visible = true;
element[element_count]._index = reply_count;
- tone.value[element_count] = dat._reply[reply_count]._tone;
+ tone._value[element_count] = dat._reply[reply_count]._tone;
const InputType type = static_cast<InputType>(IU_REPLY_0 + element_count);
Common::String text = g_engine->_inputManager->getAssociatedKey(type);
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 0862746a4e7..19d5987e0db 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -65,9 +65,9 @@ void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
dim.push_back(d);
Button b;
b.init(ref, inc.x * (count_slot % columns), inc.y * (count_slot / columns));
- b._caption.text = NumberToString(d.w);
- b._caption.text += " x ";
- b._caption.text += NumberToString(d.h);
+ b._caption._text = NumberToString(d.w);
+ b._caption._text += " x ";
+ b._caption._text += NumberToString(d.h);
element.push_back(b);
}
}
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index b4099fda39c..364f3472496 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -79,9 +79,9 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
index = menu.Index() + choice;
if (index != 0)
- ta_name.text = slot_info[index].name;
+ ta_name._text = slot_info[index].name;
else
- ta_name.text = "";
+ ta_name._text = "";
state = STATE_NAME;
}
@@ -94,7 +94,7 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
if (index <= (int)slot_info.size() && index != 0)
g_engine->getSaveFileManager()->removeSavefile(slot_info[index].path);
- selected = ta_name.text;
+ selected = ta_name._text;
state = STATE_NORMAL;
reset();
g_engine->_inputManager->setKeyBindingMode(KBM_GAME);
@@ -102,7 +102,7 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
}
if (g_engine->_inputManager->state(IU_BACK)) {
- ta_name.text = "New Save";
+ ta_name._text = "New Save";
state = STATE_NORMAL;
}
default:
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 241faae4dc6..df772be92e5 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -40,35 +40,35 @@ using namespace pyrodactyl::image;
void SectionHeader::load(rapidxml::xml_node<char> *node) {
if (TextData::load(node, NULL, false)) {
- loadStr(text, "text", node);
- text.insertChar(' ', 0);
- text += " ";
+ loadStr(_text, "text", node);
+ _text.insertChar(' ', 0);
+ _text += " ";
- loadImgKey(img, "img", node);
+ loadImgKey(_img, "img", node);
- loadBool(draw_l, "left", node);
- loadBool(draw_r, "right", node);
+ loadBool(_drawL, "left", node);
+ loadBool(_drawR, "right", node);
- Graphics::ManagedSurface *surf = g_engine->_textManager->RenderTextBlended(font, text, col);
+ Graphics::ManagedSurface *surf = g_engine->_textManager->RenderTextBlended(_font, _text, _col);
- if (align == ALIGN_CENTER) {
- left.x = x - surf->w / 2 - g_engine->_imageManager->getTexture(img).w();
- left.y = y - surf->h / 2 + g_engine->_imageManager->getTexture(img).h() / 2;
+ if (_align == ALIGN_CENTER) {
+ _left.x = x - surf->w / 2 - g_engine->_imageManager->getTexture(_img).w();
+ _left.y = y - surf->h / 2 + g_engine->_imageManager->getTexture(_img).h() / 2;
- right.x = x + surf->w / 2;
- right.y = y - surf->h / 2 + g_engine->_imageManager->getTexture(img).h() / 2;
- } else if (align == ALIGN_LEFT) {
- left.x = x - g_engine->_imageManager->getTexture(img).w();
- left.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(img).h() / 2;
+ _right.x = x + surf->w / 2;
+ _right.y = y - surf->h / 2 + g_engine->_imageManager->getTexture(_img).h() / 2;
+ } else if (_align == ALIGN_LEFT) {
+ _left.x = x - g_engine->_imageManager->getTexture(_img).w();
+ _left.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(_img).h() / 2;
- right.x = x + surf->w;
- right.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(img).h() / 2;
+ _right.x = x + surf->w;
+ _right.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(_img).h() / 2;
} else {
- left.x = x - surf->w - g_engine->_imageManager->getTexture(img).w();
- left.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(img).h() / 2;
+ _left.x = x - surf->w - g_engine->_imageManager->getTexture(_img).w();
+ _left.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(_img).h() / 2;
- right.x = x;
- right.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(img).h() / 2;
+ _right.x = x;
+ _right.y = y + surf->h / 2 - g_engine->_imageManager->getTexture(_img).h() / 2;
}
delete surf;
@@ -76,18 +76,18 @@ void SectionHeader::load(rapidxml::xml_node<char> *node) {
}
-void SectionHeader::draw(const int &XOffset, const int &YOffset) {
- draw(text, XOffset, YOffset);
+void SectionHeader::draw(const int &xOffset, const int &yOffset) {
+ draw(_text, xOffset, yOffset);
}
-void SectionHeader::draw(const Common::String &str, const int &XOffset, const int &YOffset) {
- if (draw_l)
- g_engine->_imageManager->draw(left.x + XOffset, left.y + YOffset, img);
+void SectionHeader::draw(const Common::String &str, const int &xOffset, const int &yOffset) {
+ if (_drawL)
+ g_engine->_imageManager->draw(_left.x + xOffset, _left.y + yOffset, _img);
- if (draw_r)
- g_engine->_imageManager->draw(right.x + XOffset, right.y + YOffset, img, (Rect*)NULL, FLIP_X);
+ if (_drawR)
+ g_engine->_imageManager->draw(_right.x + xOffset, _right.y + yOffset, _img, (Rect*)NULL, FLIP_X);
- TextData::draw(str, XOffset, YOffset);
+ TextData::draw(str, xOffset, yOffset);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/SectionHeader.h b/engines/crab/ui/SectionHeader.h
index 5ead8f3d215..928d06cfa58 100644
--- a/engines/crab/ui/SectionHeader.h
+++ b/engines/crab/ui/SectionHeader.h
@@ -42,29 +42,30 @@ namespace pyrodactyl {
namespace ui {
class SectionHeader : public TextData {
// The content of the header
- Common::String text;
+ Common::String _text;
// This image surrounds the text like <img> text <img>, with the right image being flipped horizontally
- ImageKey img;
+ ImageKey _img;
// The coordinates for drawing image
- Vector2i left, right;
+ Vector2i _left, _right;
// Should we draw one or both or none of the images
- bool draw_l, draw_r;
+ bool _drawL, _drawR;
public:
SectionHeader() {
- img = 0;
- draw_l = false;
- draw_r = false;
+ _img = 0;
+ _drawL = false;
+ _drawR = false;
}
+
~SectionHeader() {}
void load(rapidxml::xml_node<char> *node);
- void draw(const int &XOffset = 0, const int &YOffset = 0);
- void draw(const Common::String &str, const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &xOffset = 0, const int &yOffset = 0);
+ void draw(const Common::String &str, const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/StateButton.cpp b/engines/crab/ui/StateButton.cpp
index 373d9c495df..4eba2fd5f52 100644
--- a/engines/crab/ui/StateButton.cpp
+++ b/engines/crab/ui/StateButton.cpp
@@ -47,8 +47,8 @@ void StateButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
Button::load(node, echo);
_imgSet._normal = _img;
- _colNormal._col = _caption.col;
- _colNormal._colS = _caption.col_s;
+ _colNormal._col = _caption._col;
+ _colNormal._colS = _caption._colS;
if (nodeValid("select", node, false)) {
rapidxml::xml_node<char> *selnode = node->first_node("select");
@@ -58,20 +58,20 @@ void StateButton::load(rapidxml::xml_node<char> *node, const bool &echo) {
loadNum(_colSelect._colS, "color_s", selnode);
} else {
_imgSet._select = _img;
- _colSelect._col = _caption.col;
- _colSelect._colS = _caption.col_s;
+ _colSelect._col = _caption._col;
+ _colSelect._colS = _caption._colS;
}
}
void StateButton::state(const bool val) {
if (val) {
_img = _imgSet._select;
- _caption.col = _colSelect._col;
- _caption.col_s = _colSelect._colS;
+ _caption._col = _colSelect._col;
+ _caption._colS = _colSelect._colS;
} else {
_img = _imgSet._normal;
- _caption.col = _colNormal._col;
- _caption.col_s = _colNormal._colS;
+ _caption._col = _colNormal._col;
+ _caption._colS = _colNormal._colS;
}
// Images might be different in size
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index 2e0d7672567..de0795f4a2a 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -41,26 +41,26 @@ namespace pyrodactyl {
namespace ui {
class TextData : public Element {
public:
- int col;
- FontKey font;
- Align align;
- bool background;
+ int _col;
+ FontKey _font;
+ Align _align;
+ bool _background;
TextData(void) {
- col = 0;
- font = 0;
- align = ALIGN_LEFT;
- background = false;
+ _col = 0;
+ _font = 0;
+ _align = ALIGN_LEFT;
+ _background = false;
}
~TextData(void) {}
bool load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
// Plain drawing
- void draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const Common::String &val, const int &xOffset = 0, const int &yOffset = 0);
// Draw with a different color
- void DrawColor(const Common::String &val, const int &color, const int &XOffset = 0, const int &YOffset = 0);
+ void drawColor(const Common::String &val, const int &color, const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index 4be02a2cd60..e9094ed68e9 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -58,12 +58,12 @@ void TraitButton::draw(const int &xOffset, const int &yOffset, Rect *clip) {
void TraitButton::cache(const pyrodactyl::people::Trait &trait) {
_traitImg = trait.img;
- _caption.text = trait.name;
+ _caption._text = trait.name;
}
void TraitButton::empty() {
_traitImg = 0;
- _caption.text = "";
+ _caption._text = "";
}
} // End of namespace Crab
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 4c3b720c634..6782bff4fa4 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -83,7 +83,7 @@ void Button::init(const Button &ref, const int &xOffset, const int &yOffset) {
_seClick = ref._seClick;
_seHover = ref._seHover;
- _caption.Init(ref._caption, xOffset, yOffset);
+ _caption.init(ref._caption, xOffset, yOffset);
_tooltip.Init(ref._tooltip, xOffset, yOffset);
_visible = true;
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index 4c3d76a63e4..f348eae4d63 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -46,15 +46,15 @@ using namespace pyrodactyl::input;
// Purpose: Load stuff
//------------------------------------------------------------------------
void GameDialogBox::load(rapidxml::xml_node<char> *node) {
- loadImgKey(bg, "bg", node);
- loadImgKey(bg_p, "bg_p", node);
- pos.load(node, bg);
+ loadImgKey(_bg, "bg", node);
+ loadImgKey(_bgP, "bg_p", node);
+ _pos.load(node, _bg);
if (nodeValid("text", node))
- text.load(node->first_node("text"), &pos);
+ _text.load(node->first_node("text"), &_pos);
if (nodeValid("button", node))
- button.load(node->first_node("button"));
+ _button.load(node->first_node("button"));
}
//------------------------------------------------------------------------
@@ -62,9 +62,9 @@ void GameDialogBox::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void GameDialogBox::draw(const bool &player) {
if (player)
- g_engine->_imageManager->draw(pos.x, pos.y, bg_p);
+ g_engine->_imageManager->draw(_pos.x, _pos.y, _bgP);
else
- g_engine->_imageManager->draw(pos.x, pos.y, bg);
+ g_engine->_imageManager->draw(_pos.x, _pos.y, _bg);
}
//------------------------------------------------------------------------
@@ -75,15 +75,15 @@ void GameDialogBox::draw(pyrodactyl::event::Info &info, Common::String &message)
Common::String msg = message;
info.insertName(msg);
- text.draw(message);
- button.draw();
+ _text.draw(message);
+ _button.draw();
}
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
-bool GameDialogBox::handleEvents(const Common::Event &Event) {
- return (button.handleEvents(Event) == BUAC_LCLICK);
+bool GameDialogBox::handleEvents(const Common::Event &event) {
+ return (_button.handleEvents(event) == BUAC_LCLICK);
}
#if 0
@@ -98,9 +98,9 @@ bool GameDialogBox::handleEvents(const SDL_Event &Event) {
void GameDialogBox::setUI() {
- pos.setUI();
- text.setUI(&pos);
- button.setUI();
+ _pos.setUI();
+ _text.setUI(&_pos);
+ _button.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index f1aa52af21d..c2095f8c8bf 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -46,25 +46,26 @@ namespace pyrodactyl {
namespace ui {
class GameDialogBox {
// The position of the dialog box
- Element pos;
+ Element _pos;
// The area you click to skip to the next dialog
- Button button;
+ Button _button;
// Information related to drawing the dialog box
- ParagraphData text;
+ ParagraphData _text;
// The usual background
- ImageKey bg;
+ ImageKey _bg;
// The background drawn when we don't want to show the opinion bars
- ImageKey bg_p;
+ ImageKey _bgP;
public:
GameDialogBox() {
- bg = 0;
- bg_p = 0;
+ _bg = 0;
+ _bgP = 0;
}
+
~GameDialogBox() {}
void load(rapidxml::xml_node<char> *node);
@@ -72,7 +73,7 @@ public:
void draw(pyrodactyl::event::Info &info, Common::String &message);
void draw(const bool &player);
- bool handleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &event);
#if 0
bool handleEvents(const SDL_Event &Event);
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 8282cc09899..1c6debe37f9 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -37,18 +37,18 @@ using namespace pyrodactyl::event;
void EmotionIndicator::load(rapidxml::xml_node<char> *node) {
if (nodeValid("text", node))
- text.load(node->first_node("text"));
+ _text.load(node->first_node("text"));
}
void EmotionIndicator::draw(const int &select) {
- if (select >= 0 && (unsigned int)select < value.size())
- if (value[select] < g_engine->_eventStore->_tone.size()) {
- text.draw(g_engine->_eventStore->_tone[value[select]]._text);
+ if (select >= 0 && (unsigned int)select < _value.size())
+ if (_value[select] < g_engine->_eventStore->_tone.size()) {
+ _text.draw(g_engine->_eventStore->_tone[_value[select]]._text);
}
}
void EmotionIndicator::setUI() {
- text.setUI();
+ _text.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index a5459b143c9..f163c81c6c3 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -42,10 +42,10 @@ namespace pyrodactyl {
namespace ui {
struct EmotionIndicator {
// The info for drawing the description
- TextData text;
+ TextData _text;
// This array is used to store the corresponding tone values to a reply
- Common::Array<unsigned int> value;
+ Common::Array<unsigned int> _value;
EmotionIndicator() {}
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 1c62a02bab0..c51bc5d56dd 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -43,46 +43,46 @@ using namespace pyrodactyl::input;
void TextArea::load(rapidxml::xml_node<char> *node) {
if (TextData::load(node)) {
- loadStr(text, "text", node);
- loadNum(size, "size", node);
+ loadStr(_text, "text", node);
+ loadNum(_size, "size", node);
- loadNum(se_entry, "entry", node);
- loadNum(se_erase, "erase", node);
- loadNum(se_accept, "accept", node);
+ loadNum(_seEntry, "entry", node);
+ loadNum(_seErase, "erase", node);
+ loadNum(_seAccept, "accept", node);
if (nodeValid("caption", node))
- title.load(node->first_node("caption"), this);
+ _title.load(node->first_node("caption"), this);
}
}
-bool TextArea::handleEvents(const Common::Event &Event, bool numbers_only) {
+bool TextArea::handleEvents(const Common::Event &event, bool numbersOnly) {
warning("STUB: TextArea::handleEvents()");
- if (Event.type == Common::EVENT_KEYDOWN && Event.kbd.ascii == Common::ASCII_BACKSPACE && text.size() != 0) {
+ if (event.type == Common::EVENT_KEYDOWN && event.kbd.ascii == Common::ASCII_BACKSPACE && _text.size() != 0) {
// Now play the text erase sound
- g_engine->_musicManager->PlayEffect(se_erase, 0);
+ g_engine->_musicManager->PlayEffect(_seErase, 0);
// If backspace was pressed and the string isn't blank, remove a character from the end
- text.erase(text.size() - 1);
- } else if (Event.type == Common::EVENT_KEYDOWN) {
+ _text.erase(_text.size() - 1);
+ } else if (event.type == Common::EVENT_KEYDOWN) {
// If the string less than maximum size and does not contain invalid characters \ / : * ? " < > |
- if (text.size() < size && Event.kbd.ascii != '\\' \
- && Event.kbd.ascii != '/' && Event.kbd.ascii != ':' \
- && Event.kbd.ascii != '*' && Event.kbd.ascii != '?' \
- && Event.kbd.ascii != '\"' && Event.kbd.ascii != '<' \
- && Event.kbd.ascii != '>' && Event.kbd.ascii != '|') {
+ if (_text.size() < _size && event.kbd.ascii != '\\' \
+ && event.kbd.ascii != '/' && event.kbd.ascii != ':' \
+ && event.kbd.ascii != '*' && event.kbd.ascii != '?' \
+ && event.kbd.ascii != '\"' && event.kbd.ascii != '<' \
+ && event.kbd.ascii != '>' && event.kbd.ascii != '|') {
// Should we only accept numbers?
- if (numbers_only && (Event.kbd.ascii < '0' || Event.kbd.ascii > '9'))
+ if (numbersOnly && (event.kbd.ascii < '0' || event.kbd.ascii > '9'))
return false;
// Now play the text input sound
- g_engine->_musicManager->PlayEffect(se_entry, 0);
+ g_engine->_musicManager->PlayEffect(_seEntry, 0);
// Append the character to string
- text += Event.kbd.ascii;
+ _text += event.kbd.ascii;
}
- } else if (g_engine->_inputManager->state(IU_ACCEPT) && text.size() != 0) {
+ } else if (g_engine->_inputManager->state(IU_ACCEPT) && _text.size() != 0) {
// Now play the accept sound
- g_engine->_musicManager->PlayEffect(se_accept, 0);
+ g_engine->_musicManager->PlayEffect(_seAccept, 0);
return true;
}
@@ -128,8 +128,8 @@ bool TextArea::handleEvents(const SDL_Event &Event, bool numbers_only) {
// Purpose: Draw
//------------------------------------------------------------------------
void TextArea::draw() {
- title.draw();
- TextData::draw(text + "_");
+ _title.draw();
+ TextData::draw(_text + "_");
}
} // End of namespace Crab
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 486ed45abfd..23d8a3ca096 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -47,28 +47,28 @@ namespace pyrodactyl {
namespace ui {
class TextArea : public TextData {
// The maximum number of characters allowed
- unsigned int size;
+ unsigned int _size;
// The name of the text area is stored here
- HoverInfo title;
+ HoverInfo _title;
// Sound effects
- pyrodactyl::music::ChunkKey se_entry, se_erase, se_accept;
+ pyrodactyl::music::ChunkKey _seEntry, _seErase, _seAccept;
public:
- Common::String text;
+ Common::String _text;
- TextArea(void) : text("") {
- size = 20;
- se_entry = -1;
- se_erase = -1;
- se_accept = -1;
+ TextArea(void) : _text("") {
+ _size = 20;
+ _seEntry = -1;
+ _seErase = -1;
+ _seAccept = -1;
}
~TextArea(void) {}
void load(rapidxml::xml_node<char> *node);
- bool handleEvents(const Common::Event &Event, bool numbers_only = false);
+ bool handleEvents(const Common::Event &event, bool numbersOnly = false);
#if 0
bool handleEvents(const SDL_Event &Event, bool numbers_only = false);
#endif
@@ -76,7 +76,7 @@ public:
void draw();
void setUI() {
- title.setUI();
+ _title.setUI();
TextData::setUI();
}
};
diff --git a/engines/crab/ui/textdata.cpp b/engines/crab/ui/textdata.cpp
index 10823b3db40..b5b22ef1e64 100644
--- a/engines/crab/ui/textdata.cpp
+++ b/engines/crab/ui/textdata.cpp
@@ -39,22 +39,22 @@ using namespace pyrodactyl::text;
bool TextData::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
if (nodeValid(node, echo)) {
Element::load(node, parent, echo);
- LoadFontKey(font, "font", node);
- loadNum(col, "color", node);
- loadAlign(align, node, false);
- loadBool(background, "background", node, false);
+ LoadFontKey(_font, "font", node);
+ loadNum(_col, "color", node);
+ loadAlign(_align, node, false);
+ loadBool(_background, "background", node, false);
return true;
}
return false;
}
-void TextData::draw(const Common::String &val, const int &XOffset, const int &YOffset) {
- g_engine->_textManager->draw(x + XOffset, y + YOffset, val, col, font, align, background);
+void TextData::draw(const Common::String &val, const int &xOffset, const int &yOffset) {
+ g_engine->_textManager->draw(x + xOffset, y + yOffset, val, _col, _font, _align, _background);
}
-void TextData::DrawColor(const Common::String &val, const int &color, const int &XOffset, const int &YOffset) {
- g_engine->_textManager->draw(x + XOffset, y + YOffset, val, color, font, align, background);
+void TextData::drawColor(const Common::String &val, const int &color, const int &xOffset, const int &yOffset) {
+ g_engine->_textManager->draw(x + xOffset, y + yOffset, val, color, _font, _align, _background);
}
} // End of namespace Crab
Commit: de421bdd37cc67697b8e6aa2ccf291a0478f93fd
https://github.com/scummvm/scummvm/commit/de421bdd37cc67697b8e6aa2ccf291a0478f93fd
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make StatPreview class follow code formatting conventions
Changed paths:
engines/crab/item/StatPreview.cpp
engines/crab/item/StatPreview.h
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index cb73049fd2c..d7d3aa8b924 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -36,29 +36,29 @@ namespace Crab {
using namespace pyrodactyl::item;
void StatPreview::load(rapidxml::xml_node<char> *node) {
- loadBool(enabled, "enabled", node);
+ loadBool(_enabled, "enabled", node);
if (nodeValid("stat", node)) {
rapidxml::xml_node<char> *snode = node->first_node("stat");
stat.load(snode);
- loadNum(inc_s.x, "w", snode);
- loadNum(inc_s.y, "h", snode);
+ loadNum(_incS.x, "w", snode);
+ loadNum(_incS.y, "h", snode);
}
if (nodeValid("unit", node)) {
rapidxml::xml_node<char> *snode = node->first_node("unit");
unit.load(snode);
- loadNum(inc_u.x, "w", snode);
- loadNum(inc_u.y, "h", snode);
+ loadNum(_incU.x, "w", snode);
+ loadNum(_incU.y, "h", snode);
}
}
void StatPreview::draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
- if (enabled) {
+ if (_enabled) {
int count = 0;
for (auto i = item._bonus.begin(); i != item._bonus.end(); ++i, ++count) {
- stat.draw(helper.Name(i->type), inc_s.x * count, inc_s.y * count);
- unit.draw(gStrPool->Get(i->val), inc_u.x * count, inc_u.y * count);
+ stat.draw(helper.Name(i->type), _incS.x * count, _incS.y * count);
+ unit.draw(gStrPool->Get(i->val), _incU.x * count, _incU.y * count);
}
}
}
diff --git a/engines/crab/item/StatPreview.h b/engines/crab/item/StatPreview.h
index 0bba5251e4e..993e675305f 100644
--- a/engines/crab/item/StatPreview.h
+++ b/engines/crab/item/StatPreview.h
@@ -44,11 +44,13 @@ struct StatPreview {
pyrodactyl::ui::SectionHeader stat, unit;
// We increment stat draw position by this much for every new item bonus
- Vector2i inc_s, inc_u;
+ Vector2i _incS, _incU;
- bool enabled;
+ bool _enabled;
- StatPreview() { enabled = false; }
+ StatPreview() {
+ _enabled = false;
+ }
void load(rapidxml::xml_node<char> *node);
void draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper);
Commit: 94c777705599de16036bb772c79e3adc5fcc83c9
https://github.com/scummvm/scummvm/commit/94c777705599de16036bb772c79e3adc5fcc83c9
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make all level class follow code formatting conventions
Changed paths:
engines/crab/TMX/TMXMap.cpp
engines/crab/ai/spriteai.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/level/LevelExit.cpp
engines/crab/level/LevelExit.h
engines/crab/level/MusicArea.cpp
engines/crab/level/MusicArea.h
engines/crab/level/Stairs.cpp
engines/crab/level/Stairs.h
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/level/level_objects.cpp
engines/crab/level/level_objects.h
engines/crab/level/talknotify.cpp
engines/crab/level/talknotify.h
engines/crab/rapidxml/manual.html
engines/crab/ui/PersonScreen.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 78a85c25540..829ca834d51 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -255,7 +255,7 @@ void TMXMap::DrawDebug(const Rect &camera) {
i->draw(-camera.x, -camera.y, 0, 0, 254, 254);
for (auto i = area_exit.begin(); i != area_exit.end(); ++i)
- i->dim.draw(-camera.x, -camera.y, 0, 254, 254, 254);
+ i->_dim.draw(-camera.x, -camera.y, 0, 254, 254, 254);
for (auto i = prop.begin(); i != prop.end(); ++i)
i->pos.draw(-camera.x, -camera.y, 254, 0, 254, 254);
@@ -365,10 +365,10 @@ void TMXMap::CollideWithTrigger(const Rect rect, Common::Array<int> &collision_t
bool TMXMap::CollideWithExit(const Rect rect, LevelResult &res) {
for (auto i = area_exit.begin(); i != area_exit.end(); ++i)
- if (i->dim.Collide(rect).intersect) {
- res.val = i->name;
- res.x = i->entry.x;
- res.y = i->entry.y;
+ if (i->_dim.Collide(rect).intersect) {
+ res.val = i->_name;
+ res.x = i->_entry.x;
+ res.y = i->_entry.y;
return true;
}
@@ -378,7 +378,7 @@ bool TMXMap::CollideWithExit(const Rect rect, LevelResult &res) {
bool TMXMap::CollideWithStairs(const Rect rect, Vector2f &vel_mod) {
for (auto i = area_stairs.begin(); i != area_stairs.end(); ++i) {
if (i->Collide(rect).intersect) {
- vel_mod = i->modifier;
+ vel_mod = i->_modifier;
return true;
}
}
@@ -392,9 +392,9 @@ bool TMXMap::CollideWithStairs(const Rect rect, Vector2f &vel_mod) {
bool TMXMap::CollideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &music) {
for (auto i = area_music.begin(); i != area_music.end(); ++i) {
if (i->Collide(rect).intersect) {
- music.id = i->id;
- music.track = i->track;
- music.loops = i->loops;
+ music._id = i->_id;
+ music._track = i->_track;
+ music._loops = i->_loops;
return true;
}
}
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index ac6c8d4ad0b..21ce87cc24a 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -168,12 +168,12 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
// Find the nearest exit
for (auto &i : areaExit) {
// Compare distance to the rough center of each exit
- int dist = Distance2D(_pos.x, _pos.y, i.dim.rect.x + i.dim.rect.w / 2, i.dim.rect.y + i.dim.rect.h / 2);
+ int dist = Distance2D(_pos.x, _pos.y, i._dim.rect.x + i._dim.rect.w / 2, i._dim.rect.y + i._dim.rect.h / 2);
if (dist < min_dist) {
min_dist = dist;
// Set the destination of sprite to this exit
- _aiData.dest(i.dim.rect.x + i.dim.rect.w / 2, i.dim.rect.y + i.dim.rect.h / 2);
+ _aiData.dest(i._dim.rect.x + i._dim.rect.w / 2, i._dim.rect.y + i._dim.rect.h / 2);
_pathing.SetDestination(Vector2f((float)_aiData._dest.x, (float)_aiData._dest.y));
}
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 17e9a073970..9f2789ff6ff 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -167,7 +167,7 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
if (_intro._showTraits)
- _per.Cache(info, level.PlayerID(), level);
+ _per.Cache(info, level.playerId(), level);
}
break;
default:
@@ -281,7 +281,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
DrawType drawVal = DRAW_SAME;
if (g_engine->_eventStore->_anim[_curEvent->_special].internalEvents(drawVal))
- _eventMap[info.curLocID()].nextEvent(_activeSeq, info, level.PlayerID(), result, _endSeq);
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, level.playerId(), result, _endSeq);
if (drawVal == DRAW_STOP)
_drawGame = false;
@@ -289,7 +289,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
_drawGame = true;
} break;
case EVENT_SILENT:
- _eventMap[info.curLocID()].nextEvent(_activeSeq, info, level.PlayerID(), result, _endSeq);
+ _eventMap[info.curLocID()].nextEvent(_activeSeq, info, level.playerId(), result, _endSeq);
break;
case EVENT_REPLY:
updateDialogBox(info, level);
@@ -304,7 +304,7 @@ void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult
endSequence(info.curLocID());
} else {
_eventMap[info.curLocID()].internalEvents(info);
- calcActiveSeq(info, level, level.Camera());
+ calcActiveSeq(info, level, level.camera());
}
}
}
@@ -324,7 +324,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
case EVENT_DIALOG:
g_engine->_imageManager->dimScreen();
if (_oh.show_journal) {
- info._journal.draw(level.PlayerID());
+ info._journal.draw(level.playerId());
hud.back.draw();
} else
_oh.draw(info, _curEvent, _curEvent->_title, _player, _curSp);
@@ -332,7 +332,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
case EVENT_REPLY:
g_engine->_imageManager->dimScreen();
if (_oh.show_journal) {
- info._journal.draw(level.PlayerID());
+ info._journal.draw(level.playerId());
hud.back.draw();
} else {
_oh.draw(info, _curEvent, _curEvent->_title, _player, _curSp);
@@ -366,10 +366,10 @@ void Manager::calcActiveSeq(Info &info, pyrodactyl::level::Level &level, const R
// Set all the pointers to the new values
_curEvent = _eventMap[info.curLocID()].curEvent(_activeSeq);
_oh.reset(_curEvent->_title);
- _curSp = level.GetSprite(_curEvent->_title);
+ _curSp = level.getSprite(_curEvent->_title);
// The player character's dialog is drawn a bit differently compared to others
- _player = (_curEvent->_title == level.PlayerID());
+ _player = (_curEvent->_title == level.playerId());
switch (_curEvent->_type) {
case EVENT_ANIM:
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index c789a801043..5adcc7850a9 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -78,15 +78,15 @@ void Game::Init(const Common::String &filename) {
if (nodeValid("hud", node)) {
loadStr(path, "layout", node->first_node("hud"));
- hud.load(path, level.talk_notify, level.dest_marker);
+ hud.load(path, level._talkNotify, level._destMarker);
}
if (nodeValid("sprite", node)) {
loadStr(path, "animation", node->first_node("sprite"));
- level.LoadMoves(path);
+ level.loadMoves(path);
loadStr(path, "constant", node->first_node("sprite"));
- level.LoadConst(path);
+ level.loadConst(path);
}
if (nodeValid("event", node)) {
@@ -125,28 +125,28 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
}
// Load the level itself
- level.pop = pop_default;
+ level._pop = pop_default;
level.load(g_engine->_filePath->level[id].layout, info, game_over, player_x, player_y);
// Set the current location
info.curLocID(id);
info.curLocName(g_engine->_filePath->level[id].name);
- map.player_pos = level.map_loc;
+ map.player_pos = level._mapLoc;
// Update and center the world map to the player current position
map.Update(info);
map.Center(map.player_pos);
// If this is our first time visiting a level, reveal the associated area on the world map
- map.RevealAdd(level.map_clip.id, level.map_clip.rect);
+ map.RevealAdd(level._mapClip._id, level._mapClip._rect);
// Initialize inventory
- info._inv.Init(level.PlayerID());
+ info._inv.Init(level.playerId());
// Initialize journal
- info._journal.Init(level.PlayerID());
+ info._journal.Init(level.playerId());
- level.PreDraw();
+ level.preDraw();
return true;
}
@@ -194,7 +194,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
break;
case HS_CHAR:
ToggleState(STATE_CHARACTER);
- gem._per.Cache(info, level.PlayerID(), level);
+ gem._per.Cache(info, level.playerId(), level);
break;
case HS_JOURNAL:
ToggleState(STATE_JOURNAL);
@@ -209,12 +209,12 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
if (state == STATE_GAME) {
if (gem.eventInProgress()) {
- gem.handleEvents(info, level.PlayerID(), Event, hud, level, event_res);
+ gem.handleEvents(info, level.playerId(), Event, hud, level, event_res);
if (ApplyResult())
Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
- info._talkKeyDown = g_engine->_inputManager->state(IG_TALK) || level.ContainsClick(info.lastPerson(), Event);
+ info._talkKeyDown = g_engine->_inputManager->state(IG_TALK) || level.containsClick(info.lastPerson(), Event);
level.handleEvents(info, Event);
@@ -285,7 +285,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
break;
case STATE_JOURNAL:
- if (info._journal.handleEvents(level.PlayerID(), Event)) {
+ if (info._journal.handleEvents(level.playerId(), Event)) {
// This means we selected the "find on map" button, so we need to:
// switch to the world map, and highlight the appropriate quest marker
map.SelectDest(info._journal.marker_title);
@@ -293,10 +293,10 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
break;
case STATE_CHARACTER:
- gem._per.handleEvents(info, level.PlayerID(), Event);
+ gem._per.handleEvents(info, level.playerId(), Event);
break;
case STATE_INVENTORY:
- info._inv.handleEvents(level.PlayerID(), Event);
+ info._inv.handleEvents(level.playerId(), Event);
break;
case STATE_HELP:
g_engine->_helpScreen->handleEvents(Event);
@@ -469,7 +469,7 @@ void Game::handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
void Game::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
switch (state) {
case STATE_GAME:
- hud.internalEvents(level.ShowMap());
+ hud.internalEvents(level.showMap());
event_res.clear();
{
@@ -509,42 +509,42 @@ void Game::draw() {
if (gem.eventInProgress())
gem.draw(info, hud, level);
else
- hud.draw(info, level.PlayerID());
+ hud.draw(info, level.playerId());
break;
case STATE_PAUSE:
g_engine->_imageManager->dimScreen();
hud.pause.draw(hud.back);
- hud.draw(info, level.PlayerID());
+ hud.draw(info, level.playerId());
break;
case STATE_MAP:
g_engine->_imageManager->dimScreen();
map.draw(info);
- hud.draw(info, level.PlayerID());
+ hud.draw(info, level.playerId());
hud.back.draw();
break;
case STATE_JOURNAL:
g_engine->_imageManager->dimScreen();
- info._journal.draw(level.PlayerID());
- hud.draw(info, level.PlayerID());
+ info._journal.draw(level.playerId());
+ hud.draw(info, level.playerId());
hud.back.draw();
break;
case STATE_CHARACTER:
g_engine->_imageManager->dimScreen();
- gem._per.draw(info, level.PlayerID());
- hud.draw(info, level.PlayerID());
+ gem._per.draw(info, level.playerId());
+ hud.draw(info, level.playerId());
hud.back.draw();
break;
case STATE_INVENTORY:
g_engine->_imageManager->dimScreen();
- info.invDraw(level.PlayerID());
- hud.draw(info, level.PlayerID());
+ info.invDraw(level.playerId());
+ hud.draw(info, level.playerId());
hud.back.draw();
break;
case STATE_HELP:
g_engine->_imageManager->dimScreen();
g_engine->_helpScreen->draw();
hud.back.draw();
- hud.draw(info, level.PlayerID());
+ hud.draw(info, level.playerId());
break;
case STATE_LOSE_MENU:
hud.gom.draw();
@@ -580,11 +580,11 @@ bool Game::ApplyResult() {
break;
case ER_DEST:
if (i->_x < 0 || i->_y < 0) {
- info._journal.Marker(level.PlayerID(), i->_val, false);
+ info._journal.Marker(level.playerId(), i->_val, false);
map.DestDel(i->_val);
} else {
map.DestAdd(i->_val, i->_x, i->_y);
- info._journal.Marker(level.PlayerID(), i->_val, true);
+ info._journal.Marker(level.playerId(), i->_val, true);
info._unread._map = true;
}
break;
@@ -604,7 +604,7 @@ bool Game::ApplyResult() {
LoadLevel(i->_val, i->_x, i->_y);
break;
case ER_MOVE:
- for (auto &o : level.objects) {
+ for (auto &o : level._objects) {
if (i->_val == o.id()) {
o.x(i->_x);
o.y(i->_y);
@@ -614,19 +614,19 @@ bool Game::ApplyResult() {
break;
case ER_PLAYER:
// First stop the movement of the current player sprite
- level.PlayerStop();
+ level.playerStop();
// Then swap to the new id
- level.PlayerID(i->_val, i->_x, i->_y);
+ level.playerId(i->_val, i->_x, i->_y);
// Stop the new player sprite's movement as well
- level.PlayerStop();
+ level.playerStop();
break;
case ER_SAVE:
CreateSaveGame(SAVEGAME_EVENT);
break;
case ER_SYNC:
- level.CalcProperties(info);
+ level.calcProperties(info);
map.Update(info);
break;
case ER_QUIT:
@@ -637,7 +637,7 @@ bool Game::ApplyResult() {
}
}
- gem._per.Cache(info, level.PlayerID(), level);
+ gem._per.Cache(info, level.playerId(), level);
event_res.clear();
return false;
}
@@ -703,7 +703,7 @@ void Game::loadState(Common::SeekableReadStream *stream) {
if (nodeValid("level", node))
level.loadState(node->first_node("level"));
- gem._per.Cache(info, level.PlayerID(), level);
+ gem._per.Cache(info, level.playerId(), level);
Common::String playtime;
loadStr(playtime, "time", node);
@@ -737,8 +737,8 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
// Save player character name
Common::String char_name;
- if (info.personValid(level.PlayerID()))
- char_name = info.personGet(level.PlayerID()).name;
+ if (info.personValid(level.playerId()))
+ char_name = info.personGet(level.playerId()).name;
root->append_attribute(doc.allocate_attribute("char_name", char_name.c_str()));
// Difficulty
@@ -751,7 +751,7 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
root->append_attribute(doc.allocate_attribute("file", savefile.ironman.c_str()));
// Preview image used
- root->append_attribute(doc.allocate_attribute("preview", level.preview_path.c_str()));
+ root->append_attribute(doc.allocate_attribute("preview", level._previewPath.c_str()));
// Time played
Common::String playtime = clock.GetTime();
diff --git a/engines/crab/level/LevelExit.cpp b/engines/crab/level/LevelExit.cpp
index 7e2d5f09a36..bfb31017948 100644
--- a/engines/crab/level/LevelExit.cpp
+++ b/engines/crab/level/LevelExit.cpp
@@ -35,20 +35,20 @@ namespace Crab {
using namespace pyrodactyl::level;
void Exit::load(rapidxml::xml_node<char> *node) {
- dim.load(node);
- loadStr(name, "name", node);
+ _dim.load(node);
+ loadStr(_name, "name", node);
if (nodeValid("properties", node)) {
rapidxml::xml_node<char> *propertynode = node->first_node("properties");
for (auto n = propertynode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
- Common::String node_name;
- loadStr(node_name, "name", n);
- if (node_name == "entry_x") {
- if (!loadNum(entry.x, "value", n))
- entry.x = -1;
- } else if (node_name == "entry_y") {
- if (!loadNum(entry.y, "value", n))
- entry.y = -1;
+ Common::String nodeName;
+ loadStr(nodeName, "name", n);
+ if (nodeName == "entry_x") {
+ if (!loadNum(_entry.x, "value", n))
+ _entry.x = -1;
+ } else if (nodeName == "entry_y") {
+ if (!loadNum(_entry.y, "value", n))
+ _entry.y = -1;
}
}
}
diff --git a/engines/crab/level/LevelExit.h b/engines/crab/level/LevelExit.h
index a9cfb256b15..ef8b69531f9 100644
--- a/engines/crab/level/LevelExit.h
+++ b/engines/crab/level/LevelExit.h
@@ -41,12 +41,14 @@ namespace Crab {
namespace pyrodactyl {
namespace level {
struct Exit {
- Common::String name;
- Shape dim;
- Vector2i entry;
-
- Exit() : entry(-1, -1) {}
- Exit(rapidxml::xml_node<char> *node) { load(node); }
+ Common::String _name;
+ Shape _dim;
+ Vector2i _entry;
+
+ Exit() : _entry(-1, -1) {}
+ Exit(rapidxml::xml_node<char> *node) {
+ load(node);
+ }
void load(rapidxml::xml_node<char> *node);
};
diff --git a/engines/crab/level/MusicArea.cpp b/engines/crab/level/MusicArea.cpp
index 99d69846340..63cbcfc4914 100644
--- a/engines/crab/level/MusicArea.cpp
+++ b/engines/crab/level/MusicArea.cpp
@@ -43,11 +43,11 @@ void MusicArea::load(rapidxml::xml_node<char> *node, const bool &echo) {
Common::String name;
if (loadStr(name, "name", n, echo)) {
if (name == "music")
- loadBool(track, "value", n, echo);
+ loadBool(_track, "value", n, echo);
else if (name == "id")
- loadNum(id, "value", n, echo);
+ loadNum(_id, "value", n, echo);
else if (name == "loops")
- loadNum(loops, "value", n, echo);
+ loadNum(_loops, "value", n, echo);
}
}
}
diff --git a/engines/crab/level/MusicArea.h b/engines/crab/level/MusicArea.h
index 445bf959179..58a05132f33 100644
--- a/engines/crab/level/MusicArea.h
+++ b/engines/crab/level/MusicArea.h
@@ -41,18 +41,18 @@ namespace pyrodactyl {
namespace level {
struct MusicInfo {
// Are we playing a sound effect or a music track
- bool track;
+ bool _track;
// The id of the music track or sound effect being played
- int id;
+ int _id;
// The amount of loops
- int loops;
+ int _loops;
MusicInfo() {
- track = false;
- id = -1;
- loops = -1;
+ _track = false;
+ _id = -1;
+ _loops = -1;
}
~MusicInfo() {}
};
diff --git a/engines/crab/level/Stairs.cpp b/engines/crab/level/Stairs.cpp
index 1a924d16dbd..59f4ed6c512 100644
--- a/engines/crab/level/Stairs.cpp
+++ b/engines/crab/level/Stairs.cpp
@@ -43,9 +43,9 @@ void Stairs::load(rapidxml::xml_node<char> *node, const bool &echo) {
Common::String name;
if (loadStr(name, "name", n, echo)) {
if (name == "x")
- loadNum(modifier.x, "value", n, echo);
+ loadNum(_modifier.x, "value", n, echo);
else if (name == "y")
- loadNum(modifier.y, "value", n, echo);
+ loadNum(_modifier.y, "value", n, echo);
}
}
}
diff --git a/engines/crab/level/Stairs.h b/engines/crab/level/Stairs.h
index 8daa65ca98e..2a0592964d8 100644
--- a/engines/crab/level/Stairs.h
+++ b/engines/crab/level/Stairs.h
@@ -41,9 +41,9 @@ namespace level {
class Stairs : public Shape {
public:
// The modifier by which the velocity of the character walking over the stairs is changed
- Vector2f modifier;
+ Vector2f _modifier;
- Stairs() : modifier(1.0f, 1.0f) {}
+ Stairs() : _modifier(1.0f, 1.0f) {}
~Stairs() {}
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index ca80c844e5f..f3d85ce9962 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -46,36 +46,36 @@ using namespace pyrodactyl::event;
// this function cleans up everything to make it good as new (get it)
//------------------------------------------------------------------------
void Level::reset() {
- if (player_index > 0 && objects.size() > player_index)
- objects[player_index]._pathing.shutdown();
+ if (_playerIndex > 0 && _objects.size() > _playerIndex)
+ _objects[_playerIndex]._pathing.shutdown();
- player_index = 0;
- terrain.reset();
+ _playerIndex = 0;
+ _terrain.reset();
- objects.clear();
- obj_seq.clear();
- background.clear();
- fly.clear();
+ _objects.clear();
+ _objSeq.clear();
+ _background.clear();
+ _fly.clear();
Camera(0, 0, g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h);
- showmap.Set(true);
- inside_exit = false;
- first_hit = true;
- music.id = -1;
- preview_path.clear();
+ _showmap.set(true);
+ _insideExit = false;
+ _firstHit = true;
+ _music._id = -1;
+ _previewPath.clear();
- img.deleteImage();
+ _img.deleteImage();
}
//------------------------------------------------------------------------
// Purpose: Get index of a sprite in the object array
//------------------------------------------------------------------------
-pyrodactyl::anim::Sprite *Level::GetSprite(const Common::String &id) {
+pyrodactyl::anim::Sprite *Level::getSprite(const Common::String &id) {
int count = 0;
- for (auto i = objects.begin(); i != objects.end(); ++i, ++count)
+ for (auto i = _objects.begin(); i != _objects.end(); ++i, ++count)
if (i->id() == id)
- return &objects[count];
+ return &_objects[count];
return NULL;
}
@@ -83,8 +83,8 @@ pyrodactyl::anim::Sprite *Level::GetSprite(const Common::String &id) {
//------------------------------------------------------------------------
// Purpose: Figure visibility and let the AI see what moves are allowed
//------------------------------------------------------------------------
-void Level::CalcProperties(Info &info) {
- for (auto i = objects.begin(); i != objects.end(); ++i)
+void Level::calcProperties(pyrodactyl::event::Info &info) {
+ for (auto i = _objects.begin(); i != _objects.end(); ++i)
i->calcProperties(info);
}
@@ -98,21 +98,21 @@ void Level::handleEvents(Info &info, const Common::Event &Event) {
if (!g_engine->_mouse->_hover) {
// The destination coordinate is set by adding camera position to click position
Vector2i dest = g_engine->_mouse->_button;
- dest.x += camera.x;
- dest.y += camera.y;
+ dest.x += _camera.x;
+ dest.y += _camera.y;
- Rect b = objects[player_index].boundRect();
+ Rect b = _objects[_playerIndex].boundRect();
b.w /= 2;
b.h /= 2;
b.x = dest.x - b.w / 2;
b.y = dest.y - b.h / 2;
- objects[player_index].setDestPathfinding(dest, !terrain.InsideNoWalk(dest));
+ _objects[_playerIndex].setDestPathfinding(dest, !_terrain.InsideNoWalk(dest));
}
}
}
- objects[player_index].handleEvents(info, camera, sc_default, Event);
+ _objects[_playerIndex].handleEvents(info, _camera, _scDefault, Event);
}
#if 0
@@ -147,16 +147,16 @@ void Level::handleEvents(Info &info, const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Swap the player sprites
//------------------------------------------------------------------------
-void Level::PlayerID(const Common::String &ID, const int &X, const int &Y) {
+void Level::playerId(const Common::String &ID, const int &x, const int &y) {
int index = 0;
- for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
+ for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index) {
if (i->id() == ID) {
- player_index = index;
+ _playerIndex = index;
- if (X != -1)
- i->x(X);
- if (Y != -1)
- i->y(Y);
+ if (x != -1)
+ i->x(x);
+ if (y != -1)
+ i->y(y);
break;
}
@@ -167,9 +167,9 @@ void Level::PlayerID(const Common::String &ID, const int &X, const int &Y) {
// Purpose: Rearrange stuff after resolution change
//------------------------------------------------------------------------
void Level::setUI() {
- camera.w = g_engine->_screenSettings->cur.w;
- camera.h = g_engine->_screenSettings->cur.h;
- SetCamera();
+ _camera.w = g_engine->_screenSettings->cur.w;
+ _camera.h = g_engine->_screenSettings->cur.h;
+ setCamera();
}
} // End of namespace Crab
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index cb42d0f2679..28a13e70072 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -51,153 +51,173 @@ namespace pyrodactyl {
namespace level {
class Level {
// The .tmx file to import terrain from
- TMX::TMXMap terrain;
+ TMX::TMXMap _terrain;
// The pathfinding grid for the level
- PathfindingGrid pathfindingGrid;
+ PathfindingGrid _pathfindingGrid;
// The area we display to the player
- Rect camera;
+ Rect _camera;
// The player sprite location in the object list
- unsigned int player_index;
+ unsigned int _playerIndex;
// The order in which to draw the sprites
- Common::MultiMap<int, pyrodactyl::anim::Sprite *> obj_seq;
+ Common::MultiMap<int, pyrodactyl::anim::Sprite *> _objSeq;
// The file index which contains the fighting moves of all characters
- Common::Array<Common::String> anim_set;
+ Common::Array<Common::String> _animSet;
// The movement sets for sprites in levels
- Common::Array<pyrodactyl::ai::MovementSet> move_set;
+ Common::Array<pyrodactyl::ai::MovementSet> _moveSet;
// These sprites are only for animated objects and cannot be interacted with
- Common::Array<pyrodactyl::anim::Sprite> background;
+ Common::Array<pyrodactyl::anim::Sprite> _background;
// These sprites fly across the screen randomly
- Common::Array<pyrodactyl::anim::Sprite> fly;
+ Common::Array<pyrodactyl::anim::Sprite> _fly;
// The id of the music track being played
- MusicInfo music;
+ MusicInfo _music;
// Is the world map accessible from this level?
- MapVis showmap;
+ MapVis _showmap;
// We disable exits when player is fighting enemies - this is used to check if we are in an exit area WHILE fighting enemies
// If we are fighting inside exit area, the level switch is delayed until we walk out of exit and back in
// to prevent instant level switch as soon as you beat all enemies
- bool inside_exit;
+ bool _insideExit;
- bool first_hit;
+ bool _firstHit;
// Default sprite parameters
- pyrodactyl::ai::SpriteConstant sc_default;
+ pyrodactyl::ai::SpriteConstant _scDefault;
// Protected level functions
- bool CollidingWithObject(pyrodactyl::event::Info &info, Common::String &id);
- bool CollidingWithLevel(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s);
- bool PlayerInCombat(pyrodactyl::event::Info &info);
- void BattleAlert(pyrodactyl::event::Info &info);
+ bool collidingWithObject(pyrodactyl::event::Info &info, Common::String &id);
+ bool collidingWithLevel(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s);
+ bool playerInCombat(pyrodactyl::event::Info &info);
+ void battleAlert(pyrodactyl::event::Info &info);
- void SortObjectsToDraw();
- void MoveObject(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s);
+ void sortObjectsToDraw();
+ void moveObject(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s);
- void Think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
- Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq, Common::String &id);
+ void think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
+ Common::Array<pyrodactyl::event::EventSeqInfo> &endSeq, Common::String &id);
- void DrawObjects(pyrodactyl::event::Info &info);
- void SetCamera();
+ void drawObjects(pyrodactyl::event::Info &info);
+ void setCamera();
- bool LayerVisible(pyrodactyl::anim::Sprite *obj);
+ bool layerVisible(pyrodactyl::anim::Sprite *obj);
public:
// The objects in the level, and the player character
- Common::Array<pyrodactyl::anim::Sprite> objects;
+ Common::Array<pyrodactyl::anim::Sprite> _objects;
// The notification text drawn if the player is able to talk to a sprite
- TalkNotify talk_notify;
+ TalkNotify _talkNotify;
// Used for drawing the destination marker for point and click movement
- PlayerDestMarker dest_marker;
+ PlayerDestMarker _destMarker;
// The location of this level on the world map
- Vector2i map_loc;
+ Vector2i _mapLoc;
// The clip revealed by this level on the world map
struct MapClip {
// Which world map is this clip added to?
- int id;
+ int _id;
// The clip itself
- Rect rect;
+ Rect _rect;
- MapClip() { id = 0; }
- } map_clip;
+ MapClip() {
+ _id = 0;
+ }
+ } _mapClip;
// Used to draw ambient dialog
- pyrodactyl::ui::ParagraphData pop;
+ pyrodactyl::ui::ParagraphData _pop;
// The path of the preview image
- Common::String preview_path;
+ Common::String _previewPath;
// A full rendered image of the level
- pyrodactyl::image::Image img;
+ pyrodactyl::image::Image _img;
- Level() : player_index(0) { reset(); }
- ~Level() { reset(); }
+ Level() : _playerIndex(0) {
+ reset();
+ }
+
+ ~Level() {
+ reset();
+ }
void reset();
void Camera(int x, int y, int w, int h) {
- camera.x = x;
- camera.y = y;
- camera.w = w;
- camera.h = h;
+ _camera.x = x;
+ _camera.y = y;
+ _camera.w = w;
+ _camera.h = h;
}
- Rect Camera() { return camera; }
- void PlayerStop() { objects[player_index].stop(); }
+ Rect camera() {
+ return _camera;
+ }
- const Common::String &PlayerID() { return objects[player_index].id(); }
- void PlayerID(const Common::String &ID, const int &X, const int &Y);
+ void playerStop() {
+ _objects[_playerIndex].stop();
+ }
- void ShowMap(bool val) { showmap.normal = val; }
- bool ShowMap() { return showmap.current; }
+ const Common::String &playerId() {
+ return _objects[_playerIndex].id();
+ }
+
+ void playerId(const Common::String &ID, const int &x, const int &y);
+
+ void showMap(bool val) {
+ _showmap._normal = val;
+ }
+
+ bool showMap() {
+ return _showmap._current;
+ }
bool operator()(int i, int j);
// This calculates the unlocked moves for each sprite in the level, and the visibility of objects
- void CalcProperties(pyrodactyl::event::Info &info);
+ void calcProperties(pyrodactyl::event::Info &info);
// Loading function
- void load(const Common::String &filename, pyrodactyl::event::Info &info, pyrodactyl::event::TriggerSet &game_over,
- const int &player_x = -1, const int &player_y = -1);
+ void load(const Common::String &filename, pyrodactyl::event::Info &info, pyrodactyl::event::TriggerSet &gameOver,
+ const int &playerX = -1, const int &playerY = -1);
// One time load called first-time
- void LoadMoves(const Common::String &filename);
- void LoadConst(const Common::String &filename);
+ void loadMoves(const Common::String &filename);
+ void loadConst(const Common::String &filename);
// Used to see if a sprite collides with a rectangle
- void CalcTrigCollide(pyrodactyl::event::Info &info);
+ void calcTrigCollide(pyrodactyl::event::Info &info);
// See if a player clicked on the sprite in contact
- bool ContainsClick(const Common::String &id, const Common::Event &Event);
+ bool containsClick(const Common::String &id, const Common::Event &event);
#if 0
bool ContainsClick(const Common::String &id, const SDL_Event &Event);
#endif
// Get index of a sprite in the object array
- pyrodactyl::anim::Sprite *GetSprite(const Common::String &id);
+ pyrodactyl::anim::Sprite *getSprite(const Common::String &id);
void handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
#if 0
void handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
LevelResult internalEvents(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
- Common::Array<pyrodactyl::event::EventSeqInfo> &end_seq, bool EventInProgress);
+ Common::Array<pyrodactyl::event::EventSeqInfo> &endSeq, bool eventInProgress);
- void PreDraw();
- void PreDrawObjects(Graphics::ManagedSurface *surf);
+ void preDraw();
+ void preDrawObjects(Graphics::ManagedSurface *surf);
void draw(pyrodactyl::event::Info &info);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index c1f3c13e8f8..22a16bbe8bd 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -44,55 +44,55 @@ using namespace pyrodactyl::event;
//------------------------------------------------------------------------
// Purpose: Let the level tick along and notify if we go into an exit
//------------------------------------------------------------------------
-LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &end_seq, bool EventInProgress) {
- LevelResult l_result;
+LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq, bool eventInProgress) {
+ LevelResult lResult;
// input.internalEvents();
- CalcTrigCollide(info);
-
- if (terrain.CollideWithExit(objects[player_index].boundRect(), l_result)) {
- if (PlayerInCombat(info)) {
- inside_exit = true;
- } else if (inside_exit == false) {
- l_result.type = LR_LEVEL;
- return l_result;
+ calcTrigCollide(info);
+
+ if (_terrain.CollideWithExit(_objects[_playerIndex].boundRect(), lResult)) {
+ if (playerInCombat(info)) {
+ _insideExit = true;
+ } else if (_insideExit == false) {
+ lResult.type = LR_LEVEL;
+ return lResult;
}
} else {
- inside_exit = false;
+ _insideExit = false;
- if (PlayerInCombat(info))
- showmap.current = false;
+ if (playerInCombat(info))
+ _showmap._current = false;
else
- showmap.current = showmap.normal;
+ _showmap._current = _showmap._normal;
}
- if (EventInProgress)
- PlayerStop();
+ if (eventInProgress)
+ playerStop();
else
- Think(info, result, end_seq, l_result.val);
+ think(info, result, endSeq, lResult.val);
- if (l_result.val != "")
- info.lastPerson(l_result.val);
- else if (CollidingWithObject(info, l_result.val))
- info.lastPerson(l_result.val);
+ if (lResult.val != "")
+ info.lastPerson(lResult.val);
+ else if (collidingWithObject(info, lResult.val))
+ info.lastPerson(lResult.val);
else
info.lastPerson("");
- return l_result;
+ return lResult;
}
//------------------------------------------------------------------------
// Purpose: Let the AI think and animate the level
//------------------------------------------------------------------------
-void Level::Think(Info &info, Common::Array<EventResult> &result,
- Common::Array<EventSeqInfo> &end_seq, Common::String &id) {
+void Level::think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
+ Common::Array<pyrodactyl::event::EventSeqInfo> &endSeq, Common::String &id) {
unsigned int index = 0;
- for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
+ for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index) {
// Only bother if the sprite is visible
if (i->visible()) {
// TODO: Find a place where this should be initialized... (SZ)
if (i->_pathing.grid == NULL)
- i->_pathing.initialize(&pathfindingGrid);
+ i->_pathing.initialize(&_pathfindingGrid);
// If a sprite is dead, nothing else matters
if (info.state(i->id()) == PST_DYING) {
@@ -109,21 +109,21 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
i->_pathing.Update(0);
// For the AI sprites
- if (index != player_index) {
+ if (index != _playerIndex) {
switch (info.state(i->id())) {
case PST_FIGHT: {
// Only attack if the player is alive
- if (info.state(objects[player_index].id()) < PST_KO)
- i->attack(info, objects[player_index], sc_default);
+ if (info.state(_objects[_playerIndex].id()) < PST_KO)
+ i->attack(info, _objects[_playerIndex], _scDefault);
} break;
case PST_FLEE:
- i->flee(info, terrain.area_exit, sc_default);
+ i->flee(info, _terrain.area_exit, _scDefault);
break;
case PST_NORMAL:
- if (i->takingDamage(objects[player_index], sc_default)) {
- if (first_hit) {
- BattleAlert(info);
- first_hit = false;
+ if (i->takingDamage(_objects[_playerIndex], _scDefault)) {
+ if (_firstHit) {
+ battleAlert(info);
+ _firstHit = false;
}
}
/*else
@@ -134,8 +134,8 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
}
// Only do this if the player is alive
- if (info.state(objects[player_index].id()) < PST_KO)
- objects[player_index].exchangeDamage(info, *i, sc_default);
+ if (info.state(_objects[_playerIndex].id()) < PST_KO)
+ _objects[_playerIndex].exchangeDamage(info, *i, _scDefault);
} else {
// For the player sprite
boundRect = i->boundRect();
@@ -143,11 +143,11 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
i->_pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
i->_pathing.Update(0);
- i->moveToDestPathfinding(info, sc_default);
+ i->moveToDestPathfinding(info, _scDefault);
}
- i->internalEvents(info, PlayerID(), result, end_seq);
- MoveObject(info, *i);
+ i->internalEvents(info, playerId(), result, endSeq);
+ moveObject(info, *i);
}
i->animate(info);
@@ -155,13 +155,13 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
}
// Background sprites don't move
- for (auto &i : background)
+ for (auto &i : _background)
i.animate(PST_NORMAL);
// Flier sprites fly across the screen from left to right or vice versa
// The movement is semi-random
- for (auto &i : fly) {
- i.flyAround(camera, sc_default);
+ for (auto &i : _fly) {
+ i.flyAround(_camera, _scDefault);
i.animate(PST_NORMAL);
}
}
@@ -169,10 +169,10 @@ void Level::Think(Info &info, Common::Array<EventResult> &result,
//------------------------------------------------------------------------
// Purpose: Once a player provokes any sprite, call this function
//------------------------------------------------------------------------
-void Level::BattleAlert(Info &info) {
+void Level::battleAlert(pyrodactyl::event::Info &info) {
unsigned int index = 0;
- for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
- if (index != player_index && i->visible() && info.state(i->id()) != PST_KO) {
+ for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index) {
+ if (index != _playerIndex && i->visible() && info.state(i->id()) != PST_KO) {
switch (info.type(i->id())) {
case PE_NEUTRAL:
case PE_HOSTILE:
@@ -191,26 +191,26 @@ void Level::BattleAlert(Info &info) {
//------------------------------------------------------------------------
// Purpose: Move a sprite according to its velocity
//------------------------------------------------------------------------
-void Level::MoveObject(Info &info, pyrodactyl::anim::Sprite &s) {
+void Level::moveObject(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s) {
// Update x,y coordinates according to velocity
- s.move(sc_default);
+ s.move(_scDefault);
// First check collision with objects and forbidden areas inside a level
- if (CollidingWithLevel(info, s))
+ if (collidingWithLevel(info, s))
s.resolveCollide();
// Finally see if we are inside the overall level bounds
- if (!terrain.InsideWalk(s.boundRect()))
- s.resolveInside(terrain.AreaWalk());
+ if (!_terrain.InsideWalk(s.boundRect()))
+ s.resolveInside(_terrain.AreaWalk());
}
//------------------------------------------------------------------------
// Purpose: If any other object is trying to kill you, you are in combat
//------------------------------------------------------------------------
-bool Level::PlayerInCombat(Info &info) {
+bool Level::playerInCombat(pyrodactyl::event::Info &info) {
unsigned int index = 0;
- for (auto i = objects.begin(); i != objects.end(); ++i, ++index)
- if (index != player_index && info.state(i->id()) == PST_FIGHT && i->visible())
+ for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index)
+ if (index != _playerIndex && info.state(i->id()) == PST_FIGHT && i->visible())
return true;
return false;
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 8cdb67572b8..cd7e481859a 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -45,13 +45,13 @@ using namespace pyrodactyl::music;
//------------------------------------------------------------------------
// Purpose: See if player clicked on a sprite they are colliding with
//------------------------------------------------------------------------
-bool Level::ContainsClick(const Common::String &id, const Common::Event &Event) {
+bool Level::containsClick(const Common::String &id, const Common::Event &event) {
// If mouse is moved and is hovering on the specified sprite (id), set hover = true
- if (Event.type == Common::EVENT_MOUSEMOVE) {
- for (auto &i : objects) {
+ if (event.type == Common::EVENT_MOUSEMOVE) {
+ for (auto &i : _objects) {
Rect r = i.posRect();
- if (r.Contains(g_engine->_mouse->_motion.x + camera.x, g_engine->_mouse->_motion.y + camera.y)) {
+ if (r.Contains(g_engine->_mouse->_motion.x + _camera.x, g_engine->_mouse->_motion.y + _camera.y)) {
// This is to show the sprite's name on top of their head
i._hover = true;
@@ -64,10 +64,10 @@ bool Level::ContainsClick(const Common::String &id, const Common::Event &Event)
return false;
} else if (g_engine->_mouse->pressed()) {
- for (auto &i : objects) {
+ for (auto &i : _objects) {
if (i.id() == id) {
Rect r = i.posRect();
- if (r.Contains(g_engine->_mouse->_button.x + camera.x, g_engine->_mouse->_button.y + camera.y)) {
+ if (r.Contains(g_engine->_mouse->_button.x + _camera.x, g_engine->_mouse->_button.y + _camera.y)) {
g_engine->_mouse->_hover = true;
return true;
}
@@ -118,12 +118,12 @@ bool Level::ContainsClick(const Common::String &id, const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Find if a layer is visible (used only for objects with layers associated with them)
//------------------------------------------------------------------------
-bool Level::LayerVisible(Sprite *obj) {
+bool Level::layerVisible(pyrodactyl::anim::Sprite *obj) {
if (obj->_layer < 0)
return true;
- if ((unsigned int)obj->_layer < terrain.layer.size())
- return terrain.layer[obj->_layer].collide;
+ if ((unsigned int)obj->_layer < _terrain.layer.size())
+ return _terrain.layer[obj->_layer].collide;
return false;
}
@@ -132,27 +132,27 @@ bool Level::LayerVisible(Sprite *obj) {
// Purpose: Check if a sprite is colliding with the trigger areas
// Common::String &id is set to the id of colliding object
//------------------------------------------------------------------------
-void Level::CalcTrigCollide(Info &info) {
- for (auto i = objects.begin(); i != objects.end(); ++i)
+void Level::calcTrigCollide(pyrodactyl::event::Info &info) {
+ for (auto i = _objects.begin(); i != _objects.end(); ++i)
if (info.personValid(i->id()))
- terrain.CollideWithTrigger(i->boundRect(), info.personGet(i->id()).trig);
+ _terrain.CollideWithTrigger(i->boundRect(), info.personGet(i->id()).trig);
}
//------------------------------------------------------------------------
// Purpose: Check if a sprite is colliding with interactive objects
// Common::String &id is set to the id of colliding object
//------------------------------------------------------------------------
-bool Level::CollidingWithObject(Info &info, Common::String &id) {
+bool Level::collidingWithObject(pyrodactyl::event::Info &info, Common::String &id) {
// Clip and Bounding rectangle of player
- Rect p_pos = objects[player_index].posRect(), p_bound = objects[player_index].boundRect();
+ Rect pPos = _objects[_playerIndex].posRect(), pBound = _objects[_playerIndex].boundRect();
unsigned int index = 0;
- for (auto i = objects.begin(); i != objects.end(); ++i, ++index) {
- if (i->visible() && player_index != index && info.state(i->id()) == PST_NORMAL) {
+ for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index) {
+ if (i->visible() && _playerIndex != index && info.state(i->id()) == PST_NORMAL) {
// Clip and bounding rectangles for the NPC sprite
- Rect i_pos = i->posRect(), i_bound = i->boundRect();
+ Rect iPos = i->posRect(), iBound = i->boundRect();
- if (p_pos.Collide(i_pos) || i_pos.Contains(p_pos) || p_bound.Collide(i_bound) || i_bound.Contains(p_bound)) {
+ if (pPos.Collide(iPos) || iPos.Contains(pPos) || pBound.Collide(iBound) || iBound.Contains(pBound)) {
id = i->id();
return true;
}
@@ -166,16 +166,16 @@ bool Level::CollidingWithObject(Info &info, Common::String &id) {
// Purpose: Check if a sprite is colliding with non-interactive stuff in the level
// id is set to the id of colliding object
//------------------------------------------------------------------------
-bool Level::CollidingWithLevel(Info &info, Sprite &s) {
- terrain.CollideWithNoWalk(s.boundRect(), s._collideData);
+bool Level::collidingWithLevel(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s) {
+ _terrain.CollideWithNoWalk(s.boundRect(), s._collideData);
- terrain.CollideWithStairs(s.boundRect(), s._velMod);
+ _terrain.CollideWithStairs(s.boundRect(), s._velMod);
- if (terrain.CollideWithMusic(s.boundRect(), music)) {
- if (music.track)
- g_engine->_musicManager->PlayMusic(music.id);
+ if (_terrain.CollideWithMusic(s.boundRect(), _music)) {
+ if (_music._track)
+ g_engine->_musicManager->PlayMusic(_music._id);
else
- g_engine->_musicManager->PlayEffect(music.id, music.loops);
+ g_engine->_musicManager->PlayEffect(_music._id, _music._loops);
}
// If we are colliding with something, return true
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 1e4c5443e53..e94a3d4e9b8 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -41,22 +41,22 @@ using namespace pyrodactyl::people;
using namespace pyrodactyl::input;
// Purpose: Pre render the terrain layer
-void Level::PreDraw() {
- Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(terrain.W(), terrain.H(), *g_engine->_format);
- unsigned int layer_count = 0u;
- for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
- g_engine->_imageManager->_tileset.PreDraw(*l, terrain.tile_size, surf);
+void Level::preDraw() {
+ Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(_terrain.W(), _terrain.H(), *g_engine->_format);
+ unsigned int layerCount = 0u;
+ for (auto l = _terrain.layer.begin(); l != _terrain.layer.end(); ++l, ++layerCount) {
+ g_engine->_imageManager->_tileset.PreDraw(*l, _terrain.tile_size, surf);
// Draw the normal sprites if this is the layer for it
- if (layer_count == terrain.sprite_layer)
- PreDrawObjects(surf);
+ if (layerCount == _terrain.sprite_layer)
+ preDrawObjects(surf);
}
// This is to ensure we don't miss out on drawing sprites
- if (layer_count <= terrain.sprite_layer)
- PreDrawObjects(surf);
+ if (layerCount <= _terrain.sprite_layer)
+ preDrawObjects(surf);
- img.load(surf);
+ _img.load(surf);
delete surf;
}
@@ -64,134 +64,134 @@ void Level::PreDraw() {
// Purpose: Draw the level
//------------------------------------------------------------------------
void Level::draw(pyrodactyl::event::Info &info) {
- SetCamera();
- SortObjectsToDraw();
+ setCamera();
+ sortObjectsToDraw();
// Background sprites are assumed to be sorted by their layer count
- auto b = background.begin();
+ auto b = _background.begin();
- unsigned int layer_count = 0u;
+ unsigned int layerCount = 0u;
// Draw the terrain layer
- g_engine->_imageManager->_tileset.draw(terrain.layer[0], camera, terrain.tile_size, objects[player_index].posRect(), img);
+ g_engine->_imageManager->_tileset.draw(_terrain.layer[0], _camera, _terrain.tile_size, _objects[_playerIndex].posRect(), _img);
- Vector2i pos = objects[player_index]._aiData._dest;
- Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
+ Vector2i pos = _objects[_playerIndex]._aiData._dest;
+ Rect newpos(pos.x - (_destMarker._size.x / 2), pos.y - (_destMarker._size.y / 2), _destMarker._size.x, _destMarker._size.y);
- for (auto l = terrain.layer.begin(); l != terrain.layer.end(); ++l, ++layer_count) {
+ for (auto l = _terrain.layer.begin(); l != _terrain.layer.end(); ++l, ++layerCount) {
// Draw the background sprites
- for (; b != background.end(); ++b) {
- if ((unsigned int)b->_layer > layer_count) // We don't have any sprites to draw at this layer
+ for (; b != _background.end(); ++b) {
+ if ((unsigned int)b->_layer > layerCount) // We don't have any sprites to draw at this layer
break;
- else if ((unsigned int)b->_layer == layer_count && b->visible())
- b->draw(info, camera);
+ else if ((unsigned int)b->_layer == layerCount && b->visible())
+ b->draw(info, _camera);
}
// Draw the normal sprites if this is the layer for it
- if (layer_count == terrain.sprite_layer)
- DrawObjects(info);
+ if (layerCount == _terrain.sprite_layer)
+ drawObjects(info);
// Draw the terrain layer
- g_engine->_imageManager->_tileset.ForceDraw(*l, camera, terrain.tile_size, objects[player_index].posRect());
+ g_engine->_imageManager->_tileset.ForceDraw(*l, _camera, _terrain.tile_size, _objects[_playerIndex].posRect());
}
// Draw the background sprites
- for (; b != background.end(); ++b) {
- if ((unsigned int)b->_layer > layer_count) // We don't have any sprites to draw at this layer
+ for (; b != _background.end(); ++b) {
+ if ((unsigned int)b->_layer > layerCount) // We don't have any sprites to draw at this layer
break;
- else if ((unsigned int)b->_layer >= layer_count && b->visible())
- b->draw(info, camera);
+ else if ((unsigned int)b->_layer >= layerCount && b->visible())
+ b->draw(info, _camera);
}
// This is to ensure we don't miss out on drawing sprites
- if (layer_count <= terrain.sprite_layer)
- DrawObjects(info);
+ if (layerCount <= _terrain.sprite_layer)
+ drawObjects(info);
// Fliers are drawn above every sprite but below popup text
- for (auto &i : fly) {
+ for (auto &i : _fly) {
// Only draw if it is supposed to be flying
if (i._aiData._walk._enabled)
- i.draw(info, camera);
+ i.draw(info, _camera);
}
// Draw popup text over all level layers
- for (auto &i : objects) {
+ for (auto &i : _objects) {
// Only draw popups for visible sprites
if (i.visible()) {
if (i.popupShow())
- i.drawPopup(pop, camera);
+ i.drawPopup(_pop, _camera);
else {
// Only draw their name if they are
//(a) hovered over by the mouse, OR
//(b) are in talk range and don't have popup text over their head
if (i._hover || (info.lastPerson() == i.id() && !i.popupShow()))
- talk_notify.draw(info, i, camera);
+ _talkNotify.draw(info, i, _camera);
}
}
}
if (GameDebug)
- terrain.DrawDebug(camera);
+ _terrain.DrawDebug(_camera);
}
//------------------------------------------------------------------------
// Purpose: Draw sprites and prop layers in sequences according to depth
//------------------------------------------------------------------------
-void Level::DrawObjects(pyrodactyl::event::Info &info) {
+void Level::drawObjects(pyrodactyl::event::Info &info) {
// Draw player destination marker
- if (objects[player_index]._aiData._dest._active)
- dest_marker.draw(objects[player_index]._aiData._dest, camera);
+ if (_objects[_playerIndex]._aiData._dest._active)
+ _destMarker.draw(_objects[_playerIndex]._aiData._dest, _camera);
- Vector2i pos = objects[player_index]._aiData._dest;
- Rect newpos(pos.x - (dest_marker.size.x / 2), pos.y - (dest_marker.size.y / 2), dest_marker.size.x, dest_marker.size.y);
+ Vector2i pos = _objects[_playerIndex]._aiData._dest;
+ Rect newpos(pos.x - (_destMarker._size.x / 2), pos.y - (_destMarker._size.y / 2), _destMarker._size.x, _destMarker._size.y);
- if (terrain.prop.empty()) {
- for (auto &entry : obj_seq) {
- if (entry.second->visible() && LayerVisible(entry.second))
- entry.second->draw(info, camera);
+ if (_terrain.prop.empty()) {
+ for (auto &entry : _objSeq) {
+ if (entry.second->visible() && layerVisible(entry.second))
+ entry.second->draw(info, _camera);
}
} else {
- auto a = terrain.prop.begin();
- auto b = obj_seq.begin();
+ auto a = _terrain.prop.begin();
+ auto b = _objSeq.begin();
- while (a != terrain.prop.end() && b != obj_seq.end()) {
+ while (a != _terrain.prop.end() && b != _objSeq.end()) {
auto obj = b->second;
if (a->pos.y + a->pos.h < obj->y() + obj->h()) {
for (auto &i : a->boundRect) {
- i.draw(-camera.x, -camera.y, 128, 128, 0, 255);
- if (i.Collide(objects[player_index].posRect())) {
- g_engine->_imageManager->_tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].posRect());
+ i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
+ if (i.Collide(_objects[_playerIndex].posRect())) {
+ g_engine->_imageManager->_tileset.ForceDraw(*a, _camera, _terrain.tile_size, _objects[_playerIndex].posRect());
}
- if (i.Contains(objects[player_index]._aiData._dest)) {
- g_engine->_imageManager->_tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
+ if (i.Contains(_objects[_playerIndex]._aiData._dest)) {
+ g_engine->_imageManager->_tileset.ForceDraw(*a, _camera, _terrain.tile_size, newpos);
}
}
++a;
} else {
- if (obj->visible() && LayerVisible(obj))
- obj->draw(info, camera);
+ if (obj->visible() && layerVisible(obj))
+ obj->draw(info, _camera);
++b;
}
}
- if (a == terrain.prop.end()) {
- for (; b != obj_seq.end(); ++b) {
+ if (a == _terrain.prop.end()) {
+ for (; b != _objSeq.end(); ++b) {
auto obj = b->second;
- if (obj->visible() && LayerVisible(obj))
- obj->draw(info, camera);
+ if (obj->visible() && layerVisible(obj))
+ obj->draw(info, _camera);
}
- } else if (b == obj_seq.end()) {
- for (; a != terrain.prop.end(); ++a) {
+ } else if (b == _objSeq.end()) {
+ for (; a != _terrain.prop.end(); ++a) {
for (auto &i : a->boundRect) {
- i.draw(-camera.x, -camera.y, 128, 128, 0, 255);
- if (i.Collide(objects[player_index].posRect())) {
- g_engine->_imageManager->_tileset.ForceDraw(*a, camera, terrain.tile_size, objects[player_index].posRect());
+ i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
+ if (i.Collide(_objects[_playerIndex].posRect())) {
+ g_engine->_imageManager->_tileset.ForceDraw(*a, _camera, _terrain.tile_size, _objects[_playerIndex].posRect());
}
- if (i.Contains(objects[player_index]._aiData._dest)) {
- g_engine->_imageManager->_tileset.ForceDraw(*a, camera, terrain.tile_size, newpos);
+ if (i.Contains(_objects[_playerIndex]._aiData._dest)) {
+ g_engine->_imageManager->_tileset.ForceDraw(*a, _camera, _terrain.tile_size, newpos);
}
}
}
@@ -199,27 +199,27 @@ void Level::DrawObjects(pyrodactyl::event::Info &info) {
}
}
-void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
- if (terrain.prop.empty()) {
+void Level::preDrawObjects(Graphics::ManagedSurface *surf) {
+ if (_terrain.prop.empty()) {
return;
} else {
- auto a = terrain.prop.begin();
- auto b = obj_seq.begin();
+ auto a = _terrain.prop.begin();
+ auto b = _objSeq.begin();
- while (a != terrain.prop.end() && b != obj_seq.end()) {
+ while (a != _terrain.prop.end() && b != _objSeq.end()) {
auto obj = b->second;
if (a->pos.y + a->pos.h < obj->y() + obj->h()) {
- g_engine->_imageManager->_tileset.PreDraw(*a, terrain.tile_size, surf);
+ g_engine->_imageManager->_tileset.PreDraw(*a, _terrain.tile_size, surf);
++a;
} else {
++b;
}
}
- if (a == terrain.prop.end()) {
- } else if (b == obj_seq.end()) {
- for (; a != terrain.prop.end(); ++a)
- g_engine->_imageManager->_tileset.PreDraw(*a, terrain.tile_size, surf);
+ if (a == _terrain.prop.end()) {
+ } else if (b == _objSeq.end()) {
+ for (; a != _terrain.prop.end(); ++a)
+ g_engine->_imageManager->_tileset.PreDraw(*a, _terrain.tile_size, surf);
}
}
}
@@ -228,36 +228,36 @@ void Level::PreDrawObjects(Graphics::ManagedSurface *surf) {
// Purpose: Sort objects to draw them according to their Y coordinates
//------------------------------------------------------------------------
bool Level::operator()(int i, int j) {
- return objects[i].y() + objects[i].h() < objects[j].y() + objects[j].h();
+ return _objects[i].y() + _objects[i].h() < _objects[j].y() + _objects[j].h();
}
-void Level::SortObjectsToDraw() {
+void Level::sortObjectsToDraw() {
// add each object to the map to sort it
- obj_seq.clear();
- for (auto &object : objects)
- obj_seq.insert(Common::Pair<int, Sprite *>(object.y() + object.h(), &object));
+ _objSeq.clear();
+ for (auto &object : _objects)
+ _objSeq.insert(Common::Pair<int, Sprite *>(object.y() + object.h(), &object));
}
//------------------------------------------------------------------------
// Purpose: Center the camera on the player for scrolling levels
//------------------------------------------------------------------------
-void Level::SetCamera() {
+void Level::setCamera() {
// Use the focus points of sprites
- Vector2i focus = objects[player_index].camFocus();
+ Vector2i focus = _objects[_playerIndex].camFocus();
// Center the camera over the player
- camera.x = focus.x - (g_engine->_screenSettings->cur.w / 2);
- camera.y = focus.y - (g_engine->_screenSettings->cur.h / 2);
+ _camera.x = focus.x - (g_engine->_screenSettings->cur.w / 2);
+ _camera.y = focus.y - (g_engine->_screenSettings->cur.h / 2);
// Keep the camera in bounds
- if (camera.x > terrain.W() - camera.w)
- camera.x = terrain.W() - camera.w;
- if (camera.y > terrain.H() - camera.h)
- camera.y = terrain.H() - camera.h;
- if (camera.x < 0)
- camera.x = 0;
- if (camera.y < 0)
- camera.y = 0;
+ if (_camera.x > _terrain.W() - _camera.w)
+ _camera.x = _terrain.W() - _camera.w;
+ if (_camera.y > _terrain.H() - _camera.h)
+ _camera.y = _terrain.H() - _camera.h;
+ if (_camera.x < 0)
+ _camera.x = 0;
+ if (_camera.y < 0)
+ _camera.y = 0;
}
} // End of namespace Crab
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 8611e1fbe09..c847b5f9f27 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -51,7 +51,7 @@ bool CompSpriteLayer(const Sprite &a, const Sprite &b) {
// Purpose: Load the level
//------------------------------------------------------------------------
void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
- pyrodactyl::event::TriggerSet &game_over, const int &player_x, const int &player_y) {
+ pyrodactyl::event::TriggerSet &gameOver, const int &playerX, const int &playerY) {
reset();
XMLDoc conf(filename);
if (conf.ready()) {
@@ -60,16 +60,16 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
Common::String vis;
loadStr(vis, "map", node, false);
if (vis == "false")
- showmap.Set(false);
+ _showmap.set(false);
else
- showmap.Set(true);
+ _showmap.set(true);
if (nodeValid("preview", node))
- loadStr(preview_path, "path", node->first_node("preview"));
+ loadStr(_previewPath, "path", node->first_node("preview"));
if (nodeValid("music", node)) {
- loadNum(music.id, "id", node->first_node("music"));
- g_engine->_musicManager->PlayMusic(music.id);
+ loadNum(_music._id, "id", node->first_node("music"));
+ g_engine->_musicManager->PlayMusic(_music._id);
}
if (nodeValid("map", node)) {
@@ -78,20 +78,20 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
loadStr(path, "path", mapnode);
loadStr(tmxfile, "file", mapnode);
- terrain.load(path, tmxfile);
+ _terrain.load(path, tmxfile);
// Remember to load the terrain data before constructing the pathfinding grid
- pathfindingGrid.SetupNodes(terrain);
+ _pathfindingGrid.SetupNodes(_terrain);
- terrain.grid = &pathfindingGrid;
+ _terrain.grid = &_pathfindingGrid;
if (nodeValid("loc", mapnode))
- map_loc.load(mapnode->first_node("loc"));
+ _mapLoc.load(mapnode->first_node("loc"));
if (nodeValid("clip", mapnode)) {
rapidxml::xml_node<char> *clipnode = mapnode->first_node("clip");
- loadNum(map_clip.id, "id", clipnode);
- map_clip.rect.load(clipnode);
+ loadNum(_mapClip._id, "id", clipnode);
+ _mapClip._rect.load(clipnode);
}
}
@@ -100,18 +100,18 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
int count = 0;
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling(), ++count) {
Sprite s;
- s.load(n, anim_set);
+ s.load(n, _animSet);
Common::String str = n->name();
if (str == "player") {
- player_index = objects.size();
- if (player_x != -1 && player_y != -1) {
- s.x(player_x);
- s.y(player_y);
+ _playerIndex = _objects.size();
+ if (playerX != -1 && playerY != -1) {
+ s.x(playerX);
+ s.y(playerY);
}
}
- objects.push_back(s);
+ _objects.push_back(s);
}
}
@@ -119,79 +119,79 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
rapidxml::xml_node<char> *spritenode = node->first_node("background");
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling()) {
Sprite s;
- s.load(n, anim_set);
- background.push_back(s);
+ s.load(n, _animSet);
+ _background.push_back(s);
}
- Common::sort(background.begin(), background.end(), CompSpriteLayer);
+ Common::sort(_background.begin(), _background.end(), CompSpriteLayer);
}
if (nodeValid("fly", node)) {
rapidxml::xml_node<char> *spritenode = node->first_node("fly");
for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling()) {
Sprite s;
- s.load(n, anim_set);
+ s.load(n, _animSet);
// Set the timer target for the first time
//s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
- s._aiData._walk._timer.Target(sc_default._fly._delayMax);
+ s._aiData._walk._timer.Target(_scDefault._fly._delayMax);
- fly.push_back(s);
+ _fly.push_back(s);
}
}
if (nodeValid("movement", node)) {
rapidxml::xml_node<char> *movnode = node->first_node("movement");
for (auto n = movnode->first_node("set"); n != NULL; n = n->next_sibling("set"))
- move_set.push_back(n);
+ _moveSet.push_back(n);
}
if (nodeValid("popup", node, false))
- pop.load(node->first_node("popup"));
+ _pop.load(node->first_node("popup"));
- game_over.clear();
+ gameOver.clear();
if (nodeValid("game_over", node, false))
- game_over.load(node->first_node("game_over"));
- else if (player_index < objects.size()) {
+ gameOver.load(node->first_node("game_over"));
+ else if (_playerIndex < _objects.size()) {
// The default lose condition is the death of the player
using namespace pyrodactyl::event;
Trigger t;
t._type = TRIG_STAT;
t._target = STATNAME_HEALTH;
- t._subject = objects[player_index].id();
+ t._subject = _objects[_playerIndex].id();
t._operation = "<";
t._val = "1";
- game_over.add(t);
+ gameOver.add(t);
}
- CalcProperties(info);
+ calcProperties(info);
}
}
- SetCamera();
+ setCamera();
}
//------------------------------------------------------------------------
// Purpose: Build an index of all animation files, called once at start
//------------------------------------------------------------------------
-void Level::LoadMoves(const Common::String &filename) {
- XMLDoc mov_list(filename);
- if (mov_list.ready()) {
- rapidxml::xml_node<char> *node = mov_list.doc()->first_node("movelist");
+void Level::loadMoves(const Common::String &filename) {
+ XMLDoc movList(filename);
+ if (movList.ready()) {
+ rapidxml::xml_node<char> *node = movList.doc()->first_node("movelist");
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set")) {
- unsigned int pos = anim_set.size();
+ unsigned int pos = _animSet.size();
loadNum(pos, "id", n);
- if (pos >= anim_set.size())
- anim_set.resize(pos + 1);
+ if (pos >= _animSet.size())
+ _animSet.resize(pos + 1);
// See if there is an alternate moveset for low quality setting
// If no, just load the regular one
if (!g_engine->_screenSettings->quality) {
- if (!loadStr(anim_set[pos], "path_low", n))
- loadStr(anim_set[pos], "path", n);
+ if (!loadStr(_animSet[pos], "path_low", n))
+ loadStr(_animSet[pos], "path", n);
} else
- loadStr(anim_set[pos], "path", n);
+ loadStr(_animSet[pos], "path", n);
}
}
}
@@ -199,12 +199,12 @@ void Level::LoadMoves(const Common::String &filename) {
//------------------------------------------------------------------------
// Purpose: Load the default sprite constant parameters
//------------------------------------------------------------------------
-void Level::LoadConst(const Common::String &filename) {
+void Level::loadConst(const Common::String &filename) {
XMLDoc doc(filename);
if (doc.ready()) {
rapidxml::xml_node<char> *node = doc.doc()->first_node("constant");
if (nodeValid(node))
- sc_default.load(node);
+ _scDefault.load(node);
}
}
@@ -212,9 +212,9 @@ void Level::LoadConst(const Common::String &filename) {
// Purpose: Save all sprite positions to save file
//------------------------------------------------------------------------
void Level::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("player_index", gStrPool->Get(player_index)));
+ root->append_attribute(doc.allocate_attribute("player_index", gStrPool->Get(_playerIndex)));
- for (auto &i : objects) {
+ for (auto &i : _objects) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sprite");
i.saveState(doc, child);
root->append_node(child);
@@ -225,10 +225,10 @@ void Level::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *r
// Purpose: Load all sprite positions from save file
//------------------------------------------------------------------------
void Level::loadState(rapidxml::xml_node<char> *node) {
- loadNum(player_index, "player_index", node);
+ loadNum(_playerIndex, "player_index", node);
- auto i = objects.begin();
- for (auto *n = node->first_node("sprite"); n != NULL && i != objects.end(); n = n->next_sibling("sprite"), ++i)
+ auto i = _objects.begin();
+ for (auto *n = node->first_node("sprite"); n != NULL && i != _objects.end(); n = n->next_sibling("sprite"), ++i)
i->loadState(n);
}
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index 6c384953e5d..e86eccbb133 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -37,13 +37,13 @@ using namespace pyrodactyl::image;
using namespace pyrodactyl::level;
void PlayerDestMarker::load(rapidxml::xml_node<char> *node) {
- loadImgKey(img, "dest", node);
- size.x = g_engine->_imageManager->getTexture(img).w();
- size.y = g_engine->_imageManager->getTexture(img).h();
+ loadImgKey(_img, "dest", node);
+ _size.x = g_engine->_imageManager->getTexture(_img).w();
+ _size.y = g_engine->_imageManager->getTexture(_img).h();
}
void PlayerDestMarker::draw(const Vector2i &pos, const Rect &camera) {
- g_engine->_imageManager->draw(pos.x - (size.x / 2) - camera.x, pos.y - (size.y / 2) - camera.y, img);
+ g_engine->_imageManager->draw(pos.x - (_size.x / 2) - camera.x, pos.y - (_size.y / 2) - camera.y, _img);
}
} // End of namespace Crab
diff --git a/engines/crab/level/level_objects.h b/engines/crab/level/level_objects.h
index f6f5dcad1ca..4f3768b637f 100644
--- a/engines/crab/level/level_objects.h
+++ b/engines/crab/level/level_objects.h
@@ -41,21 +41,26 @@ namespace pyrodactyl {
namespace level {
// Is the world map accessible from this level?
struct MapVis {
- bool normal, current;
+ bool _normal, _current;
- MapVis() { Set(true); }
- void Set(bool val) {
- normal = val;
- current = val;
+ MapVis() {
+ set(true);
+ }
+
+ void set(bool val) {
+ _normal = val;
+ _current = val;
}
};
// Used for drawing the destination marker for point and click movement
struct PlayerDestMarker {
- ImageKey img;
- Vector2i size;
+ ImageKey _img;
+ Vector2i _size;
- PlayerDestMarker() { img = 0; }
+ PlayerDestMarker() {
+ _img = 0;
+ }
void load(rapidxml::xml_node<char> *node);
void draw(const Vector2i &pos, const Rect &camera);
diff --git a/engines/crab/level/talknotify.cpp b/engines/crab/level/talknotify.cpp
index 8b91c08ff3d..166da8593c0 100644
--- a/engines/crab/level/talknotify.cpp
+++ b/engines/crab/level/talknotify.cpp
@@ -37,10 +37,10 @@ using namespace pyrodactyl::level;
using namespace pyrodactyl::image;
void TalkNotify::load(rapidxml::xml_node<char> *node) {
- offset.load(node);
- loadNum(font, "font", node);
- loadAlign(align, node);
- loadNum(col, "col", node);
+ _offset.load(node);
+ loadNum(_font, "font", node);
+ loadAlign(_align, node);
+ loadNum(_col, "col", node);
}
void TalkNotify::draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s, const Rect &camera) {
@@ -48,13 +48,13 @@ void TalkNotify::draw(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s
// Find position to draw name (over the sprite's top edge)
Vector2i pos;
- pos.x = rect.x + rect.w / 2 + offset.x;
- pos.y = rect.y + offset.y;
+ pos.x = rect.x + rect.w / 2 + _offset.x;
+ pos.y = rect.y + _offset.y;
// Find the sprite name
Common::String text = info.getName(s.id());
- g_engine->_textManager->draw(pos.x - camera.x, pos.y - camera.y, text, col, font, align, true);
+ g_engine->_textManager->draw(pos.x - camera.x, pos.y - camera.y, text, _col, _font, _align, true);
}
} // End of namespace Crab
diff --git a/engines/crab/level/talknotify.h b/engines/crab/level/talknotify.h
index 896d000094c..557b1b92b0f 100644
--- a/engines/crab/level/talknotify.h
+++ b/engines/crab/level/talknotify.h
@@ -42,16 +42,16 @@ namespace pyrodactyl {
namespace level {
class TalkNotify {
// The offset to the sprite at which the name is drawn - along with alignment, font and color used to draw the name
- Vector2i offset;
- FontKey font;
- int col;
- Align align;
+ Vector2i _offset;
+ FontKey _font;
+ int _col;
+ Align _align;
public:
TalkNotify() {
- font = 0;
- col = 0;
- align = ALIGN_CENTER;
+ _font = 0;
+ _col = 0;
+ _align = ALIGN_CENTER;
}
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/rapidxml/manual.html b/engines/crab/rapidxml/manual.html
index 2c422703f4a..9f6630888f2 100644
--- a/engines/crab/rapidxml/manual.html
+++ b/engines/crab/rapidxml/manual.html
@@ -108,13 +108,13 @@ xml_attribute<> *attr = doc.allocate_attribute("href", "goo
node->append_attribute(attr);
</pre> One quirk is that nodes and attributes <i>do not own</i> the text of their names and values. This is because normally they only store pointers to the source text. So, when assigning a new name or value to the node, care must be taken to ensure proper lifetime of the string. The easiest way to achieve it is to allocate the string from the <a href="#classrapidxml_1_1xml__document" kindref="compound">xml_document</a> memory pool. In the above example this is not necessary, because we are only assigning character constants. But the code below uses <a href="#classrapidxml_1_1memory__pool_69729185bc59b0875192d667c47b8859_169729185bc59b0875192d667c47b8859" kindref="member">memory_pool::allocate_string()</a> function to allocate node name (which will have the same lifetime as the document), and assigns it to a new node: <pre>xml_document<> doc;
char *node_name = doc.allocate_string(name); // Allocate string and copy name into it
-xml_node<> *node = doc.allocate_node(node_element, node_name); // Set node name to node_name
+xml_node<> *node = doc.allocate_node(node_element, node_name); // set node name to node_name
</pre> Check <a href="#namespacerapidxml_1reference" kindref="member">Reference</a> section for description of the entire interface.</para></sect2><sect2><h3 id="namespacerapidxml_1printing">2.4 Printing XML</h3><para>You can print <code><a href="#classrapidxml_1_1xml__document" kindref="compound">xml_document</a></code> and <code><a href="#classrapidxml_1_1xml__node" kindref="compound">xml_node</a></code> objects into an XML string. Use <a href="#namespacerapidxml_b94d570fc4c4ab2423813cd0243326b1_1b94d570fc4c4ab2423813cd0243326b1" kindref="member">print()</a> function or operator <<, which are defined in <code><a href="#rapidxml__print_8hpp" kindref="compound">rapidxml_print.hpp</a></code> header. <pre>using namespace rapidxml;
xml_document<> doc; // character type defaults to char
// ... some code to fill the document
// Print to stream using operator <<
-std::cout << doc;
+std::cout << doc;
// Print to stream using print function, specifying printing flags
print(std::cout, doc, 0); // 0 means default printing flags
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 61d85e68447..e1507d23822 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -94,7 +94,7 @@ void PersonScreen::draw(pyrodactyl::event::Info &info, const Common::String &id)
}
void PersonScreen::Cache(Info &info, const Common::String &id, pyrodactyl::level::Level &level) {
- cur_sp = level.GetSprite(id);
+ cur_sp = level.getSprite(id);
if (info.personValid(id))
menu.Cache(info.personGet(id));
Commit: 8e1ae3174b2dbc431435bcb14038da0e91cd84df
https://github.com/scummvm/scummvm/commit/8e1ae3174b2dbc431435bcb14038da0e91cd84df
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make music component follow code formatting conventions
Changed paths:
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/effect.cpp
engines/crab/input/input.h
engines/crab/level/level_collide.cpp
engines/crab/level/level_load.cpp
engines/crab/mainmenu.cpp
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
engines/crab/music/musicparam.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/button.cpp
engines/crab/ui/textarea.cpp
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 6ce2c233f1b..645c93fe984 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -167,7 +167,7 @@ bool FightMoves::forceUpdate(const unsigned int &index, pyrodactyl::input::Fight
_timer.Start();
_start = true;
- g_engine->_musicManager->PlayEffect(_move[_cur]._eff._activate, 0);
+ g_engine->_musicManager->playEffect(_move[_cur]._eff._activate, 0);
return true;
}
}
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 31a97c4dee4..a66c5387940 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -680,7 +680,7 @@ void Sprite::takeDamage(Info &info, Sprite &s) {
else if (f._eff._hurt != -1)
forceUpdateMove(f._eff._hurt);
- g_engine->_musicManager->PlayEffect(f._eff._hit, 0);
+ g_engine->_musicManager->playEffect(f._eff._hit, 0);
_imgEff = f._eff._img;
}
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 2125d5820f9..d3e9fd9c42b 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -323,7 +323,7 @@ void App::LoadSettings(const Common::String &filename) {
App::~App() {
g_engine->_imageManager->quit();
- g_engine->_musicManager->Quit();
+ g_engine->_musicManager->quit();
g_engine->_textManager->Quit();
g_engine->_inputManager->quit();
g_engine->_loadingScreen->Quit();
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index f3cf3185b83..111720d592d 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -80,11 +80,11 @@ void EventSequence::nextEvent(pyrodactyl::event::Info &info, const Common::Strin
using namespace pyrodactyl::music;
if (info._sound._repDec)
- g_engine->_musicManager->PlayEffect(g_engine->_musicManager->rep_dec, 0);
+ g_engine->_musicManager->playEffect(g_engine->_musicManager->_repDec, 0);
else if (info._sound._repInc)
- g_engine->_musicManager->PlayEffect(g_engine->_musicManager->rep_inc, 0);
+ g_engine->_musicManager->playEffect(g_engine->_musicManager->_repInc, 0);
else if (info._sound._notify)
- g_engine->_musicManager->PlayEffect(g_engine->_musicManager->notify, 0);
+ g_engine->_musicManager->playEffect(g_engine->_musicManager->_notify, 0);
info._sound._notify = false;
info._sound._repDec = false;
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 5b7543a37db..ae2402cb836 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -210,15 +210,15 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
if (_subject == "music") {
if (_operation == "play") {
MusicKey m = StringToNumber<MusicKey>(_val);
- g_engine->_musicManager->PlayMusic(m);
+ g_engine->_musicManager->playMusic(m);
} else if (_operation == "stop")
- g_engine->_musicManager->Stop();
+ g_engine->_musicManager->stop();
else if (_operation == "pause")
- g_engine->_musicManager->Pause();
+ g_engine->_musicManager->pause();
else if (_operation == "resume")
- g_engine->_musicManager->Resume();
+ g_engine->_musicManager->resume();
} else
- g_engine->_musicManager->PlayEffect(StringToNumber<ChunkKey>(_val), 0);
+ g_engine->_musicManager->playEffect(StringToNumber<ChunkKey>(_val), 0);
break;
case EFF_MONEY:
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index e281847fcaa..5232535f8ab 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -135,7 +135,7 @@ public:
KeyBindingMode getKeyBindingMode() const { return _keyMode; }
void quit() {
- warning("STUB: InputManager::Quit()");
+ warning("STUB: InputManager::quit()");
#if 0
if (controller != nullptr)
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index cd7e481859a..51a2e1586bc 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -173,9 +173,9 @@ bool Level::collidingWithLevel(pyrodactyl::event::Info &info, pyrodactyl::anim::
if (_terrain.CollideWithMusic(s.boundRect(), _music)) {
if (_music._track)
- g_engine->_musicManager->PlayMusic(_music._id);
+ g_engine->_musicManager->playMusic(_music._id);
else
- g_engine->_musicManager->PlayEffect(_music._id, _music._loops);
+ g_engine->_musicManager->playEffect(_music._id, _music._loops);
}
// If we are colliding with something, return true
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index c847b5f9f27..fa6d77064f5 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -69,7 +69,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
if (nodeValid("music", node)) {
loadNum(_music._id, "id", node->first_node("music"));
- g_engine->_musicManager->PlayMusic(_music._id);
+ g_engine->_musicManager->playMusic(_music._id);
}
if (nodeValid("map", node)) {
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 123c3ec9ac8..de0d57cf0c1 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -438,16 +438,16 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
// Just play the appropriate music
if (start) {
if (ms == STATE_CREDITS)
- g_engine->_musicManager->PlayMusic(music_key.credits);
+ g_engine->_musicManager->playMusic(music_key.credits);
else
- g_engine->_musicManager->PlayMusic(music_key.normal);
+ g_engine->_musicManager->playMusic(music_key.normal);
} else {
// This is not our first run, which means some music track is already playing
// Only change tracks when going from main menu->credits or credits->main menu
if (state == STATE_CREDITS && ms != STATE_CREDITS)
- g_engine->_musicManager->PlayMusic(music_key.normal);
+ g_engine->_musicManager->playMusic(music_key.normal);
else if (state != STATE_CREDITS && ms == STATE_CREDITS)
- g_engine->_musicManager->PlayMusic(music_key.credits);
+ g_engine->_musicManager->playMusic(music_key.credits);
}
// Set current state
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 0f9a8bd26e7..33fb17503c2 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -40,8 +40,8 @@ using namespace pyrodactyl::music;
//------------------------------------------------------------------------
// Purpose: Clear stored data
//------------------------------------------------------------------------
-void MusicManager::FreeMusic() {
- warning("STUB: MusicManager::FreeMusic()");
+void MusicManager::freeMusic() {
+ warning("STUB: MusicManager::freeMusic()");
#if 0
Mix_FreeMusic(bg.track);
@@ -49,8 +49,8 @@ void MusicManager::FreeMusic() {
}
-void MusicManager::FreeChunk() {
- warning("STUB: MusicManager::FreeChunk()");
+void MusicManager::freeChunk() {
+ warning("STUB: MusicManager::freeChunk()");
#if 0
for (auto i = effect.begin(); i != effect.end(); ++i)
@@ -62,8 +62,8 @@ void MusicManager::FreeChunk() {
//------------------------------------------------------------------------
// Purpose: Play or queue music
//------------------------------------------------------------------------
-void MusicManager::PlayMusic(const MusicKey &id) {
- warning("STUB: MusicManager::PlayMusic()");
+void MusicManager::playMusic(const MusicKey &id) {
+ warning("STUB: MusicManager::playMusic()");
#if 0
if (bg.id != id) {
@@ -89,8 +89,8 @@ void MusicManager::PlayMusic(const MusicKey &id) {
//------------------------------------------------------------------------
// Purpose: Play or queue sound effects
//------------------------------------------------------------------------
-void MusicManager::PlayEffect(const ChunkKey &id, const int &loops) {
- warning("STUB: MusicManager::PlayEffect()");
+void MusicManager::playEffect(const ChunkKey &id, const int &loops) {
+ warning("STUB: MusicManager::playEffect()");
#if 0
if (effect.count(id) > 0)
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index d2c6e2ac41d..80d791129a9 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -41,7 +41,7 @@ namespace pyrodactyl {
namespace music {
class MusicManager {
// The background music for our current level
- MusicData bg;
+ MusicData _bg;
#if 0
// The sound effects in the game
@@ -49,36 +49,36 @@ class MusicManager {
#endif
// Data about the audio
- int freq, channels, chunksize;
+ int _freq, _channels, _chunksize;
public:
// The notification sound
- ChunkKey notify, rep_inc, rep_dec;
+ ChunkKey _notify, _repInc, _repDec;
MusicManager() {
#if 0
freq = MIX_DEFAULT_FREQUENCY;
channels = MIX_DEFAULT_CHANNELS;
#endif
- chunksize = 1024;
+ _chunksize = 1024;
- notify = -1;
- rep_inc = -1;
- rep_dec = -1;
+ _notify = -1;
+ _repInc = -1;
+ _repDec = -1;
- (void)freq;
- (void)channels;
- (void)chunksize;
+ (void)_freq;
+ (void)_channels;
+ (void)_chunksize;
}
~MusicManager() {}
bool load(rapidxml::xml_node<char> *node);
- void PlayMusic(const MusicKey &id);
- void PlayEffect(const ChunkKey &id, const int &loops);
+ void playMusic(const MusicKey &id);
+ void playEffect(const ChunkKey &id, const int &loops);
- static void Pause() {
- warning("STUB: MusicManager::Pause()");
+ static void pause() {
+ warning("STUB: MusicManager::pause()");
#if 0
Mix_PauseMusic();
@@ -86,8 +86,8 @@ public:
}
- static void Resume() {
- warning("STUB: MusicManager::Resume()");
+ static void resume() {
+ warning("STUB: MusicManager::resume()");
#if 0
Mix_ResumeMusic();
@@ -95,8 +95,8 @@ public:
}
- static void Stop() {
- warning("STUB: MusicManager::Stop()");
+ static void stop() {
+ warning("STUB: MusicManager::stop()");
#if 0
Mix_HaltMusic();
@@ -104,8 +104,8 @@ public:
}
- static void VolEffects(const int &volume) {
- warning("STUB: MusicManager::Stop()");
+ static void volEffects(const int &volume) {
+ warning("STUB: MusicManager::stop()");
#if 0
Mix_Volume(-1, volume);
@@ -113,8 +113,8 @@ public:
}
- static int VolEffects() {
- warning("STUB: MusicManager::VolEffects()");
+ static int volEffects() {
+ warning("STUB: MusicManager::volEffects()");
return 0;
#if 0
return Mix_Volume(0, -1);
@@ -122,8 +122,8 @@ public:
}
- static void VolMusic(const int &volume) {
- warning("STUB: MusicManager::VolMusic() %d", volume);
+ static void volMusic(const int &volume) {
+ warning("STUB: MusicManager::volMusic() %d", volume);
#if 0
Mix_VolumeMusic(volume);
@@ -131,8 +131,8 @@ public:
}
- static int VolMusic() {
- warning("STUB: MusicManager::VolMusic()");
+ static int volMusic() {
+ warning("STUB: MusicManager::volMusic()");
return 0;
#if 0
@@ -143,15 +143,15 @@ public:
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void FreeMusic();
- void FreeChunk();
- void Quit() {
- FreeMusic();
- FreeChunk();
+ void freeMusic();
+ void freeChunk();
+
+ void quit() {
+ freeMusic();
+ freeChunk();
}
};
-extern MusicManager gMusicManager;
} // End of namespace music
} // End of namespace pyrodactyl
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index 58bd8f810f5..c69e18b8751 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -48,7 +48,7 @@ typedef unsigned int ChunkKey;
struct MusicData {
// The id of this track
- MusicKey id;
+ MusicKey _id;
#if 0
// The track data
@@ -56,14 +56,14 @@ struct MusicData {
#endif
// Sound parameters
- uint32 fade_in_duration;
+ uint32 _fadeInDuration;
MusicData() {
- id = -1;
+ _id = -1;
#if 0
track = nullptr;
#endif
- fade_in_duration = 100;
+ _fadeInDuration = 100;
}
void load(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index cfffe3265a0..7feeb7cf5f6 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -73,10 +73,10 @@ void GeneralSettingMenu::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void GeneralSettingMenu::handleEvents(const Common::Event &Event) {
if (vol_music.handleEvents(Event))
- g_engine->_musicManager->VolMusic(vol_music.Value());
+ g_engine->_musicManager->volMusic(vol_music.Value());
if (vol_effects.handleEvents(Event))
- g_engine->_musicManager->VolEffects(vol_effects.Value());
+ g_engine->_musicManager->volEffects(vol_effects.Value());
// No need to change screen here
if (save_on_exit.handleEvents(Event))
@@ -148,10 +148,10 @@ void GeneralSettingMenu::draw() {
//------------------------------------------------------------------------
void GeneralSettingMenu::RestoreBackup() {
vol_music.RestoreBackup();
- g_engine->_musicManager->VolMusic(vol_music.Value());
+ g_engine->_musicManager->volMusic(vol_music.Value());
vol_effects.RestoreBackup();
- g_engine->_musicManager->VolEffects(vol_effects.Value());
+ g_engine->_musicManager->volEffects(vol_effects.Value());
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 6782bff4fa4..6044d5ca58e 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -156,7 +156,7 @@ ButtonAction Button::handleEvents(const Common::Event &Event, const int &xOffset
if (!_hoverPrev) {
_hoverPrev = true;
- g_engine->_musicManager->PlayEffect(_seHover, 0);
+ g_engine->_musicManager->playEffect(_seHover, 0);
}
} else {
_hoverPrev = false;
@@ -178,13 +178,13 @@ ButtonAction Button::handleEvents(const Common::Event &Event, const int &xOffset
if (dim.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
_mousePressed = false;
if (Event.type == Common::EVENT_LBUTTONUP) {
- g_engine->_musicManager->PlayEffect(_seClick, 0);
+ g_engine->_musicManager->playEffect(_seClick, 0);
return BUAC_LCLICK;
} else if (Event.type == Common::EVENT_RBUTTONUP)
return BUAC_RCLICK;
}
} else if (_hotkey.handleEvents(Event)) {
- g_engine->_musicManager->PlayEffect(_seClick, 0);
+ g_engine->_musicManager->playEffect(_seClick, 0);
return BUAC_LCLICK;
}
}
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index c51bc5d56dd..cfc9e79cad4 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -59,7 +59,7 @@ bool TextArea::handleEvents(const Common::Event &event, bool numbersOnly) {
warning("STUB: TextArea::handleEvents()");
if (event.type == Common::EVENT_KEYDOWN && event.kbd.ascii == Common::ASCII_BACKSPACE && _text.size() != 0) {
// Now play the text erase sound
- g_engine->_musicManager->PlayEffect(_seErase, 0);
+ g_engine->_musicManager->playEffect(_seErase, 0);
// If backspace was pressed and the string isn't blank, remove a character from the end
_text.erase(_text.size() - 1);
@@ -75,14 +75,14 @@ bool TextArea::handleEvents(const Common::Event &event, bool numbersOnly) {
return false;
// Now play the text input sound
- g_engine->_musicManager->PlayEffect(_seEntry, 0);
+ g_engine->_musicManager->playEffect(_seEntry, 0);
// Append the character to string
_text += event.kbd.ascii;
}
} else if (g_engine->_inputManager->state(IU_ACCEPT) && _text.size() != 0) {
// Now play the accept sound
- g_engine->_musicManager->PlayEffect(_seAccept, 0);
+ g_engine->_musicManager->playEffect(_seAccept, 0);
return true;
}
Commit: 9d2a32a4331f3e18a90ad270afd6f1475d25c7c1
https://github.com/scummvm/scummvm/commit/9d2a32a4331f3e18a90ad270afd6f1475d25c7c1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make people component follow code formatting conventions
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/effect.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/event/trigger.cpp
engines/crab/game.cpp
engines/crab/item/Item.cpp
engines/crab/level/level_collide.cpp
engines/crab/people/opinion.cpp
engines/crab/people/opinion.h
engines/crab/people/person.cpp
engines/crab/people/person.h
engines/crab/people/personbase.cpp
engines/crab/people/personbase.h
engines/crab/people/trait.cpp
engines/crab/people/trait.h
engines/crab/stat/StatDrawHelper.cpp
engines/crab/ui/Inventory.cpp
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/TraitButton.cpp
engines/crab/ui/TraitMenu.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index a66c5387940..d9d078e55bf 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -665,7 +665,7 @@ void Sprite::takeDamage(Info &info, Sprite &s) {
FightMove f;
if (s._animSet._fight.curMove(f) && info.personValid(s.id()) && info.personValid(_id)) {
- int dmg = -1 * (f._eff._dmg + info.personGet(s.id()).stat.val[STAT_ATTACK].cur - info.personGet(_id).stat.val[STAT_DEFENSE].cur);
+ int dmg = -1 * (f._eff._dmg + info.personGet(s.id())._stat.val[STAT_ATTACK].cur - info.personGet(_id)._stat.val[STAT_DEFENSE].cur);
if (dmg >= 0)
dmg = -1;
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 7b6f61569e8..0719855ae89 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -99,12 +99,12 @@ void Info::loadPeople(const Common::String &filename) {
//------------------------------------------------------------------------
void Info::type(const Common::String &id, const PersonType &val) {
if (_people.contains(id) > 0)
- _people[id].type = val;
+ _people[id]._type = val;
}
PersonType Info::type(const Common::String &id) {
if (_people.contains(id) > 0)
- return _people[id].type;
+ return _people[id]._type;
return PE_NEUTRAL;
}
@@ -114,12 +114,12 @@ PersonType Info::type(const Common::String &id) {
//------------------------------------------------------------------------
void Info::state(const Common::String &id, const PersonState &val) {
if (_people.contains(id) > 0)
- _people[id].state = val;
+ _people[id]._state = val;
}
PersonState Info::state(const Common::String &id) {
if (_people.contains(id) > 0)
- return _people[id].state;
+ return _people[id]._state;
return PST_NORMAL;
}
@@ -190,13 +190,13 @@ void Info::traitAdd(const Common::String &perId, const int &traitId) {
// Check for duplicate traits, DONT award anything if duplicate found
Person *p = &personGet(perId);
- for (auto i = p->trait.begin(); i != p->trait.end(); ++i)
- if (i->id == traitId)
+ for (auto i = p->_trait.begin(); i != p->_trait.end(); ++i)
+ if (i->_id == traitId)
return;
- p->trait.push_back(g_engine->_eventStore->_trait[traitId]);
+ p->_trait.push_back(g_engine->_eventStore->_trait[traitId]);
- g_engine->_eventStore->setAchievement(g_engine->_eventStore->_trait[traitId].id);
+ g_engine->_eventStore->setAchievement(g_engine->_eventStore->_trait[traitId]._id);
}
}
}
@@ -208,9 +208,9 @@ void Info::traitDel(const Common::String &perId, const int &traitId) {
{
Person *p = &personGet(perId);
- for (auto j = p->trait.begin(); j != p->trait.end(); ++j) {
- if (j->id == traitId) {
- p->trait.erase(j);
+ for (auto j = p->_trait.begin(); j != p->_trait.end(); ++j) {
+ if (j->_id == traitId) {
+ p->_trait.erase(j);
break;
}
}
@@ -225,18 +225,18 @@ bool Info::opinionGet(const Common::String &name, const pyrodactyl::people::Opin
if (_people.contains(name) == 0)
return false;
- val = _people[name].opinion.val[type];
+ val = _people[name]._opinion._val[type];
return true;
}
void Info::opinionChange(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
if (_people.contains(name) > 0)
- _people[name].opinion.Change(type, val);
+ _people[name]._opinion.change(type, val);
}
void Info::opinionSet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
if (_people.contains(name) > 0)
- _people[name].opinion.Set(type, val);
+ _people[name]._opinion.set(type, val);
}
//------------------------------------------------------------------------
@@ -246,18 +246,18 @@ bool Info::statGet(const Common::String &name, const pyrodactyl::stat::StatType
if (_people.contains(name) == 0)
return false;
- num = _people[name].stat.val[type].cur;
+ num = _people[name]._stat.val[type].cur;
return true;
}
void Info::statSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
if (_people.contains(name) > 0)
- _people[name].stat.Set(type, num);
+ _people[name]._stat.Set(type, num);
}
void Info::statChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
if (_people.contains(name) > 0)
- _people[name].stat.Change(type, num);
+ _people[name]._stat.Change(type, num);
}
//------------------------------------------------------------------------
@@ -283,7 +283,7 @@ pyrodactyl::people::Person &Info::personGet(const Common::String &id) {
bool Info::collideWithTrigger(const Common::String &id, int rectIndex) {
if (_people.contains(id) > 0) {
- for (auto i = _people[id].trig.begin(); i != _people[id].trig.end(); ++i)
+ for (auto i = _people[id]._trig.begin(); i != _people[id]._trig.end(); ++i)
if (*i == rectIndex)
return true;
}
@@ -314,7 +314,7 @@ void Info::insertName(Common::String &msg) {
// We use length+1 here because otherwise it lets the last character stay in dialog
if (personValid(s))
- msg.replace(start, len + 1, personGet(s).name);
+ msg.replace(start, len + 1, personGet(s)._name);
}
}
}
@@ -322,7 +322,7 @@ void Info::insertName(Common::String &msg) {
Common::String Info::getName(const Common::String &id) {
if (personValid(id))
- return personGet(id).name;
+ return personGet(id)._name;
return id;
}
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index ae2402cb836..2e197d3bf01 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -164,9 +164,9 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
case EFF_OBJ:
if (_operation == "type")
- info.type(_subject, pyrodactyl::people::StringToPersonType(_val));
+ info.type(_subject, pyrodactyl::people::stringToPersonType(_val));
else if (_operation == "state")
- info.state(_subject, pyrodactyl::people::StringToPersonState(_val));
+ info.state(_subject, pyrodactyl::people::stringToPersonState(_val));
break;
case EFF_ITEM:
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 9f2789ff6ff..48333435015 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -110,10 +110,10 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
if (_oh.HandleCommonEvents(Event)) {
if (info.personValid(_curEvent->_title)) {
Person &p = info.personGet(_curEvent->_title);
- if (p.alt_journal_name)
- info._journal.Open(playerId, JE_PEOPLE, p.journal_name);
+ if (p._altJournalName)
+ info._journal.Open(playerId, JE_PEOPLE, p._journalName);
else
- info._journal.Open(playerId, JE_PEOPLE, p.name);
+ info._journal.Open(playerId, JE_PEOPLE, p._name);
}
}
@@ -138,7 +138,7 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (_oh.HandleCommonEvents(Event))
if (info.personValid(_curEvent->_title))
- info._journal.Open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title).name);
+ info._journal.Open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
int choice = _reply.handleEvents(info, g_engine->_eventStore->_con[_curEvent->_special], _curEvent->_title, _oh, Event);
if (choice >= 0) {
@@ -151,7 +151,7 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (_oh.HandleCommonEvents(Event))
if (info.personValid(_curEvent->_title))
- info._journal.Open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title).name);
+ info._journal.Open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
if (_textin.handleEvents(Event))
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 6d18024ec2e..3703bbeeb39 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -114,13 +114,13 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
else
return false;
} else if (_operation == "status") {
- PersonType ty = StringToPersonType(_val);
+ PersonType ty = stringToPersonType(_val);
if (info.type(_subject) == ty)
return true;
else
return false;
} else if (_operation == "state") {
- PersonState st = StringToPersonState(_val);
+ PersonState st = stringToPersonState(_val);
if (info.state(_subject) == st)
return true;
else
@@ -132,11 +132,11 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
Person p;
if (info.personGet(_subject, p)) {
if (_target == "like")
- return evaluate(p.opinion.val[OPI_LIKE], StringToNumber<int>(_val));
+ return evaluate(p._opinion._val[OPI_LIKE], StringToNumber<int>(_val));
else if (_target == "fear")
- return evaluate(p.opinion.val[OPI_FEAR], StringToNumber<int>(_val));
+ return evaluate(p._opinion._val[OPI_FEAR], StringToNumber<int>(_val));
else if (_target == "respect")
- return evaluate(p.opinion.val[OPI_RESPECT], StringToNumber<int>(_val));
+ return evaluate(p._opinion._val[OPI_RESPECT], StringToNumber<int>(_val));
}
}
break;
@@ -174,8 +174,8 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
if (info.personValid(_target)) {
Person *p = &info.personGet(_target);
- for (auto &i : p->trait)
- if (i.name == _val)
+ for (auto &i : p->_trait)
+ if (i._name == _val)
return true;
}
break;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 5adcc7850a9..25e71959094 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -738,7 +738,7 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
// Save player character name
Common::String char_name;
if (info.personValid(level.playerId()))
- char_name = info.personGet(level.playerId()).name;
+ char_name = info.personGet(level.playerId())._name;
root->append_attribute(doc.allocate_attribute("char_name", char_name.c_str()));
// Difficulty
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 419fc7f1fe3..d3889304d73 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -110,9 +110,9 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
void Item::statChange(pyrodactyl::people::Person &obj, bool increase) {
for (auto i = _bonus.begin(); i != _bonus.end(); ++i)
if (increase)
- obj.stat.Change(i->type, i->val);
+ obj._stat.Change(i->type, i->val);
else
- obj.stat.Change(i->type, -i->val);
+ obj._stat.Change(i->type, -i->val);
}
void Item::draw(const int &x, const int &y) {
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 51a2e1586bc..37bd592480e 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -135,7 +135,7 @@ bool Level::layerVisible(pyrodactyl::anim::Sprite *obj) {
void Level::calcTrigCollide(pyrodactyl::event::Info &info) {
for (auto i = _objects.begin(); i != _objects.end(); ++i)
if (info.personValid(i->id()))
- _terrain.CollideWithTrigger(i->boundRect(), info.personGet(i->id()).trig);
+ _terrain.CollideWithTrigger(i->boundRect(), info.personGet(i->id())._trig);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index 3cf1619b245..7f0555e0dea 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -42,39 +42,39 @@ int OPINION_MIN = 0, OPINION_MAX = 100;
using namespace pyrodactyl::people;
Opinion::Opinion() {
- val[OPI_LIKE] = 0;
- val[OPI_FEAR] = 0;
- val[OPI_RESPECT] = 0;
+ _val[OPI_LIKE] = 0;
+ _val[OPI_FEAR] = 0;
+ _val[OPI_RESPECT] = 0;
}
void Opinion::load(rapidxml::xml_node<char> *node) {
- loadNum(val[OPI_LIKE], "like", node);
- loadNum(val[OPI_FEAR], "fear", node);
- loadNum(val[OPI_RESPECT], "respect", node);
+ loadNum(_val[OPI_LIKE], "like", node);
+ loadNum(_val[OPI_FEAR], "fear", node);
+ loadNum(_val[OPI_RESPECT], "respect", node);
}
-void Opinion::Change(const OpinionType &type, const int &change) {
- val[type] += change;
- Validate(type);
+void Opinion::change(const OpinionType &type, const int &change) {
+ _val[type] += change;
+ validate(type);
}
-void Opinion::Set(const OpinionType &type, const int &num) {
- val[type] = num;
- Validate(type);
+void Opinion::set(const OpinionType &type, const int &num) {
+ _val[type] = num;
+ validate(type);
}
-void Opinion::Validate(const OpinionType &type) {
- if (val[type] < OPINION_MIN)
- val[type] = OPINION_MIN;
- else if (val[type] > OPINION_MAX)
- val[type] = OPINION_MAX;
+void Opinion::validate(const OpinionType &type) {
+ if (_val[type] < OPINION_MIN)
+ _val[type] = OPINION_MIN;
+ else if (_val[type] > OPINION_MAX)
+ _val[type] = OPINION_MAX;
}
void Opinion::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "opinion");
- child->append_attribute(doc.allocate_attribute("like", gStrPool->Get(val[OPI_LIKE])));
- child->append_attribute(doc.allocate_attribute("fear", gStrPool->Get(val[OPI_FEAR])));
- child->append_attribute(doc.allocate_attribute("respect", gStrPool->Get(val[OPI_RESPECT])));
+ child->append_attribute(doc.allocate_attribute("like", gStrPool->Get(_val[OPI_LIKE])));
+ child->append_attribute(doc.allocate_attribute("fear", gStrPool->Get(_val[OPI_FEAR])));
+ child->append_attribute(doc.allocate_attribute("respect", gStrPool->Get(_val[OPI_RESPECT])));
root->append_node(child);
}
diff --git a/engines/crab/people/opinion.h b/engines/crab/people/opinion.h
index fab37edd5c6..569b1c92a4a 100644
--- a/engines/crab/people/opinion.h
+++ b/engines/crab/people/opinion.h
@@ -42,10 +42,12 @@ namespace people {
// like - how much a person likes you
// intimidate - how much a person fears you
// respect - how much a person respects you
-enum OpinionType { OPI_LIKE,
- OPI_RESPECT,
- OPI_FEAR,
- OPI_TOTAL };
+enum OpinionType {
+ OPI_LIKE,
+ OPI_RESPECT,
+ OPI_FEAR,
+ OPI_TOTAL
+};
// The limits on opinion values
extern int OPINION_MIN, OPINION_MAX;
@@ -53,14 +55,14 @@ extern int OPINION_MIN, OPINION_MAX;
struct Opinion {
// The opinion of the character about the player
// Range 0 to 100 , 100 = absolutely adore you, and 0 = really hate you
- int val[OPI_TOTAL];
+ int _val[OPI_TOTAL];
Opinion();
~Opinion() {}
- void Change(const OpinionType &type, const int &change);
- void Set(const OpinionType &type, const int &val);
- void Validate(const OpinionType &type);
+ void change(const OpinionType &type, const int &change);
+ void set(const OpinionType &type, const int &val);
+ void validate(const OpinionType &type);
void load(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index a99f9c99bce..f5bd4a419d8 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -36,93 +36,93 @@ using namespace pyrodactyl::stat;
using namespace pyrodactyl::people;
Person::Person() {
- type = PE_NEUTRAL;
- state = PST_NORMAL;
- alt_journal_name = false;
- trig.clear();
+ _type = PE_NEUTRAL;
+ _state = PST_NORMAL;
+ _altJournalName = false;
+ _trig.clear();
}
void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem) {
if (nodeValid(node)) {
- loadStr(id, "id", node);
- loadStr(name, "name", node);
+ loadStr(_id, "id", node);
+ loadStr(_name, "name", node);
// loadImgKey(pic, "img", node);
if (nodeValid("opinion", node))
- opinion.load(node->first_node("opinion"));
+ _opinion.load(node->first_node("opinion"));
if (node->first_attribute("type") != NULL) {
Common::String t;
loadStr(t, "type", node);
- type = StringToPersonType(t);
+ _type = stringToPersonType(t);
} else
- type = PE_NEUTRAL;
+ _type = PE_NEUTRAL;
if (node->first_attribute("state") != NULL) {
Common::String s;
loadStr(s, "state", node);
- state = StringToPersonState(s);
+ _state = stringToPersonState(s);
} else
- state = PST_NORMAL;
+ _state = PST_NORMAL;
if (node->first_attribute("journal_name") != NULL) {
- loadStr(journal_name, "journal_name", node);
- alt_journal_name = true;
+ loadStr(_journalName, "journal_name", node);
+ _altJournalName = true;
} else
- alt_journal_name = false;
+ _altJournalName = false;
if (nodeValid("stats", node)) {
rapidxml::xml_node<char> *statnode = node->first_node("stats");
if (statnode->first_attribute("template") == NULL) {
- stat.load(statnode);
+ _stat.load(statnode);
} else {
int index = 0;
loadNum(index, "template", statnode);
if (index >= 0 && (unsigned int)index < stem.collection.size())
for (int i = 0; i < STAT_TOTAL; i++)
- stat.val[i] = stem.collection[index].val[i];
+ _stat.val[i] = stem.collection[index].val[i];
}
}
if (nodeValid("traits", node, false)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
for (auto n = traitnode->first_node("trait"); n != NULL; n = n->next_sibling("trait"))
- trait.push_back(n);
+ _trait.push_back(n);
}
}
}
void Person::reset() {
for (auto i = 0; i < STAT_TOTAL; ++i)
- stat.val[i].reset();
+ _stat.val[i].reset();
}
-void Person::Validate() {
+void Person::validate() {
for (int i = 0; i < STAT_TOTAL; ++i)
- stat.val[i].Validate();
+ _stat.val[i].Validate();
}
void Person::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "object");
- child->append_attribute(doc.allocate_attribute("id", id.c_str()));
- child->append_attribute(doc.allocate_attribute("name", name.c_str()));
+ child->append_attribute(doc.allocate_attribute("id", _id.c_str()));
+ child->append_attribute(doc.allocate_attribute("name", _name.c_str()));
- unsigned int val = static_cast<unsigned int>(state);
+ unsigned int val = static_cast<unsigned int>(_state);
child->append_attribute(doc.allocate_attribute("state", gStrPool->Get(val)));
- opinion.saveState(doc, child);
+ _opinion.saveState(doc, child);
rapidxml::xml_node<char> *child_s = doc.allocate_node(rapidxml::node_element, "stats");
- stat.val[STAT_HEALTH].saveState(doc, child_s, STATNAME_HEALTH);
- stat.val[STAT_ATTACK].saveState(doc, child_s, STATNAME_ATTACK);
- stat.val[STAT_DEFENSE].saveState(doc, child_s, STATNAME_DEFENSE);
- stat.val[STAT_SPEED].saveState(doc, child_s, STATNAME_SPEED);
+ _stat.val[STAT_HEALTH].saveState(doc, child_s, STATNAME_HEALTH);
+ _stat.val[STAT_ATTACK].saveState(doc, child_s, STATNAME_ATTACK);
+ _stat.val[STAT_DEFENSE].saveState(doc, child_s, STATNAME_DEFENSE);
+ _stat.val[STAT_SPEED].saveState(doc, child_s, STATNAME_SPEED);
/*stat.val[STAT_CHARISMA].saveState(doc, child_s, STATNAME_CHARISMA);
stat.val[STAT_INTELLIGENCE].saveState(doc, child_s, STATNAME_INTELLIGENCE);*/
child->append_node(child_s);
rapidxml::xml_node<char> *child_t = doc.allocate_node(rapidxml::node_element, "traits");
- for (auto &i : trait)
+ for (auto &i : _trait)
i.saveState(doc, child_t, "trait");
child->append_node(child_t);
@@ -130,22 +130,22 @@ void Person::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
}
void Person::loadState(rapidxml::xml_node<char> *node) {
- loadStr(id, "id", node);
- loadStr(name, "name", node);
- loadEnum(state, "state", node);
+ loadStr(_id, "id", node);
+ loadStr(_name, "name", node);
+ loadEnum(_state, "state", node);
if (nodeValid("opinion", node))
- opinion.load(node->first_node("opinion"));
+ _opinion.load(node->first_node("opinion"));
if (nodeValid("stats", node))
- stat.load(node->first_node("stats"));
+ _stat.load(node->first_node("stats"));
if (nodeValid("traits", node, false)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
- trait.clear();
+ _trait.clear();
for (auto n = traitnode->first_node("trait"); n != NULL; n = n->next_sibling("trait"))
- trait.push_back(n);
+ _trait.push_back(n);
}
}
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index b878e6de4e2..9f5bfa7a3b7 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -45,43 +45,43 @@ namespace pyrodactyl {
namespace people {
struct Person {
// The id of the object
- Common::String id;
+ Common::String _id;
// Opinion of the person towards the player
- Opinion opinion;
+ Opinion _opinion;
// The state of the object, defines what behavior it is doing right now
- PersonState state;
+ PersonState _state;
// The stats of the character
- pyrodactyl::stat::StatGroup stat;
+ pyrodactyl::stat::StatGroup _stat;
// Name of object
- Common::String name;
+ Common::String _name;
// Type of object
- PersonType type;
+ PersonType _type;
// Sometimes a person's journal entry isn't the same as their name
- Common::String journal_name;
+ Common::String _journalName;
// If this is true, use the alternate journal name instead
- bool alt_journal_name;
+ bool _altJournalName;
// The picture of the object - DISABLED DUE TO LOW BUDGET
// ImageKey pic;
// The trigger areas the person is in right now
- Common::Array<int> trig;
+ Common::Array<int> _trig;
// The traits of a person
- Common::Array<Trait> trait;
+ Common::Array<Trait> _trait;
Person();
void load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTemplates &stem);
void reset();
- void Validate();
+ void validate();
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/people/personbase.cpp b/engines/crab/people/personbase.cpp
index e6c5b895dc8..850c56c06c8 100644
--- a/engines/crab/people/personbase.cpp
+++ b/engines/crab/people/personbase.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::stat;
namespace pyrodactyl {
namespace people {
-PersonType StringToPersonType(const Common::String &val) {
+PersonType stringToPersonType(const Common::String &val) {
if (val == "neutral")
return PE_NEUTRAL;
else if (val == "hostile")
@@ -50,7 +50,7 @@ PersonType StringToPersonType(const Common::String &val) {
return PE_NEUTRAL;
}
-PersonState StringToPersonState(const Common::String &val) {
+PersonState stringToPersonState(const Common::String &val) {
if (val == "ko")
return PST_KO;
else if (val == "fight")
diff --git a/engines/crab/people/personbase.h b/engines/crab/people/personbase.h
index 6be8772e375..44e146bdb49 100644
--- a/engines/crab/people/personbase.h
+++ b/engines/crab/people/personbase.h
@@ -43,10 +43,12 @@ namespace people {
// hostile - person who will attack you on sight
// coward - person who will flee on being attacked
// immobile - person who cannot move but can be killed
-enum PersonType { PE_NEUTRAL,
- PE_HOSTILE,
- PE_COWARD,
- PE_IMMOBILE };
+enum PersonType {
+ PE_NEUTRAL,
+ PE_HOSTILE,
+ PE_COWARD,
+ PE_IMMOBILE
+};
// What each state is, and what it does
// normal - person doing his default movement
@@ -54,14 +56,16 @@ enum PersonType { PE_NEUTRAL,
// flee - person running away from you
// ko - person is dead/knocked out
// dying - play the dying animation
-enum PersonState { PST_NORMAL,
- PST_FIGHT,
- PST_FLEE,
- PST_KO,
- PST_DYING };
+enum PersonState {
+ PST_NORMAL,
+ PST_FIGHT,
+ PST_FLEE,
+ PST_KO,
+ PST_DYING
+};
-PersonType StringToPersonType(const Common::String &val);
-PersonState StringToPersonState(const Common::String &val);
+PersonType stringToPersonType(const Common::String &val);
+PersonState stringToPersonState(const Common::String &val);
} // End of namespace people
} // End of namespace pyrodactyl
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 6da7ef528c0..40323b687f1 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -38,22 +38,22 @@ using namespace pyrodactyl::people;
// Purpose: Load
//------------------------------------------------------------------------
void Trait::load(rapidxml::xml_node<char> *node) {
- loadStr(id_str, "id", node);
- id = StringToNumber<int>(id_str);
+ loadStr(_idStr, "id", node);
+ _id = StringToNumber<int>(_idStr);
- loadStr(name, "name", node);
- loadStr(desc, "desc", node);
- loadImgKey(img, "img", node);
- loadBool(unread, "unread", node);
+ loadStr(_name, "name", node);
+ loadStr(_desc, "desc", node);
+ loadImgKey(_img, "img", node);
+ loadBool(_unread, "unread", node);
}
-void Trait::Clear() {
- id = -1;
- id_str = "";
- name = "";
- desc = "";
- img = 0;
- unread = false;
+void Trait::clear() {
+ _id = -1;
+ _idStr = "";
+ _name = "";
+ _desc = "";
+ _img = 0;
+ _unread = false;
}
//------------------------------------------------------------------------
@@ -61,12 +61,12 @@ void Trait::Clear() {
//------------------------------------------------------------------------
void Trait::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, rootname);
- child->append_attribute(doc.allocate_attribute("id", gStrPool->Get(id)));
- child->append_attribute(doc.allocate_attribute("name", name.c_str()));
- child->append_attribute(doc.allocate_attribute("desc", desc.c_str()));
- child->append_attribute(doc.allocate_attribute("img", gStrPool->Get(img)));
+ child->append_attribute(doc.allocate_attribute("id", gStrPool->Get(_id)));
+ child->append_attribute(doc.allocate_attribute("name", _name.c_str()));
+ child->append_attribute(doc.allocate_attribute("desc", _desc.c_str()));
+ child->append_attribute(doc.allocate_attribute("img", gStrPool->Get(_img)));
- saveBool(unread, "unread", doc, child);
+ saveBool(_unread, "unread", doc, child);
root->append_node(child);
}
diff --git a/engines/crab/people/trait.h b/engines/crab/people/trait.h
index db95c317375..3ec117ebefd 100644
--- a/engines/crab/people/trait.h
+++ b/engines/crab/people/trait.h
@@ -40,32 +40,35 @@ namespace pyrodactyl {
namespace people {
struct Trait {
// The id of the trait
- int id;
+ int _id;
// Used for achievements
- Common::String id_str;
+ Common::String _idStr;
// The name of the trait
- Common::String name;
+ Common::String _name;
// The description of the trait
- Common::String desc;
+ Common::String _desc;
// The image used to draw the trait
- ImageKey img;
+ ImageKey _img;
// Indicator for traits the player hasn't read before
- bool unread;
+ bool _unread;
Trait() {
- id = -1;
- img = 0;
- unread = true;
+ _id = -1;
+ _img = 0;
+ _unread = true;
}
- Trait(rapidxml::xml_node<char> *node) { load(node); }
+ Trait(rapidxml::xml_node<char> *node) {
+ load(node);
+ }
+
~Trait() {}
- void Clear();
+ void clear();
void load(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname);
};
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index 1501410be29..bc906de9372 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -78,7 +78,7 @@ void StatDrawHelper::load(rapidxml::xml_node<char> *node) {
void StatDrawHelper::DrawInfo(const Person &obj) {
for (int i = 0; i < STAT_TOTAL; i++)
- info[i].draw(obj.stat.val[i].cur, obj.stat.val[i].max);
+ info[i].draw(obj._stat.val[i].cur, obj._stat.val[i].max);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index d30ce8c945b..f7810522400 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -93,7 +93,7 @@ bool Inventory::HasItem(const Common::String &char_id, const Common::String &con
void Inventory::draw(Person &obj, const int &money_val) {
bg.draw();
// helper.DrawInfo(obj);
- collection.draw(obj.id /*, helper*/);
+ collection.draw(obj._id /*, helper*/);
money._caption._text = NumberToString(money_val);
money.draw();
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 023bd2b4731..46cc2253662 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -92,12 +92,12 @@ void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
}
if (info.personValid(person_id)) {
- name.draw(info.personGet(person_id).name);
+ name.draw(info.personGet(person_id)._name);
if (!player) {
- opinion[OPI_LIKE].draw(info.personGet(person_id).opinion.val[OPI_LIKE], OPINION_MAX);
- opinion[OPI_RESPECT].draw(info.personGet(person_id).opinion.val[OPI_RESPECT], OPINION_MAX);
- opinion[OPI_FEAR].draw(info.personGet(person_id).opinion.val[OPI_FEAR], OPINION_MAX);
+ opinion[OPI_LIKE].draw(info.personGet(person_id)._opinion._val[OPI_LIKE], OPINION_MAX);
+ opinion[OPI_RESPECT].draw(info.personGet(person_id)._opinion._val[OPI_RESPECT], OPINION_MAX);
+ opinion[OPI_FEAR].draw(info.personGet(person_id)._opinion._val[OPI_FEAR], OPINION_MAX);
}
}
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index e1507d23822..d868e38f2a4 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -82,7 +82,7 @@ void PersonScreen::draw(pyrodactyl::event::Info &info, const Common::String &id)
bg.draw();
if (info.personValid(id)) {
- name.draw(info.personGet(id).name);
+ name.draw(info.personGet(id)._name);
menu.draw(&info.personGet(id));
} else
menu.draw(nullptr);
diff --git a/engines/crab/ui/TraitButton.cpp b/engines/crab/ui/TraitButton.cpp
index e9094ed68e9..b2365e4bd20 100644
--- a/engines/crab/ui/TraitButton.cpp
+++ b/engines/crab/ui/TraitButton.cpp
@@ -57,8 +57,8 @@ void TraitButton::draw(const int &xOffset, const int &yOffset, Rect *clip) {
}
void TraitButton::cache(const pyrodactyl::people::Trait &trait) {
- _traitImg = trait.img;
- _caption._text = trait.name;
+ _traitImg = trait._img;
+ _caption._text = trait._name;
}
void TraitButton::empty() {
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 5d77784dccd..4cb7838b994 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -68,17 +68,17 @@ void TraitMenu::load(rapidxml::xml_node<char> *node) {
void TraitMenu::draw(const pyrodactyl::people::Person *obj) {
if (obj != nullptr) {
auto i = menu.element.begin();
- for (auto t = obj->trait.begin(); t != obj->trait.end() && i != menu.element.end(); ++t, ++i) {
+ for (auto t = obj->_trait.begin(); t != obj->_trait.end() && i != menu.element.end(); ++t, ++i) {
i->draw();
- if (t->unread)
+ if (t->_unread)
g_engine->_imageManager->notifyDraw(i->x + i->w, i->y);
}
for (; i != menu.element.end(); ++i)
i->draw();
- if (select > -1 && (unsigned int)select < obj->trait.size())
- desc.draw(obj->trait[select].desc);
+ if (select > -1 && (unsigned int)select < obj->_trait.size())
+ desc.draw(obj->_trait[select]._desc);
} else
for (auto &i : menu.element)
i.draw();
@@ -94,8 +94,8 @@ void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const Common::Even
select = choice;
if (obj != nullptr) {
- if (select > -1 && (unsigned int)select < obj->trait.size())
- obj->trait[select].unread = false;
+ if (select > -1 && (unsigned int)select < obj->_trait.size())
+ obj->_trait[select]._unread = false;
}
}
}
@@ -121,7 +121,7 @@ void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const SDL_Event &E
void TraitMenu::Cache(const pyrodactyl::people::Person &obj) {
auto e = menu.element.begin();
- for (auto i = obj.trait.begin(); i != obj.trait.end() && e != menu.element.end(); ++i, ++e)
+ for (auto i = obj._trait.begin(); i != obj._trait.end() && e != menu.element.end(); ++i, ++e)
e->cache(*i);
for (; e != menu.element.end(); ++e)
Commit: 61b24cf928f16ffaa240f5c2d10c8a462e29dc11
https://github.com/scummvm/scummvm/commit/61b24cf928f16ffaa240f5c2d10c8a462e29dc11
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make stat component follow code formatting conventions
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/trigger.cpp
engines/crab/item/Item.cpp
engines/crab/item/StatPreview.cpp
engines/crab/people/person.cpp
engines/crab/stat/Stat.cpp
engines/crab/stat/Stat.h
engines/crab/stat/StatDrawHelper.cpp
engines/crab/stat/StatDrawHelper.h
engines/crab/stat/StatTemplate.cpp
engines/crab/stat/StatTemplate.h
engines/crab/stat/bonus.h
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index d9d078e55bf..fd87857d89b 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -665,7 +665,7 @@ void Sprite::takeDamage(Info &info, Sprite &s) {
FightMove f;
if (s._animSet._fight.curMove(f) && info.personValid(s.id()) && info.personValid(_id)) {
- int dmg = -1 * (f._eff._dmg + info.personGet(s.id())._stat.val[STAT_ATTACK].cur - info.personGet(_id)._stat.val[STAT_DEFENSE].cur);
+ int dmg = -1 * (f._eff._dmg + info.personGet(s.id())._stat._val[STAT_ATTACK]._cur - info.personGet(_id)._stat._val[STAT_DEFENSE]._cur);
if (dmg >= 0)
dmg = -1;
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 0719855ae89..7f6fdba8633 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -246,18 +246,18 @@ bool Info::statGet(const Common::String &name, const pyrodactyl::stat::StatType
if (_people.contains(name) == 0)
return false;
- num = _people[name]._stat.val[type].cur;
+ num = _people[name]._stat._val[type]._cur;
return true;
}
void Info::statSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
if (_people.contains(name) > 0)
- _people[name]._stat.Set(type, num);
+ _people[name]._stat.set(type, num);
}
void Info::statChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
if (_people.contains(name) > 0)
- _people[name]._stat.Change(type, num);
+ _people[name]._stat.change(type, num);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 3703bbeeb39..9196a7e7406 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -153,7 +153,7 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
return info.collideWithTrigger(_subject, StringToNumber<int>(_val));
case TRIG_STAT: {
- StatType ty = StringToStatType(_target);
+ StatType ty = stringToStatType(_target);
int sub = 0, value = 0;
bool compareToVar = Common::find_if(_val.begin(), _val.end(), IsChar) != _val.end();
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index d3889304d73..baba411d9d1 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -80,7 +80,7 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
for (auto i = _bonus.begin(); i != _bonus.end(); ++i) {
auto n = doc.allocate_node(rapidxml::node_element, "bonus");
- switch (i->type) {
+ switch (i->_type) {
case STAT_HEALTH:
n->append_attribute(doc.allocate_attribute("type", STATNAME_HEALTH));
break;
@@ -99,7 +99,7 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
break;
}
- n->append_attribute(doc.allocate_attribute("val", gStrPool->Get(i->val)));
+ n->append_attribute(doc.allocate_attribute("val", gStrPool->Get(i->_val)));
root->append_node(n);
}
}
@@ -110,9 +110,9 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
void Item::statChange(pyrodactyl::people::Person &obj, bool increase) {
for (auto i = _bonus.begin(); i != _bonus.end(); ++i)
if (increase)
- obj._stat.Change(i->type, i->val);
+ obj._stat.change(i->_type, i->_val);
else
- obj._stat.Change(i->type, -i->val);
+ obj._stat.change(i->_type, -i->_val);
}
void Item::draw(const int &x, const int &y) {
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index d7d3aa8b924..bbb2d5d7483 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -57,8 +57,8 @@ void StatPreview::draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
if (_enabled) {
int count = 0;
for (auto i = item._bonus.begin(); i != item._bonus.end(); ++i, ++count) {
- stat.draw(helper.Name(i->type), _incS.x * count, _incS.y * count);
- unit.draw(gStrPool->Get(i->val), _incU.x * count, _incU.y * count);
+ stat.draw(helper.name(i->_type), _incS.x * count, _incS.y * count);
+ unit.draw(gStrPool->Get(i->_val), _incU.x * count, _incU.y * count);
}
}
}
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index f5bd4a419d8..06ab56048d2 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -78,9 +78,9 @@ void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
} else {
int index = 0;
loadNum(index, "template", statnode);
- if (index >= 0 && (unsigned int)index < stem.collection.size())
+ if (index >= 0 && (unsigned int)index < stem._collection.size())
for (int i = 0; i < STAT_TOTAL; i++)
- _stat.val[i] = stem.collection[index].val[i];
+ _stat._val[i] = stem._collection[index]._val[i];
}
}
@@ -94,12 +94,12 @@ void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
void Person::reset() {
for (auto i = 0; i < STAT_TOTAL; ++i)
- _stat.val[i].reset();
+ _stat._val[i].reset();
}
void Person::validate() {
for (int i = 0; i < STAT_TOTAL; ++i)
- _stat.val[i].Validate();
+ _stat._val[i].validate();
}
void Person::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
@@ -113,10 +113,10 @@ void Person::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
_opinion.saveState(doc, child);
rapidxml::xml_node<char> *child_s = doc.allocate_node(rapidxml::node_element, "stats");
- _stat.val[STAT_HEALTH].saveState(doc, child_s, STATNAME_HEALTH);
- _stat.val[STAT_ATTACK].saveState(doc, child_s, STATNAME_ATTACK);
- _stat.val[STAT_DEFENSE].saveState(doc, child_s, STATNAME_DEFENSE);
- _stat.val[STAT_SPEED].saveState(doc, child_s, STATNAME_SPEED);
+ _stat._val[STAT_HEALTH].saveState(doc, child_s, STATNAME_HEALTH);
+ _stat._val[STAT_ATTACK].saveState(doc, child_s, STATNAME_ATTACK);
+ _stat._val[STAT_DEFENSE].saveState(doc, child_s, STATNAME_DEFENSE);
+ _stat._val[STAT_SPEED].saveState(doc, child_s, STATNAME_SPEED);
/*stat.val[STAT_CHARISMA].saveState(doc, child_s, STATNAME_CHARISMA);
stat.val[STAT_INTELLIGENCE].saveState(doc, child_s, STATNAME_INTELLIGENCE);*/
child->append_node(child_s);
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index ecc246b3dae..bca5a075af7 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -35,7 +35,7 @@ namespace Crab {
namespace pyrodactyl {
namespace stat {
-StatType StringToStatType(const Common::String &val) {
+StatType stringToStatType(const Common::String &val) {
if (val == STATNAME_HEALTH)
return STAT_HEALTH;
else if (val == STATNAME_ATTACK)
@@ -50,7 +50,7 @@ StatType StringToStatType(const Common::String &val) {
return STAT_HEALTH;
}
-const char *StatTypeToString(const StatType &val) {
+const char *statTypeToString(const StatType &val) {
if (val == STAT_HEALTH)
return STATNAME_HEALTH;
else if (val == STAT_ATTACK)
@@ -70,44 +70,44 @@ const char *StatTypeToString(const StatType &val) {
using namespace pyrodactyl::stat;
void Stat::load(rapidxml::xml_node<char> *node) {
- loadNum(cur, "cur", node);
- loadNum(def, "def", node);
- loadNum(min, "min", node);
- loadNum(max, "max", node);
+ loadNum(_cur, "cur", node);
+ loadNum(_def, "def", node);
+ loadNum(_min, "min", node);
+ loadNum(_max, "max", node);
}
void StatGroup::load(rapidxml::xml_node<char> *node) {
- val[STAT_HEALTH].load(node->first_node(STATNAME_HEALTH));
- val[STAT_ATTACK].load(node->first_node(STATNAME_ATTACK));
- val[STAT_DEFENSE].load(node->first_node(STATNAME_DEFENSE));
- val[STAT_SPEED].load(node->first_node(STATNAME_SPEED));
+ _val[STAT_HEALTH].load(node->first_node(STATNAME_HEALTH));
+ _val[STAT_ATTACK].load(node->first_node(STATNAME_ATTACK));
+ _val[STAT_DEFENSE].load(node->first_node(STATNAME_DEFENSE));
+ _val[STAT_SPEED].load(node->first_node(STATNAME_SPEED));
/*val[STAT_CHARISMA].load(node->first_node(STATNAME_CHARISMA));
val[STAT_INTELLIGENCE].load(node->first_node(STATNAME_INTELLIGENCE));*/
}
-void StatGroup::Change(const StatType &type, const int &change) {
- val[type].cur += change;
- val[type].Validate();
+void StatGroup::change(const pyrodactyl::stat::StatType &type, const int &change) {
+ _val[type]._cur += change;
+ _val[type].validate();
}
-void StatGroup::Set(const StatType &type, const int &num) {
- val[type].cur = num;
- val[type].Validate();
+void StatGroup::set(const pyrodactyl::stat::StatType &type, const int &num) {
+ _val[type]._cur = num;
+ _val[type].validate();
}
-void Stat::Validate() {
- if (cur < min)
- cur = min;
- else if (cur > max)
- cur = max;
+void Stat::validate() {
+ if (_cur < _min)
+ _cur = _min;
+ else if (_cur > _max)
+ _cur = _max;
}
void Stat::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(cur)));
- child->append_attribute(doc.allocate_attribute("def", gStrPool->Get(def)));
- child->append_attribute(doc.allocate_attribute("min", gStrPool->Get(min)));
- child->append_attribute(doc.allocate_attribute("max", gStrPool->Get(max)));
+ child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(_cur)));
+ child->append_attribute(doc.allocate_attribute("def", gStrPool->Get(_def)));
+ child->append_attribute(doc.allocate_attribute("min", gStrPool->Get(_min)));
+ child->append_attribute(doc.allocate_attribute("max", gStrPool->Get(_max)));
root->append_node(child);
}
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index 103a83b6614..bb1355567e1 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -41,17 +41,20 @@ namespace pyrodactyl {
namespace stat {
struct Stat {
// The current, default, minimum and maximum value of the stat
- int cur, def, min, max;
+ int _cur, _def, _min, _max;
Stat() {
- min = 0;
- max = 1;
- cur = 1;
- def = 1;
+ _min = 0;
+ _max = 1;
+ _cur = 1;
+ _def = 1;
}
- void reset() { cur = def; }
- void Validate();
+ void reset() {
+ _cur = _def;
+ }
+
+ void validate();
void load(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name);
@@ -59,19 +62,21 @@ struct Stat {
struct StatGroup {
// We group all stats a single person can have
- Stat val[STAT_TOTAL];
+ Stat _val[STAT_TOTAL];
StatGroup() {}
- StatGroup(rapidxml::xml_node<char> *node) { load(node); }
+ StatGroup(rapidxml::xml_node<char> *node) {
+ load(node);
+ }
- void Change(const pyrodactyl::stat::StatType &type, const int &change);
- void Set(const pyrodactyl::stat::StatType &type, const int &val);
+ void change(const pyrodactyl::stat::StatType &type, const int &change);
+ void set(const pyrodactyl::stat::StatType &type, const int &val);
void load(rapidxml::xml_node<char> *node);
};
-StatType StringToStatType(const Common::String &val);
-const char *StatTypeToString(const StatType &val);
+StatType stringToStatType(const Common::String &val);
+const char *statTypeToString(const StatType &val);
} // End of namespace stat
} // End of namespace pyrodactyl
diff --git a/engines/crab/stat/StatDrawHelper.cpp b/engines/crab/stat/StatDrawHelper.cpp
index bc906de9372..42edac76cf1 100644
--- a/engines/crab/stat/StatDrawHelper.cpp
+++ b/engines/crab/stat/StatDrawHelper.cpp
@@ -39,46 +39,46 @@ using namespace pyrodactyl::people;
void StatInfo::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- loadBool(active, "active", node);
- desc.load(node->first_node("info"));
- loadStr(text, "text", node->first_node("info"));
+ loadBool(_active, "active", node);
+ _desc.load(node->first_node("info"));
+ loadStr(_text, "text", node->first_node("info"));
if (nodeValid("value", node)) {
rapidxml::xml_node<char> *valuenode = node->first_node("value");
- dim.load(valuenode);
- loadImgKey(full, "full", valuenode);
- loadImgKey(empty, "empty", valuenode);
+ _dim.load(valuenode);
+ loadImgKey(_full, "full", valuenode);
+ loadImgKey(_empty, "empty", valuenode);
}
}
}
void StatInfo::draw(const int &val, const int &max) {
- if (active) {
+ if (_active) {
using namespace pyrodactyl::image;
- desc.draw(text);
+ _desc.draw(_text);
int i = 0;
for (; i < val; ++i)
- g_engine->_imageManager->draw(dim.x + i * dim.w, dim.y + i * dim.h, full);
+ g_engine->_imageManager->draw(_dim.x + i * _dim.w, _dim.y + i * _dim.h, _full);
for (; i < max; ++i)
- g_engine->_imageManager->draw(dim.x + i * dim.w, dim.y + i * dim.h, empty);
+ g_engine->_imageManager->draw(_dim.x + i * _dim.w, _dim.y + i * _dim.h, _empty);
}
}
void StatDrawHelper::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- info[STAT_HEALTH].load(node->first_node(STATNAME_HEALTH));
- info[STAT_ATTACK].load(node->first_node(STATNAME_ATTACK));
- info[STAT_DEFENSE].load(node->first_node(STATNAME_DEFENSE));
- info[STAT_SPEED].load(node->first_node(STATNAME_SPEED));
+ _info[STAT_HEALTH].load(node->first_node(STATNAME_HEALTH));
+ _info[STAT_ATTACK].load(node->first_node(STATNAME_ATTACK));
+ _info[STAT_DEFENSE].load(node->first_node(STATNAME_DEFENSE));
+ _info[STAT_SPEED].load(node->first_node(STATNAME_SPEED));
/*info[STAT_CHARISMA].load(node->first_node(STATNAME_CHARISMA));
info[STAT_INTELLIGENCE].load(node->first_node(STATNAME_INTELLIGENCE));*/
}
}
-void StatDrawHelper::DrawInfo(const Person &obj) {
+void StatDrawHelper::drawInfo(const pyrodactyl::people::Person &obj) {
for (int i = 0; i < STAT_TOTAL; i++)
- info[i].draw(obj._stat.val[i].cur, obj._stat.val[i].max);
+ _info[i].draw(obj._stat._val[i]._cur, obj._stat._val[i]._max);
}
} // End of namespace Crab
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index c56598309d9..7d4bb678a5b 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -41,17 +41,17 @@ namespace pyrodactyl {
namespace stat {
struct StatInfo {
// Used to draw stat value and description
- pyrodactyl::ui::TextData desc;
- Common::String text;
+ pyrodactyl::ui::TextData _desc;
+ Common::String _text;
- Rect dim;
- ImageKey full, empty;
- bool active;
+ Rect _dim;
+ ImageKey _full, _empty;
+ bool _active;
StatInfo() {
- active = false;
- full = 0;
- empty = 0;
+ _active = false;
+ _full = 0;
+ _empty = 0;
}
void load(rapidxml::xml_node<char> *node);
@@ -59,16 +59,18 @@ struct StatInfo {
};
class StatDrawHelper {
- StatInfo info[STAT_TOTAL];
+ StatInfo _info[STAT_TOTAL];
public:
StatDrawHelper() {}
~StatDrawHelper() {}
void load(rapidxml::xml_node<char> *node);
- void DrawInfo(const pyrodactyl::people::Person &obj);
+ void drawInfo(const pyrodactyl::people::Person &obj);
- const Common::String &Name(const StatType &type) { return info[type].text; }
+ const Common::String &name(const StatType &type) {
+ return _info[type]._text;
+ }
};
} // End of namespace stat
} // End of namespace pyrodactyl
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index 56749ad8c3d..af99f56b0ca 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -41,7 +41,7 @@ void StatTemplates::load(const Common::String &filename) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("templates");
for (auto n = node->first_node("stats"); n != NULL; n = n->next_sibling("stats"))
- collection.push_back(n);
+ _collection.push_back(n);
}
}
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index 2a8504d530d..55b652e9402 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -39,7 +39,7 @@ namespace Crab {
namespace pyrodactyl {
namespace stat {
struct StatTemplates {
- Common::Array<StatGroup> collection;
+ Common::Array<StatGroup> _collection;
public:
StatTemplates(void) {}
diff --git a/engines/crab/stat/bonus.h b/engines/crab/stat/bonus.h
index bf033f58b23..5a63f7d1091 100644
--- a/engines/crab/stat/bonus.h
+++ b/engines/crab/stat/bonus.h
@@ -40,12 +40,12 @@ namespace pyrodactyl {
namespace stat {
// Stat bonuses for an item
struct Bonus {
- StatType type;
- int val;
+ StatType _type;
+ int _val;
void load(rapidxml::xml_node<char> *node) {
- loadStatType(type, node);
- loadNum(val, "val", node);
+ loadStatType(_type, node);
+ loadNum(_val, "val", node);
}
};
} // End of namespace stat
Commit: bd576ca66771a0ece59a933544a3d761f3553bdd
https://github.com/scummvm/scummvm/commit/bd576ca66771a0ece59a933544a3d761f3553bdd
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Text component follow code formatting conventions
Changed paths:
engines/crab/app.cpp
engines/crab/splash.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.cpp
engines/crab/text/color.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/SectionHeader.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index d3e9fd9c42b..ae28e4fc5c1 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -324,7 +324,7 @@ void App::LoadSettings(const Common::String &filename) {
App::~App() {
g_engine->_imageManager->quit();
g_engine->_musicManager->quit();
- g_engine->_textManager->Quit();
+ g_engine->_textManager->quit();
g_engine->_inputManager->quit();
g_engine->_loadingScreen->Quit();
g_engine->_mouse->Quit();
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 5cccc9461ec..8786bdacb29 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -63,7 +63,7 @@ void Splash::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
if (first_run == false) {
g_engine->_loadingScreen->load();
g_engine->_imageManager->init();
- g_engine->_textManager->Init();
+ g_engine->_textManager->init();
load_complete = true;
}
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 0bba4a928a1..e53db4718d9 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -39,21 +39,21 @@ using namespace pyrodactyl::text;
//------------------------------------------------------------------------
// Purpose: Initialize, set cache etc
//------------------------------------------------------------------------
-void TextManager::Init() {
+void TextManager::init() {
// First, delete everything that exists
- Quit();
+ quit();
// Load the list of fonts
- XMLDoc font_list(g_engine->_filePath->font);
- if (font_list.ready()) {
- rapidxml::xml_node<char> *node = font_list.doc()->first_node("fonts");
+ XMLDoc fontList(g_engine->_filePath->font);
+ if (fontList.ready()) {
+ rapidxml::xml_node<char> *node = fontList.doc()->first_node("fonts");
- loadNum(cache_size, "cache_size", node);
- cache.resize(cache_size);
- oldest = 0;
+ loadNum(_cacheSize, "cache_size", node);
+ _cache.resize(_cacheSize);
+ _oldest = 0;
if (nodeValid(node->first_node("padding")))
- pad_bg.load(node->first_node("padding"));
+ _padBg.load(node->first_node("padding"));
for (auto n = node->first_node("font"); n != NULL; n = n->next_sibling("font")) {
rapidxml::xml_attribute<char> *id, *path, *size;
@@ -63,47 +63,47 @@ void TextManager::Init() {
if (id != NULL && path != NULL && size != NULL) {
unsigned int pos = StringToNumber<unsigned int>(id->value());
- if (font.size() <= pos)
- font.resize(pos + 1);
+ if (_font.size() <= pos)
+ _font.resize(pos + 1);
#if 0
font[pos] = TTF_OpenFont(path->value(), StringToNumber<int>(size->value()));
TTF_SetFontHinting(font[pos], TTF_HINTING_LIGHT);
#endif
Common::File file;
FileOpen(path->value(), &file);
- font[pos] = Graphics::loadTTFFont(file, StringToNumber<int>(size->value()));
+ _font[pos] = Graphics::loadTTFFont(file, StringToNumber<int>(size->value()));
}
}
}
- colpool.load(g_engine->_filePath->colors);
+ _colpool.load(g_engine->_filePath->colors);
}
void TextManager::reset() {
- cache.clear();
- cache.resize(cache_size);
+ _cache.clear();
+ _cache.resize(_cacheSize);
}
//------------------------------------------------------------------------
// Purpose: Search cache for rendered text
//------------------------------------------------------------------------
-int TextManager::Search(const Common::String &text, int col, FontKey fontid) {
+int TextManager::search(const Common::String &text, int col, FontKey fontid) {
int pos = 0;
- for (auto i = cache.begin(); i != cache.end(); ++i, ++pos)
- if (i->empty == false && i->text == text && i->EqualCol(col) && i->font == fontid)
+ for (auto i = _cache.begin(); i != _cache.end(); ++i, ++pos)
+ if (i->_empty == false && i->_text == text && i->EqualCol(col) && i->_font == fontid)
return pos;
return -1;
}
-int TextManager::FindFreeSlot() {
+int TextManager::findFreeSlot() {
int pos = 0;
- for (auto i = cache.begin(); i != cache.end(); ++i, ++pos)
- if (i->empty)
+ for (auto i = _cache.begin(); i != _cache.end(); ++i, ++pos)
+ if (i->_empty)
return pos;
- int ret = oldest;
- oldest = (oldest + 1) % cache.size();
+ int ret = _oldest;
+ _oldest = (_oldest + 1) % _cache.size();
return ret;
}
@@ -119,22 +119,22 @@ SDL_Surface *TextManager::RenderTextBlended(const FontKey &font, const Common::S
}
#endif
-Graphics::ManagedSurface *TextManager::RenderTextBlended(const FontKey &fKey, const Common::String &text, const int &color) {
- SDL_Color sdlcolor = colpool.Get(color);
+Graphics::ManagedSurface *TextManager::renderTextBlended(const FontKey &fKey, const Common::String &text, const int &color) {
+ SDL_Color sdlcolor = _colpool.get(color);
uint32 col = g_engine->_format->ARGBToColor(255, sdlcolor.r, sdlcolor.g, sdlcolor.b);
Graphics::ManagedSurface *surf = nullptr;
if (text.empty()) {
- Common::Rect rec = GetFont(fKey)->getBoundingBox(" ");
+ Common::Rect rec = getFont(fKey)->getBoundingBox(" ");
int h = rec.height();
surf = new Graphics::ManagedSurface(rec.width(), h + (h / 2), *g_engine->_format);
- GetFont(fKey)->drawString(surf, " ", 0, 0, rec.width(), col);
+ getFont(fKey)->drawString(surf, " ", 0, 0, rec.width(), col);
} else {
- Common::Rect rec = GetFont(fKey)->getBoundingBox(text);
+ Common::Rect rec = getFont(fKey)->getBoundingBox(text);
int h = rec.height();
surf = new Graphics::ManagedSurface(rec.width(), h + (h / 2), *g_engine->_format);
- GetFont(fKey)->drawString(surf, text, 0, 0, rec.width(), col);
+ getFont(fKey)->drawString(surf, text, 0, 0, rec.width(), col);
}
return surf;
@@ -149,21 +149,21 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
if (text == " ") return;
- int pos = Search(text, color, fontk);
+ int pos = search(text, color, fontk);
if (pos == -1) {
- pos = FindFreeSlot();
+ pos = findFreeSlot();
#if 0
SDL_Surface *surf = RenderTextBlended(font, text, color);
#endif
- Graphics::ManagedSurface *surf = RenderTextBlended(fontk, text, color);
- cache[pos].img.deleteImage();
- cache[pos].empty = false;
+ Graphics::ManagedSurface *surf = renderTextBlended(fontk, text, color);
+ _cache[pos]._img.deleteImage();
+ _cache[pos]._empty = false;
- cache[pos].text = text;
- cache[pos].col = color;
- cache[pos].font = fontk;
+ _cache[pos]._text = text;
+ _cache[pos]._col = color;
+ _cache[pos]._font = fontk;
- cache[pos].img.load(surf);
+ _cache[pos]._img.load(surf);
delete surf;
#if 0
@@ -172,13 +172,13 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
}
if (background) {
- rect.w = cache[pos].img.w() + (2 * pad_bg.x);
- rect.h = cache[pos].img.h() + (2 * pad_bg.y);
+ _rect.w = _cache[pos]._img.w() + (2 * _padBg.x);
+ _rect.h = _cache[pos]._img.h() + (2 * _padBg.y);
uint32 col = g_engine->_format->ARGBToColor(128, 0, 0, 0);
Graphics::Surface surf;
- surf.create(rect.w, rect.h, *g_engine->_format);
- surf.fillRect(Common::Rect(rect.w, rect.h), col);
+ surf.create(_rect.w, _rect.h, *g_engine->_format);
+ surf.fillRect(Common::Rect(_rect.w, _rect.h), col);
#if 0
SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
@@ -186,77 +186,77 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
#endif
if (align == ALIGN_LEFT) {
- rect.x = x - pad_bg.x;
- rect.y = y - pad_bg.y;
- g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
+ _rect.x = x - _padBg.x;
+ _rect.y = y - _padBg.y;
+ g_engine->_screen->blitFrom(surf, Common::Point(_rect.x, _rect.y));
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- cache[pos].img.draw(x, y);
+ _cache[pos]._img.draw(x, y);
} else if (align == ALIGN_CENTER) {
- rect.x = x - cache[pos].img.w() / 2 - pad_bg.x;
- rect.y = y - cache[pos].img.h() / 2 - pad_bg.y;
- g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
+ _rect.x = x - _cache[pos]._img.w() / 2 - _padBg.x;
+ _rect.y = y - _cache[pos]._img.h() / 2 - _padBg.y;
+ g_engine->_screen->blitFrom(surf, Common::Point(_rect.x, _rect.y));
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- cache[pos].img.draw(x - cache[pos].img.w() / 2, y - cache[pos].img.h() / 2);
+ _cache[pos]._img.draw(x - _cache[pos]._img.w() / 2, y - _cache[pos]._img.h() / 2);
} else {
- rect.x = x - cache[pos].img.w() - pad_bg.x;
- rect.y = y - pad_bg.y;
- g_engine->_screen->blitFrom(surf, Common::Point(rect.x, rect.y));
+ _rect.x = x - _cache[pos]._img.w() - _padBg.x;
+ _rect.y = y - _padBg.y;
+ g_engine->_screen->blitFrom(surf, Common::Point(_rect.x, _rect.y));
#if 0
SDL_RenderFillRect(gRenderer, &rect);
#endif
- cache[pos].img.draw(x - cache[pos].img.w(), y);
+ _cache[pos]._img.draw(x - _cache[pos]._img.w(), y);
}
surf.free();
} else {
if (align == ALIGN_LEFT)
- cache[pos].img.draw(x, y);
+ _cache[pos]._img.draw(x, y);
else if (align == ALIGN_CENTER)
- cache[pos].img.draw(x - cache[pos].img.w() / 2, y - cache[pos].img.h() / 2);
+ _cache[pos]._img.draw(x - _cache[pos]._img.w() / 2, y - _cache[pos]._img.h() / 2);
else
- cache[pos].img.draw(x - cache[pos].img.w(), y);
+ _cache[pos]._img.draw(x - _cache[pos]._img.w(), y);
}
}
void TextManager::draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &fKey, const Align &align,
- const unsigned int &line_width, const unsigned int &line_height, const bool &background) {
- for (unsigned int start_pos = 0, len = text.size(); start_pos < len; y += line_height) {
- unsigned int end_pos = start_pos + 1;
- int last_interrupt = -1;
+ const unsigned int &lineWidth, const unsigned int &lineHeight, const bool &background) {
+ for (unsigned int startPos = 0, len = text.size(); startPos < len; y += lineHeight) {
+ unsigned int endPos = startPos + 1;
+ int lastInterrupt = -1;
Common::String word;
- while (end_pos - start_pos <= line_width) {
- if (end_pos == len || text[end_pos] == '`') {
- last_interrupt = end_pos;
+ while (endPos - startPos <= lineWidth) {
+ if (endPos == len || text[endPos] == '`') {
+ lastInterrupt = endPos;
break;
}
- if (text[end_pos] == ' ' || text[end_pos] == ',' || text[end_pos] == '.')
- last_interrupt = end_pos;
+ if (text[endPos] == ' ' || text[endPos] == ',' || text[endPos] == '.')
+ lastInterrupt = endPos;
- end_pos++;
+ endPos++;
}
- if (last_interrupt >= 0) // wrap a word around
+ if (lastInterrupt >= 0) // wrap a word around
{
- for (unsigned int i = 0; i < last_interrupt - start_pos; i++)
- word += text[start_pos + i];
+ for (unsigned int i = 0; i < lastInterrupt - startPos; i++)
+ word += text[startPos + i];
- start_pos = last_interrupt + 1;
+ startPos = lastInterrupt + 1;
} else // word bigger than line, just thunk
{
- for (unsigned int i = 0; i < end_pos - start_pos; i++)
- word += text[start_pos + i];
+ for (unsigned int i = 0; i < endPos - startPos; i++)
+ word += text[startPos + i];
- start_pos += line_width;
+ startPos += lineWidth;
}
draw(x, y, word, color, fKey, align, background);
@@ -266,14 +266,14 @@ void TextManager::draw(const int &x, int y, const Common::String &text, const in
//------------------------------------------------------------------------
// Purpose: Quit
//------------------------------------------------------------------------
-void TextManager::Quit() {
- for (auto i = font.begin(); i != font.end(); ++i)
+void TextManager::quit() {
+ for (auto i = _font.begin(); i != _font.end(); ++i)
delete *i;
- for (auto i = cache.begin(); i != cache.end(); ++i) {
- if (i->empty == false) {
- i->img.deleteImage();
- i->empty = true;
+ for (auto i = _cache.begin(); i != _cache.end(); ++i) {
+ if (i->_empty == false) {
+ i->_img.deleteImage();
+ i->_empty = true;
}
}
}
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index a185ce780c8..f57077477b9 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -49,62 +49,69 @@ namespace pyrodactyl {
namespace text {
class TextManager {
// The collection of stored fonts
- Common::Array<Graphics::Font *> font;
+ Common::Array<Graphics::Font *> _font;
// The size of the cache
- int cache_size;
+ int _cacheSize;
// The padding at the end of the background - this needs to be loaded from file later
- Vector2i pad_bg;
+ Vector2i _padBg;
// The data stored in our cache - text and texture
struct TextCacheUnit {
- Common::String text;
- int col;
- FontKey font;
+ Common::String _text;
+ int _col;
+ FontKey _font;
- pyrodactyl::image::Image img;
- bool empty;
+ pyrodactyl::image::Image _img;
+ bool _empty;
TextCacheUnit() {
- empty = true;
- col = 0;
- font = 0;
+ _empty = true;
+ _col = 0;
+ _font = 0;
+ }
+ ~TextCacheUnit() {
+ _img.deleteImage();
}
- ~TextCacheUnit() { img.deleteImage(); }
- bool EqualCol(int color) { return col == color; }
+ bool EqualCol(int color) {
+ return _col == color;
+ }
};
// Text Cache - done to avoid having to render a texture every time text is drawn
- Common::Array<TextCacheUnit> cache;
+ Common::Array<TextCacheUnit> _cache;
// The oldest element in the text cache
- int oldest;
+ int _oldest;
// The place to store all colors
- ColorPool colpool;
+ ColorPool _colpool;
// The rectangle used to store the darkened rectangle coordinates
- Rect rect;
+ Rect _rect;
- int Search(const Common::String &text, int col, FontKey fontid);
- int FindFreeSlot();
+ int search(const Common::String &text, int col, FontKey fontid);
+ int findFreeSlot();
public:
TextManager(void) {
- oldest = 0;
- cache_size = 30;
+ _oldest = 0;
+ _cacheSize = 30;
}
+
~TextManager(void) {}
- void Init();
- void Quit();
+ void init();
+ void quit();
void reset();
+ Graphics::Font *getFont(const FontKey &fontid) {
+ return _font[fontid];
+ }
- Graphics::Font *GetFont(const FontKey &fontid) { return font[fontid]; }
- Graphics::ManagedSurface *RenderTextBlended(const FontKey &font, const Common::String &text, const int &color);
+ Graphics::ManagedSurface *renderTextBlended(const FontKey &font, const Common::String &text, const int &color);
#if 0
SDL_Surface *RenderTextBlended(const FontKey &font, const Common::String &text, const int &color);
#endif
@@ -113,7 +120,7 @@ public:
const FontKey &font = 0, const Align &align = ALIGN_LEFT, const bool &background = false);
void draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &font, const Align &align,
- const unsigned int &line_width, const unsigned int &line_height, const bool &background = false);
+ const unsigned int &lineWidth, const unsigned int &lineHeight, const bool &background = false);
};
} // End of namespace text
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index dff3d462f3c..c59b9f247c0 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -35,23 +35,23 @@ namespace Crab {
using namespace pyrodactyl::text;
void ColorPool::load(const Common::String &filename) {
- pool.clear();
- XMLDoc col_list(filename);
- if (col_list.ready()) {
- rapidxml::xml_node<char> *node = col_list.doc()->first_node("colors");
+ _pool.clear();
+ XMLDoc colList(filename);
+ if (colList.ready()) {
+ rapidxml::xml_node<char> *node = colList.doc()->first_node("colors");
for (rapidxml::xml_node<char> *n = node->first_node("color"); n != NULL; n = n->next_sibling("color")) {
SDL_Color c;
loadColor(c, n);
- pool.push_back(c);
+ _pool.push_back(c);
}
}
}
-SDL_Color &ColorPool::Get(const int &num) {
- if (pool.size() <= static_cast<unsigned int>(num))
- return invalid;
+SDL_Color &ColorPool::get(const int &num) {
+ if (_pool.size() <= static_cast<unsigned int>(num))
+ return _invalid;
- return pool[num];
+ return _pool[num];
}
} // End of namespace Crab
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index d3928e03d03..dce498c81cc 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -43,20 +43,20 @@ namespace text {
class ColorPool {
- Common::Array<SDL_Color> pool;
+ Common::Array<SDL_Color> _pool;
// Default invalid color
- SDL_Color invalid;
+ SDL_Color _invalid;
public:
ColorPool() {
- pool.clear();
- invalid.r = 255;
- invalid.g = 0;
- invalid.b = 220;
+ _pool.clear();
+ _invalid.r = 255;
+ _invalid.g = 0;
+ _invalid.b = 220;
}
- SDL_Color &Get(const int &num);
+ SDL_Color &get(const int &num);
void load(const Common::String &filename);
};
} // End of namespace text
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 06133a1fd96..52af018dbe2 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -74,8 +74,8 @@ void ReplyButton::Cache(const Common::String &val, const int &spacing, const int
#if 0
TTF_SizeText(g_engine->_textManager->GetFont(font), val, &width, &height);
#endif
- width = g_engine->_textManager->GetFont(_font)->getStringWidth(val);
- height = g_engine->_textManager->GetFont(_font)->getFontHeight();
+ width = g_engine->_textManager->getFont(_font)->getStringWidth(val);
+ height = g_engine->_textManager->getFont(_font)->getFontHeight();
// Find out how many line sizes will the text take
int lines = ((_text.size() - 1) / _lineSize.x) + 1;
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index df772be92e5..eaacadb7393 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -49,7 +49,7 @@ void SectionHeader::load(rapidxml::xml_node<char> *node) {
loadBool(_drawL, "left", node);
loadBool(_drawR, "right", node);
- Graphics::ManagedSurface *surf = g_engine->_textManager->RenderTextBlended(_font, _text, _col);
+ Graphics::ManagedSurface *surf = g_engine->_textManager->renderTextBlended(_font, _text, _col);
if (_align == ALIGN_CENTER) {
_left.x = x - surf->w / 2 - g_engine->_imageManager->getTexture(_img).w();
Commit: 5831d909e5e4b1ef93941937053ea1933ae53946
https://github.com/scummvm/scummvm/commit/5831d909e5e4b1ef93941937053ea1933ae53946
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make TMX component follow code formatting conventions
Changed paths:
engines/crab/PathfindingGrid.cpp
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/TMX/TMXTileSet.h
engines/crab/TMX/TileInfo.h
engines/crab/level/level.cpp
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 5bc46947060..7966b6e5b77 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -71,22 +71,22 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
// delete nodes if they exist
reset();
- dimensions.x = map.path_rows; // Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
- dimensions.y = map.path_cols;
+ dimensions.x = map._pathRows; // Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
+ dimensions.y = map._pathCols;
- cellSize.x = (float)map.path_size.x;
- cellSize.y = (float)map.path_size.y;
+ cellSize.x = (float)map._pathSize.x;
+ cellSize.y = (float)map._pathSize.y;
// Check to see if the costs have been loaded from the level file.
// If not, assign to defaults.
- if (map.movementCosts.no_walk != 0) {
- blockedCost = map.movementCosts.no_walk;
+ if (map._movementCosts._noWalk != 0) {
+ blockedCost = map._movementCosts._noWalk;
}
- if (map.movementCosts.open != 0) {
- openCost = map.movementCosts.open;
+ if (map._movementCosts._open != 0) {
+ openCost = map._movementCosts._open;
}
- if (map.movementCosts.stairs != 0) {
- stairsCost = map.movementCosts.stairs;
+ if (map._movementCosts._stairs != 0) {
+ stairsCost = map._movementCosts._stairs;
}
nodes = new PathfindingGraphNode *[dimensions.x];
@@ -121,7 +121,7 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
pos.y += cellSize.y;
- Common::Array<Shape> noWalk = map.AreaNoWalk();
+ Common::Array<Shape> noWalk = map.areaNoWalk();
// Check if the square should count as blocked
for (auto i = noWalk.begin(); i != noWalk.end(); ++i) {
@@ -133,7 +133,7 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
// Check for stairs if the cell isn't blocked
if (nodes[x][y].movementCost >= 0.0f) {
- Common::Array<pyrodactyl::level::Stairs> stairs = map.AreaStairs();
+ Common::Array<pyrodactyl::level::Stairs> stairs = map.areaStairs();
for (auto i = stairs.begin(); i != stairs.end(); ++i) {
if (i->Collide(nodes[x][y].collisionRect).intersect) {
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index aee124eb404..049368e0ad4 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -36,7 +36,7 @@ using namespace TMX;
bool Layer::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node))
- return loadStr(name, "name", node) && loadNum(w, "width", node) && loadNum(h, "height", node);
+ return loadStr(_name, "name", node) && loadNum(_w, "width", node) && loadNum(_h, "height", node);
return false;
}
@@ -44,13 +44,13 @@ bool Layer::load(rapidxml::xml_node<char> *node) {
bool MapLayer::load(const Common::String &path, rapidxml::xml_node<char> *node) {
if (Layer::load(node)) {
if (nodeValid("image", node, false)) {
- type = LAYER_IMAGE;
+ _type = LAYER_IMAGE;
rapidxml::xml_node<char> *imgnode = node->first_node("image");
if (imgnode->first_attribute("source") != NULL)
- img.load((path + imgnode->first_attribute("source")->value()));
+ _img.load((path + imgnode->first_attribute("source")->value()));
} else {
- type = LAYER_NORMAL;
+ _type = LAYER_NORMAL;
int i = 0;
Common::Array<TileInfo> t;
@@ -58,8 +58,8 @@ bool MapLayer::load(const Common::String &path, rapidxml::xml_node<char> *node)
for (auto n = node->first_node("data")->first_node("tile"); n != NULL; n = n->next_sibling("tile")) {
t.push_back(n);
- if (++i >= w) {
- tile.push_back(t);
+ if (++i >= _w) {
+ _tile.push_back(t);
t.clear();
i = 0;
}
@@ -74,25 +74,25 @@ bool MapLayer::load(const Common::String &path, rapidxml::xml_node<char> *node)
for (auto p = node->first_node("properties")->first_node("property"); p != NULL; p = p->next_sibling("property")) {
if (loadStr(n, "name", p) && loadStr(v, "value", p)) {
if (n == "prop" && v == "true")
- type = LAYER_PROP;
+ _type = LAYER_PROP;
else if (n == "autohide" && v == "true")
- type = LAYER_AUTOHIDE;
+ _type = LAYER_AUTOHIDE;
else if (n == "autoshow" && v == "true")
- type = LAYER_AUTOSHOW;
+ _type = LAYER_AUTOSHOW;
else if (n == "x") {
- pos.x = StringToNumber<int>(v);
+ _pos.x = StringToNumber<int>(v);
} else if (n == "y") {
- pos.y = StringToNumber<int>(v);
+ _pos.y = StringToNumber<int>(v);
} else if (n == "w") {
- pos.w = StringToNumber<int>(v);
+ _pos.w = StringToNumber<int>(v);
} else if (n == "h") {
- pos.h = StringToNumber<int>(v);
+ _pos.h = StringToNumber<int>(v);
} else if (n == "scroll_rate_x") {
- rate.x = StringToNumber<float>(v);
- type = LAYER_PARALLAX;
+ _rate.x = StringToNumber<float>(v);
+ _type = LAYER_PARALLAX;
} else if (n == "scroll_rate_y") {
- rate.y = StringToNumber<float>(v);
- type = LAYER_PARALLAX;
+ _rate.y = StringToNumber<float>(v);
+ _type = LAYER_PARALLAX;
}
}
}
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index 9e4d5f0d804..31ff760b4cf 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -65,14 +65,14 @@ enum LayerType {
class Layer {
public:
// Name of the layer
- Common::String name;
+ Common::String _name;
// Dimensions of the layer in terms of tiles
- int w, h;
+ int _w, _h;
Layer() {
- w = 0;
- h = 0;
+ _w = 0;
+ _h = 0;
}
bool load(rapidxml::xml_node<char> *node);
};
@@ -81,29 +81,29 @@ public:
class MapLayer : public Layer {
public:
// The tiles in the layer
- Common::Array<Common::Array<TileInfo> > tile;
+ Common::Array<Common::Array<TileInfo>> _tile;
// The type of layer
- LayerType type;
+ LayerType _type;
// The image in the layer
- pyrodactyl::image::Image img;
+ pyrodactyl::image::Image _img;
// The coordinates to draw the prop in(x,y) and dimensions of the area(w,h) in terms of tiles
// This is also the collision rectangle of the prop and auto hide layer
- Rect pos;
+ Rect _pos;
- Common::List<Rect> boundRect;
+ Common::List<Rect> _boundRect;
// The rate of scrolling of image, used for parallax
- Vector2f rate;
+ Vector2f _rate;
// Is the player colliding with the layer? (used for auto hide layer)
- bool collide;
+ bool _collide;
- MapLayer() : rate(1, 1) {
- type = LAYER_NORMAL;
- collide = false;
+ MapLayer() : _rate(1, 1) {
+ _type = LAYER_NORMAL;
+ _collide = false;
}
bool load(const Common::String &path, rapidxml::xml_node<char> *node);
};
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 829ca834d51..c06d4a63bbc 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -37,24 +37,24 @@ namespace Crab {
using namespace TMX;
using namespace pyrodactyl::image;
-bool PropCompare(const MapLayer &l1, const MapLayer &l2) {
- return l1.pos.y + l1.pos.h < l2.pos.y + l2.pos.h;
+bool propCompare(const MapLayer &l1, const MapLayer &l2) {
+ return l1._pos.y + l1._pos.h < l2._pos.y + l2._pos.h;
}
TMXMap::TMXMap() {
- tile_rows = 0;
- tile_cols = 0;
- path_rows = 0;
- path_cols = 0;
-
- w = 0;
- h = 0;
- sprite_layer = 0;
- grid = nullptr;
-
- movementCosts.no_walk = 0;
- movementCosts.open = 0;
- movementCosts.stairs = 0;
+ _tileRows = 0;
+ _tileCols = 0;
+ _pathRows = 0;
+ _pathCols = 0;
+
+ _w = 0;
+ _h = 0;
+ _spriteLayer = 0;
+ _grid = nullptr;
+
+ _movementCosts._noWalk = 0;
+ _movementCosts._open = 0;
+ _movementCosts._stairs = 0;
}
//------------------------------------------------------------------------
@@ -66,44 +66,44 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("map");
if (nodeValid(node)) {
- loadNum(tile_rows, "width", node);
- loadNum(tile_cols, "height", node);
- loadNum(tile_size.x, "tilewidth", node);
- loadNum(tile_size.y, "tileheight", node);
+ loadNum(_tileRows, "width", node);
+ loadNum(_tileCols, "height", node);
+ loadNum(_tileSize.x, "tilewidth", node);
+ loadNum(_tileSize.y, "tileheight", node);
// Pathfinding info load
- path_size.x = 0;
- path_size.y = 0;
+ _pathSize.x = 0;
+ _pathSize.y = 0;
- loadNum(path_size.x, "pathwidth", node);
- loadNum(path_size.y, "pathheight", node);
+ loadNum(_pathSize.x, "pathwidth", node);
+ loadNum(_pathSize.y, "pathheight", node);
// Load costs...Not sure if this is right. (SZ)
- loadNum(movementCosts.open, "opencost", node);
- loadNum(movementCosts.no_walk, "nowalkcost", node);
- loadNum(movementCosts.stairs, "stairscost", node);
+ loadNum(_movementCosts._open, "opencost", node);
+ loadNum(_movementCosts._noWalk, "nowalkcost", node);
+ loadNum(_movementCosts._stairs, "stairscost", node);
// if(path_size.x == 0)
// path_size.x = tile_size.x;
// if(path_size.y == 0)
// path_size.y = tile_size.y;
// Testing
- if (path_size.x == 0)
- path_size.x = 40;
- if (path_size.y == 0)
- path_size.y = 40;
+ if (_pathSize.x == 0)
+ _pathSize.x = 40;
+ if (_pathSize.y == 0)
+ _pathSize.y = 40;
- w = tile_rows * tile_size.x;
- h = tile_cols * tile_size.y;
+ _w = _tileRows * _tileSize.x;
+ _h = _tileCols * _tileSize.y;
- path_rows = (int)ceil((float)w / (float)path_size.x + .5f); // Adding .5 before casting in order to round up (SZ)
- path_cols = (int)ceil((float)h / (float)path_size.y + .5f);
+ _pathRows = (int)ceil((float)_w / (float)_pathSize.x + .5f); // Adding .5 before casting in order to round up (SZ)
+ _pathCols = (int)ceil((float)_h / (float)_pathSize.y + .5f);
g_engine->_imageManager->_tileset.load(path, node);
// Reset the layer at which sprites are drawn
- sprite_layer = 0;
- unsigned int layer_count = 0;
+ _spriteLayer = 0;
+ unsigned int layerCount = 0;
// We need to cycle through all tile and object layers in order to
// see the level at which the sprites will be drawn
@@ -115,68 +115,68 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
{
MapLayer l;
l.load(path, groupnode);
- l.pos.x *= tile_size.x;
- l.pos.y *= tile_size.y;
- l.pos.w *= tile_size.x;
- l.pos.h *= tile_size.y;
+ l._pos.x *= _tileSize.x;
+ l._pos.y *= _tileSize.y;
+ l._pos.w *= _tileSize.x;
+ l._pos.h *= _tileSize.y;
- if (l.type == LAYER_PROP)
- prop.push_back(l);
+ if (l._type == LAYER_PROP)
+ _prop.push_back(l);
else
- layer.push_back(l);
+ _layer.push_back(l);
- layer_count++;
+ layerCount++;
} else if (name == "objectgroup") // Is this an object layer
{
- Common::String group_name;
- loadStr(group_name, "name", groupnode);
- if (group_name == "exit") {
+ Common::String groupName;
+ loadStr(groupName, "name", groupnode);
+ if (groupName == "exit") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
pyrodactyl::level::Exit le(n);
- area_exit.push_back(le);
+ _areaExit.push_back(le);
}
- } else if (group_name == "walk") {
+ } else if (groupName == "walk") {
auto n = groupnode->first_node("object");
if (n != NULL)
- area_walk.load(n, true, "x", "y", "width", "height");
- } else if (group_name == "no_walk") {
+ _areaWalk.load(n, true, "x", "y", "width", "height");
+ } else if (groupName == "no_walk") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
Shape s;
s.load(n);
- area_nowalk.push_back(s);
+ _areaNowalk.push_back(s);
}
- } else if (group_name == "trigger") {
+ } else if (groupName == "trigger") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
Shape s;
s.load(n);
- unsigned int pos = area_trig.size();
+ unsigned int pos = _areaTrig.size();
loadNum(pos, "name", n);
- if (area_trig.size() <= pos)
- area_trig.resize(pos + 1);
+ if (_areaTrig.size() <= pos)
+ _areaTrig.resize(pos + 1);
- area_trig[pos] = s;
+ _areaTrig[pos] = s;
}
- } else if (group_name == "stairs") {
+ } else if (groupName == "stairs") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
pyrodactyl::level::Stairs s;
s.load(n);
- area_stairs.push_back(s);
+ _areaStairs.push_back(s);
}
- } else if (group_name == "music") {
+ } else if (groupName == "music") {
for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
pyrodactyl::level::MusicArea ma;
ma.load(n);
- area_music.push_back(ma);
+ _areaMusic.push_back(ma);
}
- } else if (group_name == "sprites")
- sprite_layer = layer_count;
+ } else if (groupName == "sprites")
+ _spriteLayer = layerCount;
}
}
// Sort the props in the level according to y axis
- Common::sort(prop.begin(), prop.end(), PropCompare);
+ Common::sort(_prop.begin(), _prop.end(), propCompare);
}
}
}
@@ -233,40 +233,40 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
//------------------------------------------------------------------------
void TMXMap::reset() {
g_engine->_imageManager->_tileset.reset();
- layer.clear();
+ _layer.clear();
- area_nowalk.clear();
- area_exit.clear();
- area_trig.clear();
- area_stairs.clear();
- area_music.clear();
+ _areaNowalk.clear();
+ _areaExit.clear();
+ _areaTrig.clear();
+ _areaStairs.clear();
+ _areaMusic.clear();
- prop.clear();
- sprite_layer = 0;
+ _prop.clear();
+ _spriteLayer = 0;
}
//------------------------------------------------------------------------
// Purpose: Draw functions
//------------------------------------------------------------------------
-void TMXMap::DrawDebug(const Rect &camera) {
+void TMXMap::drawDebug(const Rect &camera) {
using namespace pyrodactyl::text;
- for (auto i = area_trig.begin(); i != area_trig.end(); ++i)
+ for (auto i = _areaTrig.begin(); i != _areaTrig.end(); ++i)
i->draw(-camera.x, -camera.y, 0, 0, 254, 254);
- for (auto i = area_exit.begin(); i != area_exit.end(); ++i)
+ for (auto i = _areaExit.begin(); i != _areaExit.end(); ++i)
i->_dim.draw(-camera.x, -camera.y, 0, 254, 254, 254);
- for (auto i = prop.begin(); i != prop.end(); ++i)
- i->pos.draw(-camera.x, -camera.y, 254, 0, 254, 254);
+ for (auto i = _prop.begin(); i != _prop.end(); ++i)
+ i->_pos.draw(-camera.x, -camera.y, 254, 0, 254, 254);
- for (auto i = area_nowalk.begin(); i != area_nowalk.end(); ++i)
+ for (auto i = _areaNowalk.begin(); i != _areaNowalk.end(); ++i)
i->draw(-camera.x, -camera.y, 254, 0, 0, 254);
- for (auto i = area_music.begin(); i != area_music.end(); ++i)
+ for (auto i = _areaMusic.begin(); i != _areaMusic.end(); ++i)
i->draw(-camera.x, -camera.y, 254, 254, 0, 254);
- for (auto i = area_stairs.begin(); i != area_stairs.end(); ++i) {
+ for (auto i = _areaStairs.begin(); i != _areaStairs.end(); ++i) {
i->draw(-camera.x, -camera.y, 0, 254, 0, 254);
//g_engine->_textManager->draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x), 0);
//g_engine->_textManager->draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y), 0);
@@ -284,10 +284,10 @@ void TMXMap::DrawDebug(const Rect &camera) {
}
}*/
- for (auto i = layer.begin(); i != layer.end(); ++i)
- i->pos.draw(-camera.x, -camera.y, 254, 216, 0);
+ for (auto i = _layer.begin(); i != _layer.end(); ++i)
+ i->_pos.draw(-camera.x, -camera.y, 254, 216, 0);
- area_walk.draw(-camera.x, -camera.y, 254, 254, 254, 254);
+ _areaWalk.draw(-camera.x, -camera.y, 254, 254, 254, 254);
// g_engine->_textManager->draw(0, 200, NumberToString(sprite_layer), 0);
// Use this if you want to draw poly lines in debug
@@ -316,55 +316,55 @@ void TMXMap::DrawDebug(const Rect &camera) {
//------------------------------------------------------------------------
// Purpose: Collision functions
//------------------------------------------------------------------------
-void TMXMap::CollideWithNoWalk(const Rect bounding_box, Common::List<CollisionData> &colliders) {
+void TMXMap::collideWithNoWalk(const Rect boundingBox, Common::List<CollisionData> &colliders) {
CollisionData res;
- for (auto i = area_nowalk.begin(); i != area_nowalk.end(); ++i) {
- res = i->Collide(bounding_box);
+ for (auto i = _areaNowalk.begin(); i != _areaNowalk.end(); ++i) {
+ res = i->Collide(boundingBox);
if (res.intersect)
colliders.push_back(res);
}
}
-bool TMXMap::InsideNoWalk(const Vector2i &pos) {
- for (auto i = area_nowalk.begin(); i != area_nowalk.end(); ++i)
+bool TMXMap::insideNoWalk(const Vector2i &pos) {
+ for (auto i = _areaNowalk.begin(); i != _areaNowalk.end(); ++i)
if (i->Contains(pos))
return true;
return false;
}
-bool TMXMap::InsideWalk(const Rect bounding_box) {
- if (area_walk.Contains(bounding_box))
+bool TMXMap::insideWalk(const Rect boundingBox) {
+ if (_areaWalk.Contains(boundingBox))
return true;
return false;
}
-bool TMXMap::InsideWalk(const Vector2i &pos) {
- if (area_walk.Contains(pos))
+bool TMXMap::insideWalk(const Vector2i &pos) {
+ if (_areaWalk.Contains(pos))
return true;
return false;
}
-bool TMXMap::CollideWithTrigger(const Rect rect, int index) {
- if (area_trig.size() > (unsigned int)index)
- return area_trig[index].Collide(rect).intersect;
+bool TMXMap::collideWithTrigger(const Rect rect, int index) {
+ if (_areaTrig.size() > (unsigned int)index)
+ return _areaTrig[index].Collide(rect).intersect;
return false;
}
-void TMXMap::CollideWithTrigger(const Rect rect, Common::Array<int> &collision_table) {
+void TMXMap::collideWithTrigger(const Rect rect, Common::Array<int> &collisionTable) {
int index = 0;
- collision_table.clear();
+ collisionTable.clear();
- for (auto i = area_trig.begin(); i != area_trig.end(); ++i, ++index)
+ for (auto i = _areaTrig.begin(); i != _areaTrig.end(); ++i, ++index)
if (i->Collide(rect).intersect)
- collision_table.push_back(index);
+ collisionTable.push_back(index);
}
-bool TMXMap::CollideWithExit(const Rect rect, LevelResult &res) {
- for (auto i = area_exit.begin(); i != area_exit.end(); ++i)
+bool TMXMap::collideWithExit(const Rect rect, LevelResult &res) {
+ for (auto i = _areaExit.begin(); i != _areaExit.end(); ++i)
if (i->_dim.Collide(rect).intersect) {
res.val = i->_name;
res.x = i->_entry.x;
@@ -375,22 +375,22 @@ bool TMXMap::CollideWithExit(const Rect rect, LevelResult &res) {
return false;
}
-bool TMXMap::CollideWithStairs(const Rect rect, Vector2f &vel_mod) {
- for (auto i = area_stairs.begin(); i != area_stairs.end(); ++i) {
+bool TMXMap::collideWithStairs(const Rect rect, Vector2f &velMod) {
+ for (auto i = _areaStairs.begin(); i != _areaStairs.end(); ++i) {
if (i->Collide(rect).intersect) {
- vel_mod = i->_modifier;
+ velMod = i->_modifier;
return true;
}
}
// We are not colliding with any stairs, reset the modifier
- vel_mod.x = 1.0f;
- vel_mod.y = 1.0f;
+ velMod.x = 1.0f;
+ velMod.y = 1.0f;
return false;
}
-bool TMXMap::CollideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &music) {
- for (auto i = area_music.begin(); i != area_music.end(); ++i) {
+bool TMXMap::collideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &music) {
+ for (auto i = _areaMusic.begin(); i != _areaMusic.end(); ++i) {
if (i->Collide(rect).intersect) {
music._id = i->_id;
music._track = i->_track;
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 797ca72dbb6..0afb657512a 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -49,22 +49,22 @@ namespace TMX {
class TMXMap {
protected:
// The actual dimensions of the level
- int w, h;
+ int _w, _h;
// The area you can move in
- Rect area_walk;
+ Rect _areaWalk;
// The non-walk able areas in the level
- Common::Array<Shape> area_nowalk;
+ Common::Array<Shape> _areaNowalk;
// The trigger rectangles in the level
- Common::Array<Shape> area_trig;
+ Common::Array<Shape> _areaTrig;
// Stairs modify the player walking speed
- Common::Array<pyrodactyl::level::Stairs> area_stairs;
+ Common::Array<pyrodactyl::level::Stairs> _areaStairs;
// Music areas change the music if player collides with them
- Common::Array<pyrodactyl::level::MusicArea> area_music;
+ Common::Array<pyrodactyl::level::MusicArea> _areaMusic;
// Archived methods for loading poly lines in tiled
// void LoadPath(rapidxml::xml_node<char> *node);
@@ -72,35 +72,35 @@ protected:
public:
// The exits to different levels
- Common::Array<pyrodactyl::level::Exit> area_exit;
+ Common::Array<pyrodactyl::level::Exit> _areaExit;
// The layer on top of which objects walk
- unsigned int sprite_layer;
+ unsigned int _spriteLayer;
// Dimensions of the level in terms of tiles
- int tile_rows, tile_cols;
+ int _tileRows, _tileCols;
// Dimensions of the level in terms of pathfinding grid cells (SZ)
- int path_rows, path_cols;
+ int _pathRows, _pathCols;
// The width and height of tiles
- Vector2i tile_size;
+ Vector2i _tileSize;
// The width and height of pathfinding grid cells (SZ)
- Vector2i path_size;
+ Vector2i _pathSize;
// The layers of tiles in the level
- Common::Array<MapLayer> layer;
+ Common::Array<MapLayer> _layer;
// The props in the level
- Common::Array<MapLayer> prop;
+ Common::Array<MapLayer> _prop;
- PathfindingGrid *grid; // The grid of graph nodes used for navigating.
+ PathfindingGrid *_grid; // The grid of graph nodes used for navigating.
// Movement costs
struct {
- int open, no_walk, stairs;
- } movementCosts;
+ int _open, _noWalk, _stairs;
+ } _movementCosts;
TMXMap();
~TMXMap() {}
@@ -108,26 +108,40 @@ public:
void reset();
void load(const Common::String &path, Common::String filename);
- void DrawDebug(const Rect &camera);
+ void drawDebug(const Rect &camera);
- bool InsideWalk(const Rect bounding_box);
- bool InsideWalk(const Vector2i &pos);
+ bool insideWalk(const Rect boundingBox);
+ bool insideWalk(const Vector2i &pos);
- bool InsideNoWalk(const Vector2i &pos);
- void CollideWithNoWalk(const Rect bounding_box, Common::List<CollisionData> &colliders);
+ bool insideNoWalk(const Vector2i &pos);
+ void collideWithNoWalk(const Rect boundingBox, Common::List<CollisionData> &colliders);
- bool CollideWithExit(const Rect rect, LevelResult &res);
- bool CollideWithStairs(const Rect rect, Vector2f &vel_mod);
- bool CollideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &music);
+ bool collideWithExit(const Rect rect, LevelResult &res);
+ bool collideWithStairs(const Rect rect, Vector2f &velMod);
+ bool collideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &music);
- bool CollideWithTrigger(const Rect rect, int index);
- void CollideWithTrigger(const Rect rect, Common::Array<int> &collision_table);
+ bool collideWithTrigger(const Rect rect, int index);
+ void collideWithTrigger(const Rect rect, Common::Array<int> &collisionTable);
- int W() { return w; }
- int H() { return h; }
- Rect AreaWalk() { return area_walk; }
- Common::Array<Shape> AreaNoWalk() { return area_nowalk; }
- Common::Array<pyrodactyl::level::Stairs> AreaStairs() { return area_stairs; }
+ int w() {
+ return _w;
+ }
+
+ int h() {
+ return _h;
+ }
+
+ Rect areaWalk() {
+ return _areaWalk;
+ }
+
+ Common::Array<Shape> areaNoWalk() {
+ return _areaNowalk;
+ }
+
+ Common::Array<pyrodactyl::level::Stairs> areaStairs() {
+ return _areaStairs;
+ }
};
} // End of namespace TMX
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 3171aebcb1c..ec8bd43f0bf 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -38,38 +38,38 @@ using namespace TMX;
void TileSet::load(const Common::String &path, rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- loadNum(first_gid, "firstgid", node);
- loadStr(name, "name", node);
- loadNum(tile_w, "tilewidth", node);
- loadNum(tile_h, "tileheight", node);
+ loadNum(_firstGid, "firstgid", node);
+ loadStr(_name, "name", node);
+ loadNum(_tileW, "tilewidth", node);
+ loadNum(_tileH, "tileheight", node);
- clip.w = tile_w;
- clip.h = tile_h;
+ _clip.w = _tileW;
+ _clip.h = _tileH;
if (nodeValid("image", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("image");
Common::String filename;
loadStr(filename, "source", imgnode);
- loc = path + filename;
+ _loc = path + filename;
- img.load(loc);
- total_rows = img.h() / tile_h;
- total_cols = img.w() / tile_w;
- warning("Total rows : %d Total cols: %d gid: %d", total_rows, total_cols, first_gid);
+ _img.load(_loc);
+ _totalRows = _img.h() / _tileH;
+ _totalCols = _img.w() / _tileW;
+ warning("Total rows : %d Total cols: %d gid: %d", _totalRows, _totalCols, _firstGid);
}
}
// Prevent divide by zero errors later
- if (total_cols == 0)
- total_cols = 1;
+ if (_totalCols == 0)
+ _totalCols = 1;
}
void TileSetGroup::reset() {
- for (auto i = tileset.begin(); i != tileset.end(); ++i)
- i->img.deleteImage();
+ for (auto i = _tileset.begin(); i != _tileset.end(); ++i)
+ i->_img.deleteImage();
- tileset.clear();
+ _tileset.clear();
}
void TileSetGroup::load(const Common::String &path, rapidxml::xml_node<char> *node) {
@@ -77,179 +77,179 @@ void TileSetGroup::load(const Common::String &path, rapidxml::xml_node<char> *no
for (auto n = node->first_node("tileset"); n != NULL; n = n->next_sibling("tileset")) {
TileSet t;
t.load(path, n);
- tileset.push_back(t);
+ _tileset.push_back(t);
}
}
void TileSet::draw(const Vector2i &pos, const TileInfo &tile) {
- if (tile.gid != 0) {
- clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
- clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
+ if (tile._gid != 0) {
+ _clip.x = ((tile._gid - _firstGid) % _totalCols) * _tileW;
+ _clip.y = ((tile._gid - _firstGid) / _totalCols) * _tileH;
- img.draw(pos.x, pos.y, &clip, tile.flip);
+ _img.draw(pos.x, pos.y, &_clip, tile._flip);
}
}
-void TileSet::PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf) {
- if (tile.gid != 0) {
- clip.x = ((tile.gid - first_gid) % total_cols) * tile_w;
- clip.y = ((tile.gid - first_gid) / total_cols) * tile_h;
+void TileSet::preDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf) {
+ if (tile._gid != 0) {
+ _clip.x = ((tile._gid - _firstGid) % _totalCols) * _tileW;
+ _clip.y = ((tile._gid - _firstGid) / _totalCols) * _tileH;
- img.draw(pos.x, pos.y, &clip, tile.flip, surf);
+ _img.draw(pos.x, pos.y, &_clip, tile._flip, surf);
}
}
-void TileSetGroup::PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf) {
- if (layer.type == LAYER_IMAGE)
+void TileSetGroup::preDraw(MapLayer &layer, const Vector2i &tileSize, Graphics::ManagedSurface *surf) {
+ if (layer._type == LAYER_IMAGE)
return;
- start.x = 0;
- start.y = 0;
+ _start.x = 0;
+ _start.y = 0;
- finish.x = layer.tile.size();
- finish.y = layer.tile[0].size();
+ _finish.x = layer._tile.size();
+ _finish.y = layer._tile[0].size();
- v.x = start.y * tile_size.x;
- v.y = start.x * tile_size.y;
+ _v.x = _start.y * tileSize.x;
+ _v.y = _start.x * tileSize.y;
- for (int x = start.x; x < finish.x; ++x) {
- for (int y = start.y; y < finish.y; ++y) {
- for (int i = tileset.size() - 1; i >= 0; --i)
- if (layer.tile[x][y].gid >= tileset[i].first_gid) {
- tileset[i].PreDraw(v, layer.tile[x][y], surf);
- layer.boundRect.push_back(Rect(v.x, v.y, tile_size.x, tile_size.y));
+ for (int x = _start.x; x < _finish.x; ++x) {
+ for (int y = _start.y; y < _finish.y; ++y) {
+ for (int i = _tileset.size() - 1; i >= 0; --i)
+ if (layer._tile[x][y]._gid >= _tileset[i]._firstGid) {
+ _tileset[i].preDraw(_v, layer._tile[x][y], surf);
+ layer._boundRect.push_back(Rect(_v.x, _v.y, tileSize.x, tileSize.y));
break;
}
- v.x += tile_size.x;
+ _v.x += tileSize.x;
}
- v.x = start.y * tile_size.x;
- v.y += tile_size.y;
+ _v.x = _start.y * tileSize.x;
+ _v.y += tileSize.y;
}
Common::List<Rect>::iterator rOuter, rInner;
// Process the bound rect list to find any rects to merge
- for (rOuter = layer.boundRect.begin(); rOuter != layer.boundRect.end(); ++rOuter) {
+ for (rOuter = layer._boundRect.begin(); rOuter != layer._boundRect.end(); ++rOuter) {
rInner = rOuter;
- while (++rInner != layer.boundRect.end()) {
+ while (++rInner != layer._boundRect.end()) {
if ((*rOuter).Collide(*rInner)) {
rOuter->Extend(*rInner);
- layer.boundRect.erase(rInner);
+ layer._boundRect.erase(rInner);
rInner = rOuter;
}
}
}
}
-void TileSetGroup::ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos) {
+void TileSetGroup::forceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tileSize, const Rect &playerPos) {
- if (layer.type == LAYER_IMAGE)
+ if (layer._type == LAYER_IMAGE)
return;
- layer.collide = layer.pos.Collide(player_pos);
+ layer._collide = layer._pos.Collide(playerPos);
// Normal and prop layers are drawn this way
// The row and column we start drawing at
- start.x = player_pos.y / tile_size.y;
- start.y = player_pos.x / tile_size.x;
+ _start.x = playerPos.y / tileSize.y;
+ _start.y = playerPos.x / tileSize.x;
- if(start.x < 0 || start.y < 0)
+ if(_start.x < 0 || _start.y < 0)
return;
// The row and column we end drawing at
- finish.x = (player_pos.y + player_pos.h) / tile_size.y + 1;
- finish.y = (player_pos.x + player_pos.w) / tile_size.x + 1;
-
- if (finish.x > (int)layer.tile.size())
- finish.x = layer.tile.size();
- if (finish.y > (int)layer.tile[0].size())
- finish.y = layer.tile[0].size();
-
- v.x = start.y * tile_size.x - camera.x;
- v.y = start.x * tile_size.y - camera.y;
-
- for (int x = start.x; x < finish.x; ++x) {
- for (int y = start.y; y < finish.y; ++y) {
- for (int i = tileset.size() - 1; i >= 0; --i)
- if (layer.tile[x][y].gid >= tileset[i].first_gid) {
- tileset[i].draw(v, layer.tile[x][y]);
+ _finish.x = (playerPos.y + playerPos.h) / tileSize.y + 1;
+ _finish.y = (playerPos.x + playerPos.w) / tileSize.x + 1;
+
+ if (_finish.x > (int)layer._tile.size())
+ _finish.x = layer._tile.size();
+ if (_finish.y > (int)layer._tile[0].size())
+ _finish.y = layer._tile[0].size();
+
+ _v.x = _start.y * tileSize.x - camera.x;
+ _v.y = _start.x * tileSize.y - camera.y;
+
+ for (int x = _start.x; x < _finish.x; ++x) {
+ for (int y = _start.y; y < _finish.y; ++y) {
+ for (int i = _tileset.size() - 1; i >= 0; --i)
+ if (layer._tile[x][y]._gid >= _tileset[i]._firstGid) {
+ _tileset[i].draw(_v, layer._tile[x][y]);
break;
}
- v.x += tile_size.x;
+ _v.x += tileSize.x;
}
- v.x = start.y * tile_size.x - camera.x;
- v.y += tile_size.y;
+ _v.x = _start.y * tileSize.x - camera.x;
+ _v.y += tileSize.y;
}
}
-void TileSetGroup::draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img) {
- if (layer.type == LAYER_IMAGE)
- layer.img.draw(-1.0f * camera.x * layer.rate.x, -1.0f * camera.y * layer.rate.y);
- else if (layer.type == LAYER_PARALLAX) {
+void TileSetGroup::draw(MapLayer &layer, const Rect &camera, const Vector2i &tileSize, const Rect &playerPos, pyrodactyl::image::Image &img) {
+ if (layer._type == LAYER_IMAGE)
+ layer._img.draw(-1.0f * camera.x * layer._rate.x, -1.0f * camera.y * layer._rate.y);
+ else if (layer._type == LAYER_PARALLAX) {
// The row and column we start drawing at
- start.x = 0;
- start.y = 0;
+ _start.x = 0;
+ _start.y = 0;
// The row and column we end drawing at
- finish.x = layer.tile.size() - 1;
- finish.y = layer.tile[0].size() - 1;
+ _finish.x = layer._tile.size() - 1;
+ _finish.y = layer._tile[0].size() - 1;
- v.x = (start.y * tile_size.x - camera.x) * layer.rate.x;
- v.y = (start.x * tile_size.y - camera.y) * layer.rate.y;
+ _v.x = (_start.y * tileSize.x - camera.x) * layer._rate.x;
+ _v.y = (_start.x * tileSize.y - camera.y) * layer._rate.y;
- for (int x = start.x; x < finish.x; ++x) {
- for (int y = start.y; y < finish.y; ++y) {
- for (int i = tileset.size() - 1; i >= 0; --i)
- if (layer.tile[x][y].gid >= tileset[i].first_gid) {
- tileset[i].draw(v, layer.tile[x][y]);
+ for (int x = _start.x; x < _finish.x; ++x) {
+ for (int y = _start.y; y < _finish.y; ++y) {
+ for (int i = _tileset.size() - 1; i >= 0; --i)
+ if (layer._tile[x][y]._gid >= _tileset[i]._firstGid) {
+ _tileset[i].draw(_v, layer._tile[x][y]);
break;
}
- v.x += tile_size.x;
+ _v.x += tileSize.x;
}
- v.x = (start.y * tile_size.x - camera.x) * layer.rate.x;
- v.y += tile_size.y;
+ _v.x = (_start.y * tileSize.x - camera.x) * layer._rate.x;
+ _v.y += tileSize.y;
}
} else {
- layer.collide = layer.pos.Collide(player_pos);
+ layer._collide = layer._pos.Collide(playerPos);
// If player is inside the layer bounds, draw normally - else skip drawing
- if (layer.type == LAYER_AUTOHIDE && !layer.collide)
+ if (layer._type == LAYER_AUTOHIDE && !layer._collide)
return;
// If the player is outside the layer bounds, draw normally - else skip drawing
- if (layer.type == LAYER_AUTOSHOW && layer.collide)
+ if (layer._type == LAYER_AUTOSHOW && layer._collide)
return;
// Normal and prop layers are drawn this way
// The row and column we start drawing at
- start.x = camera.y / tile_size.y;
- start.y = camera.x / tile_size.x;
+ _start.x = camera.y / tileSize.y;
+ _start.y = camera.x / tileSize.x;
// The row and column we end drawing at
- finish.x = (camera.y + camera.h) / tile_size.y + 1;
- finish.y = (camera.x + camera.w) / tile_size.x + 1;
+ _finish.x = (camera.y + camera.h) / tileSize.y + 1;
+ _finish.y = (camera.x + camera.w) / tileSize.x + 1;
- if (finish.x > (int)layer.tile.size())
- finish.x = layer.tile.size();
- if (finish.y > (int)layer.tile[0].size())
- finish.y = layer.tile[0].size();
+ if (_finish.x > (int)layer._tile.size())
+ _finish.x = layer._tile.size();
+ if (_finish.y > (int)layer._tile[0].size())
+ _finish.y = layer._tile[0].size();
- v.x = camera.x;
- v.y = camera.y;
+ _v.x = camera.x;
+ _v.y = camera.y;
Vector2i end;
end.x = camera.x + g_engine->_screen->w;
end.y = camera.y + g_engine->_screen->h;
- Rect clip(v.x, v.y, end.x - v.x, end.y - v.y);
+ Rect clip(_v.x, _v.y, end.x - _v.x, end.y - _v.y);
img.fastDraw(0, 0, &clip);
}
}
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 01298e3b512..48fa7b15a59 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -40,55 +40,58 @@ namespace Crab {
namespace TMX {
struct TileSet {
// The name of the tileset
- Common::String name;
+ Common::String _name;
// The location of the tileset image on the disk
- Common::String loc;
+ Common::String _loc;
// The first gid of the tileset
- GidFormat first_gid;
+ GidFormat _firstGid;
// Dimensions of tiles
- int tile_w, tile_h;
+ int _tileW, _tileH;
// Number of rows and columns of tiles
- int total_rows, total_cols;
+ int _totalRows, _totalCols;
// The image used by the tileset
- pyrodactyl::image::Image img;
+ pyrodactyl::image::Image _img;
// Stuff used to store temporary data
// The rectangle used to store clip info
- Rect clip;
-
- void Init() {
- first_gid = 1;
- tile_w = 1;
- tile_h = 1;
- total_rows = 1;
- total_cols = 1;
+ Rect _clip;
+
+ void init() {
+ _firstGid = 1;
+ _tileW = 1;
+ _tileH = 1;
+ _totalRows = 1;
+ _totalCols = 1;
+ }
+
+ TileSet() {
+ init();
}
- TileSet() { Init(); }
TileSet(const Common::String &path, rapidxml::xml_node<char> *node) {
- Init();
+ init();
load(path, node);
}
void load(const Common::String &path, rapidxml::xml_node<char> *node);
void draw(const Vector2i &pos, const TileInfo &tile);
- void PreDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf);
+ void preDraw(const Vector2i &pos, const TileInfo &tile, Graphics::ManagedSurface *surf);
};
class TileSetGroup {
- Common::Array<TileSet> tileset;
+ Common::Array<TileSet> _tileset;
// The latest tile position
- Vector2i v;
+ Vector2i _v;
// The area that we have to draw
- Vector2i start, finish;
+ Vector2i _start, _finish;
public:
TileSetGroup() {}
@@ -96,9 +99,9 @@ public:
void reset();
void load(const Common::String &path, rapidxml::xml_node<char> *node);
- void draw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos, pyrodactyl::image::Image &img);
- void PreDraw(MapLayer &layer, const Vector2i &tile_size, Graphics::ManagedSurface *surf);
- void ForceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tile_size, const Rect &player_pos);
+ void draw(MapLayer &layer, const Rect &camera, const Vector2i &tileSize, const Rect &playerPos, pyrodactyl::image::Image &img);
+ void preDraw(MapLayer &layer, const Vector2i &tileSize, Graphics::ManagedSurface *surf);
+ void forceDraw(MapLayer &layer, const Rect &camera, const Vector2i &tileSize, const Rect &playerPos);
};
} // End of namespace TMX
diff --git a/engines/crab/TMX/TileInfo.h b/engines/crab/TMX/TileInfo.h
index 0997aa87416..5ebfa8e91e4 100644
--- a/engines/crab/TMX/TileInfo.h
+++ b/engines/crab/TMX/TileInfo.h
@@ -46,52 +46,52 @@ const static GidFormat FlippedAntiDiagonallyFlag = 0x20000000;
struct TileInfo {
// The gid of the tile
- GidFormat gid;
+ GidFormat _gid;
// Do we need to flip this tile?
- TextureFlipType flip;
+ TextureFlipType _flip;
TileInfo() {
- gid = 0;
- flip = FLIP_NONE;
+ _gid = 0;
+ _flip = FLIP_NONE;
}
TileInfo(rapidxml::xml_node<char> *node) {
// Load the gid of the tile
- if (!loadNum(gid, "gid", node))
- gid = 0;
+ if (!loadNum(_gid, "gid", node))
+ _gid = 0;
- bool horizontal = (gid & FlippedHorizontallyFlag) != 0;
- bool vertical = (gid & FlippedVerticallyFlag) != 0;
- bool antidiagonal = (gid & FlippedAntiDiagonallyFlag) != 0;
+ bool horizontal = (_gid & FlippedHorizontallyFlag) != 0;
+ bool vertical = (_gid & FlippedVerticallyFlag) != 0;
+ bool antidiagonal = (_gid & FlippedAntiDiagonallyFlag) != 0;
// Find how the tile is flipped
if (horizontal) {
if (vertical) {
if (antidiagonal)
- flip = FLIP_XYD;
+ _flip = FLIP_XYD;
else
- flip = FLIP_XY;
+ _flip = FLIP_XY;
} else if (antidiagonal)
- flip = FLIP_DX;
+ _flip = FLIP_DX;
else
- flip = FLIP_X;
+ _flip = FLIP_X;
} else if (vertical) {
if (antidiagonal)
- flip = FLIP_DY;
+ _flip = FLIP_DY;
else
- flip = FLIP_Y;
+ _flip = FLIP_Y;
} else if (antidiagonal)
- flip = FLIP_D;
+ _flip = FLIP_D;
else
- flip = FLIP_NONE;
+ _flip = FLIP_NONE;
// Clear the flags
- gid &= ~(FlippedHorizontallyFlag | FlippedVerticallyFlag | FlippedAntiDiagonallyFlag);
+ _gid &= ~(FlippedHorizontallyFlag | FlippedVerticallyFlag | FlippedAntiDiagonallyFlag);
}
bool operator==(const TileInfo& other) const {
- return (gid == other.gid) && (flip == other.flip);
+ return (_gid == other._gid) && (_flip == other._flip);
}
};
} // End of namespace TMX
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index f3d85ce9962..7766c77e825 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -107,7 +107,7 @@ void Level::handleEvents(Info &info, const Common::Event &Event) {
b.x = dest.x - b.w / 2;
b.y = dest.y - b.h / 2;
- _objects[_playerIndex].setDestPathfinding(dest, !_terrain.InsideNoWalk(dest));
+ _objects[_playerIndex].setDestPathfinding(dest, !_terrain.insideNoWalk(dest));
}
}
}
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 22a16bbe8bd..11a2c9b2fda 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -50,7 +50,7 @@ LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result
// input.internalEvents();
calcTrigCollide(info);
- if (_terrain.CollideWithExit(_objects[_playerIndex].boundRect(), lResult)) {
+ if (_terrain.collideWithExit(_objects[_playerIndex].boundRect(), lResult)) {
if (playerInCombat(info)) {
_insideExit = true;
} else if (_insideExit == false) {
@@ -117,7 +117,7 @@ void Level::think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event
i->attack(info, _objects[_playerIndex], _scDefault);
} break;
case PST_FLEE:
- i->flee(info, _terrain.area_exit, _scDefault);
+ i->flee(info, _terrain._areaExit, _scDefault);
break;
case PST_NORMAL:
if (i->takingDamage(_objects[_playerIndex], _scDefault)) {
@@ -200,8 +200,8 @@ void Level::moveObject(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &
s.resolveCollide();
// Finally see if we are inside the overall level bounds
- if (!_terrain.InsideWalk(s.boundRect()))
- s.resolveInside(_terrain.AreaWalk());
+ if (!_terrain.insideWalk(s.boundRect()))
+ s.resolveInside(_terrain.areaWalk());
}
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 37bd592480e..c5ba1dad913 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -122,8 +122,8 @@ bool Level::layerVisible(pyrodactyl::anim::Sprite *obj) {
if (obj->_layer < 0)
return true;
- if ((unsigned int)obj->_layer < _terrain.layer.size())
- return _terrain.layer[obj->_layer].collide;
+ if ((unsigned int)obj->_layer < _terrain._layer.size())
+ return _terrain._layer[obj->_layer]._collide;
return false;
}
@@ -135,7 +135,7 @@ bool Level::layerVisible(pyrodactyl::anim::Sprite *obj) {
void Level::calcTrigCollide(pyrodactyl::event::Info &info) {
for (auto i = _objects.begin(); i != _objects.end(); ++i)
if (info.personValid(i->id()))
- _terrain.CollideWithTrigger(i->boundRect(), info.personGet(i->id())._trig);
+ _terrain.collideWithTrigger(i->boundRect(), info.personGet(i->id())._trig);
}
//------------------------------------------------------------------------
@@ -167,11 +167,11 @@ bool Level::collidingWithObject(pyrodactyl::event::Info &info, Common::String &i
// id is set to the id of colliding object
//------------------------------------------------------------------------
bool Level::collidingWithLevel(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &s) {
- _terrain.CollideWithNoWalk(s.boundRect(), s._collideData);
+ _terrain.collideWithNoWalk(s.boundRect(), s._collideData);
- _terrain.CollideWithStairs(s.boundRect(), s._velMod);
+ _terrain.collideWithStairs(s.boundRect(), s._velMod);
- if (_terrain.CollideWithMusic(s.boundRect(), _music)) {
+ if (_terrain.collideWithMusic(s.boundRect(), _music)) {
if (_music._track)
g_engine->_musicManager->playMusic(_music._id);
else
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index e94a3d4e9b8..b690435303c 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -42,18 +42,18 @@ using namespace pyrodactyl::input;
// Purpose: Pre render the terrain layer
void Level::preDraw() {
- Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(_terrain.W(), _terrain.H(), *g_engine->_format);
+ Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(_terrain.w(), _terrain.h(), *g_engine->_format);
unsigned int layerCount = 0u;
- for (auto l = _terrain.layer.begin(); l != _terrain.layer.end(); ++l, ++layerCount) {
- g_engine->_imageManager->_tileset.PreDraw(*l, _terrain.tile_size, surf);
+ for (auto l = _terrain._layer.begin(); l != _terrain._layer.end(); ++l, ++layerCount) {
+ g_engine->_imageManager->_tileset.preDraw(*l, _terrain._tileSize, surf);
// Draw the normal sprites if this is the layer for it
- if (layerCount == _terrain.sprite_layer)
+ if (layerCount == _terrain._spriteLayer)
preDrawObjects(surf);
}
// This is to ensure we don't miss out on drawing sprites
- if (layerCount <= _terrain.sprite_layer)
+ if (layerCount <= _terrain._spriteLayer)
preDrawObjects(surf);
_img.load(surf);
@@ -73,12 +73,12 @@ void Level::draw(pyrodactyl::event::Info &info) {
unsigned int layerCount = 0u;
// Draw the terrain layer
- g_engine->_imageManager->_tileset.draw(_terrain.layer[0], _camera, _terrain.tile_size, _objects[_playerIndex].posRect(), _img);
+ g_engine->_imageManager->_tileset.draw(_terrain._layer[0], _camera, _terrain._tileSize, _objects[_playerIndex].posRect(), _img);
Vector2i pos = _objects[_playerIndex]._aiData._dest;
Rect newpos(pos.x - (_destMarker._size.x / 2), pos.y - (_destMarker._size.y / 2), _destMarker._size.x, _destMarker._size.y);
- for (auto l = _terrain.layer.begin(); l != _terrain.layer.end(); ++l, ++layerCount) {
+ for (auto l = _terrain._layer.begin(); l != _terrain._layer.end(); ++l, ++layerCount) {
// Draw the background sprites
for (; b != _background.end(); ++b) {
@@ -89,11 +89,11 @@ void Level::draw(pyrodactyl::event::Info &info) {
}
// Draw the normal sprites if this is the layer for it
- if (layerCount == _terrain.sprite_layer)
+ if (layerCount == _terrain._spriteLayer)
drawObjects(info);
// Draw the terrain layer
- g_engine->_imageManager->_tileset.ForceDraw(*l, _camera, _terrain.tile_size, _objects[_playerIndex].posRect());
+ g_engine->_imageManager->_tileset.forceDraw(*l, _camera, _terrain._tileSize, _objects[_playerIndex].posRect());
}
// Draw the background sprites
@@ -105,7 +105,7 @@ void Level::draw(pyrodactyl::event::Info &info) {
}
// This is to ensure we don't miss out on drawing sprites
- if (layerCount <= _terrain.sprite_layer)
+ if (layerCount <= _terrain._spriteLayer)
drawObjects(info);
// Fliers are drawn above every sprite but below popup text
@@ -132,7 +132,7 @@ void Level::draw(pyrodactyl::event::Info &info) {
}
if (GameDebug)
- _terrain.DrawDebug(_camera);
+ _terrain.drawDebug(_camera);
}
//------------------------------------------------------------------------
@@ -146,26 +146,26 @@ void Level::drawObjects(pyrodactyl::event::Info &info) {
Vector2i pos = _objects[_playerIndex]._aiData._dest;
Rect newpos(pos.x - (_destMarker._size.x / 2), pos.y - (_destMarker._size.y / 2), _destMarker._size.x, _destMarker._size.y);
- if (_terrain.prop.empty()) {
+ if (_terrain._prop.empty()) {
for (auto &entry : _objSeq) {
if (entry.second->visible() && layerVisible(entry.second))
entry.second->draw(info, _camera);
}
} else {
- auto a = _terrain.prop.begin();
+ auto a = _terrain._prop.begin();
auto b = _objSeq.begin();
- while (a != _terrain.prop.end() && b != _objSeq.end()) {
+ while (a != _terrain._prop.end() && b != _objSeq.end()) {
auto obj = b->second;
- if (a->pos.y + a->pos.h < obj->y() + obj->h()) {
- for (auto &i : a->boundRect) {
+ if (a->_pos.y + a->_pos.h < obj->y() + obj->h()) {
+ for (auto &i : a->_boundRect) {
i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
if (i.Collide(_objects[_playerIndex].posRect())) {
- g_engine->_imageManager->_tileset.ForceDraw(*a, _camera, _terrain.tile_size, _objects[_playerIndex].posRect());
+ g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, _objects[_playerIndex].posRect());
}
if (i.Contains(_objects[_playerIndex]._aiData._dest)) {
- g_engine->_imageManager->_tileset.ForceDraw(*a, _camera, _terrain.tile_size, newpos);
+ g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, newpos);
}
}
++a;
@@ -176,22 +176,22 @@ void Level::drawObjects(pyrodactyl::event::Info &info) {
}
}
- if (a == _terrain.prop.end()) {
+ if (a == _terrain._prop.end()) {
for (; b != _objSeq.end(); ++b) {
auto obj = b->second;
if (obj->visible() && layerVisible(obj))
obj->draw(info, _camera);
}
} else if (b == _objSeq.end()) {
- for (; a != _terrain.prop.end(); ++a) {
- for (auto &i : a->boundRect) {
+ for (; a != _terrain._prop.end(); ++a) {
+ for (auto &i : a->_boundRect) {
i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
if (i.Collide(_objects[_playerIndex].posRect())) {
- g_engine->_imageManager->_tileset.ForceDraw(*a, _camera, _terrain.tile_size, _objects[_playerIndex].posRect());
+ g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, _objects[_playerIndex].posRect());
}
if (i.Contains(_objects[_playerIndex]._aiData._dest)) {
- g_engine->_imageManager->_tileset.ForceDraw(*a, _camera, _terrain.tile_size, newpos);
+ g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, newpos);
}
}
}
@@ -200,26 +200,26 @@ void Level::drawObjects(pyrodactyl::event::Info &info) {
}
void Level::preDrawObjects(Graphics::ManagedSurface *surf) {
- if (_terrain.prop.empty()) {
+ if (_terrain._prop.empty()) {
return;
} else {
- auto a = _terrain.prop.begin();
+ auto a = _terrain._prop.begin();
auto b = _objSeq.begin();
- while (a != _terrain.prop.end() && b != _objSeq.end()) {
+ while (a != _terrain._prop.end() && b != _objSeq.end()) {
auto obj = b->second;
- if (a->pos.y + a->pos.h < obj->y() + obj->h()) {
- g_engine->_imageManager->_tileset.PreDraw(*a, _terrain.tile_size, surf);
+ if (a->_pos.y + a->_pos.h < obj->y() + obj->h()) {
+ g_engine->_imageManager->_tileset.preDraw(*a, _terrain._tileSize, surf);
++a;
} else {
++b;
}
}
- if (a == _terrain.prop.end()) {
+ if (a == _terrain._prop.end()) {
} else if (b == _objSeq.end()) {
- for (; a != _terrain.prop.end(); ++a)
- g_engine->_imageManager->_tileset.PreDraw(*a, _terrain.tile_size, surf);
+ for (; a != _terrain._prop.end(); ++a)
+ g_engine->_imageManager->_tileset.preDraw(*a, _terrain._tileSize, surf);
}
}
}
@@ -250,10 +250,10 @@ void Level::setCamera() {
_camera.y = focus.y - (g_engine->_screenSettings->cur.h / 2);
// Keep the camera in bounds
- if (_camera.x > _terrain.W() - _camera.w)
- _camera.x = _terrain.W() - _camera.w;
- if (_camera.y > _terrain.H() - _camera.h)
- _camera.y = _terrain.H() - _camera.h;
+ if (_camera.x > _terrain.w() - _camera.w)
+ _camera.x = _terrain.w() - _camera.w;
+ if (_camera.y > _terrain.h() - _camera.h)
+ _camera.y = _terrain.h() - _camera.h;
if (_camera.x < 0)
_camera.x = 0;
if (_camera.y < 0)
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index fa6d77064f5..c4c065bb1f2 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -83,7 +83,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
// Remember to load the terrain data before constructing the pathfinding grid
_pathfindingGrid.SetupNodes(_terrain);
- _terrain.grid = &_pathfindingGrid;
+ _terrain._grid = &_pathfindingGrid;
if (nodeValid("loc", mapnode))
_mapLoc.load(mapnode->first_node("loc"));
Commit: 1e04b7e2761ff7ab781d99daf56ebd9b344c9a16
https://github.com/scummvm/scummvm/commit/1e04b7e2761ff7ab781d99daf56ebd9b344c9a16
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make multiple UI classes follow code formatting conventions
Changed paths:
engines/crab/event/GameEventInfo.cpp
engines/crab/event/effect.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/event/trigger.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/mainmenu.cpp
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/FileData.cpp
engines/crab/ui/FileData.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/HoverInfo.cpp
engines/crab/ui/HoverInfo.h
engines/crab/ui/ImageData.cpp
engines/crab/ui/ImageData.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/ItemDesc.h
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/button.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 7f6fdba8633..8774b6647cb 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -77,7 +77,7 @@ void Info::load(rapidxml::xml_node<char> *node) {
}
curLocID(node->first_node("level")->first_attribute("start")->value());
- _inv.ItemFile(node->first_node("item")->first_attribute("list")->value());
+ _inv.itemFile(node->first_node("item")->first_attribute("list")->value());
}
void Info::loadPeople(const Common::String &filename) {
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 2e197d3bf01..3a463d45e77 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -149,11 +149,11 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
case EFF_JOURNAL:
if (_subject == "finish")
- info._journal.Move(playerId, _operation, true);
+ info._journal.move(playerId, _operation, true);
else if (_subject == "start")
- info._journal.Move(playerId, _operation, false);
+ info._journal.move(playerId, _operation, false);
else
- info._journal.Add(playerId, _subject, _operation, _val);
+ info._journal.add(playerId, _subject, _operation, _val);
// Update unread status of journal
info._unread._journal = true;
@@ -171,9 +171,9 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
case EFF_ITEM:
if (_operation == "del")
- info._inv.DelItem(_subject, _val);
+ info._inv.delItem(_subject, _val);
else
- info._inv.LoadItem(_subject, _val);
+ info._inv.loadItem(_subject, _val);
// Update unread status of inventory
info._unread._inventory = true;
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 48333435015..ddfcced3fd4 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -103,7 +103,7 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
if (_oh.show_journal) {
info._journal.handleEvents(playerId, Event);
- if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
+ if (hud._back.handleEvents(Event) == BUAC_LCLICK || hud._pausekey.handleEvents(Event))
_oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
@@ -111,9 +111,9 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
if (info.personValid(_curEvent->_title)) {
Person &p = info.personGet(_curEvent->_title);
if (p._altJournalName)
- info._journal.Open(playerId, JE_PEOPLE, p._journalName);
+ info._journal.open(playerId, JE_PEOPLE, p._journalName);
else
- info._journal.Open(playerId, JE_PEOPLE, p._name);
+ info._journal.open(playerId, JE_PEOPLE, p._name);
}
}
@@ -132,13 +132,13 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
if (_oh.show_journal) {
info._journal.handleEvents(playerId, Event);
- if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
+ if (hud._back.handleEvents(Event) == BUAC_LCLICK || hud._pausekey.handleEvents(Event))
_oh.show_journal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (_oh.HandleCommonEvents(Event))
if (info.personValid(_curEvent->_title))
- info._journal.Open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
+ info._journal.open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
int choice = _reply.handleEvents(info, g_engine->_eventStore->_con[_curEvent->_special], _curEvent->_title, _oh, Event);
if (choice >= 0) {
@@ -151,7 +151,7 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
// If journal button is select from within an event, go to the entry corresponding to that person's name
if (_oh.HandleCommonEvents(Event))
if (info.personValid(_curEvent->_title))
- info._journal.Open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
+ info._journal.open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
if (_textin.handleEvents(Event))
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
@@ -160,7 +160,7 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
if (_intro._showTraits) {
_per.handleEvents(info, _curEvent->_title, Event);
- if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
+ if (hud._back.handleEvents(Event) == BUAC_LCLICK || hud._pausekey.handleEvents(Event))
_intro._showTraits = false;
} else {
if (_intro.handleEvents(Event))
@@ -325,7 +325,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
g_engine->_imageManager->dimScreen();
if (_oh.show_journal) {
info._journal.draw(level.playerId());
- hud.back.draw();
+ hud._back.draw();
} else
_oh.draw(info, _curEvent, _curEvent->_title, _player, _curSp);
break;
@@ -333,7 +333,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
g_engine->_imageManager->dimScreen();
if (_oh.show_journal) {
info._journal.draw(level.playerId());
- hud.back.draw();
+ hud._back.draw();
} else {
_oh.draw(info, _curEvent, _curEvent->_title, _player, _curSp);
_reply.draw();
@@ -347,7 +347,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
g_engine->_imageManager->dimScreen();
if (_intro._showTraits) {
_per.draw(info, _curEvent->_title);
- hud.back.draw();
+ hud._back.draw();
} else
_intro.draw(info, _curEvent->_dialog, _curSp, _curEvent->_state);
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 9196a7e7406..9c83287524d 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -146,7 +146,7 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
break;
case TRIG_ITEM:
- return info._inv.HasItem(_target, _subject, _val);
+ return info._inv.hasItem(_target, _subject, _val);
break;
case TRIG_RECT:
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 25e71959094..717e3029d84 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -46,7 +46,7 @@ void Game::StartNewGame() {
info.ironMan(g_engine->_tempData->ironman);
savefile.ironman = g_engine->_tempData->filename;
clock.Start();
- hud.pause.UpdateMode(info.ironMan());
+ hud._pause.UpdateMode(info.ironMan());
CreateSaveGame(SAVEGAME_EVENT);
}
@@ -141,10 +141,10 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
map.RevealAdd(level._mapClip._id, level._mapClip._rect);
// Initialize inventory
- info._inv.Init(level.playerId());
+ info._inv.init(level.playerId());
// Initialize journal
- info._journal.Init(level.playerId());
+ info._journal.init(level.playerId());
level.preDraw();
return true;
@@ -162,9 +162,9 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
// if (GameDebug)
// debug_console.handleEvents(Event);
- if (!debug_console.RestrictInput()) {
+ if (!debug_console.restrictInput()) {
if (state == STATE_LOSE_MENU) {
- switch (hud.gom.handleEvents(Event)) {
+ switch (hud._gom.handleEvents(Event)) {
case 0:
state = STATE_LOSE_LOAD;
break;
@@ -181,10 +181,10 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
return;
}
- if (hud.pausekey.handleEvents(Event) || hud.back.handleEvents(Event) == BUAC_LCLICK)
+ if (hud._pausekey.handleEvents(Event) || hud._back.handleEvents(Event) == BUAC_LCLICK)
state = STATE_LOSE_MENU;
} else {
- if (!gem.eventInProgress() && !hud.pause.DisableHotkeys()) {
+ if (!gem.eventInProgress() && !hud._pause.DisableHotkeys()) {
switch (hud.handleEvents(info, Event)) {
case HS_MAP:
ToggleState(STATE_MAP);
@@ -220,7 +220,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
if (!game_over.empty() && game_over.evaluate(info)) {
state = STATE_LOSE_MENU;
- hud.gom.reset();
+ hud._gom.reset();
return;
}
@@ -236,20 +236,20 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
#endif
- if (hud.pausekey.handleEvents(Event))
+ if (hud._pausekey.handleEvents(Event))
ToggleState(STATE_PAUSE);
}
} else if (state == STATE_PAUSE) {
- switch (hud.pause.handleEvents(Event, hud.back)) {
+ switch (hud._pause.handleEvents(Event, hud._back)) {
case PS_RESUME:
ToggleState(STATE_GAME);
- hud.SetTooltip();
+ hud.setTooltip();
break;
case PS_SAVE:
CreateSaveGame(SAVEGAME_NORMAL);
ToggleState(STATE_GAME);
- hud.SetTooltip();
+ hud.setTooltip();
break;
case PS_LOAD:
//ShouldChangeState = true;
@@ -273,7 +273,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
break;
}
} else {
- if (hud.back.handleEvents(Event) == BUAC_LCLICK)
+ if (hud._back.handleEvents(Event) == BUAC_LCLICK)
ToggleState(STATE_GAME);
switch (state) {
@@ -288,7 +288,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
if (info._journal.handleEvents(level.playerId(), Event)) {
// This means we selected the "find on map" button, so we need to:
// switch to the world map, and highlight the appropriate quest marker
- map.SelectDest(info._journal.marker_title);
+ map.SelectDest(info._journal._markerTitle);
ToggleState(STATE_MAP);
}
break;
@@ -513,45 +513,45 @@ void Game::draw() {
break;
case STATE_PAUSE:
g_engine->_imageManager->dimScreen();
- hud.pause.draw(hud.back);
+ hud._pause.draw(hud._back);
hud.draw(info, level.playerId());
break;
case STATE_MAP:
g_engine->_imageManager->dimScreen();
map.draw(info);
hud.draw(info, level.playerId());
- hud.back.draw();
+ hud._back.draw();
break;
case STATE_JOURNAL:
g_engine->_imageManager->dimScreen();
info._journal.draw(level.playerId());
hud.draw(info, level.playerId());
- hud.back.draw();
+ hud._back.draw();
break;
case STATE_CHARACTER:
g_engine->_imageManager->dimScreen();
gem._per.draw(info, level.playerId());
hud.draw(info, level.playerId());
- hud.back.draw();
+ hud._back.draw();
break;
case STATE_INVENTORY:
g_engine->_imageManager->dimScreen();
info.invDraw(level.playerId());
hud.draw(info, level.playerId());
- hud.back.draw();
+ hud._back.draw();
break;
case STATE_HELP:
g_engine->_imageManager->dimScreen();
g_engine->_helpScreen->draw();
- hud.back.draw();
+ hud._back.draw();
hud.draw(info, level.playerId());
break;
case STATE_LOSE_MENU:
- hud.gom.draw();
+ hud._gom.draw();
break;
case STATE_LOSE_LOAD:
g_engine->_loadMenu->draw();
- hud.back.draw();
+ hud._back.draw();
break;
default:
break;
@@ -580,11 +580,11 @@ bool Game::ApplyResult() {
break;
case ER_DEST:
if (i->_x < 0 || i->_y < 0) {
- info._journal.Marker(level.playerId(), i->_val, false);
+ info._journal.marker(level.playerId(), i->_val, false);
map.DestDel(i->_val);
} else {
map.DestAdd(i->_val, i->_x, i->_y);
- info._journal.Marker(level.playerId(), i->_val, true);
+ info._journal.marker(level.playerId(), i->_val, true);
info._unread._map = true;
}
break;
@@ -652,7 +652,7 @@ void Game::ApplyResult(LevelResult result) {
return;
case LR_GAMEOVER:
state = STATE_LOSE_MENU;
- hud.gom.reset();
+ hud._gom.reset();
break;
default:
break;
@@ -683,7 +683,7 @@ void Game::loadState(Common::SeekableReadStream *stream) {
if (nodeValid(node)) {
info.loadIronMan(node);
loadStr(savefile.ironman, "file", node);
- hud.pause.UpdateMode(info.ironMan());
+ hud._pause.UpdateMode(info.ironMan());
if (nodeValid("events", node))
gem.loadState(node->first_node("events"));
@@ -830,7 +830,7 @@ void Game::ToggleState(const State &s) {
// This is because game is the first state, the rest are in order
hud.State(state - 1);
- hud.pause.reset();
+ hud._pause.reset();
// Only load help screen image if we have to
if (state == STATE_HELP)
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 7d394f58317..9edd963ae91 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -120,7 +120,7 @@ private:
}
// Load the current player image
- void PlayerImg() { hud.PlayerImg(g_engine->_eventStore->_img[info.playerImg()]); }
+ void PlayerImg() { hud.playerImg(g_engine->_eventStore->_img[info.playerImg()]); }
public:
Game() : _isInited(false) {}
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index de0d57cf0c1..e1a3eace090 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -165,7 +165,7 @@ void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
switch (choice) {
case 0:
- if (g_engine->_loadMenu->SelectNewestFile()) {
+ if (g_engine->_loadMenu->selectNewestFile()) {
ChangeState(STATE_NORMAL);
ShouldChangeState = true;
NewStateID = GAMESTATE_LOAD_GAME;
@@ -176,7 +176,7 @@ void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
case 2:
ChangeState(STATE_LOAD);
- g_engine->_loadMenu->ScanDir();
+ g_engine->_loadMenu->scanDir();
break;
case 3:
ChangeState(STATE_OPTIONS);
@@ -463,7 +463,7 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
me_main.UseKeyboard((state == STATE_NORMAL));
// Continue button is only enabled if there is a save to load
- me_main.element[0]._visible = !g_engine->_loadMenu->Empty();
+ me_main.element[0]._visible = !g_engine->_loadMenu->empty();
// Enable credits and quit button if outside all menus, otherwise disable it
me_main.element[6]._visible = (state == STATE_NORMAL);
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 7d6f5d92333..a0e43e57f2e 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -37,10 +37,10 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
void CreditScreen::reset() {
- start.x = g_engine->_screenSettings->cur.w / 2 - 150;
- start.y = g_engine->_screenSettings->cur.h + 20;
- cur.x = start.x;
- speed.cur = speed.slow;
+ _start.x = g_engine->_screenSettings->cur.w / 2 - 150;
+ _start.y = g_engine->_screenSettings->cur.h + 20;
+ _cur.x = _start.x;
+ _speed._cur = _speed._slow;
}
void CreditScreen::load(const Common::String &filename) {
@@ -49,72 +49,72 @@ void CreditScreen::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("credits");
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("h", node))
- heading.load(node->first_node("h"));
+ _heading.load(node->first_node("h"));
if (nodeValid("p", node))
- paragraph.load(node->first_node("p"));
+ _paragraph.load(node->first_node("p"));
if (nodeValid("logo", node))
- logo.load(node->first_node("logo"));
+ _logo.load(node->first_node("logo"));
if (nodeValid("website", node))
- website.load(node->first_node("website"), false);
+ _website.load(node->first_node("website"), false);
if (nodeValid("twitter", node))
- twitter.load(node->first_node("twitter"), false);
+ _twitter.load(node->first_node("twitter"), false);
if (nodeValid("twitter", node))
- back.load(node->first_node("back"));
+ _back.load(node->first_node("back"));
if (nodeValid("fast", node)) {
rapidxml::xml_node<char> *fnode = node->first_node("fast");
- fast.load(fnode);
- loadNum(speed.fast, "val", fnode);
+ _fast.load(fnode);
+ loadNum(_speed._fast, "val", fnode);
}
if (nodeValid("slow", node)) {
rapidxml::xml_node<char> *snode = node->first_node("slow");
- slow.load(snode);
- loadNum(speed.slow, "val", snode);
+ _slow.load(snode);
+ loadNum(_speed._slow, "val", snode);
}
if (nodeValid("reverse", node)) {
rapidxml::xml_node<char> *rnode = node->first_node("reverse");
- reverse.load(rnode);
- loadNum(speed.reverse, "val", rnode);
+ _reverse.load(rnode);
+ loadNum(_speed._reverse, "val", rnode);
}
- speed.cur = speed.slow;
+ _speed._cur = _speed._slow;
if (nodeValid("pause", node))
- pause.load(node->first_node("pause"));
+ _pause.load(node->first_node("pause"));
if (nodeValid("text", node)) {
rapidxml::xml_node<char> *tnode = node->first_node("text");
for (rapidxml::xml_node<char> *n = tnode->first_node(); n != NULL; n = n->next_sibling()) {
CreditText t;
- t.text = n->value();
- t.heading = (n->name()[0] == 'h');
- list.push_back(t);
+ t._text = n->value();
+ t._heading = (n->name()[0] == 'h');
+ _list.push_back(t);
}
}
}
}
bool CreditScreen::handleEvents(Common::Event &Event) {
- if (slow.handleEvents(Event) == BUAC_LCLICK)
- speed.cur = speed.slow;
- else if (fast.handleEvents(Event) == BUAC_LCLICK)
- speed.cur = speed.fast;
- else if (pause.handleEvents(Event) == BUAC_LCLICK)
- speed.cur = 0.0f;
- else if (reverse.handleEvents(Event) == BUAC_LCLICK)
- speed.cur = speed.reverse;
-
- return (back.handleEvents(Event) == BUAC_LCLICK);
+ if (_slow.handleEvents(Event) == BUAC_LCLICK)
+ _speed._cur = _speed._slow;
+ else if (_fast.handleEvents(Event) == BUAC_LCLICK)
+ _speed._cur = _speed._fast;
+ else if (_pause.handleEvents(Event) == BUAC_LCLICK)
+ _speed._cur = 0.0f;
+ else if (_reverse.handleEvents(Event) == BUAC_LCLICK)
+ _speed._cur = _speed._reverse;
+
+ return (_back.handleEvents(Event) == BUAC_LCLICK);
}
#if 0
@@ -138,57 +138,57 @@ bool CreditScreen::handleEvents(SDL_Event &Event) {
#endif
void CreditScreen::draw() {
- bg.draw();
+ _bg.draw();
- slow.draw();
- fast.draw();
- pause.draw();
- reverse.draw();
+ _slow.draw();
+ _fast.draw();
+ _pause.draw();
+ _reverse.draw();
- logo.draw();
- twitter.draw();
- website.draw();
+ _logo.draw();
+ _twitter.draw();
+ _website.draw();
- back.draw();
+ _back.draw();
- cur.y = start.y;
+ _cur.y = _start.y;
- for (auto i = list.begin(); i != list.end(); ++i) {
- cur.y += paragraph.inc;
+ for (auto i = _list.begin(); i != _list.end(); ++i) {
+ _cur.y += _paragraph._inc;
- if (i->heading) {
- cur.y += heading.inc;
- if (cur.y > -30 && cur.y < g_engine->_screenSettings->cur.h + 40) // Only draw text if it is actually visible on screen
- g_engine->_textManager->draw(cur.x, cur.y, i->text, heading.color, heading.font, heading.align);
- } else if (cur.y > -30 && cur.y < g_engine->_screenSettings->cur.h + 40)
- g_engine->_textManager->draw(cur.x, cur.y, i->text, paragraph.color, paragraph.font, paragraph.align);
+ if (i->_heading) {
+ _cur.y += _heading._inc;
+ if (_cur.y > -30 && _cur.y < g_engine->_screenSettings->cur.h + 40) // Only draw text if it is actually visible on screen
+ g_engine->_textManager->draw(_cur.x, _cur.y, i->_text, _heading._color, _heading._font, _heading._align);
+ } else if (_cur.y > -30 && _cur.y < g_engine->_screenSettings->cur.h + 40)
+ g_engine->_textManager->draw(_cur.x, _cur.y, i->_text, _paragraph._color, _paragraph._font, _paragraph._align);
// If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
- if (cur.y > g_engine->_screenSettings->cur.h + 40)
+ if (_cur.y > g_engine->_screenSettings->cur.h + 40)
break;
}
- start.y -= speed.cur;
+ _start.y -= _speed._cur;
// Sanity check so that we don't scroll too high or low
- if (start.y > g_engine->_screenSettings->cur.h + 40)
- start.y = g_engine->_screenSettings->cur.h + 40;
- else if (start.y < INT_MIN + 10)
- start.y = INT_MIN + 10;
+ if (_start.y > g_engine->_screenSettings->cur.h + 40)
+ _start.y = g_engine->_screenSettings->cur.h + 40;
+ else if (_start.y < INT_MIN + 10)
+ _start.y = INT_MIN + 10;
}
void CreditScreen::setUI() {
- bg.setUI();
- back.setUI();
+ _bg.setUI();
+ _back.setUI();
- slow.setUI();
- fast.setUI();
- pause.setUI();
- reverse.setUI();
+ _slow.setUI();
+ _fast.setUI();
+ _pause.setUI();
+ _reverse.setUI();
- logo.setUI();
- twitter.setUI();
- website.setUI();
+ _logo.setUI();
+ _twitter.setUI();
+ _website.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 99a221ca521..375470dc5e0 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -46,69 +46,72 @@ class CreditScreen {
// Text and formatting information
struct CreditText {
// Title of the section (stuff like programmer, designer etc)
- Common::String text;
+ Common::String _text;
// The style it should be drawn in
- bool heading;
+ bool _heading;
};
// The background image and company logo
- pyrodactyl::ui::ImageData bg, logo;
+ pyrodactyl::ui::ImageData _bg, _logo;
// The names displayed in the credits
- Common::Array<CreditText> list;
+ Common::Array<CreditText> _list;
// The starting position
- Vector2i start;
+ Vector2i _start;
// The current position
- Vector2D<long> cur;
+ Vector2D<long> _cur;
// Text parameters
struct TextParam {
- int inc, color;
- FontKey font;
- Align align;
+ int _inc, _color;
+ FontKey _font;
+ Align _align;
TextParam() {
- inc = 30;
- color = 0;
- font = 1;
- align = ALIGN_CENTER;
+ _inc = 30;
+ _color = 0;
+ _font = 1;
+ _align = ALIGN_CENTER;
}
void load(rapidxml::xml_node<char> *node) {
- loadNum(inc, "inc", node);
- loadNum(color, "color", node);
- LoadFontKey(font, "font", node);
- loadAlign(align, node);
+ loadNum(_inc, "inc", node);
+ loadNum(_color, "color", node);
+ LoadFontKey(_font, "font", node);
+ loadAlign(_align, node);
}
- } heading, paragraph;
+ } _heading, _paragraph;
// All speed levels at which credits can scroll through
struct ScrollSpeed {
// The current speed
- float cur;
+ float _cur;
// Various levels
- float slow, fast, reverse;
+ float _slow, _fast, _reverse;
ScrollSpeed() {
- slow = 1.0f;
- fast = 4.0f;
- reverse = -2.0f;
- cur = slow;
+ _slow = 1.0f;
+ _fast = 4.0f;
+ _reverse = -2.0f;
+ _cur = _slow;
}
- } speed;
+ } _speed;
// Speed controls for credits
- Button fast, slow, reverse, pause;
+ Button _fast, _slow, _reverse, _pause;
// The back button, website and twitter buttons
- Button back, website, twitter;
+ Button _back, _website, _twitter;
public:
- CreditScreen() { reset(); }
+ CreditScreen() {
+ reset();
+ }
+
~CreditScreen() {}
void load(const Common::String &filename);
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index ce047443558..cfd3eead298 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -40,47 +40,47 @@ void DebugConsole::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("debug");
if (nodeValid(node)) {
if (nodeValid("menu", node))
- menu.load(node->first_node("menu"));
+ _menu.load(node->first_node("menu"));
if (nodeValid("variable", node)) {
rapidxml::xml_node<char> *varnode = node->first_node("variable");
if (nodeValid("bg", varnode))
- bg.load(varnode->first_node("bg"));
+ _bg.load(varnode->first_node("bg"));
if (nodeValid("check", varnode))
- check.load(varnode->first_node("check"));
+ _check.load(varnode->first_node("check"));
if (nodeValid("back", varnode))
- back.load(varnode->first_node("back"));
+ _back.load(varnode->first_node("back"));
if (nodeValid("value", varnode))
- value.load(varnode->first_node("value"));
+ _value.load(varnode->first_node("value"));
if (nodeValid("text", varnode))
- text_field.load(varnode->first_node("text"));
+ _textField.load(varnode->first_node("text"));
}
}
}
}
void DebugConsole::draw(pyrodactyl::event::Info &info) {
- switch (state) {
+ switch (_state) {
case STATE_NORMAL:
- menu.draw();
+ _menu.draw();
break;
case STATE_VAR:
- bg.draw();
- check.draw();
- back.draw();
- text_field.draw();
+ _bg.draw();
+ _check.draw();
+ _back.draw();
+ _textField.draw();
{
int temp = 0;
- if (info.varGet(var_name, temp))
- value.draw(NumberToString(temp));
+ if (info.varGet(_varName, temp))
+ _value.draw(NumberToString(temp));
else
- value.draw("Does not exist.");
+ _value.draw("Does not exist.");
}
break;
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index f67845fe88c..b7b38865003 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -41,27 +41,34 @@ namespace pyrodactyl {
namespace ui {
class DebugConsole {
// The state of the menu
- enum { STATE_NORMAL,
- STATE_VAR } state;
+ enum {
+ STATE_NORMAL,
+ STATE_VAR
+ } _state;
// The overarching menu that is the starting point for all functions
- ButtonMenu menu;
+ ButtonMenu _menu;
// The dialog box UI - used to check value of a variable
- ImageData bg;
- Button check, back;
- TextData value;
- TextArea text_field;
+ ImageData _bg;
+ Button _check, _back;
+ TextData _value;
+ TextArea _textField;
// The variable name we're tracking
- Common::String var_name;
+ Common::String _varName;
public:
- DebugConsole() { state = STATE_NORMAL; }
+ DebugConsole() {
+ _state = STATE_NORMAL;
+ }
+
~DebugConsole() {}
// Only restrict input when we're in variable state
- bool RestrictInput() { return (state == STATE_VAR || menu.HoverIndex() != -1); }
+ bool restrictInput() {
+ return (_state == STATE_VAR || _menu.HoverIndex() != -1);
+ }
void load(const Common::String &filename);
void draw(pyrodactyl::event::Info &info);
diff --git a/engines/crab/ui/FileData.cpp b/engines/crab/ui/FileData.cpp
index ee04c8133de..45872a50748 100644
--- a/engines/crab/ui/FileData.cpp
+++ b/engines/crab/ui/FileData.cpp
@@ -37,12 +37,12 @@ namespace Crab {
using namespace pyrodactyl::ui;
SaveFileData::SaveFileData(const Common::String &file) {
- path = file;
+ _path = file;
// Extract String between _ and . For eg., CRAB_Autosave 1.unr -> Autosave 1
// 4 => .unr
size_t pos = file.findFirstOf('_');
- name = file.substr(pos + 1, file.size() - (pos + 1) - 4);
+ _name = file.substr(pos + 1, file.size() - (pos + 1) - 4);
if (g_engine->getSaveFileManager()->exists(file)) {
Common::InSaveFile *savefile = g_engine->getSaveFileManager()->openForLoading(file);
@@ -57,13 +57,13 @@ SaveFileData::SaveFileData(const Common::String &file) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("save");
if (nodeValid(node)) {
- loadStr(diff, "diff", node);
- loadStr(loc_id, "loc_id", node);
- loadStr(loc_name, "loc_name", node);
- loadStr(char_name, "char_name", node);
- loadStr(time, "time", node);
- loadStr(preview, "preview", node);
- blank = false;
+ loadStr(_diff, "diff", node);
+ loadStr(_locId, "loc_id", node);
+ loadStr(_locName, "loc_name", node);
+ loadStr(_charName, "char_name", node);
+ loadStr(_time, "time", node);
+ loadStr(_preview, "preview", node);
+ _blank = false;
}
}
}
diff --git a/engines/crab/ui/FileData.h b/engines/crab/ui/FileData.h
index 5cd0fbeead4..50a837d3ae2 100644
--- a/engines/crab/ui/FileData.h
+++ b/engines/crab/ui/FileData.h
@@ -41,15 +41,15 @@ namespace pyrodactyl {
namespace ui {
class FileData {
public:
- Common::String name, path, last_modified;
+ Common::String _name, _path, _lastModified;
};
class SaveFileData : public FileData {
public:
- Common::String loc_id, loc_name, char_name, diff, time, preview;
+ Common::String _locId, _locName, _charName, _diff, _time, _preview;
// This is to account for the first save slot, called "New Save", which doesn't actually have a file
- bool blank;
+ bool _blank;
SaveFileData(const Common::String &filepath);
SaveFileData(const bool empty);
@@ -57,24 +57,31 @@ public:
class ModFileData : public FileData {
public:
- Common::String author, version, info, website, preview;
+ Common::String _author, _version, _info, _website, _preview;
ModFileData(const Common::String &filepath);
};
// The types of data shown about the save file
-enum { DATA_SAVENAME,
- DATA_LASTMODIFIED,
- DATA_BUTTON_TOTAL };
+enum {
+ DATA_SAVENAME,
+ DATA_LASTMODIFIED,
+ DATA_BUTTON_TOTAL
+};
// Both of these are capped at DATA_HOVER_TOTAL
-enum { DATA_LOCNAME,
- DATA_DIFFICULTY,
- DATA_TIMEPLAYED,
- DATA_PLAYERNAME };
-enum { DATA_AUTHOR,
- DATA_VERSION,
- DATA_INFO,
- DATA_WEBSITE };
+enum {
+ DATA_LOCNAME,
+ DATA_DIFFICULTY,
+ DATA_TIMEPLAYED,
+ DATA_PLAYERNAME
+};
+
+enum {
+ DATA_AUTHOR,
+ DATA_VERSION,
+ DATA_INFO,
+ DATA_WEBSITE
+};
const int DATA_HOVER_TOTAL = 4;
} // End of namespace ui
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index e054f015445..5a08c5b48e9 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -49,85 +49,90 @@ template<typename FileType>
class FileMenu {
protected:
// The background of the menu
- ImageData bg;
+ ImageData _bg;
// The collection of buttons
- PageButtonMenu menu;
+ PageButtonMenu _menu;
// The final filename that is selected
- Common::String selected;
+ Common::String _selected;
// The extension and directory used by this menu
- Common::String extension, directory;
+ Common::String _extension, _directory;
// The save information for each slot
- Common::Array<FileType> slot_info;
- TextData td_b[DATA_BUTTON_TOTAL];
+ Common::Array<FileType> _slotInfo;
+ TextData tdB[DATA_BUTTON_TOTAL];
// The titles for loc_name, difficulty, time_played and player_name
HoverInfo hov[DATA_HOVER_TOTAL];
- TextData td_h[DATA_HOVER_TOTAL];
+ TextData tdH[DATA_HOVER_TOTAL];
// The preview picture details
struct
{
// We load only the current preview image instead of all of them
- pyrodactyl::image::Image preview;
+ pyrodactyl::image::Image _preview;
// Fallback path if there is no preview image or if we fail to load it
- Common::String no_preview_path;
+ Common::String _noPreviewPath;
// Position of image
- Element pos;
+ Element _pos;
// Is the image loaded
- bool loaded;
- } img;
+ bool _loaded;
+ } _img;
// Are we hovering over a button right now?
- bool hover;
+ bool _hover;
// The previously hover button
- int prev_hover;
+ int _prevHover;
public:
FileMenu() {
- img.loaded = false;
- hover = false;
- prev_hover = -1;
+ _img._loaded = false;
+ _hover = false;
+ _prevHover = -1;
}
~FileMenu() {
- if (img.loaded)
- img.preview.deleteImage();
+ if (_img._loaded)
+ _img._preview.deleteImage();
}
void reset() {
- if (img.loaded)
- img.preview.deleteImage();
- img.loaded = false;
- hover = false;
+ if (_img._loaded)
+ _img._preview.deleteImage();
+ _img._loaded = false;
+ _hover = false;
}
- Common::String SelectedPath() { return selected; }
- void SelectedPath(const Common::String &val) { selected = val; }
+ Common::String selectedPath() {
+ return _selected;
+ }
+
+ void selectedPath(const Common::String &val) {
+ _selected = val;
+ }
- void ScanDir() {
- warning("STUB: FileMenu::ScanDir()");
+ void scanDir() {
+ warning("STUB: FileMenu::scanDir()");
Common::String res = "CRAB_*";
res += g_engine->_filePath->save_ext;
Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
- slot_info.clear();
- menu.Clear();
+ _slotInfo.clear();
+ _menu.Clear();
- unsigned int count_slot = 0, count_menu = 0;
+ unsigned int countSlot = 0, countMenu = 0;
for (const Common::String& save : saves) {
- slot_info.push_back(FileType(save));
- menu.Add(count_slot, count_menu);
+ _slotInfo.push_back(FileType(save));
+ _menu.Add(countSlot, countMenu);
}
- menu.AssignPaths();
+ _menu.AssignPaths();
#if 0
using namespace boost::filesystem;
@@ -159,29 +164,29 @@ public:
void load(rapidxml::xml_node<char> *node) {
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("menu", node))
- menu.load(node->first_node("menu"));
+ _menu.load(node->first_node("menu"));
if (nodeValid("preview", node)) {
auto prnode = node->first_node("preview");
- img.pos.load(prnode);
- loadStr(img.no_preview_path, "path", prnode);
+ _img._pos.load(prnode);
+ loadStr(_img._noPreviewPath, "path", prnode);
}
if (nodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
// Stuff displayed on the slot button
- td_b[DATA_SAVENAME].load(offnode->first_node("save_name"));
- td_b[DATA_LASTMODIFIED].load(offnode->first_node("last_modified"));
+ tdB[DATA_SAVENAME].load(offnode->first_node("save_name"));
+ tdB[DATA_LASTMODIFIED].load(offnode->first_node("last_modified"));
// Stuff displayed when you hover over a slot button
- td_h[DATA_LOCNAME].load(offnode->first_node("loc_name"));
- td_h[DATA_DIFFICULTY].load(offnode->first_node("difficulty"));
- td_h[DATA_TIMEPLAYED].load(offnode->first_node("time_played"));
- td_h[DATA_PLAYERNAME].load(offnode->first_node("player_name"));
+ tdH[DATA_LOCNAME].load(offnode->first_node("loc_name"));
+ tdH[DATA_DIFFICULTY].load(offnode->first_node("difficulty"));
+ tdH[DATA_TIMEPLAYED].load(offnode->first_node("time_played"));
+ tdH[DATA_PLAYERNAME].load(offnode->first_node("player_name"));
// Titles for the stuff displayed when you hover over a slot button
hov[DATA_LOCNAME].load(offnode->first_node("loc_name_title"));
@@ -190,16 +195,16 @@ public:
hov[DATA_PLAYERNAME].load(offnode->first_node("player_name_title"));
}
- extension = g_engine->_filePath->save_ext;
- directory = (g_engine->_filePath->appdata + g_engine->_filePath->save_dir);
- ScanDir();
+ _extension = g_engine->_filePath->save_ext;
+ _directory = (g_engine->_filePath->appdata + g_engine->_filePath->save_dir);
+ scanDir();
}
bool handleEvents(const Common::Event &Event) {
- int choice = menu.handleEvents(Event);
+ int choice = _menu.handleEvents(Event);
if (choice >= 0) {
- menu.reset();
- selected = slot_info[menu.Index() + choice].path;
+ _menu.reset();
+ _selected = _slotInfo[_menu.Index() + choice]._path;
reset();
return true;
}
@@ -222,50 +227,50 @@ public:
#endif
void draw() {
- bg.draw();
- menu.draw();
- for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++) {
- auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
- td_b[DATA_SAVENAME].draw(slot_info[i].name, base_x, base_y);
- td_b[DATA_LASTMODIFIED].draw(slot_info[i].last_modified, base_x, base_y);
+ _bg.draw();
+ _menu.draw();
+ for (auto i = _menu.Index(), count = 0u; i < _menu.IndexPlusOne() && i < _slotInfo.size(); i++, count++) {
+ auto base_x = _menu.BaseX(count), base_y = _menu.BaseY(count);
+ tdB[DATA_SAVENAME].draw(_slotInfo[i]._name, base_x, base_y);
+ tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
}
DrawHover();
}
void DrawHover() {
- if (menu.HoverIndex() >= 0) {
- int i = menu.HoverIndex();
-
- if (!img.loaded || prev_hover != i) {
- img.loaded = true;
- prev_hover = i;
- if (!img.preview.load(slot_info[i].preview))
- img.preview.load(img.no_preview_path);
+ if (_menu.HoverIndex() >= 0) {
+ int i = _menu.HoverIndex();
+
+ if (!_img._loaded || _prevHover != i) {
+ _img._loaded = true;
+ _prevHover = i;
+ if (!_img._preview.load(_slotInfo[i]._preview))
+ _img._preview.load(_img._noPreviewPath);
}
- hover = true;
- img.preview.draw(img.pos.x, img.pos.y);
+ _hover = true;
+ _img._preview.draw(_img._pos.x, _img._pos.y);
- td_h[DATA_LOCNAME].draw(slot_info[i].loc_name);
- td_h[DATA_DIFFICULTY].draw(slot_info[i].diff);
- td_h[DATA_TIMEPLAYED].draw(slot_info[i].time);
- td_h[DATA_PLAYERNAME].draw(slot_info[i].char_name);
+ tdH[DATA_LOCNAME].draw(_slotInfo[i]._locName);
+ tdH[DATA_DIFFICULTY].draw(_slotInfo[i]._diff);
+ tdH[DATA_TIMEPLAYED].draw(_slotInfo[i]._time);
+ tdH[DATA_PLAYERNAME].draw(_slotInfo[i]._charName);
for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
hov[num].draw();
- } else if (hover)
+ } else if (_hover)
reset();
}
- bool Empty() {
- ScanDir();
- return slot_info.empty();
+ bool empty() {
+ scanDir();
+ return _slotInfo.empty();
}
- bool SelectNewestFile() {
- if (slot_info.size() > 0) {
- selected = slot_info[0].path;
+ bool selectNewestFile() {
+ if (_slotInfo.size() > 0) {
+ _selected = _slotInfo[0]._path;
return true;
}
@@ -273,16 +278,16 @@ public:
}
void setUI() {
- bg.setUI();
- menu.setUI();
- ScanDir();
- img.pos.setUI();
+ _bg.setUI();
+ _menu.setUI();
+ scanDir();
+ _img._pos.setUI();
for (int i = 0; i < DATA_BUTTON_TOTAL; ++i)
- td_b[i].setUI();
+ tdB[i].setUI();
for (int i = 0; i < DATA_HOVER_TOTAL; ++i) {
- td_h[i].setUI();
+ tdH[i].setUI();
hov[i].setUI();
}
}
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index 1f4d73dc659..cb044003e91 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -39,25 +39,25 @@ using namespace pyrodactyl::image;
void GameOverMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("title", node)) {
rapidxml::xml_node<char> *tinode = node->first_node("title");
- title.load(tinode);
+ _title.load(tinode);
for (auto n = tinode->first_node("quote"); n != NULL; n = n->next_sibling("quote")) {
Common::String str;
loadStr(str, "text", n);
- quote.push_back(str);
+ _quote.push_back(str);
}
}
- menu.load(node->first_node("menu"));
+ _menu.load(node->first_node("menu"));
}
}
-int GameOverMenu::handleEvents(const Common::Event &Event) {
- return menu.handleEvents(Event);
+int GameOverMenu::handleEvents(const Common::Event &event) {
+ return _menu.handleEvents(event);
}
#if 0
@@ -67,17 +67,17 @@ int GameOverMenu::handleEvents(const SDL_Event &Event) {
#endif
void GameOverMenu::draw() {
- bg.draw();
- if (cur < quote.size())
- title.draw(quote[cur]);
+ _bg.draw();
+ if (_cur < _quote.size())
+ _title.draw(_quote[_cur]);
- menu.draw();
+ _menu.draw();
}
void GameOverMenu::setUI() {
- bg.setUI();
- title.setUI();
- menu.setUI();
+ _bg.setUI();
+ _title.setUI();
+ _menu.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 8e3b3635b6b..1438adf9f51 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -42,22 +42,25 @@ namespace pyrodactyl {
namespace ui {
class GameOverMenu {
// Background image
- ImageData bg;
+ ImageData _bg;
// The selection of quotes, we pick one out of these
- Common::Array<Common::String> quote;
+ Common::Array<Common::String> _quote;
// The current picked quote
- unsigned int cur;
+ unsigned int _cur;
// How to draw the quote
- TextData title;
+ TextData _title;
// The menu for actions we can take
- ButtonMenu menu;
+ ButtonMenu _menu;
public:
- GameOverMenu(void) { cur = 0; }
+ GameOverMenu(void) {
+ _cur = 0;
+ }
+
~GameOverMenu(void) {}
void reset() {
@@ -69,7 +72,7 @@ public:
void load(rapidxml::xml_node<char> *node);
- int handleEvents(const Common::Event &Event);
+ int handleEvents(const Common::Event &event);
#if 0
int handleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 7feeb7cf5f6..b9a82cb9a88 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -45,7 +45,7 @@ void GeneralSettingMenu::load(rapidxml::xml_node<char> *node) {
rapidxml::xml_node<char> *musnode = node->first_node("volume");
if (nodeValid("desc", musnode))
- notice_volume.load(musnode->first_node("desc"));
+ _noticeVolume.load(musnode->first_node("desc"));
// if (nodeValid("music", musnode))
// vol_music.load(musnode->first_node("music"), 0, MIX_MAX_VOLUME, g_engine->_musicManager->VolMusic());
@@ -55,41 +55,41 @@ void GeneralSettingMenu::load(rapidxml::xml_node<char> *node) {
}
if (nodeValid("mouse_trap", node))
- mouse_trap.load(node->first_node("mouse_trap"));
+ _mouseTrap.load(node->first_node("mouse_trap"));
if (nodeValid("save_on_exit", node))
- save_on_exit.load(node->first_node("save_on_exit"));
+ _saveOnExit.load(node->first_node("save_on_exit"));
if (nodeValid("text_speed", node))
- text_speed.load(node->first_node("text_speed"));
+ _textSpeed.load(node->first_node("text_speed"));
// Sync popup text value with actual value
- for (auto &i : text_speed.element)
+ for (auto &i : _textSpeed.element)
i._state = (i._val == g_engine->_screenSettings->text_speed);
}
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-void GeneralSettingMenu::handleEvents(const Common::Event &Event) {
- if (vol_music.handleEvents(Event))
- g_engine->_musicManager->volMusic(vol_music.Value());
+void GeneralSettingMenu::handleEvents(const Common::Event &event) {
+ if (_volMusic.handleEvents(event))
+ g_engine->_musicManager->volMusic(_volMusic.Value());
- if (vol_effects.handleEvents(Event))
- g_engine->_musicManager->volEffects(vol_effects.Value());
+ if (_volEffects.handleEvents(event))
+ g_engine->_musicManager->volEffects(_volEffects.Value());
// No need to change screen here
- if (save_on_exit.handleEvents(Event))
+ if (_saveOnExit.handleEvents(event))
g_engine->_screenSettings->save_on_exit = !g_engine->_screenSettings->save_on_exit;
- if (mouse_trap.handleEvents(Event)) {
+ if (_mouseTrap.handleEvents(event)) {
g_engine->_screenSettings->mouse_trap = !g_engine->_screenSettings->mouse_trap;
g_engine->_screenSettings->SetMouseTrap();
}
- int result = text_speed.handleEvents(Event);
+ int result = _textSpeed.handleEvents(event);
if (result >= 0)
- g_engine->_screenSettings->text_speed = text_speed.element[result]._val;
+ g_engine->_screenSettings->text_speed = _textSpeed.element[result]._val;
}
#if 0
@@ -122,8 +122,8 @@ void GeneralSettingMenu::handleEvents(const SDL_Event &Event) {
// Purpose: Sync our buttons with screen settings
//------------------------------------------------------------------------
void GeneralSettingMenu::internalEvents() {
- save_on_exit._state = g_engine->_screenSettings->save_on_exit;
- mouse_trap._state = g_engine->_screenSettings->mouse_trap;
+ _saveOnExit._state = g_engine->_screenSettings->save_on_exit;
+ _mouseTrap._state = g_engine->_screenSettings->mouse_trap;
}
//------------------------------------------------------------------------
@@ -131,40 +131,40 @@ void GeneralSettingMenu::internalEvents() {
//------------------------------------------------------------------------
void GeneralSettingMenu::draw() {
// Draw volume sliders
- notice_volume.draw();
- vol_music.draw();
- vol_effects.draw();
+ _noticeVolume.draw();
+ _volMusic.draw();
+ _volEffects.draw();
// Draw the auto-save on exit option
- save_on_exit.draw();
- mouse_trap.draw();
+ _saveOnExit.draw();
+ _mouseTrap.draw();
// Text speed radio button menu
- text_speed.draw();
+ _textSpeed.draw();
}
//------------------------------------------------------------------------
// Purpose: Revert to previously backed up settings
//------------------------------------------------------------------------
void GeneralSettingMenu::RestoreBackup() {
- vol_music.RestoreBackup();
- g_engine->_musicManager->volMusic(vol_music.Value());
+ _volMusic.RestoreBackup();
+ g_engine->_musicManager->volMusic(_volMusic.Value());
- vol_effects.RestoreBackup();
- g_engine->_musicManager->volEffects(vol_effects.Value());
+ _volEffects.RestoreBackup();
+ g_engine->_musicManager->volEffects(_volEffects.Value());
}
//------------------------------------------------------------------------
// Purpose: Set UI positioned on screen size change
//------------------------------------------------------------------------
void GeneralSettingMenu::setUI() {
- save_on_exit.setUI();
- mouse_trap.setUI();
+ _saveOnExit.setUI();
+ _mouseTrap.setUI();
- vol_music.setUI();
- vol_effects.setUI();
+ _volMusic.setUI();
+ _volEffects.setUI();
- text_speed.setUI();
+ _textSpeed.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index a4be9d46bd5..40a868e3487 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -42,14 +42,14 @@ namespace pyrodactyl {
namespace ui {
class GeneralSettingMenu {
// The volume sliders and their caption
- Slider vol_music, vol_effects;
- HoverInfo notice_volume;
+ Slider _volMusic, _volEffects;
+ HoverInfo _noticeVolume;
// Other settings
- ToggleButton save_on_exit, mouse_trap;
+ ToggleButton _saveOnExit, _mouseTrap;
// The menu for select pop-up text speed
- RadioButtonMenu text_speed;
+ RadioButtonMenu _textSpeed;
public:
GeneralSettingMenu() {}
@@ -57,7 +57,7 @@ public:
void load(rapidxml::xml_node<char> *node);
- void handleEvents(const Common::Event &Event);
+ void handleEvents(const Common::Event &event);
#if 0
void handleEvents(const SDL_Event &Event);
#endif
@@ -68,8 +68,8 @@ public:
void setUI();
void CreateBackup() {
- vol_music.CreateBackup();
- vol_effects.CreateBackup();
+ _volMusic.CreateBackup();
+ _volEffects.CreateBackup();
}
void RestoreBackup();
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 670185edb58..59a71ef2312 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -40,27 +40,27 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
void GfxSettingMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("resolution", node))
- resolution.load(node->first_node("resolution"));
+ _resolution.load(node->first_node("resolution"));
if (nodeValid("fullscreen", node))
- fullscreen.load(node->first_node("fullscreen"));
+ _fullscreen.load(node->first_node("fullscreen"));
if (nodeValid("vsync", node))
- vsync.load(node->first_node("vsync"));
+ _vsync.load(node->first_node("vsync"));
if (nodeValid("border", node))
- border.load(node->first_node("border"));
+ _border.load(node->first_node("border"));
if (nodeValid("quality", node)) {
rapidxml::xml_node<char> *qnode = node->first_node("quality");
- quality.load(qnode);
+ _quality.load(qnode);
if (nodeValid("message", qnode))
- notice_quality.load(qnode->first_node("message"), &quality);
+ _noticeQuality.load(qnode->first_node("message"), &_quality);
}
if (nodeValid("brightness", node))
- brightness.load(node->first_node("brightness"), 0, 100, g_engine->_screenSettings->gamma * 100);
+ _brightness.load(node->first_node("brightness"), 0, 100, g_engine->_screenSettings->gamma * 100);
}
//------------------------------------------------------------------------
@@ -69,58 +69,58 @@ void GfxSettingMenu::load(rapidxml::xml_node<char> *node) {
void GfxSettingMenu::draw() {
// Window border doesn't matter if you are in fullscreen
if (!g_engine->_screenSettings->fullscreen)
- border.draw();
+ _border.draw();
// Draw toggle buttons
- brightness.draw();
- fullscreen.draw();
- vsync.draw();
+ _brightness.draw();
+ _fullscreen.draw();
+ _vsync.draw();
// Quality and resolution can only be changed in the main menu
if (!g_engine->_screenSettings->in_game) {
// Tree quality button
- quality.draw();
+ _quality.draw();
} else
- notice_quality.draw(); // Notice about quality settings
+ _noticeQuality.draw(); // Notice about quality settings
// Draw resolution menu
- resolution.draw();
+ _resolution.draw();
}
//------------------------------------------------------------------------
// Purpose: Handle input
//------------------------------------------------------------------------
-int GfxSettingMenu::handleEvents(const Common::Event &Event) {
- if (fullscreen.handleEvents(Event)) {
+int GfxSettingMenu::handleEvents(const Common::Event &event) {
+ if (_fullscreen.handleEvents(event)) {
// Setting video flags is necessary when toggling fullscreen
g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
g_engine->_screenSettings->SetFullscreen();
}
// Vsync doesn't need to set the change value
- if (vsync.handleEvents(Event)) {
+ if (_vsync.handleEvents(event)) {
g_engine->_screenSettings->vsync = !g_engine->_screenSettings->vsync;
g_engine->_screenSettings->SetVsync();
}
// Quality and resolution can only be changed in the main menu
if (!g_engine->_screenSettings->in_game) {
- if (quality.handleEvents(Event))
+ if (_quality.handleEvents(event))
g_engine->_screenSettings->quality = !g_engine->_screenSettings->quality;
}
// Window border doesn't matter if you are in fullscreen
- if (border.handleEvents(Event) && !g_engine->_screenSettings->fullscreen) {
+ if (_border.handleEvents(event) && !g_engine->_screenSettings->fullscreen) {
g_engine->_screenSettings->border = !g_engine->_screenSettings->border;
g_engine->_screenSettings->SetWindowBorder();
}
- if (brightness.handleEvents(Event)) {
- g_engine->_screenSettings->gamma = static_cast<float>(brightness.Value()) / 100.0f;
+ if (_brightness.handleEvents(event)) {
+ g_engine->_screenSettings->gamma = static_cast<float>(_brightness.Value()) / 100.0f;
g_engine->_screenSettings->SetGamma();
}
- return resolution.handleEvents(Event);
+ return _resolution.handleEvents(event);
}
#if 0
@@ -165,25 +165,25 @@ int GfxSettingMenu::handleEvents(const SDL_Event &Event) {
// Purpose: Keep button settings synced with our screen settings
//------------------------------------------------------------------------
void GfxSettingMenu::internalEvents() {
- fullscreen._state = g_engine->_screenSettings->fullscreen;
- vsync._state = g_engine->_screenSettings->vsync;
- border._state = g_engine->_screenSettings->border;
- quality._state = g_engine->_screenSettings->quality;
+ _fullscreen._state = g_engine->_screenSettings->fullscreen;
+ _vsync._state = g_engine->_screenSettings->vsync;
+ _border._state = g_engine->_screenSettings->border;
+ _quality._state = g_engine->_screenSettings->quality;
}
//------------------------------------------------------------------------
// Purpose: Rearrange UI when resolution changes
//------------------------------------------------------------------------
void GfxSettingMenu::setUI() {
- resolution.setUI();
+ _resolution.setUI();
- fullscreen.setUI();
- vsync.setUI();
- border.setUI();
- quality.setUI();
+ _fullscreen.setUI();
+ _vsync.setUI();
+ _border.setUI();
+ _quality.setUI();
- notice_quality.setUI();
- brightness.setUI();
+ _noticeQuality.setUI();
+ _brightness.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index b36ddbead86..dc019207358 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -44,16 +44,16 @@ namespace pyrodactyl {
namespace ui {
class GfxSettingMenu {
// The brightness slider
- Slider brightness;
+ Slider _brightness;
// The button to toggle between full and windowed, and turn vsync on/off, window borders or not, game quality
- ToggleButton fullscreen, vsync, border, quality;
+ ToggleButton _fullscreen, _vsync, _border, _quality;
// The buttons and menus for changing resolution
- ResolutionMenu resolution;
+ ResolutionMenu _resolution;
// Notice that quality setting can only be changed outside the game
- HoverInfo notice_quality;
+ HoverInfo _noticeQuality;
public:
GfxSettingMenu() {}
@@ -61,7 +61,7 @@ public:
void load(rapidxml::xml_node<char> *node);
- int handleEvents(const Common::Event &Event);
+ int handleEvents(const Common::Event &event);
#if 0
int handleEvents(const SDL_Event &Event);
#endif
@@ -70,7 +70,7 @@ public:
void draw();
void setUI();
- void SetInfo() { resolution.SetInfo(); }
+ void SetInfo() { _resolution.SetInfo(); }
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/HoverInfo.cpp b/engines/crab/ui/HoverInfo.cpp
index 920db50cf01..64e72cf9aa6 100644
--- a/engines/crab/ui/HoverInfo.cpp
+++ b/engines/crab/ui/HoverInfo.cpp
@@ -36,22 +36,22 @@ namespace Crab {
using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
-void HoverInfo::Init(const HoverInfo &hInfo, const int &XOffset, const int &YOffset) {
+void HoverInfo::init(const HoverInfo &hInfo, const int &xOffset, const int &yOffset) {
*this = hInfo;
- x += XOffset;
- y += YOffset;
+ x += xOffset;
+ y += yOffset;
}
void HoverInfo::load(rapidxml::xml_node<char> *node, Rect *parent) {
if (TextData::load(node, parent, false)) {
- loadStr(text, "text", node);
- enabled = true;
+ loadStr(_text, "text", node);
+ _enabled = true;
}
}
-void HoverInfo::draw(const int &XOffset, const int &YOffset) {
- if (enabled)
- TextData::draw(text, XOffset, YOffset);
+void HoverInfo::draw(const int &xOffset, const int &yOffset) {
+ if (_enabled)
+ TextData::draw(_text, xOffset, yOffset);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index 2b9b35d8512..9294ead7d31 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -41,16 +41,19 @@ namespace ui {
// Tooltip for buttons
class HoverInfo : public TextData {
public:
- bool enabled;
- Common::String text;
+ bool _enabled;
+ Common::String _text;
+
+ HoverInfo(void) {
+ _enabled = false;
+ }
- HoverInfo(void) { enabled = false; }
~HoverInfo(void) {}
- void Init(const HoverInfo &h, const int &XOffset = 0, const int &YOffset = 0);
+ void init(const HoverInfo &h, const int &xOffset = 0, const int &yOffset = 0);
void load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
- void draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 92bcbcb1067..9c6fb6c7fb1 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -37,20 +37,20 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
void ImageData::load(rapidxml::xml_node<char> *node, const bool &echo) {
- loadImgKey(key, "img", node, echo);
- loadBool(crop, "crop", node, false);
+ loadImgKey(_key, "img", node, echo);
+ loadBool(_crop, "crop", node, false);
if (nodeValid("clip", node, false))
- clip.load(node->first_node("clip"));
+ _clip.load(node->first_node("clip"));
- Element::load(node, key, echo);
+ Element::load(node, _key, echo);
}
-void ImageData::draw(const int &XOffset, const int &YOffset) {
- if (crop)
- g_engine->_imageManager->draw(x + XOffset, y + YOffset, key, &clip);
+void ImageData::draw(const int &xOffset, const int &yOffset) {
+ if (_crop)
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _key, &_clip);
else
- g_engine->_imageManager->draw(x + XOffset, y + YOffset, key);
+ g_engine->_imageManager->draw(x + xOffset, y + yOffset, _key);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ImageData.h b/engines/crab/ui/ImageData.h
index b6df47eb5d5..d353ccf5b96 100644
--- a/engines/crab/ui/ImageData.h
+++ b/engines/crab/ui/ImageData.h
@@ -41,23 +41,24 @@ namespace pyrodactyl {
namespace ui {
class ImageData : public Element {
// The image
- ImageKey key;
+ ImageKey _key;
// Should we clip the image? (usually used for large background images)
- bool crop;
+ bool _crop;
// The clip rectangle, used only when clip is true
- Rect clip;
+ Rect _clip;
public:
ImageData() {
- key = 0;
- crop = false;
+ _key = 0;
+ _crop = false;
}
+
~ImageData() {}
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void draw(const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index f7810522400..c02e9caa854 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -46,65 +46,65 @@ void Inventory::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("inventory");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
- collection.load(node->first_node("items"));
+ _collection.load(node->first_node("items"));
/*if (nodeValid("stats", node))
helper.load(node->first_node("stats"));*/
if (nodeValid("money", node))
- money.load(node->first_node("money"));
+ _money.load(node->first_node("money"));
}
}
}
-void Inventory::LoadItem(const Common::String &char_id, const Common::String &id) {
+void Inventory::loadItem(const Common::String &charId, const Common::String &id) {
Item i;
- XMLDoc item_list(itemfile);
- if (item_list.ready()) {
- rapidxml::xml_node<char> *node = item_list.doc()->first_node("items");
+ XMLDoc itemList(_itemfile);
+ if (itemList.ready()) {
+ rapidxml::xml_node<char> *node = itemList.doc()->first_node("items");
for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item")) {
Common::String str = n->first_attribute("id")->value();
if (id == str) {
i.load(n);
- AddItem(char_id, i);
+ addItem(charId, i);
break;
}
}
}
}
-void Inventory::DelItem(const Common::String &char_id, const Common::String &item_id) {
- collection.del(char_id, item_id);
+void Inventory::delItem(const Common::String &charId, const Common::String &itemId) {
+ _collection.del(charId, itemId);
}
-void Inventory::AddItem(const Common::String &char_id, Item &item) {
- collection.add(char_id, item);
+void Inventory::addItem(const Common::String &charId, pyrodactyl::item::Item &item) {
+ _collection.add(charId, item);
}
-bool Inventory::HasItem(const Common::String &char_id, const Common::String &container, const Common::String &item_id) {
- return collection.has(char_id, container, item_id);
+bool Inventory::hasItem(const Common::String &charId, const Common::String &container, const Common::String &itemId) {
+ return _collection.has(charId, container, itemId);
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void Inventory::draw(Person &obj, const int &money_val) {
- bg.draw();
+void Inventory::draw(Person &obj, const int &moneyVal) {
+ _bg.draw();
// helper.DrawInfo(obj);
- collection.draw(obj._id /*, helper*/);
+ _collection.draw(obj._id /*, helper*/);
- money._caption._text = NumberToString(money_val);
- money.draw();
+ _money._caption._text = NumberToString(moneyVal);
+ _money.draw();
}
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Inventory::handleEvents(const Common::String &char_id, const Common::Event &Event) {
- collection.handleEvents(char_id, Event);
- money.handleEvents(Event);
+void Inventory::handleEvents(const Common::String &string, const Common::Event &Event) {
+ _collection.handleEvents(string, Event);
+ _money.handleEvents(Event);
}
#if 0
@@ -122,12 +122,12 @@ void Inventory::handleEvents(const Common::String &char_id, const SDL_Event &Eve
//------------------------------------------------------------------------
void Inventory::loadState(rapidxml::xml_node<char> *node) {
if (nodeValid("items", node))
- collection.loadState(node->first_node("items"));
+ _collection.loadState(node->first_node("items"));
}
void Inventory::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "items");
- collection.saveState(doc, child);
+ _collection.saveState(doc, child);
root->append_node(child);
}
@@ -135,9 +135,9 @@ void Inventory::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char
// Purpose: Set UI positions after screen size change
//------------------------------------------------------------------------
void Inventory::setUI() {
- bg.setUI();
- collection.setUI();
- money.setUI();
+ _bg.setUI();
+ _collection.setUI();
+ _money.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index a9a8c2e52dd..f65067f482a 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -44,35 +44,37 @@ namespace pyrodactyl {
namespace ui {
class Inventory {
// The background image and location
- ImageData bg;
+ ImageData _bg;
// The equipment and storage space, stored according to the player character id
- pyrodactyl::item::ItemCollection collection;
+ pyrodactyl::item::ItemCollection _collection;
// To draw the player stats
// pyrodactyl::stat::StatDrawHelper helper;
// The file where all the item information is stored
- Common::String itemfile;
+ Common::String _itemfile;
// Used to draw the money value
- Button money;
+ Button _money;
public:
Inventory() {}
~Inventory() {}
- void Init(const Common::String &char_id) { collection.init(char_id); }
+ void init(const Common::String &charId) {
+ _collection.init(charId);
+ }
- void LoadItem(const Common::String &char_id, const Common::String &name);
- void AddItem(const Common::String &char_id, pyrodactyl::item::Item &item);
- void DelItem(const Common::String &char_id, const Common::String &item_id);
- bool HasItem(const Common::String &char_id, const Common::String &container, const Common::String &item_id);
+ void loadItem(const Common::String &charId, const Common::String &name);
+ void addItem(const Common::String &charId, pyrodactyl::item::Item &item);
+ void delItem(const Common::String &charId, const Common::String &itemId);
+ bool hasItem(const Common::String &charId, const Common::String &container, const Common::String &itemId);
void load(const Common::String &filename);
- void draw(pyrodactyl::people::Person &obj, const int &money_val);
+ void draw(pyrodactyl::people::Person &obj, const int &moneyVal);
- void handleEvents(const Common::String &char_id, const Common::Event &Event);
+ void handleEvents(const Common::String &string, const Common::Event &Event);
#if 0
void handleEvents(const Common::String &char_id, const SDL_Event &Event);
#endif
@@ -80,7 +82,9 @@ public:
void loadState(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
- void ItemFile(const Common::String &filename) { itemfile = filename; }
+ void itemFile(const Common::String &filename) {
+ _itemfile = filename;
+ }
void setUI();
};
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index 6647fdf924b..f298291a2c7 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -41,10 +41,10 @@ namespace pyrodactyl {
namespace ui {
class ItemDesc {
// The name of the item
- TextData name;
+ TextData _name;
// The description of the item
- ParagraphData desc;
+ ParagraphData _desc;
public:
ItemDesc() {}
@@ -52,20 +52,20 @@ public:
void load(rapidxml::xml_node<char> *node) {
if (nodeValid("name", node))
- name.load(node->first_node("name"));
+ _name.load(node->first_node("name"));
if (nodeValid("desc", node))
- desc.load(node->first_node("desc"));
+ _desc.load(node->first_node("desc"));
}
void draw(pyrodactyl::item::Item &item) {
- name.draw(item._name);
- desc.draw(item._desc);
+ _name.draw(item._name);
+ _desc.draw(item._desc);
}
void setUI() {
- name.setUI();
- desc.setUI();
+ _name.setUI();
+ _desc.setUI();
}
};
} // End of namespace ui
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index a9df9a350a9..386ea47dbe7 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -61,7 +61,7 @@ public:
void AddButton(const Common::String &name, const int &x, const int &y) {
StateButton b;
b.init(ref, x, y);
- b._tooltip.text = name;
+ b._tooltip._text = name;
menu.element.push_back(b);
}
@@ -70,12 +70,12 @@ public:
void SelectDest(const Common::String &name) {
for (auto &i : menu.element)
- i.state(i._tooltip.text == name);
+ i.state(i._tooltip._text == name);
}
void Erase(const Common::String &name) {
for (auto i = menu.element.begin(); i != menu.element.end(); ++i) {
- if (i->_tooltip.text == name) {
+ if (i->_tooltip._text == name) {
menu.element.erase(i);
AssignPaths();
break;
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 0cfeba6f725..3fc46c7e1ed 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -40,29 +40,29 @@ void ModMenu::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("mod_menu");
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("menu", node))
- menu.load(node->first_node("menu"));
+ _menu.load(node->first_node("menu"));
if (nodeValid("preview", node)) {
auto prnode = node->first_node("preview");
- img.pos.load(prnode);
- loadStr(img.no_preview_path, "path", prnode);
+ _img._pos.load(prnode);
+ loadStr(_img._noPreviewPath, "path", prnode);
}
if (nodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
// Stuff displayed on the slot button
- td_b[DATA_SAVENAME].load(offnode->first_node("mod_name"));
- td_b[DATA_LASTMODIFIED].load(offnode->first_node("last_modified"));
+ tdB[DATA_SAVENAME].load(offnode->first_node("mod_name"));
+ tdB[DATA_LASTMODIFIED].load(offnode->first_node("last_modified"));
// Stuff displayed when you hover over a slot button
- td_h[DATA_AUTHOR].load(offnode->first_node("author"));
- td_h[DATA_VERSION].load(offnode->first_node("version"));
- td_h[DATA_INFO].load(offnode->first_node("info"));
- td_h[DATA_WEBSITE].load(offnode->first_node("website"));
+ tdH[DATA_AUTHOR].load(offnode->first_node("author"));
+ tdH[DATA_VERSION].load(offnode->first_node("version"));
+ tdH[DATA_INFO].load(offnode->first_node("info"));
+ tdH[DATA_WEBSITE].load(offnode->first_node("website"));
// Titles for the stuff displayed when you hover over a slot button
hov[DATA_AUTHOR].load(offnode->first_node("author_title"));
@@ -71,16 +71,16 @@ void ModMenu::load(const Common::String &filename) {
hov[DATA_WEBSITE].load(offnode->first_node("website_title"));
}
- extension = g_engine->_filePath->mod_ext;
- directory = g_engine->_filePath->mod_path;
- ScanDir();
+ _extension = g_engine->_filePath->mod_ext;
+ _directory = g_engine->_filePath->mod_path;
+ scanDir();
}
}
bool ModMenu::handleEvents(const Common::Event &Event) {
- int choice = menu.handleEvents(Event);
+ int choice = _menu.handleEvents(Event);
if (choice >= 0) {
- g_engine->_filePath->mod_cur = slot_info[menu.Index() + choice].path;
+ g_engine->_filePath->mod_cur = _slotInfo[_menu.Index() + choice]._path;
return true;
}
@@ -100,35 +100,35 @@ bool ModMenu::handleEvents(const SDL_Event &Event) {
#endif
void ModMenu::draw() {
- bg.draw();
- menu.draw();
- for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++) {
- auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
- td_b[DATA_SAVENAME].draw(slot_info[i].name, base_x, base_y);
- td_b[DATA_LASTMODIFIED].draw(slot_info[i].last_modified, base_x, base_y);
+ _bg.draw();
+ _menu.draw();
+ for (auto i = _menu.Index(), count = 0u; i < _menu.IndexPlusOne() && i < _slotInfo.size(); i++, count++) {
+ auto base_x = _menu.BaseX(count), base_y = _menu.BaseY(count);
+ tdB[DATA_SAVENAME].draw(_slotInfo[i]._name, base_x, base_y);
+ tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
}
- if (menu.HoverIndex() >= 0) {
- int i = menu.HoverIndex();
+ if (_menu.HoverIndex() >= 0) {
+ int i = _menu.HoverIndex();
- if (!img.loaded || prev_hover != i) {
- img.loaded = true;
- prev_hover = i;
- if (!img.preview.load(slot_info[i].preview))
- img.preview.load(img.no_preview_path);
+ if (!_img._loaded || _prevHover != i) {
+ _img._loaded = true;
+ _prevHover = i;
+ if (!_img._preview.load(_slotInfo[i]._preview))
+ _img._preview.load(_img._noPreviewPath);
}
- hover = true;
- img.preview.draw(img.pos.x, img.pos.y);
+ _hover = true;
+ _img._preview.draw(_img._pos.x, _img._pos.y);
- td_h[DATA_AUTHOR].draw(slot_info[i].author);
- td_h[DATA_VERSION].draw(slot_info[i].version);
- td_h[DATA_INFO].draw(slot_info[i].info);
- td_h[DATA_WEBSITE].draw(slot_info[i].website);
+ tdH[DATA_AUTHOR].draw(_slotInfo[i]._author);
+ tdH[DATA_VERSION].draw(_slotInfo[i]._version);
+ tdH[DATA_INFO].draw(_slotInfo[i]._info);
+ tdH[DATA_WEBSITE].draw(_slotInfo[i]._website);
for (int num = 0; num < DATA_HOVER_TOTAL; ++num)
hov[num].draw();
- } else if (hover)
+ } else if (_hover)
reset();
}
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index fd178d4be78..89ae536f264 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -94,8 +94,8 @@ public:
bool draw(Button &back);
void reset() { state = STATE_NORMAL; }
- void ScanDir() { save.ScanDir(); }
- Common::String SaveFile() { return save.SelectedPath(); }
+ void ScanDir() { save.scanDir(); }
+ Common::String SaveFile() { return save.selectedPath(); }
bool DisableHotkeys();
// Should we allow the pause key(default escape) to quit to main menu?
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index fb46e45394b..d516760a5cc 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -105,7 +105,7 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
total_page = page_count + 1;
// Update the text
- status.text = (NumberToString(current_page + 1) + " of " + NumberToString(total_page));
+ status._text = (NumberToString(current_page + 1) + " of " + NumberToString(total_page));
// Now, start drawing the quest
status.draw();
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 19d5987e0db..d54657865c7 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -43,7 +43,7 @@ void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
custom.load(node->first_node("custom"));
info.load(node->first_node("info"));
- def_info = info.text;
+ def_info = info._text;
if (nodeValid("reference", node))
ref.load(node->first_node("reference"));
@@ -157,10 +157,10 @@ int ResolutionMenu::handleEvents(const SDL_Event &Event) {
#endif
void ResolutionMenu::SetInfo() {
- info.text = def_info;
- info.text += NumberToString(g_engine->_screenSettings->cur.w);
- info.text += " x ";
- info.text += NumberToString(g_engine->_screenSettings->cur.h);
+ info._text = def_info;
+ info._text += NumberToString(g_engine->_screenSettings->cur.w);
+ info._text += " x ";
+ info._text += NumberToString(g_engine->_screenSettings->cur.h);
}
void ResolutionMenu::setUI() {
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 364f3472496..1f78dc70a50 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -43,17 +43,17 @@ void GameSaveMenu::load(rapidxml::xml_node<char> *node) {
}
void GameSaveMenu::AddButton(const Common::String &p, unsigned int &slot_index, unsigned int &menu_index) {
- slot_info.push_back(SaveFileData(p));
- menu.Add(slot_index, menu_index);
+ _slotInfo.push_back(SaveFileData(p));
+ _menu.Add(slot_index, menu_index);
}
-void GameSaveMenu::ScanDir() {
+void GameSaveMenu::scanDir() {
Common::String res = "CRAB_*";
res += g_engine->_filePath->save_ext;
Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
- slot_info.clear();
- menu.Clear();
+ _slotInfo.clear();
+ _menu.Clear();
unsigned int count_slot = 0, count_menu = 0;
@@ -64,22 +64,22 @@ void GameSaveMenu::ScanDir() {
AddButton(save, count_menu, count_slot);
}
- menu.AssignPaths();
+ _menu.AssignPaths();
}
bool GameSaveMenu::handleEvents(const Common::Event &Event) {
int choice = -1;
switch (state) {
case STATE_NORMAL:
- choice = menu.handleEvents(Event);
+ choice = _menu.handleEvents(Event);
if (choice >= 0) {
- ta_name.x = menu.CurX(choice) + td_b[DATA_SAVENAME].x;
- ta_name.y = menu.CurY(choice) + td_b[DATA_SAVENAME].y;
+ ta_name.x = _menu.CurX(choice) + tdB[DATA_SAVENAME].x;
+ ta_name.y = _menu.CurY(choice) + tdB[DATA_SAVENAME].y;
- index = menu.Index() + choice;
+ index = _menu.Index() + choice;
if (index != 0)
- ta_name._text = slot_info[index].name;
+ ta_name._text = _slotInfo[index]._name;
else
ta_name._text = "";
@@ -91,10 +91,10 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
g_engine->_inputManager->setKeyBindingMode(KBM_UI);
if (ta_name.handleEvents(Event)) {
- if (index <= (int)slot_info.size() && index != 0)
- g_engine->getSaveFileManager()->removeSavefile(slot_info[index].path);
+ if (index <= (int)_slotInfo.size() && index != 0)
+ g_engine->getSaveFileManager()->removeSavefile(_slotInfo[index]._path);
- selected = ta_name._text;
+ _selected = ta_name._text;
state = STATE_NORMAL;
reset();
g_engine->_inputManager->setKeyBindingMode(KBM_GAME);
@@ -113,16 +113,16 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
}
void GameSaveMenu::draw() {
- bg.draw();
- menu.draw();
- for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < slot_info.size(); i++, count++) {
- float base_x = menu.BaseX(count), base_y = menu.BaseY(count);
- td_b[DATA_LASTMODIFIED].draw(slot_info[i].last_modified, base_x, base_y);
+ _bg.draw();
+ _menu.draw();
+ for (auto i = _menu.Index(), count = 0u; i < _menu.IndexPlusOne() && i < _slotInfo.size(); i++, count++) {
+ float base_x = _menu.BaseX(count), base_y = _menu.BaseY(count);
+ tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
if (i == (unsigned int)index && state == STATE_NAME)
ta_name.draw();
else
- td_b[DATA_SAVENAME].draw(slot_info[i].name, base_x, base_y);
+ tdB[DATA_SAVENAME].draw(_slotInfo[i]._name, base_x, base_y);
}
DrawHover();
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index ecc6771ba99..aa66f586ccf 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -60,7 +60,7 @@ public:
}
~GameSaveMenu() {}
- void ScanDir();
+ void scanDir();
bool DisableHotkeys() { return state == STATE_NAME; }
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 6044d5ca58e..2d5c91c9cb8 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -84,7 +84,7 @@ void Button::init(const Button &ref, const int &xOffset, const int &yOffset) {
_seHover = ref._seHover;
_caption.init(ref._caption, xOffset, yOffset);
- _tooltip.Init(ref._tooltip, xOffset, yOffset);
+ _tooltip.init(ref._tooltip, xOffset, yOffset);
_visible = true;
_canmove = false;
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 0ccf83016a1..de3b3d1be01 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -46,14 +46,14 @@ void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
rapidxml::xml_node<char> *node = conf.doc()->first_node("hud");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("tray", node))
- menu.load(node->first_node("tray"));
+ _menu.load(node->first_node("tray"));
- pause.load(node->first_node("pause"));
- gom.load(node->first_node("game_over"));
- back.load(node->first_node("back"));
+ _pause.load(node->first_node("pause"));
+ _gom.load(node->first_node("game_over"));
+ _back.load(node->first_node("back"));
// health.load(node->first_node("health"));
if (nodeValid("notify", node)) {
@@ -65,66 +65,66 @@ void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
if (nodeValid("anim", notifynode)) {
rapidxml::xml_node<char> *animnode = notifynode->first_node("anim");
- loadImgKey(notify_anim, "img", animnode);
- clip.load(animnode);
+ loadImgKey(_notifyAnim, "img", animnode);
+ _clip.load(animnode);
- timer.load(animnode, "delay");
- timer.Start();
+ _timer.load(animnode, "delay");
+ _timer.Start();
}
}
}
// Create a copy of all the tooltips
- for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
- tooltip.push_back(i->_tooltip.text);
+ for (auto i = _menu.element.begin(); i != _menu.element.end(); ++i)
+ _tooltip.push_back(i->_tooltip._text);
- SetTooltip();
+ setTooltip();
}
}
void HUD::draw(pyrodactyl::event::Info &info, const Common::String &id) {
- bg.draw();
- menu.draw();
+ _bg.draw();
+ _menu.draw();
if (info._unread._journal) {
- g_engine->_imageManager->draw(menu.element[HS_JOURNAL].x + menu.element[HS_JOURNAL].w - clip.w / 2,
- menu.element[HS_JOURNAL].y - clip.h / 2, notify_anim, &clip);
+ g_engine->_imageManager->draw(_menu.element[HS_JOURNAL].x + _menu.element[HS_JOURNAL].w - _clip.w / 2,
+ _menu.element[HS_JOURNAL].y - _clip.h / 2, _notifyAnim, &_clip);
}
if (info._unread._inventory) {
- g_engine->_imageManager->draw(menu.element[HS_INV].x + menu.element[HS_INV].w - clip.w / 2,
- menu.element[HS_INV].y - clip.h / 2, notify_anim, &clip);
+ g_engine->_imageManager->draw(_menu.element[HS_INV].x + _menu.element[HS_INV].w - _clip.w / 2,
+ _menu.element[HS_INV].y - _clip.h / 2, _notifyAnim, &_clip);
}
if (info._unread._trait) {
- g_engine->_imageManager->draw(menu.element[HS_CHAR].x + menu.element[HS_CHAR].w - clip.w / 2,
- menu.element[HS_CHAR].y - clip.h / 2, notify_anim, &clip);
+ g_engine->_imageManager->draw(_menu.element[HS_CHAR].x + _menu.element[HS_CHAR].w - _clip.w / 2,
+ _menu.element[HS_CHAR].y - _clip.h / 2, _notifyAnim, &_clip);
}
if (info._unread._map) {
- g_engine->_imageManager->draw(menu.element[HS_MAP].x + menu.element[HS_MAP].w - clip.w / 2,
- menu.element[HS_MAP].y - clip.h / 2, notify_anim, &clip);
+ g_engine->_imageManager->draw(_menu.element[HS_MAP].x + _menu.element[HS_MAP].w - _clip.w / 2,
+ _menu.element[HS_MAP].y - _clip.h / 2, _notifyAnim, &_clip);
}
//#endif
}
-void HUD::internalEvents(bool ShowMap) {
- menu.element[HS_MAP]._visible = ShowMap;
+void HUD::internalEvents(bool showMap) {
+ _menu.element[HS_MAP]._visible = showMap;
- if (timer.TargetReached()) {
- clip.x += clip.w;
+ if (_timer.TargetReached()) {
+ _clip.x += _clip.w;
- if (clip.x >= g_engine->_imageManager->getTexture(notify_anim).w())
- clip.x = 0;
+ if (_clip.x >= g_engine->_imageManager->getTexture(_notifyAnim).w())
+ _clip.x = 0;
- timer.Start();
+ _timer.Start();
}
}
-HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
- g_engine->_mouse->_insideHud = bg.Contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y);
+HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const Common::Event &event) {
+ g_engine->_mouse->_insideHud = _bg.Contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y);
- int choice = menu.handleEvents(Event);
+ int choice = _menu.handleEvents(event);
if (choice == HS_JOURNAL)
info._unread._journal = false;
@@ -159,25 +159,25 @@ HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Even
void HUD::State(const int &val) {
int count = 0;
- for (auto i = menu.element.begin(); i != menu.element.end(); ++i, ++count)
+ for (auto i = _menu.element.begin(); i != _menu.element.end(); ++i, ++count)
i->state(val == count);
}
-void HUD::SetTooltip() {
+void HUD::setTooltip() {
unsigned int count = 0;
- for (auto i = menu.element.begin(); i != menu.element.end() && count < tooltip.size(); ++i, ++count)
- i->_tooltip.text = tooltip[count] + " (" + i->_hotkey.name() + ")";
+ for (auto i = _menu.element.begin(); i != _menu.element.end() && count < _tooltip.size(); ++i, ++count)
+ i->_tooltip._text = _tooltip[count] + " (" + i->_hotkey.name() + ")";
- menu.element[HS_PAUSE]._tooltip.text = tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->getAssociatedKey(IG_PAUSE) + ")";
+ _menu.element[HS_PAUSE]._tooltip._text = _tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->getAssociatedKey(IG_PAUSE) + ")";
}
void HUD::setUI() {
- bg.setUI();
- menu.setUI();
+ _bg.setUI();
+ _menu.setUI();
- gom.setUI();
- pause.setUI();
- back.setUI();
+ _gom.setUI();
+ _pause.setUI();
+ _back.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 3e66553dd27..823d4657990 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -51,56 +51,60 @@ namespace Crab {
namespace pyrodactyl {
namespace ui {
-enum HUDSignal { HS_NONE = -1,
- HS_MAP,
- HS_PAUSE,
- HS_CHAR,
- HS_JOURNAL,
- HS_INV };
+enum HUDSignal {
+ HS_NONE = -1,
+ HS_MAP,
+ HS_PAUSE,
+ HS_CHAR,
+ HS_JOURNAL,
+ HS_INV
+};
// The world map, inventory and objective buttons are in the button menu
class HUD {
// The background image
- ImageData bg;
+ ImageData _bg;
// The launcher menu for stuff like inventory, character, pause etc
- Menu<StateButton> menu;
+ Menu<StateButton> _menu;
// The health gem thingy
// HealthIndicator health;
// Sprite sheet for animated notify icon
- ImageKey notify_anim;
+ ImageKey _notifyAnim;
// Animated notification icon needs a clip sign
- Rect clip;
+ Rect _clip;
// The amount of time to wait before incrementing clip
- Timer timer;
+ Timer _timer;
// The original tooltips as provided in the xml
- Common::Array<Common::String> tooltip;
+ Common::Array<Common::String> _tooltip;
public:
- GameOverMenu gom;
- PauseMenu pause;
- pyrodactyl::input::HotKey pausekey;
- Button back;
+ GameOverMenu _gom;
+ PauseMenu _pause;
+ pyrodactyl::input::HotKey _pausekey;
+ Button _back;
HUD() {
- pausekey.set(pyrodactyl::input::IG_PAUSE);
- notify_anim = 0;
+ _pausekey.set(pyrodactyl::input::IG_PAUSE);
+ _notifyAnim = 0;
}
~HUD() {}
- void internalEvents(bool ShowMap);
- void PlayerImg(const StateButtonImage &img) { menu.element[HS_CHAR].img(img); }
+ void internalEvents(bool showMap);
+ void playerImg(const StateButtonImage &img) {
+ _menu.element[HS_CHAR].img(img);
+ }
void State(const int &val);
void load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
- HUDSignal handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
+ HUDSignal handleEvents(pyrodactyl::event::Info &info, const Common::Event &event);
#if 0
HUDSignal handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
@@ -109,7 +113,7 @@ public:
// Set the tooltips for the buttons in the menu
// The tooltips are of the style <Name> (<Hotkey>), with Name being provided by the xml
- void SetTooltip();
+ void setTooltip();
void setUI();
};
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 9d21b5e1959..5b05821fd5c 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -45,18 +45,18 @@ void Journal::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("objectives");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("map", node))
- bu_map.load(node->first_node("map"));
+ _bu_map.load(node->first_node("map"));
if (nodeValid("category", node))
- category.load(node->first_node("category"));
+ _category.load(node->first_node("category"));
if (nodeValid("quest_list", node))
- ref.load(node->first_node("quest_list"));
+ _ref.load(node->first_node("quest_list"));
- category.UseKeyboard(true);
+ _category.UseKeyboard(true);
}
}
}
@@ -64,41 +64,41 @@ void Journal::load(const Common::String &filename) {
//------------------------------------------------------------------------
// Purpose: Prepare a new character's journal
//------------------------------------------------------------------------
-void Journal::Init(const Common::String &id) {
+void Journal::init(const Common::String &id) {
int found = false;
- for (auto &i : journal)
- if (i.id == id) {
+ for (auto &i : _journal)
+ if (i._id == id) {
found = true;
break;
}
if (!found) {
Group g;
- g.id = id;
+ g._id = id;
for (int i = 0; i < JE_TOTAL; ++i) {
- g.menu[i] = ref;
- g.menu[i].UseKeyboard(true);
- g.menu[i].AssignPaths();
+ g._menu[i] = _ref;
+ g._menu[i].UseKeyboard(true);
+ g._menu[i].AssignPaths();
}
- journal.push_back(g);
+ _journal.push_back(g);
}
}
//------------------------------------------------------------------------
// Purpose: Select a category
//------------------------------------------------------------------------
-void Journal::Select(const Common::String &id, const int &choice) {
- for (unsigned int i = 0; i < category.element.size(); ++i)
- category.element[i].state(false);
+void Journal::select(const Common::String &id, const int &choice) {
+ for (unsigned int i = 0; i < _category.element.size(); ++i)
+ _category.element[i].state(false);
- category.element[choice].state(true);
- select = choice;
+ _category.element[choice].state(true);
+ _select = choice;
// Always find valid journal group first
- for (auto &jo : journal)
- if (jo.id == id) {
- jo.menu[choice].unread = false;
+ for (auto &jo : _journal)
+ if (jo._id == id) {
+ jo._menu[choice].unread = false;
break;
}
}
@@ -107,19 +107,19 @@ void Journal::Select(const Common::String &id, const int &choice) {
// Purpose: Draw stuff
//------------------------------------------------------------------------
void Journal::draw(const Common::String &id) {
- bg.draw();
- category.draw();
+ _bg.draw();
+ _category.draw();
// Always find valid journal group first
- for (auto &jo : journal)
- if (jo.id == id) {
+ for (auto &jo : _journal)
+ if (jo._id == id) {
int count = 0;
- for (auto i = category.element.begin(); i != category.element.end() && count < JE_TOTAL; ++i, ++count)
- if (jo.menu[count].unread)
+ for (auto i = _category.element.begin(); i != _category.element.end() && count < JE_TOTAL; ++i, ++count)
+ if (jo._menu[count].unread)
g_engine->_imageManager->notifyDraw(i->x + i->w, i->y);
- if (select >= 0 && select < JE_TOTAL)
- jo.menu[select].draw(bu_map);
+ if (_select >= 0 && _select < JE_TOTAL)
+ jo._menu[_select].draw(_bu_map);
break;
}
@@ -128,17 +128,17 @@ void Journal::draw(const Common::String &id) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool Journal::handleEvents(const Common::String &id, const Common::Event &Event) {
- int choice = category.handleEvents(Event);
- if (choice >= 0 && (unsigned int)choice < category.element.size())
- Select(id, choice);
+bool Journal::handleEvents(const Common::String &id, const Common::Event &event) {
+ int choice = _category.handleEvents(event);
+ if (choice >= 0 && (unsigned int)choice < _category.element.size())
+ select(id, choice);
// Check if select is valid
- if (select >= 0 && select < JE_TOTAL) {
+ if (_select >= 0 && _select < JE_TOTAL) {
// Always find valid journal group first
- for (auto &jo : journal)
- if (jo.id == id)
- return jo.menu[select].handleEvents(bu_map, marker_title, Event);
+ for (auto &jo : _journal)
+ if (jo._id == id)
+ return jo._menu[_select].handleEvents(_bu_map, _markerTitle, event);
}
return false;
@@ -168,20 +168,20 @@ bool Journal::handleEvents(const Common::String &id, const SDL_Event &Event) {
//------------------------------------------------------------------------
// Purpose: Add an entry to journal
//------------------------------------------------------------------------
-void Journal::Add(const Common::String &id, const Common::String &Category, const Common::String &Title, const Common::String &Text) {
+void Journal::add(const Common::String &id, const Common::String &category, const Common::String &title, const Common::String &text) {
// Always find valid journal group first
- for (auto &jo : journal)
- if (jo.id == id) {
- if (Category == JE_CUR_NAME) {
- jo.menu[JE_CUR].Add(Title, Text);
- } else if (Category == JE_DONE_NAME) {
- jo.menu[JE_DONE].Add(Title, Text);
- } else if (Category == JE_PEOPLE_NAME) {
- jo.menu[JE_PEOPLE].Add(Title, Text);
- } else if (Category == JE_LOCATION_NAME) {
- jo.menu[JE_LOCATION].Add(Title, Text);
- } else if (Category == JE_HISTORY_NAME) {
- jo.menu[JE_HISTORY].Add(Title, Text);
+ for (auto &jo : _journal)
+ if (jo._id == id) {
+ if (category == JE_CUR_NAME) {
+ jo._menu[JE_CUR].Add(title, text);
+ } else if (category == JE_DONE_NAME) {
+ jo._menu[JE_DONE].Add(title, text);
+ } else if (category == JE_PEOPLE_NAME) {
+ jo._menu[JE_PEOPLE].Add(title, text);
+ } else if (category == JE_LOCATION_NAME) {
+ jo._menu[JE_LOCATION].Add(title, text);
+ } else if (category == JE_HISTORY_NAME) {
+ jo._menu[JE_HISTORY].Add(title, text);
}
break;
@@ -191,11 +191,11 @@ void Journal::Add(const Common::String &id, const Common::String &Category, cons
//------------------------------------------------------------------------
// Purpose: Set the marker of a quest
//------------------------------------------------------------------------
-void Journal::Marker(const Common::String &id, const Common::String &Title, const bool &val) {
+void Journal::marker(const Common::String &id, const Common::String &title, const bool &val) {
// Always find valid journal group first
- for (auto &jo : journal)
- if (jo.id == id) {
- jo.menu[JE_CUR].Marker(Title, val);
+ for (auto &jo : _journal)
+ if (jo._id == id) {
+ jo._menu[JE_CUR].Marker(title, val);
break;
}
}
@@ -203,7 +203,7 @@ void Journal::Marker(const Common::String &id, const Common::String &Title, cons
//------------------------------------------------------------------------
// Purpose: Move an entry from one category to another
//------------------------------------------------------------------------
-void Journal::Move(const Common::String &id, const Common::String &Title, const bool &completed) {
+void Journal::move(const Common::String &id, const Common::String &title, const bool &completed) {
JournalCategory source, destination;
if (completed) {
source = JE_CUR;
@@ -214,17 +214,17 @@ void Journal::Move(const Common::String &id, const Common::String &Title, const
}
// Always find valid journal group first
- for (auto &jo : journal)
- if (jo.id == id) {
+ for (auto &jo : _journal)
+ if (jo._id == id) {
// Find the quest chain in the source menu
unsigned int index = 0;
- for (auto i = jo.menu[source].quest.begin(); i != jo.menu[source].quest.end(); ++i, ++index)
- if (i->_title == Title)
+ for (auto i = jo._menu[source].quest.begin(); i != jo._menu[source].quest.end(); ++i, ++index)
+ if (i->_title == title)
break;
- if (index < jo.menu[source].quest.size()) {
- jo.menu[destination].Add(jo.menu[source].quest[index]);
- jo.menu[source].Erase(index);
+ if (index < jo._menu[source].quest.size()) {
+ jo._menu[destination].Add(jo._menu[source].quest[index]);
+ jo._menu[source].Erase(index);
}
break;
@@ -234,21 +234,21 @@ void Journal::Move(const Common::String &id, const Common::String &Title, const
//------------------------------------------------------------------------
// Purpose: Open a specific entry in the journal
//------------------------------------------------------------------------
-void Journal::Open(const Common::String &id, const JournalCategory &Category, const Common::String &Title) {
+void Journal::open(const Common::String &id, const JournalCategory &category, const Common::String &title) {
// Always find valid journal group first
- for (auto &jo : journal)
- if (jo.id == id) {
- if (Category >= 0 && Category < category.element.size()) {
+ for (auto &jo : _journal)
+ if (jo._id == id) {
+ if (category >= 0 && category < _category.element.size()) {
// If category passes the valid check, select it
- Select(id, Category);
+ select(id, category);
// Perform validity check on select, just in case
- if (select > 0 && select < JE_TOTAL) {
+ if (_select > 0 && _select < JE_TOTAL) {
// Search for the title with same name
- for (unsigned int num = 0; num < jo.menu[select].quest.size(); ++num)
- if (jo.menu[select].quest[num]._title == Title) {
+ for (unsigned int num = 0; num < jo._menu[_select].quest.size(); ++num)
+ if (jo._menu[_select].quest[num]._title == title) {
// Found it, switch to this
- jo.menu[select].Select(num);
+ jo._menu[_select].Select(num);
break;
}
}
@@ -262,15 +262,15 @@ void Journal::Open(const Common::String &id, const JournalCategory &Category, co
// Purpose: Load save game stuff
//------------------------------------------------------------------------
void Journal::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto &m : journal) {
+ for (auto &m : _journal) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "journal");
- child->append_attribute(doc.allocate_attribute("id", m.id.c_str()));
+ child->append_attribute(doc.allocate_attribute("id", m._id.c_str()));
- m.menu[JE_CUR].saveState(doc, child, JE_CUR_NAME);
- m.menu[JE_DONE].saveState(doc, child, JE_DONE_NAME);
- m.menu[JE_PEOPLE].saveState(doc, child, JE_PEOPLE_NAME);
- m.menu[JE_LOCATION].saveState(doc, child, JE_LOCATION_NAME);
- m.menu[JE_HISTORY].saveState(doc, child, JE_HISTORY_NAME);
+ m._menu[JE_CUR].saveState(doc, child, JE_CUR_NAME);
+ m._menu[JE_DONE].saveState(doc, child, JE_DONE_NAME);
+ m._menu[JE_PEOPLE].saveState(doc, child, JE_PEOPLE_NAME);
+ m._menu[JE_LOCATION].saveState(doc, child, JE_LOCATION_NAME);
+ m._menu[JE_HISTORY].saveState(doc, child, JE_HISTORY_NAME);
root->append_node(child);
}
}
@@ -280,15 +280,15 @@ void Journal::loadState(rapidxml::xml_node<char> *node) {
Common::String id;
loadStr(id, "id", n);
- Init(id);
+ init(id);
- for (auto &i : journal)
- if (i.id == id) {
- i.menu[JE_CUR].loadState(n->first_node(JE_CUR_NAME));
- i.menu[JE_DONE].loadState(n->first_node(JE_DONE_NAME));
- i.menu[JE_PEOPLE].loadState(n->first_node(JE_PEOPLE_NAME));
- i.menu[JE_LOCATION].loadState(n->first_node(JE_LOCATION_NAME));
- i.menu[JE_HISTORY].loadState(n->first_node(JE_HISTORY_NAME));
+ for (auto &i : _journal)
+ if (i._id == id) {
+ i._menu[JE_CUR].loadState(n->first_node(JE_CUR_NAME));
+ i._menu[JE_DONE].loadState(n->first_node(JE_DONE_NAME));
+ i._menu[JE_PEOPLE].loadState(n->first_node(JE_PEOPLE_NAME));
+ i._menu[JE_LOCATION].loadState(n->first_node(JE_LOCATION_NAME));
+ i._menu[JE_HISTORY].loadState(n->first_node(JE_HISTORY_NAME));
}
}
}
@@ -297,13 +297,13 @@ void Journal::loadState(rapidxml::xml_node<char> *node) {
// Purpose: Adjust UI elements
//------------------------------------------------------------------------
void Journal::setUI() {
- bg.setUI();
- category.setUI();
- ref.setUI();
+ _bg.setUI();
+ _category.setUI();
+ _ref.setUI();
- for (auto &m : journal)
+ for (auto &m : _journal)
for (auto i = 0; i < JE_TOTAL; ++i)
- m.menu[i].setUI();
+ m._menu[i].setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index e5539b14d1c..284f7143d39 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -59,59 +59,62 @@ enum JournalCategory {
class Journal {
// The background image data
- ImageData bg;
+ ImageData _bg;
// The menu to select the category to display
- Menu<StateButton> category;
+ Menu<StateButton> _category;
// The selected category
- int select;
+ int _select;
// A group contains the entire journal for a single character
struct Group {
// Id of the character who this journal belongs to
- Common::String id;
+ Common::String _id;
// The set of menus containing all categories of journals
- QuestMenu menu[JE_TOTAL];
+ QuestMenu _menu[JE_TOTAL];
};
// This contains journal entries for all characters
- Common::Array<Group> journal;
+ Common::Array<Group> _journal;
// The reference quest menu, used to copy layouts
- QuestMenu ref;
+ QuestMenu _ref;
// This button is the "go to map" button, shown if the quest has a corresponding map marker
- Button bu_map;
+ Button _bu_map;
- void Select(const Common::String &id, const int &choice);
+ void select(const Common::String &id, const int &choice);
public:
// The title of the quest selected by the "show in map" button
- Common::String marker_title;
+ Common::String _markerTitle;
+
+ Journal() {
+ _select = 0;
+ }
- Journal() { select = 0; }
~Journal() {}
void load(const Common::String &filename);
void draw(const Common::String &id);
// Return true if "go to map" is selected
- bool handleEvents(const Common::String &id, const Common::Event &Event);
+ bool handleEvents(const Common::String &id, const Common::Event &event);
#if 0
bool handleEvents(const Common::String &id, const SDL_Event &Event);
#endif
- void Add(const Common::String &id, const Common::String &Category, const Common::String &Title, const Common::String &Text);
- void Move(const Common::String &id, const Common::String &Title, const bool &completed);
- void Marker(const Common::String &id, const Common::String &Title, const bool &val);
+ void add(const Common::String &id, const Common::String &category, const Common::String &title, const Common::String &text);
+ void move(const Common::String &id, const Common::String &title, const bool &completed);
+ void marker(const Common::String &id, const Common::String &title, const bool &val);
// Open a specific entry in the journal
- void Open(const Common::String &id, const JournalCategory &Category, const Common::String &Title);
+ void open(const Common::String &id, const JournalCategory &category, const Common::String &title);
// Prepare a new character's journal
- void Init(const Common::String &id);
+ void init(const Common::String &id);
void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index cfae5bab071..525f4091f4a 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -136,7 +136,7 @@ void Map::draw(pyrodactyl::event::Info &info) {
fg.draw();
bu_overlay.draw();
- title.text = info.curLocName();
+ title._text = info.curLocName();
title.draw();
marker.draw(pos, player_pos, camera);
Commit: 1dcf544251ed86a776b289d1ab3d525492a8f394
https://github.com/scummvm/scummvm/commit/1dcf544251ed86a776b289d1ab3d525492a8f394
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make more UI classes follow code formatting conventions
Changed paths:
engines/crab/animation/PopUp.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/mainmenu.cpp
engines/crab/ui/DevConsole.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/KeyBindMenu.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapData.cpp
engines/crab/ui/MapData.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/ParagraphData.cpp
engines/crab/ui/ParagraphData.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/mapbutton.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 9237169b733..14cdbb58f4c 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -116,11 +116,11 @@ void PopUpCollection::internalEvents(pyrodactyl::event::Info &info, const Common
void PopUp::draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
if (_show) {
if (x + pop.x < camera.w / 3)
- g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_LEFT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_LEFT, pop._line.x, pop._line.y, true);
else if (x + pop.x > (2 * camera.w) / 3)
- g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_RIGHT, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_RIGHT, pop._line.x, pop._line.y, true);
else
- g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_CENTER, pop.line.x, pop.line.y, true);
+ g_engine->_textManager->draw(x + pop.x, y + pop.y, _text, pop._col, pop._font, ALIGN_CENTER, pop._line.x, pop._line.y, true);
}
}
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index ddfcced3fd4..5a2916037c3 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -100,14 +100,14 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
if (_eventMap.contains(info.curLocID()) > 0 && _eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
switch (_curEvent->_type) {
case EVENT_DIALOG:
- if (_oh.show_journal) {
+ if (_oh._showJournal) {
info._journal.handleEvents(playerId, Event);
if (hud._back.handleEvents(Event) == BUAC_LCLICK || hud._pausekey.handleEvents(Event))
- _oh.show_journal = false;
+ _oh._showJournal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (_oh.HandleCommonEvents(Event)) {
+ if (_oh.handleCommonEvents(Event)) {
if (info.personValid(_curEvent->_title)) {
Person &p = info.personGet(_curEvent->_title);
if (p._altJournalName)
@@ -117,9 +117,9 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
}
}
- if (_oh.HandleDlboxEvents(Event)) {
+ if (_oh.handleDlboxEvents(Event)) {
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
- _oh.show_journal = false;
+ _oh._showJournal = false;
}
}
break;
@@ -129,27 +129,27 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
break;
case EVENT_REPLY:
- if (_oh.show_journal) {
+ if (_oh._showJournal) {
info._journal.handleEvents(playerId, Event);
if (hud._back.handleEvents(Event) == BUAC_LCLICK || hud._pausekey.handleEvents(Event))
- _oh.show_journal = false;
+ _oh._showJournal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (_oh.HandleCommonEvents(Event))
+ if (_oh.handleCommonEvents(Event))
if (info.personValid(_curEvent->_title))
info._journal.open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
int choice = _reply.handleEvents(info, g_engine->_eventStore->_con[_curEvent->_special], _curEvent->_title, _oh, Event);
if (choice >= 0) {
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq, choice);
- _oh.show_journal = false;
+ _oh._showJournal = false;
}
}
break;
case EVENT_TEXT:
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (_oh.HandleCommonEvents(Event))
+ if (_oh.handleCommonEvents(Event))
if (info.personValid(_curEvent->_title))
info._journal.open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
@@ -323,7 +323,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
break;
case EVENT_DIALOG:
g_engine->_imageManager->dimScreen();
- if (_oh.show_journal) {
+ if (_oh._showJournal) {
info._journal.draw(level.playerId());
hud._back.draw();
} else
@@ -331,7 +331,7 @@ void Manager::draw(Info &info, HUD &hud, Level &level) {
break;
case EVENT_REPLY:
g_engine->_imageManager->dimScreen();
- if (_oh.show_journal) {
+ if (_oh._showJournal) {
info._journal.draw(level.playerId());
hud._back.draw();
} else {
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 717e3029d84..8d99538094d 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -46,7 +46,7 @@ void Game::StartNewGame() {
info.ironMan(g_engine->_tempData->ironman);
savefile.ironman = g_engine->_tempData->filename;
clock.Start();
- hud._pause.UpdateMode(info.ironMan());
+ hud._pause.updateMode(info.ironMan());
CreateSaveGame(SAVEGAME_EVENT);
}
@@ -131,14 +131,14 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
// Set the current location
info.curLocID(id);
info.curLocName(g_engine->_filePath->level[id].name);
- map.player_pos = level._mapLoc;
+ map._playerPos = level._mapLoc;
// Update and center the world map to the player current position
- map.Update(info);
- map.Center(map.player_pos);
+ map.update(info);
+ map.center(map._playerPos);
// If this is our first time visiting a level, reveal the associated area on the world map
- map.RevealAdd(level._mapClip._id, level._mapClip._rect);
+ map.revealAdd(level._mapClip._id, level._mapClip._rect);
// Initialize inventory
info._inv.init(level.playerId());
@@ -184,7 +184,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
if (hud._pausekey.handleEvents(Event) || hud._back.handleEvents(Event) == BUAC_LCLICK)
state = STATE_LOSE_MENU;
} else {
- if (!gem.eventInProgress() && !hud._pause.DisableHotkeys()) {
+ if (!gem.eventInProgress() && !hud._pause.disableHotkeys()) {
switch (hud.handleEvents(info, Event)) {
case HS_MAP:
ToggleState(STATE_MAP);
@@ -280,7 +280,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
case STATE_MAP:
if (map.handleEvents(info, Event)) {
// We need to load the new level
- LoadLevel(map.cur_loc);
+ LoadLevel(map._curLoc);
ToggleState(STATE_GAME);
}
break;
@@ -288,7 +288,7 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
if (info._journal.handleEvents(level.playerId(), Event)) {
// This means we selected the "find on map" button, so we need to:
// switch to the world map, and highlight the appropriate quest marker
- map.SelectDest(info._journal._markerTitle);
+ map.selectDest(info._journal._markerTitle);
ToggleState(STATE_MAP);
}
break;
@@ -572,18 +572,18 @@ bool Game::ApplyResult() {
switch (i->_type) {
case ER_MAP:
if (i->_val == "img")
- map.SetImage(i->_y);
+ map.setImage(i->_y);
else if (i->_val == "pos") {
- map.player_pos.x = i->_x;
- map.player_pos.y = i->_y;
+ map._playerPos.x = i->_x;
+ map._playerPos.y = i->_y;
}
break;
case ER_DEST:
if (i->_x < 0 || i->_y < 0) {
info._journal.marker(level.playerId(), i->_val, false);
- map.DestDel(i->_val);
+ map.destDel(i->_val);
} else {
- map.DestAdd(i->_val, i->_x, i->_y);
+ map.destAdd(i->_val, i->_x, i->_y);
info._journal.marker(level.playerId(), i->_val, true);
info._unread._map = true;
}
@@ -627,7 +627,7 @@ bool Game::ApplyResult() {
break;
case ER_SYNC:
level.calcProperties(info);
- map.Update(info);
+ map.update(info);
break;
case ER_QUIT:
g_engine->_tempData->credits = (i->_val == "credits");
@@ -683,7 +683,7 @@ void Game::loadState(Common::SeekableReadStream *stream) {
if (nodeValid(node)) {
info.loadIronMan(node);
loadStr(savefile.ironman, "file", node);
- hud._pause.UpdateMode(info.ironMan());
+ hud._pause.updateMode(info.ironMan());
if (nodeValid("events", node))
gem.loadState(node->first_node("events"));
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 44b921df4cb..55a0ce2456b 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -45,11 +45,11 @@ void ItemMenu::Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int
for (unsigned int i = 0; i < size; ++i) {
ItemSlot b;
b.init(ref, inc.x * (i % cols), inc.y * (i / cols));
- element.push_back(b);
+ _element.push_back(b);
}
- use_keyboard = keyboard;
- AssignPaths();
+ _useKeyboard = keyboard;
+ assignPaths();
}
//------------------------------------------------------------------------
@@ -57,15 +57,15 @@ void ItemMenu::Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int
//------------------------------------------------------------------------
void ItemMenu::loadState(rapidxml::xml_node<char> *node) {
unsigned int count = 0;
- for (auto n = node->first_node(); n != NULL && count < element.size(); n = n->next_sibling(), ++count)
- element[count].loadState(n);
+ for (auto n = node->first_node(); n != NULL && count < _element.size(); n = n->next_sibling(), ++count)
+ _element[count].loadState(n);
}
//------------------------------------------------------------------------
// Purpose: Save to file
//------------------------------------------------------------------------
void ItemMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto i = element.begin(); i != element.end(); ++i)
+ for (auto i = _element.begin(); i != _element.end(); ++i)
i->saveState(doc, root);
}
@@ -76,8 +76,8 @@ void ItemMenu::handleEvents(const Common::Event &Event, const int &XOffset, cons
int result = Menu<ItemSlot>::handleEvents(Event);
if (result != -1) {
select_index = result;
- for (unsigned int i = 0; i < element.size(); ++i)
- element[i].state(i == (unsigned int)select_index);
+ for (unsigned int i = 0; i < _element.size(); ++i)
+ _element[i].state(i == (unsigned int)select_index);
}
}
@@ -100,9 +100,9 @@ void ItemMenu::handleEvents(const SDL_Event &Event, const int &XOffset, const in
//------------------------------------------------------------------------
void ItemMenu::draw(ItemDesc &item_info) {
if (select_index != -1)
- item_info.draw(element[select_index]._item);
+ item_info.draw(_element[select_index]._item);
- for (auto i = element.begin(); i != element.end(); ++i)
+ for (auto i = _element.begin(); i != _element.end(); ++i)
i->draw();
}
@@ -110,7 +110,7 @@ void ItemMenu::draw(ItemDesc &item_info) {
// Purpose: Equip an item at the first available location (used in events)
//------------------------------------------------------------------------
bool ItemMenu::Equip(Item &item) {
- for (auto i = element.begin(); i != element.end(); ++i)
+ for (auto i = _element.begin(); i != _element.end(); ++i)
if (i->_category == SLOT_STORAGE && i->equip(item))
return true;
@@ -123,7 +123,7 @@ bool ItemMenu::Equip(Item &item) {
bool ItemMenu::Del(const Common::String &id) {
bool result = false;
- for (auto &i : element)
+ for (auto &i : _element)
if (i._item._id == id) {
i._empty = true;
i._item.clear();
@@ -139,7 +139,7 @@ bool ItemMenu::Del(const Common::String &id) {
// Purpose: Find out if we have an item with a name
//------------------------------------------------------------------------
bool ItemMenu::Has(const Common::String &container, const Common::String &id) {
- for (auto i = element.begin(); i != element.end(); ++i)
+ for (auto i = _element.begin(); i != _element.end(); ++i)
if (i->_item._id == id) {
if (container == "equip") {
if (i->_category == SLOT_EQUIP)
@@ -163,17 +163,17 @@ bool ItemMenu::Swap(ItemMenu &target, int index) {
// If no slot of type is found, don't swap items at all
int found_index = -1, cur_index = 0;
- for (auto i = element.begin(); i != element.end(); ++i, ++cur_index)
- if (i->_itemType == target.element[index]._itemType) {
+ for (auto i = _element.begin(); i != _element.end(); ++i, ++cur_index)
+ if (i->_itemType == target._element[index]._itemType) {
if (i->_empty) {
- i->swap(target.element[index]);
+ i->swap(target._element[index]);
return true;
} else
found_index = cur_index;
}
if (found_index != -1) {
- element[found_index].swap(target.element[index]);
+ _element[found_index].swap(target._element[index]);
return true;
}
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index 8fbc19d311c..13b565a6d5a 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -62,7 +62,7 @@ public:
}
~ItemMenu() {}
- int HoverIndex() { return hover_index; }
+ int hoverIndex() { return _hoverIndex; }
void draw(pyrodactyl::ui::ItemDesc &item_info);
/*pyrodactyl::people::Person &obj, pyrodactyl::stat::StatDrawHelper &helper*/
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index e1a3eace090..ff59312bde5 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -52,9 +52,9 @@ MainMenu::MainMenu() {
back.load(node->first_node("back"));
- if (!g_engine->_optionMenu->loaded) {
+ if (!g_engine->_optionMenu->_loaded) {
g_engine->_optionMenu->load(node->first_node("option")->first_attribute("path")->value());
- g_engine->_optionMenu->loaded = true;
+ g_engine->_optionMenu->_loaded = true;
}
mod.load(node->first_node("mod")->first_attribute("path")->value());
@@ -160,8 +160,8 @@ void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
if (state != STATE_CREDITS) {
int choice = me_main.handleEvents(Event);
if (choice >= 0) {
- for (unsigned i = 0; i < me_main.element.size(); ++i)
- me_main.element[i].state(i == (unsigned int)choice);
+ for (unsigned i = 0; i < me_main._element.size(); ++i)
+ me_main._element[i].state(i == (unsigned int)choice);
switch (choice) {
case 0:
@@ -455,19 +455,19 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
// We are entering the normal state, i.e outside all menus - reset color of menu items
if (state == STATE_NORMAL) {
- for (unsigned i = 0; i < me_main.element.size(); ++i)
- me_main.element[i].state(false);
+ for (unsigned i = 0; i < me_main._element.size(); ++i)
+ me_main._element[i].state(false);
}
// Enable keyboard navigation if outside all menus, otherwise disable it
- me_main.UseKeyboard((state == STATE_NORMAL));
+ me_main.useKeyboard((state == STATE_NORMAL));
// Continue button is only enabled if there is a save to load
- me_main.element[0]._visible = !g_engine->_loadMenu->empty();
+ me_main._element[0]._visible = !g_engine->_loadMenu->empty();
// Enable credits and quit button if outside all menus, otherwise disable it
- me_main.element[6]._visible = (state == STATE_NORMAL);
- me_main.element[7]._visible = (state == STATE_NORMAL);
+ me_main._element[6]._visible = (state == STATE_NORMAL);
+ me_main._element[7]._visible = (state == STATE_NORMAL);
// If switching to help screen, load latest image otherwise remove it from memory
if (state == STATE_HELP)
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index b7b38865003..f28101d0da7 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -67,7 +67,7 @@ public:
// Only restrict input when we're in variable state
bool restrictInput() {
- return (_state == STATE_VAR || _menu.HoverIndex() != -1);
+ return (_state == STATE_VAR || _menu.hoverIndex() != -1);
}
void load(const Common::String &filename);
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 5a08c5b48e9..afb9df355e1 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -124,15 +124,15 @@ public:
Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
_slotInfo.clear();
- _menu.Clear();
+ _menu.clear();
unsigned int countSlot = 0, countMenu = 0;
for (const Common::String& save : saves) {
_slotInfo.push_back(FileType(save));
- _menu.Add(countSlot, countMenu);
+ _menu.add(countSlot, countMenu);
}
- _menu.AssignPaths();
+ _menu.assignPaths();
#if 0
using namespace boost::filesystem;
@@ -204,7 +204,7 @@ public:
int choice = _menu.handleEvents(Event);
if (choice >= 0) {
_menu.reset();
- _selected = _slotInfo[_menu.Index() + choice]._path;
+ _selected = _slotInfo[_menu.index() + choice]._path;
reset();
return true;
}
@@ -229,8 +229,8 @@ public:
void draw() {
_bg.draw();
_menu.draw();
- for (auto i = _menu.Index(), count = 0u; i < _menu.IndexPlusOne() && i < _slotInfo.size(); i++, count++) {
- auto base_x = _menu.BaseX(count), base_y = _menu.BaseY(count);
+ for (auto i = _menu.index(), count = 0u; i < _menu.indexPlusOne() && i < _slotInfo.size(); i++, count++) {
+ auto base_x = _menu.baseX(count), base_y = _menu.baseY(count);
tdB[DATA_SAVENAME].draw(_slotInfo[i]._name, base_x, base_y);
tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
}
@@ -239,8 +239,8 @@ public:
}
void DrawHover() {
- if (_menu.HoverIndex() >= 0) {
- int i = _menu.HoverIndex();
+ if (_menu.hoverIndex() >= 0) {
+ int i = _menu.hoverIndex();
if (!_img._loaded || _prevHover != i) {
_img._loaded = true;
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index b9a82cb9a88..1e0fe108ffd 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -64,7 +64,7 @@ void GeneralSettingMenu::load(rapidxml::xml_node<char> *node) {
_textSpeed.load(node->first_node("text_speed"));
// Sync popup text value with actual value
- for (auto &i : _textSpeed.element)
+ for (auto &i : _textSpeed._element)
i._state = (i._val == g_engine->_screenSettings->text_speed);
}
@@ -89,7 +89,7 @@ void GeneralSettingMenu::handleEvents(const Common::Event &event) {
int result = _textSpeed.handleEvents(event);
if (result >= 0)
- g_engine->_screenSettings->text_speed = _textSpeed.element[result]._val;
+ g_engine->_screenSettings->text_speed = _textSpeed._element[result]._val;
}
#if 0
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index 949f019cef3..6ef58defb11 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -44,37 +44,37 @@ void KeyBindMenu::load(rapidxml::xml_node<char> *node) {
rapidxml::xml_node<char> *menode = node->first_node("menu");
if (nodeValid("primary", menode))
- prim.load(menode->first_node("primary"));
+ _prim.load(menode->first_node("primary"));
if (nodeValid("alt", menode))
- alt.load(menode->first_node("alt"));
+ _alt.load(menode->first_node("alt"));
if (nodeValid("prompt", menode))
- prompt.load(menode->first_node("prompt"));
+ _prompt.load(menode->first_node("prompt"));
if (nodeValid("inc", menode))
- inc.load(menode->first_node("inc"));
+ _inc.load(menode->first_node("inc"));
if (nodeValid("dim", menode))
- dim.load(menode->first_node("dim"));
+ _dim.load(menode->first_node("dim"));
if (nodeValid("divide", menode))
- divide.load(menode->first_node("divide"));
+ _divide.load(menode->first_node("divide"));
if (nodeValid("desc", menode))
- desc.load(menode->first_node("desc"));
+ _desc.load(menode->first_node("desc"));
}
// Initialize the menus
- InitMenu(CON_GAME);
- InitMenu(CON_UI);
+ initMenu(CON_GAME);
+ initMenu(CON_UI);
if (nodeValid("controls", node))
- sel_controls.load(node->first_node("controls"));
+ _selControls.load(node->first_node("controls"));
}
}
-void KeyBindMenu::StartAndSize(const int &type, int &start, int &size) {
+void KeyBindMenu::startAndSize(const int &type, int &start, int &size) {
switch (type) {
case CON_GAME:
start = IG_START;
@@ -89,8 +89,8 @@ void KeyBindMenu::StartAndSize(const int &type, int &start, int &size) {
}
}
-void KeyBindMenu::InitMenu(const int &type) {
- warning("STUB: KeyBindMenu::InitMenu()");
+void KeyBindMenu::initMenu(const int &type) {
+ warning("STUB: KeyBindMenu::initMenu()");
#if 0
int start = 0, size = 0;
@@ -111,27 +111,27 @@ void KeyBindMenu::InitMenu(const int &type) {
#endif
}
-void KeyBindMenu::DrawDesc(const int &type) {
+void KeyBindMenu::drawDesc(const int &type) {
int start = 0, size = 0;
- StartAndSize(type, start, size);
+ startAndSize(type, start, size);
for (int i = 0; i < size; i++) {
- int xoffset = inc.x * i + divide.x * (i / dim.x);
- int yoffset = inc.y * (i % dim.x) + divide.y * (i / dim.x);
+ int xoffset = _inc.x * i + _divide.x * (i / _dim.x);
+ int yoffset = _inc.y * (i % _dim.x) + _divide.y * (i / _dim.x);
- desc.draw(g_engine->_inputManager->_iv[i + start].name, xoffset, yoffset);
+ _desc.draw(g_engine->_inputManager->_iv[i + start].name, xoffset, yoffset);
}
}
void KeyBindMenu::draw() {
- sel_controls.draw();
+ _selControls.draw();
- menu[sel_controls.cur].draw();
- DrawDesc(sel_controls.cur);
+ _menu[_selControls._cur].draw();
+ drawDesc(_selControls._cur);
}
-void KeyBindMenu::SetCaption() {
- warning("STUB: KeyBindMenu::SetCaption()");
+void KeyBindMenu::setCaption() {
+ warning("STUB: KeyBindMenu::setCaption()");
#if 0
int start = 0, size = 0;
@@ -144,7 +144,7 @@ void KeyBindMenu::SetCaption() {
#endif
}
-void KeyBindMenu::handleEvents(const Common::Event &Event) {
+void KeyBindMenu::handleEvents(const Common::Event &event) {
warning("STUB: KeyBindMenu::handleEvents()");
/*
@@ -226,17 +226,17 @@ void KeyBindMenu::SwapKey(const SDL_Scancode &find) {
#endif
void KeyBindMenu::setUI() {
- menu[CON_GAME].Clear();
- menu[CON_UI].Clear();
+ _menu[CON_GAME].clear();
+ _menu[CON_UI].clear();
// Initialize the menus
- prim.setUI();
- alt.setUI();
- InitMenu(CON_GAME);
- InitMenu(CON_UI);
+ _prim.setUI();
+ _alt.setUI();
+ initMenu(CON_GAME);
+ initMenu(CON_UI);
- desc.setUI();
- sel_controls.setUI();
+ _desc.setUI();
+ _selControls.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 24e926ccbec..47f87e73d7c 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -42,85 +42,93 @@ namespace pyrodactyl {
namespace ui {
class KeyBindMenu {
// The keyboard controls menu has 2 types of inputs
- enum Controls { CON_GAME,
- CON_UI,
- CON_TOTAL };
+ enum Controls {
+ CON_GAME,
+ CON_UI,
+ CON_TOTAL
+ };
// Each menu can be in these 2 states
- enum States { STATE_NORMAL,
- STATE_KEY } state;
+ enum States {
+ STATE_NORMAL,
+ STATE_KEY
+ } _state;
// This button swaps between sub-sections "Gameplay" and "Interface"
- OptionSelect sel_controls;
+ OptionSelect _selControls;
// These two buttons are the template buttons for the menu
- Button prim, alt;
+ Button _prim, _alt;
// This is the template text info
- TextData desc;
+ TextData _desc;
// inc tells us what to add to the reference buttons to get multiple buttons
// Divide is the space between two columns
- Vector2i inc, divide;
+ Vector2i _inc, _divide;
// The number of rows and columns
- Vector2i dim;
+ Vector2i _dim;
// The menu for the keyboard options in both sub categories
// all control types have equal entries so we just need to change the text displayed
- ButtonMenu menu[CON_TOTAL];
+ ButtonMenu _menu[CON_TOTAL];
// The selected button in the current menu
- int choice;
+ int _choice;
struct PromptInfo {
- int col, col_prev;
- Common::String text;
+ int _col, _colPrev;
+ Common::String _text;
PromptInfo() {
- col = 0;
- col_prev = 0;
+ _col = 0;
+ _colPrev = 0;
}
void load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- loadStr(text, "text", node);
- loadNum(col, "color", node);
+ loadStr(_text, "text", node);
+ loadNum(_col, "color", node);
}
}
void Swap(Caption &c) {
- col_prev = c._col;
- c._text = text;
- c._col = col;
+ _colPrev = c._col;
+ c._text = _text;
+ c._col = _col;
}
- } prompt;
+ } _prompt;
- void StartAndSize(const int &type, int &start, int &size);
- void InitMenu(const int &type);
- void DrawDesc(const int &type);
+ void startAndSize(const int &type, int &start, int &size);
+ void initMenu(const int &type);
+ void drawDesc(const int &type);
public:
KeyBindMenu() {
reset();
- choice = -1;
+ _choice = -1;
}
~KeyBindMenu() {}
- void reset() { state = STATE_NORMAL; }
+ void reset() {
+ _state = STATE_NORMAL;
+ }
#if 0
void SwapKey(const SDL_Scancode &find);
#endif
- bool DisableHotkeys() { return state != STATE_NORMAL; }
+ bool disableHotkeys() {
+ return _state != STATE_NORMAL;
+ }
void load(rapidxml::xml_node<char> *node);
- void handleEvents(const Common::Event &Event);
+ void handleEvents(const Common::Event &event);
#if 0
void handleEvents(const SDL_Event &Event);
#endif
- void SetCaption();
+ void setCaption();
void draw();
void setUI();
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index 272d84f687e..7b165ced176 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -35,54 +35,54 @@ namespace Crab {
using namespace pyrodactyl::ui;
void MapData::load(rapidxml::xml_node<char> *node) {
- loadStr(path_bg, "bg", node);
- loadStr(path_overlay, "overlay", node);
+ loadStr(_pathBg, "bg", node);
+ loadStr(_pathOverlay, "overlay", node);
}
-void MapData::DestAdd(const Common::String &name, const int &x, const int &y) {
+void MapData::destAdd(const Common::String &name, const int &x, const int &y) {
MarkerData md;
- md.name = name;
- md.pos.x = x;
- md.pos.y = y;
- dest.push_back(md);
+ md._name = name;
+ md._pos.x = x;
+ md._pos.y = y;
+ _dest.push_back(md);
}
void MapData::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child_clip = doc.allocate_node(rapidxml::node_element, "clip");
- for (auto c = reveal.begin(); c != reveal.end(); ++c)
+ for (auto c = _reveal.begin(); c != _reveal.end(); ++c)
c->saveState(doc, child_clip, "rect");
root->append_node(child_clip);
rapidxml::xml_node<char> *child_dest = doc.allocate_node(rapidxml::node_element, "dest");
- for (auto d = dest.begin(); d != dest.end(); ++d) {
+ for (auto d = _dest.begin(); d != _dest.end(); ++d) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "pos");
- child->append_attribute(doc.allocate_attribute("name", d->name.c_str()));
- child->append_attribute(doc.allocate_attribute("x", gStrPool->Get(d->pos.x)));
- child->append_attribute(doc.allocate_attribute("y", gStrPool->Get(d->pos.y)));
+ child->append_attribute(doc.allocate_attribute("name", d->_name.c_str()));
+ child->append_attribute(doc.allocate_attribute("x", gStrPool->Get(d->_pos.x)));
+ child->append_attribute(doc.allocate_attribute("y", gStrPool->Get(d->_pos.y)));
child_dest->append_node(child);
}
root->append_node(child_dest);
}
void MapData::loadState(rapidxml::xml_node<char> *node) {
- reveal.clear();
+ _reveal.clear();
if (nodeValid("clip", node)) {
rapidxml::xml_node<char> *clipnode = node->first_node("clip");
for (rapidxml::xml_node<char> *n = clipnode->first_node("rect"); n != NULL; n = n->next_sibling("rect")) {
Rect r;
r.load(n);
- reveal.push_back(r);
+ _reveal.push_back(r);
}
}
- dest.clear();
+ _dest.clear();
if (nodeValid("dest", node)) {
rapidxml::xml_node<char> *destnode = node->first_node("dest");
for (rapidxml::xml_node<char> *n = destnode->first_node("pos"); n != NULL; n = n->next_sibling("pos")) {
MarkerData md;
- loadStr(md.name, "name", n);
- md.pos.load(n);
- dest.push_back(md);
+ loadStr(md._name, "name", n);
+ md._pos.load(n);
+ _dest.push_back(md);
}
}
}
diff --git a/engines/crab/ui/MapData.h b/engines/crab/ui/MapData.h
index 8a4cc97a4bd..baa7dba3ede 100644
--- a/engines/crab/ui/MapData.h
+++ b/engines/crab/ui/MapData.h
@@ -40,28 +40,30 @@ namespace pyrodactyl {
namespace ui {
struct MapData {
// The paths of set of map images - background and the fully revealed map overlay
- Common::String path_bg, path_overlay;
+ Common::String _pathBg, _pathOverlay;
// The places the player has revealed in this world map
- Common::Array<Rect> reveal;
+ Common::Array<Rect> _reveal;
struct MarkerData {
// The name of the marker, same name as the quest
- Common::String name;
+ Common::String _name;
// Position of the marker
- Vector2i pos;
+ Vector2i _pos;
};
// The set of destinations currently active
- Common::Array<MarkerData> dest;
+ Common::Array<MarkerData> _dest;
MapData() {}
- MapData(rapidxml::xml_node<char> *node) { load(node); }
+ MapData(rapidxml::xml_node<char> *node) {
+ load(node);
+ }
~MapData() {}
void load(rapidxml::xml_node<char> *node);
- void DestAdd(const Common::String &name, const int &x, const int &y);
+ void destAdd(const Common::String &name, const int &x, const int &y);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index bc5400cb8d2..013994b6214 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -39,22 +39,22 @@ using namespace pyrodactyl::ui;
//------------------------------------------------------------------------
void MapMarkerMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("ref", node))
- ref.load(node->first_node("ref"));
+ _ref.load(node->first_node("ref"));
if (nodeValid("player", node))
- player.load(node->first_node("player"));
+ _player.load(node->first_node("player"));
if (nodeValid("offset", node)) {
rapidxml::xml_node<char> *offnode = node->first_node("offset");
if (nodeValid("marker", offnode))
- offset.marker.load(offnode->first_node("marker"));
+ _offset._marker.load(offnode->first_node("marker"));
if (nodeValid("player", offnode))
- offset.player.load(offnode->first_node("player"));
+ _offset._player.load(offnode->first_node("player"));
}
- menu.UseKeyboard(true);
+ _menu.useKeyboard(true);
}
//------------------------------------------------------------------------
@@ -62,33 +62,33 @@ void MapMarkerMenu::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void MapMarkerMenu::draw(const Element &pos, const Vector2i &player_pos, const Rect &camera) {
// Calculate all offsets
- Vector2i offset_p(pos.x + player_pos.x + offset.player.x - camera.x, pos.y + player_pos.y + offset.player.y - camera.y);
- Vector2i offset_m(pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+ Vector2i offsetP(pos.x + player_pos.x + _offset._player.x - camera.x, pos.y + player_pos.y + _offset._player.y - camera.y);
+ Vector2i offsetM(pos.x - camera.x + _offset._marker.x, pos.y - camera.y + _offset._marker.y);
// Only draw the image - captions drawn later to prevent drawing another button over caption
- player.imageCaptionOnlyDraw(offset_p.x, offset_p.y);
+ _player.imageCaptionOnlyDraw(offsetP.x, offsetP.y);
- for (auto &i : menu.element)
- i.imageCaptionOnlyDraw(offset_m.x, offset_m.y);
+ for (auto &i : _menu._element)
+ i.imageCaptionOnlyDraw(offsetM.x, offsetM.y);
// Now draw the tool-tips for everything combined
- player.hoverInfoOnlyDraw(offset_p.x, offset_p.y);
+ _player.hoverInfoOnlyDraw(offsetP.x, offsetP.y);
- for (auto &i : menu.element)
- i.hoverInfoOnlyDraw(offset_m.x, offset_m.y);
+ for (auto &i : _menu._element)
+ i.hoverInfoOnlyDraw(offsetM.x, offsetM.y);
}
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-void MapMarkerMenu::handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event) {
- if (player_pos.x >= camera.x && player_pos.y >= camera.y)
- player.handleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
+void MapMarkerMenu::handleEvents(const Element &pos, const Vector2i &playerPos, const Rect &camera, const Common::Event &event) {
+ if (playerPos.x >= camera.x && playerPos.y >= camera.y)
+ _player.handleEvents(event, pos.x + playerPos.x - camera.x + _offset._player.x, pos.y + playerPos.y - camera.y + _offset._player.y);
- int choice = menu.handleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+ int choice = _menu.handleEvents(event, pos.x - camera.x + _offset._marker.x, pos.y - camera.y + _offset._marker.y);
if (choice != -1) {
int c = 0;
- for (auto &i : menu.element) {
+ for (auto &i : _menu._element) {
if (c == choice) // For an already selected marker, clicking it toggles the selection state
i.state(!i.state());
else
@@ -125,24 +125,24 @@ void MapMarkerMenu::handleEvents(const Element &pos, const Vector2i &player_pos,
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
-void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds) {
+void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &playerPos, const Rect &camera, Rect bounds) {
// Find if the player marker is visible or not
{
- Rect r(pos.x + player_pos.x - offset.marker.x - camera.x,
- pos.y + player_pos.y - offset.marker.y - camera.y,
- player.w + offset.marker.x,
- player.h + offset.marker.y);
+ Rect r(pos.x + playerPos.x - _offset._marker.x - camera.x,
+ pos.y + playerPos.y - _offset._marker.y - camera.y,
+ _player.w + _offset._marker.x,
+ _player.h + _offset._marker.y);
- player._visible = bounds.Contains(r);
+ _player._visible = bounds.Contains(r);
}
// Redefine p for marker buttons
- Vector2i p(pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
+ Vector2i p(pos.x - camera.x + _offset._marker.x, pos.y - camera.y + _offset._marker.y);
// Calculate visibility for each marker
- for (auto &i : menu.element) {
- Rect r(i.x + p.x - offset.marker.x, i.y + p.y - offset.marker.y,
- i.w + offset.marker.x, i.h + offset.marker.y);
+ for (auto &i : _menu._element) {
+ Rect r(i.x + p.x - _offset._marker.x, i.y + p.y - _offset._marker.y,
+ i.w + _offset._marker.x, i.h + _offset._marker.y);
i._visible = bounds.Contains(r);
}
@@ -152,8 +152,8 @@ void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &player_po
// Purpose: Reposition UI
//------------------------------------------------------------------------
void MapMarkerMenu::setUI() {
- player.setUI();
- menu.setUI();
+ _player.setUI();
+ _menu.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 386ea47dbe7..6efe9d62a78 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -41,43 +41,48 @@ namespace pyrodactyl {
namespace ui {
class MapMarkerMenu {
// The reference map marker
- StateButton ref;
+ StateButton _ref;
// The menu containing all the map markers
- Menu<StateButton> menu;
+ Menu<StateButton> _menu;
// The offset at which every map marker is drawn (used to compensate for icon design width)
struct {
- Vector2i marker, player;
- } offset;
+ Vector2i _marker, _player;
+ } _offset;
// The button for the player's current position
- Button player;
+ Button _player;
public:
MapMarkerMenu() {}
~MapMarkerMenu() {}
- void AddButton(const Common::String &name, const int &x, const int &y) {
+ void addButton(const Common::String &name, const int &x, const int &y) {
StateButton b;
- b.init(ref, x, y);
+ b.init(_ref, x, y);
b._tooltip._text = name;
- menu.element.push_back(b);
+ _menu._element.push_back(b);
}
- void Clear() { menu.element.clear(); }
- void AssignPaths() { menu.AssignPaths(); }
+ void clear() {
+ _menu._element.clear();
+ }
+
+ void assignPaths() {
+ _menu.assignPaths();
+ }
- void SelectDest(const Common::String &name) {
- for (auto &i : menu.element)
+ void selectDest(const Common::String &name) {
+ for (auto &i : _menu._element)
i.state(i._tooltip._text == name);
}
- void Erase(const Common::String &name) {
- for (auto i = menu.element.begin(); i != menu.element.end(); ++i) {
+ void erase(const Common::String &name) {
+ for (auto i = _menu._element.begin(); i != _menu._element.end(); ++i) {
if (i->_tooltip._text == name) {
- menu.element.erase(i);
- AssignPaths();
+ _menu._element.erase(i);
+ assignPaths();
break;
}
}
@@ -87,11 +92,11 @@ public:
void draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
- void handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const Common::Event &Event);
+ void handleEvents(const Element &pos, const Vector2i &playerPos, const Rect &camera, const Common::Event &event);
#if 0
void handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
#endif
- void internalEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, Rect bounds);
+ void internalEvents(const Element &pos, const Vector2i &playerPos, const Rect &camera, Rect bounds);
void setUI();
};
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 3fc46c7e1ed..e089ca8cce9 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -77,10 +77,10 @@ void ModMenu::load(const Common::String &filename) {
}
}
-bool ModMenu::handleEvents(const Common::Event &Event) {
- int choice = _menu.handleEvents(Event);
+bool ModMenu::handleEvents(const Common::Event &event) {
+ int choice = _menu.handleEvents(event);
if (choice >= 0) {
- g_engine->_filePath->mod_cur = _slotInfo[_menu.Index() + choice]._path;
+ g_engine->_filePath->mod_cur = _slotInfo[_menu.index() + choice]._path;
return true;
}
@@ -102,14 +102,14 @@ bool ModMenu::handleEvents(const SDL_Event &Event) {
void ModMenu::draw() {
_bg.draw();
_menu.draw();
- for (auto i = _menu.Index(), count = 0u; i < _menu.IndexPlusOne() && i < _slotInfo.size(); i++, count++) {
- auto base_x = _menu.BaseX(count), base_y = _menu.BaseY(count);
+ for (auto i = _menu.index(), count = 0u; i < _menu.indexPlusOne() && i < _slotInfo.size(); i++, count++) {
+ auto base_x = _menu.baseX(count), base_y = _menu.baseY(count);
tdB[DATA_SAVENAME].draw(_slotInfo[i]._name, base_x, base_y);
tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
}
- if (_menu.HoverIndex() >= 0) {
- int i = _menu.HoverIndex();
+ if (_menu.hoverIndex() >= 0) {
+ int i = _menu.hoverIndex();
if (!_img._loaded || _prevHover != i) {
_img._loaded = true;
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index b943a852140..cc5c12a9e73 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -45,7 +45,7 @@ public:
void load(const Common::String &filename);
- bool handleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &event);
#if 0
bool handleEvents(const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 655eb1b9329..0fc2989e8ac 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -43,190 +43,190 @@ void OptionMenu::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("option");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("state", node)) {
- menu.load(node->first_node("state"));
+ _menu.load(node->first_node("state"));
- if (!menu.element.empty())
- menu.element[0].state(true);
+ if (!_menu._element.empty())
+ _menu._element[0].state(true);
}
if (nodeValid("keybind", node))
- keybind.load(node->first_node("keybind"));
+ _keybind.load(node->first_node("keybind"));
if (nodeValid("controller", node))
- conbind.load(node->first_node("controller"));
+ _conbind.load(node->first_node("controller"));
if (nodeValid("graphics", node))
- gfx.load(node->first_node("graphics"));
+ _gfx.load(node->first_node("graphics"));
if (nodeValid("general", node))
- general.load(node->first_node("general"));
+ _general.load(node->first_node("general"));
if (nodeValid("change", node)) {
rapidxml::xml_node<char> *chanode = node->first_node("change");
if (nodeValid("accept", chanode))
- accept.load(chanode->first_node("accept"));
+ _accept.load(chanode->first_node("accept"));
if (nodeValid("cancel", chanode))
- cancel.load(chanode->first_node("cancel"));
+ _cancel.load(chanode->first_node("cancel"));
if (nodeValid("message", chanode))
- notice_res.load(chanode->first_node("message"));
+ _noticeRes.load(chanode->first_node("message"));
if (nodeValid("width", chanode))
- prompt_w.load(chanode->first_node("width"));
+ _promptW.load(chanode->first_node("width"));
if (nodeValid("height", chanode))
- prompt_h.load(chanode->first_node("height"));
+ _promptH.load(chanode->first_node("height"));
if (nodeValid("countdown", chanode)) {
rapidxml::xml_node<char> *counode = chanode->first_node("countdown");
- countdown.load(counode);
- timer.load(counode, "time");
+ _countdown.load(counode);
+ _timer.load(counode, "time");
}
if (nodeValid("bg", chanode))
- questionbox.load(chanode->first_node("bg"));
+ _questionbox.load(chanode->first_node("bg"));
}
}
}
}
void OptionMenu::reset() {
- keybind.reset();
- state = STATE_GENERAL;
+ _keybind.reset();
+ _state = STATE_GENERAL;
- for (unsigned i = 0; i < menu.element.size(); ++i)
- menu.element[i].state(i == STATE_GENERAL);
+ for (unsigned i = 0; i < _menu._element.size(); ++i)
+ _menu._element[i].state(i == STATE_GENERAL);
}
void OptionMenu::draw(Button &back) {
- if (state < STATE_ENTER_W) {
- bg.draw();
+ if (_state < STATE_ENTER_W) {
+ _bg.draw();
- switch (state) {
+ switch (_state) {
case STATE_GENERAL:
- general.draw();
+ _general.draw();
break;
case STATE_GRAPHICS:
- gfx.draw();
+ _gfx.draw();
break;
case STATE_KEYBOARD:
- keybind.draw();
+ _keybind.draw();
break;
case STATE_CONTROLLER:
- conbind.draw();
+ _conbind.draw();
break;
default:
break;
}
- menu.draw();
+ _menu.draw();
back.draw();
} else {
- questionbox.draw();
+ _questionbox.draw();
- switch (state) {
+ switch (_state) {
case STATE_ENTER_W:
- prompt_w.draw();
+ _promptW.draw();
break;
case STATE_ENTER_H:
- prompt_h.draw();
+ _promptH.draw();
break;
case STATE_CONFIRM:
- notice_res.draw();
- countdown.draw(NumberToString(timer.RemainingTicks() / 1000));
+ _noticeRes.draw();
+ _countdown.draw(NumberToString(_timer.RemainingTicks() / 1000));
break;
default:
break;
}
- accept.draw();
- cancel.draw();
+ _accept.draw();
+ _cancel.draw();
}
}
-bool OptionMenu::handleEvents(Button &back, const Common::Event &Event) {
- if (state < STATE_ENTER_W) {
- bg.draw();
+bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
+ if (_state < STATE_ENTER_W) {
+ _bg.draw();
- switch (state) {
+ switch (_state) {
case STATE_GENERAL:
- general.handleEvents(Event);
+ _general.handleEvents(event);
break;
case STATE_KEYBOARD:
- keybind.handleEvents(Event);
+ _keybind.handleEvents(event);
break;
case STATE_GRAPHICS: {
- int result = gfx.handleEvents(Event);
+ int result = _gfx.handleEvents(event);
if (result == 1) {
- state = STATE_CONFIRM;
- timer.Start();
+ _state = STATE_CONFIRM;
+ _timer.Start();
g_engine->_screenSettings->SetResolution();
- gfx.SetInfo();
+ _gfx.SetInfo();
} else if (result == 2)
- state = STATE_ENTER_W;
+ _state = STATE_ENTER_W;
} break;
default:
break;
}
- return HandleTabs(back, Event);
+ return handleTabs(back, event);
} else {
- questionbox.draw();
+ _questionbox.draw();
- switch (state) {
+ switch (_state) {
case STATE_ENTER_W:
- if (prompt_w.handleEvents(Event, true) || accept.handleEvents(Event) == BUAC_LCLICK) {
- g_engine->_screenSettings->cur.w = StringToNumber<int>(prompt_w._text);
- state = STATE_ENTER_H;
- } else if (cancel.handleEvents(Event) == BUAC_LCLICK) {
+ if (_promptW.handleEvents(event, true) || _accept.handleEvents(event) == BUAC_LCLICK) {
+ g_engine->_screenSettings->cur.w = StringToNumber<int>(_promptW._text);
+ _state = STATE_ENTER_H;
+ } else if (_cancel.handleEvents(event) == BUAC_LCLICK) {
g_engine->_screenSettings->RestoreBackup();
- gfx.SetInfo();
- state = STATE_GRAPHICS;
+ _gfx.SetInfo();
+ _state = STATE_GRAPHICS;
}
break;
case STATE_ENTER_H:
- if (prompt_h.handleEvents(Event, true) || accept.handleEvents(Event) == BUAC_LCLICK) {
- g_engine->_screenSettings->cur.h = StringToNumber<int>(prompt_h._text);
- state = STATE_CONFIRM;
- timer.Start();
+ if (_promptH.handleEvents(event, true) || _accept.handleEvents(event) == BUAC_LCLICK) {
+ g_engine->_screenSettings->cur.h = StringToNumber<int>(_promptH._text);
+ _state = STATE_CONFIRM;
+ _timer.Start();
g_engine->_screenSettings->SetResolution();
- gfx.SetInfo();
- } else if (cancel.handleEvents(Event) == BUAC_LCLICK) {
+ _gfx.SetInfo();
+ } else if (_cancel.handleEvents(event) == BUAC_LCLICK) {
g_engine->_screenSettings->RestoreBackup();
- gfx.SetInfo();
- state = STATE_GRAPHICS;
+ _gfx.SetInfo();
+ _state = STATE_GRAPHICS;
}
break;
case STATE_CONFIRM:
- if (accept.handleEvents(Event)) {
- state = STATE_GRAPHICS;
- timer.Stop();
- } else if (cancel.handleEvents(Event)) {
+ if (_accept.handleEvents(event)) {
+ _state = STATE_GRAPHICS;
+ _timer.Stop();
+ } else if (_cancel.handleEvents(event)) {
g_engine->_screenSettings->RestoreBackup();
g_engine->_screenSettings->SetResolution();
- gfx.SetInfo();
- state = STATE_GRAPHICS;
+ _gfx.SetInfo();
+ _state = STATE_GRAPHICS;
}
break;
default:
break;
}
- accept.draw();
- cancel.draw();
+ _accept.draw();
+ _cancel.draw();
}
return false;
}
-bool OptionMenu::HandleTabs(Button &back, const Common::Event &Event) {
- warning("STUB: OptionMenu::HandleTabs()");
+bool OptionMenu::handleTabs(Button &back, const Common::Event &event) {
+ warning("STUB: OptionMenu::handleTabs()");
return false;
}
@@ -369,14 +369,14 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
void OptionMenu::internalEvents() {
// Since these states can be changed at any time, we just update it regularly
- gfx.internalEvents();
- general.internalEvents();
+ _gfx.internalEvents();
+ _general.internalEvents();
- if (state == STATE_CONFIRM && timer.TargetReached()) {
+ if (_state == STATE_CONFIRM && _timer.TargetReached()) {
g_engine->_screenSettings->RestoreBackup();
g_engine->_screenSettings->SetResolution();
- gfx.SetInfo();
- state = STATE_GRAPHICS;
+ _gfx.SetInfo();
+ _state = STATE_GRAPHICS;
}
}
@@ -415,25 +415,25 @@ void OptionMenu::saveState() {
}
void OptionMenu::setUI() {
- bg.setUI();
- menu.setUI();
+ _bg.setUI();
+ _menu.setUI();
- keybind.setUI();
- conbind.setUI();
+ _keybind.setUI();
+ _conbind.setUI();
- gfx.setUI();
- general.setUI();
+ _gfx.setUI();
+ _general.setUI();
- notice_res.setUI();
+ _noticeRes.setUI();
- countdown.setUI();
- questionbox.setUI();
+ _countdown.setUI();
+ _questionbox.setUI();
- prompt_w.setUI();
- prompt_h.setUI();
+ _promptW.setUI();
+ _promptH.setUI();
- accept.setUI();
- cancel.setUI();
+ _accept.setUI();
+ _cancel.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 5eb15c9e138..942a400a6bd 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -47,67 +47,71 @@ namespace pyrodactyl {
namespace ui {
class OptionMenu {
// What overall state the menu is in
- enum { STATE_GENERAL,
- STATE_GRAPHICS,
- STATE_KEYBOARD,
- STATE_CONTROLLER,
- STATE_ENTER_W,
- STATE_ENTER_H,
- STATE_CONFIRM } state;
+ enum {
+ STATE_GENERAL,
+ STATE_GRAPHICS,
+ STATE_KEYBOARD,
+ STATE_CONTROLLER,
+ STATE_ENTER_W,
+ STATE_ENTER_H,
+ STATE_CONFIRM
+ } _state;
// The overall menu for switching between states
// The second last button is save, the last button is cancel
- Menu<StateButton> menu;
+ Menu<StateButton> _menu;
// The background image
- ImageData bg;
+ ImageData _bg;
// The graphical settings menu
- GfxSettingMenu gfx;
+ GfxSettingMenu _gfx;
// The general settings menu
- GeneralSettingMenu general;
+ GeneralSettingMenu _general;
// Keyboard controls menu
- KeyBindMenu keybind;
+ KeyBindMenu _keybind;
// The controller controls are just drawn in a single image, no reassign options
- ImageData conbind;
+ ImageData _conbind;
// The UI for accepting/rejecting change in resolution
- HoverInfo notice_res;
- ImageData questionbox;
- Button accept, cancel;
+ HoverInfo _noticeRes;
+ ImageData _questionbox;
+ Button _accept, _cancel;
// If the user wants to input a custom resolution, these are used along with the question box
- TextArea prompt_w, prompt_h;
+ TextArea _promptW, _promptH;
// The countdown until the timer resets
- TextData countdown;
- Timer timer;
+ TextData _countdown;
+ Timer _timer;
// Function to draw the main menu (controls, settings, save, cancel)
- bool HandleTabs(Button &back, const Common::Event &Event);
+ bool handleTabs(Button &back, const Common::Event &event);
#if 0
bool HandleTabs(Button &back, const SDL_Event &Event);
#endif
public:
- bool loaded;
+ bool _loaded;
OptionMenu(void) {
- loaded = false;
- state = STATE_GENERAL;
- menu.UseKeyboard(true);
+ _loaded = false;
+ _state = STATE_GENERAL;
+ _menu.useKeyboard(true);
}
~OptionMenu(void) {}
void reset();
- bool DisableHotkeys() { return keybind.DisableHotkeys(); }
+ bool disableHotkeys() {
+ return _keybind.disableHotkeys();
+ }
void load(const Common::String &filename);
void draw(Button &back);
- bool handleEvents(Button &back, const Common::Event &Event);
+ bool handleEvents(Button &back, const Common::Event &event);
#if 0
bool handleEvents(Button &back, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 9facc782d36..456ef0c0cf7 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -38,48 +38,48 @@ using namespace pyrodactyl::ui;
void OptionSelect::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- option.data.load(node);
- prev.load(node->first_node("prev"));
- next.load(node->first_node("next"));
- cur = 0;
+ option._data.load(node);
+ _prev.load(node->first_node("prev"));
+ _next.load(node->first_node("next"));
+ _cur = 0;
- option.text.clear();
+ option._text.clear();
for (auto n = node->first_node("option"); n != NULL; n = n->next_sibling("option")) {
Common::String s;
loadStr(s, "name", n);
- option.text.push_back(s);
+ option._text.push_back(s);
}
- loadBool(usekeyboard, "keyboard", node, false);
+ loadBool(_usekeyboard, "keyboard", node, false);
}
}
void OptionSelect::draw() {
- option.draw(cur);
+ option.draw(_cur);
- if (cur > 0)
- prev.draw();
+ if (_cur > 0)
+ _prev.draw();
- if ((unsigned int)cur < option.text.size() - 1)
- next.draw();
+ if ((unsigned int)_cur < option._text.size() - 1)
+ _next.draw();
}
bool OptionSelect::handleEvents(const Common::Event &Event) {
using namespace pyrodactyl::input;
- if (cur > 0) {
+ if (_cur > 0) {
// Don't check for keyboard inputs for now
- if (prev.handleEvents(Event) == BUAC_LCLICK) {
- cur--;
+ if (_prev.handleEvents(Event) == BUAC_LCLICK) {
+ _cur--;
return true;
}
}
- if ((unsigned int)cur < option.text.size() - 1) {
+ if ((unsigned int)_cur < option._text.size() - 1) {
// Don't check for keyboard inputs for now
- if (next.handleEvents(Event) == BUAC_LCLICK) {
- cur++;
+ if (_next.handleEvents(Event) == BUAC_LCLICK) {
+ _cur++;
return true;
}
}
@@ -110,9 +110,9 @@ bool OptionSelect::handleEvents(const SDL_Event &Event) {
#endif
void OptionSelect::setUI() {
- option.data.setUI();
- prev.setUI();
- next.setUI();
+ option._data.setUI();
+ _prev.setUI();
+ _next.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index 62fd998c36c..eb674a3a969 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -40,26 +40,25 @@ namespace Crab {
namespace pyrodactyl {
namespace ui {
class OptionSelect {
- struct
- {
- Common::Array<Common::String> text;
- TextData data;
+ struct {
+ Common::Array<Common::String> _text;
+ TextData _data;
void draw(const int &index) {
- if (index >= 0 && (unsigned int)index < text.size())
- data.draw(text[index]);
+ if (index >= 0 && (unsigned int)index < _text.size())
+ _data.draw(_text[index]);
}
} option;
- Button prev, next;
- bool usekeyboard;
+ Button _prev, _next;
+ bool _usekeyboard;
public:
- int cur;
+ int _cur;
OptionSelect() {
- cur = 0;
- usekeyboard = false;
+ _cur = 0;
+ _usekeyboard = false;
}
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 8752536f61c..c0b22be33db 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -43,183 +43,206 @@ namespace ui {
template<typename T>
class PageMenu {
// The buttons for cycling between pages of the menu
- Button prev, next;
+ Button _prev, _next;
// Each page is stored separately in a menu object
- Common::Array<Menu<T> > menu;
+ Common::Array<Menu<T>> _menu;
// Keep track of which page we are at, and how many elements we keep in a page
- unsigned int current_page, elements_per_page, rows, cols;
+ unsigned int _currentPage, _elementsPerPage, _rows, _cols;
// The image used for the elements
- Button ref;
+ Button _ref;
// This vector stores the increments in x,y for each new button
- Vector2i inc;
+ Vector2i _inc;
// Display "Page 1 of 3" style information for the menu
- TextData status;
- Common::String info;
+ TextData _status;
+ Common::String _info;
public:
PageMenu() {
- current_page = 0;
- elements_per_page = 1;
- rows = 1;
- cols = 1;
- Clear();
+ _currentPage = 0;
+ _elementsPerPage = 1;
+ _rows = 1;
+ _cols = 1;
+ clear();
}
~PageMenu() {}
void reset() {
- for (auto m = menu.begin(); m != menu.end(); ++m)
+ for (auto m = _menu.begin(); m != _menu.end(); ++m)
m->reset();
}
- void Clear() {
- menu.resize(1);
- menu[0].Clear();
- menu[0].UseKeyboard(true);
+ void clear() {
+ _menu.resize(1);
+ _menu[0].clear();
+ _menu[0].useKeyboard(true);
}
// Get the elements per page
- unsigned int ElementsPerPage() { return elements_per_page; }
+ unsigned int elementsPerPage() {
+ return _elementsPerPage;
+ }
// This is added to the result from handleEvents to calculate the exact position
- unsigned int Index() { return current_page * elements_per_page; }
+ unsigned int index() {
+ return _currentPage * _elementsPerPage;
+ }
// The end position of the elements
- unsigned int IndexPlusOne() { return (current_page + 1) * elements_per_page; }
+ unsigned int indexPlusOne() {
+ return (_currentPage + 1) * _elementsPerPage;
+ }
// Get the current page of the menu
- unsigned int CurrentPage() { return current_page; }
- void CurrentPage(int &val) { current_page = val; }
+ unsigned int currentPage() {
+ return _currentPage;
+ }
+
+ void currentPage(int &val) {
+ _currentPage = val;
+ }
// Get the index of the hovered element in the menu
- int HoverIndex() {
- if (menu[current_page].HoverIndex() >= 0)
- return (current_page * elements_per_page) + menu[current_page].HoverIndex();
+ int hoverIndex() {
+ if (_menu[_currentPage].hoverIndex() >= 0)
+ return (_currentPage * _elementsPerPage) + _menu[_currentPage].hoverIndex();
return -1;
}
// Get the base position of the elements
- int BaseX(const int &count) { return ref.x + inc.x * (count % cols); }
- int BaseY(const int &count) { return ref.y + inc.y * (count / cols); }
+ int baseX(const int &count) {
+ return _ref.x + _inc.x * (count % _cols);
+ }
+
+ int baseY(const int &count) {
+ return _ref.y + _inc.y * (count / _cols);
+ }
// This is used to get the coordinates of a button
- const int &CurX(const int &count) { return menu[current_page].element[count].x; }
- const int &CurY(const int &count) { return menu[current_page].element[count].y; }
+ const int &curX(const int &count) {
+ return _menu[_currentPage]._element[count].x;
+ }
- void Image(const int &slot, const int &page, ButtonImage &bi) { menu[page].element[slot].img(bi); }
+ const int &curY(const int &count) {
+ return _menu[_currentPage]._element[count].y;
+ }
- void AssignPaths() {
- for (auto m = menu.begin(); m != menu.end(); ++m)
- m->AssignPaths();
+ void image(const int &slot, const int &page, ButtonImage &bi) {
+ _menu[page]._element[slot].img(bi);
}
- void UseKeyboard(const bool &val) {
- for (auto m = menu.begin(); m != menu.end(); ++m)
- m->UseKeyboard(val);
+ void assignPaths() {
+ for (auto m = _menu.begin(); m != _menu.end(); ++m)
+ m->assignPaths();
+ }
+
+ void useKeyboard(const bool &val) {
+ for (auto m = _menu.begin(); m != _menu.end(); ++m)
+ m->useKeyboard(val);
}
void setUI() {
- prev.setUI();
- next.setUI();
- ref.setUI();
- status.setUI();
+ _prev.setUI();
+ _next.setUI();
+ _ref.setUI();
+ _status.setUI();
- for (auto m = menu.begin(); m != menu.end(); ++m)
+ for (auto m = _menu.begin(); m != _menu.end(); ++m)
m->setUI();
}
- void UpdateInfo() {
- info = NumberToString(current_page + 1);
- info += " of ";
- info += NumberToString(menu.size());
+ void updateInfo() {
+ _info = NumberToString(_currentPage + 1);
+ _info += " of ";
+ _info += NumberToString(_menu.size());
}
void load(rapidxml::xml_node<char> *node) {
using namespace pyrodactyl::input;
if (nodeValid(node)) {
if (nodeValid("prev", node)) {
- prev.load(node->first_node("prev"));
- prev._hotkey.set(IU_PREV);
+ _prev.load(node->first_node("prev"));
+ _prev._hotkey.set(IU_PREV);
}
if (nodeValid("next", node)) {
- next.load(node->first_node("next"));
- next._hotkey.set(IU_NEXT);
+ _next.load(node->first_node("next"));
+ _next._hotkey.set(IU_NEXT);
}
if (nodeValid("reference", node))
- ref.load(node->first_node("reference"));
+ _ref.load(node->first_node("reference"));
if (nodeValid("inc", node))
- inc.load(node->first_node("inc"));
+ _inc.load(node->first_node("inc"));
if (nodeValid("status", node))
- status.load(node->first_node("status"));
+ _status.load(node->first_node("status"));
if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
- loadNum(rows, "rows", dimnode);
- loadNum(cols, "cols", dimnode);
- elements_per_page = rows * cols;
+ loadNum(_rows, "rows", dimnode);
+ loadNum(_cols, "cols", dimnode);
+ _elementsPerPage = _rows * _cols;
}
}
}
- void Add(unsigned int &slot, unsigned int &page) {
- if (slot >= elements_per_page) {
+ void add(unsigned int &slot, unsigned int &page) {
+ if (slot >= _elementsPerPage) {
++page;
slot = 0;
- menu.resize(page + 1);
- menu[page].UseKeyboard(true);
+ _menu.resize(page + 1);
+ _menu[page].useKeyboard(true);
}
T b;
- b.init(ref, inc.x * (slot % cols), inc.y * (slot / cols));
- menu[page].element.push_back(b);
+ b.init(_ref, _inc.x * (slot % _cols), _inc.y * (slot / _cols));
+ _menu[page]._element.push_back(b);
++slot;
- AssignPaths();
- UpdateInfo();
+ assignPaths();
+ updateInfo();
}
- void Add() {
- unsigned int page = menu.size() - 1;
- unsigned int slot = menu[page].element.size();
- Add(slot, page);
+ void add() {
+ unsigned int page = _menu.size() - 1;
+ unsigned int slot = _menu[page]._element.size();
+ add(slot, page);
}
- void Erase() {
- unsigned int page = menu.size() - 1;
- menu[page].element.pop_back();
- AssignPaths();
- UpdateInfo();
+ void erase() {
+ unsigned int page = _menu.size() - 1;
+ _menu[page]._element.pop_back();
+ assignPaths();
+ updateInfo();
}
int handleEvents(const Common::Event &Event) {
using namespace pyrodactyl::input;
- if (current_page > 0 && prev.handleEvents(Event) == BUAC_LCLICK) {
- current_page--;
- UpdateInfo();
+ if (_currentPage > 0 && _prev.handleEvents(Event) == BUAC_LCLICK) {
+ _currentPage--;
+ updateInfo();
- if ((int)current_page < 0)
- current_page = 0;
+ if ((int)_currentPage < 0)
+ _currentPage = 0;
}
- if (current_page < menu.size() - 1 && next.handleEvents(Event) == BUAC_LCLICK) {
- current_page++;
- UpdateInfo();
+ if (_currentPage < _menu.size() - 1 && _next.handleEvents(Event) == BUAC_LCLICK) {
+ _currentPage++;
+ updateInfo();
- if (current_page >= menu.size())
- current_page = menu.size() - 1;
+ if (_currentPage >= _menu.size())
+ _currentPage = _menu.size() - 1;
}
- return menu[current_page].handleEvents(Event);
+ return _menu[_currentPage].handleEvents(Event);
}
#if 0
@@ -247,14 +270,14 @@ public:
#endif
void draw() {
- status.draw(info);
- menu[current_page].draw();
+ _status.draw(_info);
+ _menu[_currentPage].draw();
- if (current_page > 0)
- prev.draw();
+ if (_currentPage > 0)
+ _prev.draw();
- if (current_page < menu.size() - 1)
- next.draw();
+ if (_currentPage < _menu.size() - 1)
+ _next.draw();
}
};
diff --git a/engines/crab/ui/ParagraphData.cpp b/engines/crab/ui/ParagraphData.cpp
index 65038fa515e..7665d05b47b 100644
--- a/engines/crab/ui/ParagraphData.cpp
+++ b/engines/crab/ui/ParagraphData.cpp
@@ -37,13 +37,13 @@ using namespace pyrodactyl::ui;
bool ParagraphData::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &echo) {
if (nodeValid("line", node))
- line.load(node->first_node("line"));
+ _line.load(node->first_node("line"));
return TextData::load(node, parent, echo);
}
-void ParagraphData::draw(const Common::String &val, const int &XOffset, const int &YOffset) {
- g_engine->_textManager->draw(x + XOffset, y + YOffset, val, _col, _font, _align, line.x, line.y);
+void ParagraphData::draw(const Common::String &val, const int &xOffset, const int &yOffset) {
+ g_engine->_textManager->draw(x + xOffset, y + yOffset, val, _col, _font, _align, _line.x, _line.y);
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ParagraphData.h b/engines/crab/ui/ParagraphData.h
index e04e5578d15..20eb82ca376 100644
--- a/engines/crab/ui/ParagraphData.h
+++ b/engines/crab/ui/ParagraphData.h
@@ -40,14 +40,14 @@ namespace pyrodactyl {
namespace ui {
class ParagraphData : public TextData {
public:
- Vector2i line;
+ Vector2i _line;
- ParagraphData() : line(1, 1) {}
+ ParagraphData() : _line(1, 1) {}
~ParagraphData() {}
bool load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
- void draw(const Common::String &val, const int &XOffset = 0, const int &YOffset = 0);
+ void draw(const Common::String &val, const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index 2ee2ff9eae3..ee4b73e7068 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -36,18 +36,18 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
void PauseMenu::load(rapidxml::xml_node<char> *node) {
- menu.load(node->first_node("menu"));
- save.load(node->first_node("save"));
+ _menu.load(node->first_node("menu"));
+ _save.load(node->first_node("save"));
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
}
bool PauseMenu::draw(Button &back) {
- switch (state) {
+ switch (_state) {
case STATE_NORMAL:
- bg.draw();
- menu.draw();
+ _bg.draw();
+ _menu.draw();
break;
case STATE_OPTION:
g_engine->_optionMenu->draw(back);
@@ -60,33 +60,33 @@ bool PauseMenu::draw(Button &back) {
}
PauseSignal PauseMenu::handleEvents(const Common::Event &Event, Button &back) {
- switch (state) {
+ switch (_state) {
case STATE_NORMAL:
- choice = menu.handleEvents(Event);
- if (choice == -1) {
+ _choice = _menu.handleEvents(Event);
+ if (_choice == -1) {
if (back._hotkey.handleEvents(Event))
return PS_RESUME;
} else {
- switch (choice) {
+ switch (_choice) {
case 0:
- state = STATE_NORMAL;
+ _state = STATE_NORMAL;
return PS_RESUME;
case 1:
if (g_engine->saveGameDialog()) {
- state = STATE_NORMAL;
+ _state = STATE_NORMAL;
return PS_SAVE;
} else
- state = STATE_NORMAL;
+ _state = STATE_NORMAL;
break;
case 2:
if (g_engine->loadGameDialog()) {
- state = STATE_NORMAL;
+ _state = STATE_NORMAL;
return PS_LOAD;
} else
- state = STATE_NORMAL;
+ _state = STATE_NORMAL;
break;
case 3:
- state = STATE_OPTION;
+ _state = STATE_OPTION;
break;
case 4:
return PS_HELP;
@@ -102,14 +102,14 @@ PauseSignal PauseMenu::handleEvents(const Common::Event &Event, Button &back) {
case STATE_OPTION:
if (g_engine->_optionMenu->handleEvents(back, Event)) {
g_engine->_optionMenu->reset();
- state = STATE_NORMAL;
+ _state = STATE_NORMAL;
}
break;
case STATE_LOAD:
if (g_engine->loadGameDialog())
return PS_LOAD;
else
- state = STATE_NORMAL;
+ _state = STATE_NORMAL;
break;
default:
break;
@@ -180,14 +180,14 @@ PauseSignal PauseMenu::handleEvents(const SDL_Event &Event, Button &back) {
}
#endif
-bool PauseMenu::DisableHotkeys() {
- return (state == STATE_SAVE && save.DisableHotkeys()) || (state == STATE_OPTION && g_engine->_optionMenu->DisableHotkeys());
+bool PauseMenu::disableHotkeys() {
+ return (_state == STATE_SAVE && _save.DisableHotkeys()) || (_state == STATE_OPTION && g_engine->_optionMenu->disableHotkeys());
}
void PauseMenu::setUI() {
- bg.setUI();
- menu.setUI();
- save.setUI();
+ _bg.setUI();
+ _menu.setUI();
+ _save.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 89ae536f264..caefa25ee25 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -45,42 +45,47 @@ namespace Crab {
namespace pyrodactyl {
namespace ui {
-enum PauseSignal { PS_NONE,
- PS_RESUME,
- PS_SAVE,
- PS_LOAD,
- PS_HELP,
- PS_QUIT_MENU,
- PS_QUIT_GAME };
+enum PauseSignal {
+ PS_NONE,
+ PS_RESUME,
+ PS_SAVE,
+ PS_LOAD,
+ PS_HELP,
+ PS_QUIT_MENU,
+ PS_QUIT_GAME
+};
class PauseMenu {
- enum PauseState { STATE_NORMAL,
- STATE_SAVE,
- STATE_OPTION,
- STATE_LOAD } state;
+ enum PauseState {
+ STATE_NORMAL,
+ STATE_SAVE,
+ STATE_OPTION,
+ STATE_LOAD
+ } _state;
// The pause menu background
- ImageData bg;
+ ImageData _bg;
// The buttons in the menu
- ButtonMenu menu;
+ ButtonMenu _menu;
// Save game menu
- GameSaveMenu save;
+ GameSaveMenu _save;
// The selected main menu button
- int choice;
+ int _choice;
public:
PauseMenu(void) {
- state = STATE_NORMAL;
- choice = -1;
+ _state = STATE_NORMAL;
+ _choice = -1;
}
+
~PauseMenu(void) {}
- void UpdateMode(const bool &ironman) {
- menu.element[PS_SAVE - 1]._visible = !ironman;
- menu.element[PS_LOAD - 1]._visible = !ironman;
+ void updateMode(const bool &ironman) {
+ _menu._element[PS_SAVE - 1]._visible = !ironman;
+ _menu._element[PS_LOAD - 1]._visible = !ironman;
}
void load(rapidxml::xml_node<char> *node);
@@ -93,14 +98,25 @@ public:
// Returns true if inside options menu, false otherwise
bool draw(Button &back);
- void reset() { state = STATE_NORMAL; }
- void ScanDir() { save.scanDir(); }
- Common::String SaveFile() { return save.selectedPath(); }
- bool DisableHotkeys();
+ void reset() {
+ _state = STATE_NORMAL;
+ }
+
+ void scanDir() {
+ _save.scanDir();
+ }
+
+ Common::String saveFile() {
+ return _save.selectedPath();
+ }
+
+ bool disableHotkeys();
// Should we allow the pause key(default escape) to quit to main menu?
// This is done because esc is both the "go back on menu level" and the pause key
- bool ShowLevel() { return state == STATE_NORMAL; }
+ bool showLevel() {
+ return _state == STATE_NORMAL;
+ }
void setUI();
};
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 46cc2253662..051bd568914 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -39,91 +39,91 @@ using namespace pyrodactyl::people;
void PersonHandler::load(rapidxml::xml_node<char> *node) {
if (nodeValid("dialog", node))
- dlbox.load(node->first_node("dialog"));
+ _dlbox.load(node->first_node("dialog"));
if (nodeValid("opinion", node)) {
rapidxml::xml_node<char> *opnode = node->first_node("opinion");
if (nodeValid("friendship", opnode))
- opinion[OPI_LIKE].load(opnode->first_node("friendship"));
+ _opinion[OPI_LIKE].load(opnode->first_node("friendship"));
if (nodeValid("respect", opnode))
- opinion[OPI_RESPECT].load(opnode->first_node("respect"));
+ _opinion[OPI_RESPECT].load(opnode->first_node("respect"));
if (nodeValid("fear", opnode))
- opinion[OPI_FEAR].load(opnode->first_node("fear"));
+ _opinion[OPI_FEAR].load(opnode->first_node("fear"));
}
if (nodeValid("image", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("image");
- img.load(imgnode);
+ _img.load(imgnode);
if (nodeValid("sprite_align", imgnode))
- sprite_align.load(imgnode->first_node("sprite_align"));
+ _spriteAlign.load(imgnode->first_node("sprite_align"));
}
if (nodeValid("name", node))
- name.load(node->first_node("name"));
+ _name.load(node->first_node("name"));
if (nodeValid("journal", node))
- jb.load(node->first_node("journal"));
+ _jb.load(node->first_node("journal"));
}
-void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
+void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *event, const Common::String &personId,
const bool &player, pyrodactyl::anim::Sprite *s) {
// Draw the dialog box background
- dlbox.draw(player);
+ _dlbox.draw(player);
if (s != NULL) {
- Rect r = s->dialogClip(Event->_state);
- int x = img.x, y = img.y;
+ Rect r = s->dialogClip(event->_state);
+ int x = _img.x, y = _img.y;
- if (sprite_align.x == ALIGN_CENTER)
+ if (_spriteAlign._x == ALIGN_CENTER)
x -= r.w / 2;
- else if (sprite_align.x == ALIGN_RIGHT)
+ else if (_spriteAlign._x == ALIGN_RIGHT)
x -= r.w;
- if (sprite_align.y == ALIGN_CENTER)
+ if (_spriteAlign._y == ALIGN_CENTER)
y -= r.h / 2;
- else if (sprite_align.y == ALIGN_RIGHT)
+ else if (_spriteAlign._y == ALIGN_RIGHT)
y -= r.h;
g_engine->_imageManager->draw(x, y, s->img(), &r);
}
- if (info.personValid(person_id)) {
- name.draw(info.personGet(person_id)._name);
+ if (info.personValid(personId)) {
+ _name.draw(info.personGet(personId)._name);
if (!player) {
- opinion[OPI_LIKE].draw(info.personGet(person_id)._opinion._val[OPI_LIKE], OPINION_MAX);
- opinion[OPI_RESPECT].draw(info.personGet(person_id)._opinion._val[OPI_RESPECT], OPINION_MAX);
- opinion[OPI_FEAR].draw(info.personGet(person_id)._opinion._val[OPI_FEAR], OPINION_MAX);
+ _opinion[OPI_LIKE].draw(info.personGet(personId)._opinion._val[OPI_LIKE], OPINION_MAX);
+ _opinion[OPI_RESPECT].draw(info.personGet(personId)._opinion._val[OPI_RESPECT], OPINION_MAX);
+ _opinion[OPI_FEAR].draw(info.personGet(personId)._opinion._val[OPI_FEAR], OPINION_MAX);
}
}
// Draw the journal button
- jb.draw();
+ _jb.draw();
// Draw the dialog box text
- dlbox.draw(info, Event->_dialog);
+ _dlbox.draw(info, event->_dialog);
}
-bool PersonHandler::HandleCommonEvents(const Common::Event &Event) {
- opinion[OPI_LIKE].handleEvents(Event);
- opinion[OPI_RESPECT].handleEvents(Event);
- opinion[OPI_FEAR].handleEvents(Event);
+bool PersonHandler::handleCommonEvents(const Common::Event &event) {
+ _opinion[OPI_LIKE].handleEvents(event);
+ _opinion[OPI_RESPECT].handleEvents(event);
+ _opinion[OPI_FEAR].handleEvents(event);
- if (jb.handleEvents(Event) == BUAC_LCLICK) {
+ if (_jb.handleEvents(event) == BUAC_LCLICK) {
// User wants to open their journal
- show_journal = true;
+ _showJournal = true;
return true;
}
return false;
}
-bool PersonHandler::HandleDlboxEvents(const Common::Event &Event) {
- return dlbox.handleEvents(Event);
+bool PersonHandler::handleDlboxEvents(const Common::Event &event) {
+ return _dlbox.handleEvents(event);
}
#if 0
@@ -151,7 +151,7 @@ void PersonHandler::internalEvents(const pyrodactyl::people::PersonState &state,
s->dialogUpdateClip(state);
}
-void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const Common::String &id, const pyrodactyl::people::OpinionType &type, const int &val) {
+void PersonHandler::opinionChange(pyrodactyl::event::Info &info, const Common::String &id, const pyrodactyl::people::OpinionType &type, const int &val) {
if (info.personValid(id)) {
// First, get the value of the object's opinion
int old = 0;
@@ -165,29 +165,29 @@ void PersonHandler::OpinionChange(pyrodactyl::event::Info &info, const Common::S
info.opinionGet(id, type, value);
// Now, send the new and old value of the object's opinion for drawing the change effect
- opinion[type].Effect(value, old);
+ _opinion[type].Effect(value, old);
- prev = id;
+ _prev = id;
}
}
void PersonHandler::reset(const Common::String &id) {
- if (prev != id) {
+ if (_prev != id) {
using namespace pyrodactyl::people;
- opinion[OPI_LIKE].reset();
- opinion[OPI_RESPECT].reset();
- opinion[OPI_FEAR].reset();
+ _opinion[OPI_LIKE].reset();
+ _opinion[OPI_RESPECT].reset();
+ _opinion[OPI_FEAR].reset();
}
}
void PersonHandler::setUI() {
- img.setUI();
- name.setUI();
- dlbox.setUI();
- jb.setUI();
+ _img.setUI();
+ _name.setUI();
+ _dlbox.setUI();
+ _jb.setUI();
for (auto i = 0; i < pyrodactyl::people::OPI_TOTAL; ++i)
- opinion[i].setUI();
+ _opinion[i].setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index 1f11d4d612f..dd219031e91 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -46,43 +46,46 @@ namespace ui {
class PersonHandler {
// The positions of various elements
// img = player image position
- Element img;
+ Element _img;
// How the individual sprite clips are drawn
struct ImageAnchor {
- Align x, y;
+ Align _x, _y;
ImageAnchor() {
- x = ALIGN_CENTER;
- y = ALIGN_RIGHT;
+ _x = ALIGN_CENTER;
+ _y = ALIGN_RIGHT;
}
void load(rapidxml::xml_node<char> *node, const bool &echo = true) {
- loadAlign(x, node, echo, "align_x");
- loadAlign(y, node, echo, "align_y");
+ loadAlign(_x, node, echo, "align_x");
+ loadAlign(_y, node, echo, "align_y");
}
- } sprite_align;
+ } _spriteAlign;
// For drawing the name
- TextData name;
+ TextData _name;
// The dialog box used to draw dialog
- pyrodactyl::ui::GameDialogBox dlbox;
+ pyrodactyl::ui::GameDialogBox _dlbox;
// The three opinion bars
- pyrodactyl::ui::ProgressBar opinion[pyrodactyl::people::OPI_TOTAL];
+ pyrodactyl::ui::ProgressBar _opinion[pyrodactyl::people::OPI_TOTAL];
// The button for selecting the journal
- Button jb;
+ Button _jb;
// The person id of the changed opinion, we use this to reset bar
- Common::String prev;
+ Common::String _prev;
public:
// Used by other objects to see if journal needs to be displayed or not
- bool show_journal;
+ bool _showJournal;
+
+ PersonHandler() {
+ _showJournal = false;
+ }
- PersonHandler() { show_journal = false; }
~PersonHandler() {}
void reset(const Common::String &id);
@@ -90,10 +93,10 @@ public:
void load(rapidxml::xml_node<char> *node);
// Handle events for the three opinion bars and journal - used in both dialog box and reply events
- bool HandleCommonEvents(const Common::Event &Event);
+ bool handleCommonEvents(const Common::Event &event);
// Handle events for the dialog box
- bool HandleDlboxEvents(const Common::Event &Event);
+ bool handleDlboxEvents(const Common::Event &event);
#if 0
bool HandleCommonEvents(const SDL_Event &Event);
@@ -102,10 +105,10 @@ public:
void internalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s);
- void draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *Event, const Common::String &person_id,
+ void draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *event, const Common::String &personId,
const bool &player, pyrodactyl::anim::Sprite *s = nullptr);
- void OpinionChange(pyrodactyl::event::Info &info, const Common::String &id,
+ void opinionChange(pyrodactyl::event::Info &info, const Common::String &id,
const pyrodactyl::people::OpinionType &type, const int &val);
void setUI();
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index d868e38f2a4..dcbcd108413 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -43,25 +43,25 @@ void PersonScreen::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("character");
if (nodeValid(node)) {
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("name", node))
- name.load(node->first_node("name"));
+ _name.load(node->first_node("name"));
if (nodeValid("img", node))
- img.load(node->first_node("img"));
+ _img.load(node->first_node("img"));
if (nodeValid("menu", node))
- menu.load(node->first_node("menu"));
+ _menu.load(node->first_node("menu"));
}
}
}
-void PersonScreen::handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event) {
+void PersonScreen::handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &event) {
if (info.personValid(id))
- menu.handleEvents(&info.personGet(id), Event);
+ _menu.handleEvents(&info.personGet(id), event);
else
- menu.handleEvents(nullptr, Event);
+ _menu.handleEvents(nullptr, event);
}
#if 0
@@ -74,39 +74,39 @@ void PersonScreen::handleEvents(pyrodactyl::event::Info &info, const Common::Str
#endif
void PersonScreen::internalEvents() {
- if (cur_sp != nullptr)
- cur_sp->dialogUpdateClip(PST_NORMAL);
+ if (_curSp != nullptr)
+ _curSp->dialogUpdateClip(PST_NORMAL);
}
void PersonScreen::draw(pyrodactyl::event::Info &info, const Common::String &id) {
- bg.draw();
+ _bg.draw();
if (info.personValid(id)) {
- name.draw(info.personGet(id)._name);
- menu.draw(&info.personGet(id));
+ _name.draw(info.personGet(id)._name);
+ _menu.draw(&info.personGet(id));
} else
- menu.draw(nullptr);
+ _menu.draw(nullptr);
- if (cur_sp != nullptr) {
- Rect clip = cur_sp->dialogClip(PST_NORMAL);
- g_engine->_imageManager->draw(img.x, img.y, cur_sp->img(), &clip);
+ if (_curSp != nullptr) {
+ Rect clip = _curSp->dialogClip(PST_NORMAL);
+ g_engine->_imageManager->draw(_img.x, _img.y, _curSp->img(), &clip);
}
}
void PersonScreen::Cache(Info &info, const Common::String &id, pyrodactyl::level::Level &level) {
- cur_sp = level.getSprite(id);
+ _curSp = level.getSprite(id);
if (info.personValid(id))
- menu.Cache(info.personGet(id));
+ _menu.Cache(info.personGet(id));
else
- menu.Clear();
+ _menu.Clear();
}
void PersonScreen::setUI() {
- bg.setUI();
- name.setUI();
- img.setUI();
- menu.setUI();
+ _bg.setUI();
+ _name.setUI();
+ _img.setUI();
+ _menu.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 39483f1a0c6..73c3fb4132d 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -46,28 +46,31 @@ namespace pyrodactyl {
namespace ui {
class PersonScreen {
// The background
- ImageData bg;
+ ImageData _bg;
// The name of the character
- TextData name;
+ TextData _name;
// The place where the sprite should be drawn
- Element img;
+ Element _img;
// The buttons for drawing traits
- TraitMenu menu;
+ TraitMenu _menu;
// Store the current person sprite temporarily
- pyrodactyl::anim::Sprite *cur_sp;
+ pyrodactyl::anim::Sprite *_curSp;
public:
- PersonScreen() { cur_sp = nullptr; }
+ PersonScreen() {
+ _curSp = nullptr;
+ }
+
~PersonScreen() {}
void load(const Common::String &filename);
void Cache(pyrodactyl::event::Info &info, const Common::String &id, pyrodactyl::level::Level &level);
- void handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &event);
#if 0
void handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index d516760a5cc..2b26c868a10 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -77,7 +77,7 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
// Start from line 0, page 0 and scan the list of entries
for (unsigned int i = 0, line_count = 0; i < q._text.size(); ++i) {
// Increment the number of lines by one text entry
- line_count += (q._text[i].size() / line.x) + 1;
+ line_count += (q._text[i].size() / _line.x) + 1;
// If we go over the quota for lines per page, go to next page and reset line counter to 0
if (line_count > lines_per_page) {
@@ -126,12 +126,12 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
// Draw first entry in selected color, and older quest entries in standard color
if (i == 0)
- g_engine->_textManager->draw(x, y, q._text[i], col_s, _font, _align, line.x, line.y);
+ g_engine->_textManager->draw(x, y, q._text[i], col_s, _font, _align, _line.x, _line.y);
else
ParagraphData::draw(q._text[i], inc.x * count, inc.y * count);
// Count is reduced extra by the amount of lines it takes for the message to be drawn
- count += (q._text[i].size() / line.x) + 1;
+ count += (q._text[i].size() / _line.x) + 1;
}
}
}
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index 9012367c7b5..f961f93af32 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -68,8 +68,8 @@ public:
if (result >= 0) {
select = result;
- for (int i = 0; i < (int)element.size(); ++i)
- element[i]._state = (i == result);
+ for (int i = 0; i < (int)_element.size(); ++i)
+ _element[i]._state = (i == result);
}
return result;
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 38b5879571d..e68dcbc93c7 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -51,7 +51,7 @@ void ReplyMenu::load(const Common::String &filename) {
if (nodeValid("reply", node)) {
rapidxml::xml_node<char> *replynode = node->first_node("reply");
Menu<ReplyButton>::load(replynode->first_node("menu"));
- tone._value.resize(element.size());
+ tone._value.resize(_element.size());
bg.load(replynode->first_node("bg"));
loadNum(spacing, "spacing", replynode);
@@ -67,12 +67,12 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
bool play_sound = false;
// Loop through any opinion changes required
- for (auto &i : dat._reply[element[choice]._index]._change) {
+ for (auto &i : dat._reply[_element[choice]._index]._change) {
if (i._id == cur_id) {
// This is a special case because we also need to update the opinion bars
- oh.OpinionChange(info, i._id, OPI_LIKE, i._val[OPI_LIKE]);
- oh.OpinionChange(info, i._id, OPI_RESPECT, i._val[OPI_RESPECT]);
- oh.OpinionChange(info, i._id, OPI_FEAR, i._val[OPI_FEAR]);
+ oh.opinionChange(info, i._id, OPI_LIKE, i._val[OPI_LIKE]);
+ oh.opinionChange(info, i._id, OPI_RESPECT, i._val[OPI_RESPECT]);
+ oh.opinionChange(info, i._id, OPI_FEAR, i._val[OPI_FEAR]);
play_sound = true;
} else {
info.opinionChange(i._id, OPI_LIKE, i._val[OPI_LIKE]);
@@ -94,7 +94,7 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
}
#endif
- return dat._reply[element[choice]._index]._nextid;
+ return dat._reply[_element[choice]._index]._nextid;
}
return -1;
@@ -140,7 +140,7 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
void ReplyMenu::draw() {
bg.draw();
- tone.draw(hover_index);
+ tone.draw(_hoverIndex);
// Draw the reply options
Menu<ReplyButton>::draw();
@@ -153,8 +153,8 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
for (auto i = dat._reply.begin(); i != dat._reply.end() && reply_count < dat._reply.size(); ++i, ++reply_count) {
if (i->_unlock.evaluate(info)) {
- element[element_count]._visible = true;
- element[element_count]._index = reply_count;
+ _element[element_count]._visible = true;
+ _element[element_count]._index = reply_count;
tone._value[element_count] = dat._reply[reply_count]._tone;
@@ -164,9 +164,9 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
info.insertName(text);
if (element_count == 0)
- element[element_count].Cache(text, spacing, 0, &bg);
+ _element[element_count].Cache(text, spacing, 0, &bg);
else
- element[element_count].Cache(text, spacing, element[element_count - 1].y + element[element_count - 1].h, &bg);
+ _element[element_count].Cache(text, spacing, _element[element_count - 1].y + _element[element_count - 1].h, &bg);
// Increment the element count only if the reply is unlocked
// This means we will keep checking against element 0 until we find an unlocked reply
@@ -176,8 +176,8 @@ void ReplyMenu::Cache(Info &info, ConversationData &dat) {
}
// Unused element buttons are hidden
- for (; element_count < element.size(); element_count++)
- element[element_count]._visible = false;
+ for (; element_count < _element.size(); element_count++)
+ _element[element_count]._visible = false;
}
void ReplyMenu::setUI() {
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index d54657865c7..7e0fed51c26 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -68,15 +68,15 @@ void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
b._caption._text = NumberToString(d.w);
b._caption._text += " x ";
b._caption._text += NumberToString(d.h);
- element.push_back(b);
+ _element.push_back(b);
}
}
}
SetInfo();
- loadBool(use_keyboard, "keyboard", node, false);
- AssignPaths();
+ loadBool(_useKeyboard, "keyboard", node, false);
+ assignPaths();
}
void ResolutionMenu::draw() {
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 1f78dc70a50..8bdc8b36d70 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -44,7 +44,7 @@ void GameSaveMenu::load(rapidxml::xml_node<char> *node) {
void GameSaveMenu::AddButton(const Common::String &p, unsigned int &slot_index, unsigned int &menu_index) {
_slotInfo.push_back(SaveFileData(p));
- _menu.Add(slot_index, menu_index);
+ _menu.add(slot_index, menu_index);
}
void GameSaveMenu::scanDir() {
@@ -53,7 +53,7 @@ void GameSaveMenu::scanDir() {
Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
_slotInfo.clear();
- _menu.Clear();
+ _menu.clear();
unsigned int count_slot = 0, count_menu = 0;
@@ -64,7 +64,7 @@ void GameSaveMenu::scanDir() {
AddButton(save, count_menu, count_slot);
}
- _menu.AssignPaths();
+ _menu.assignPaths();
}
bool GameSaveMenu::handleEvents(const Common::Event &Event) {
@@ -73,10 +73,10 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
case STATE_NORMAL:
choice = _menu.handleEvents(Event);
if (choice >= 0) {
- ta_name.x = _menu.CurX(choice) + tdB[DATA_SAVENAME].x;
- ta_name.y = _menu.CurY(choice) + tdB[DATA_SAVENAME].y;
+ ta_name.x = _menu.curX(choice) + tdB[DATA_SAVENAME].x;
+ ta_name.y = _menu.curY(choice) + tdB[DATA_SAVENAME].y;
- index = _menu.Index() + choice;
+ index = _menu.index() + choice;
if (index != 0)
ta_name._text = _slotInfo[index]._name;
@@ -115,8 +115,8 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
void GameSaveMenu::draw() {
_bg.draw();
_menu.draw();
- for (auto i = _menu.Index(), count = 0u; i < _menu.IndexPlusOne() && i < _slotInfo.size(); i++, count++) {
- float base_x = _menu.BaseX(count), base_y = _menu.BaseY(count);
+ for (auto i = _menu.index(), count = 0u; i < _menu.indexPlusOne() && i < _slotInfo.size(); i++, count++) {
+ float base_x = _menu.baseX(count), base_y = _menu.baseY(count);
tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
if (i == (unsigned int)index && state == STATE_NAME)
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 4cb7838b994..d992a902b38 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -55,42 +55,42 @@ void TraitMenu::load(rapidxml::xml_node<char> *node) {
for (unsigned int i = 0; i < size; ++i) {
TraitButton b;
b.init(ref, inc.x * (i % cols), inc.y * (i / cols));
- menu.element.push_back(b);
+ menu._element.push_back(b);
}
bool usekey = false;
loadBool(usekey, "keyboard", node);
- menu.UseKeyboard(usekey);
+ menu.useKeyboard(usekey);
- menu.AssignPaths();
+ menu.assignPaths();
}
void TraitMenu::draw(const pyrodactyl::people::Person *obj) {
if (obj != nullptr) {
- auto i = menu.element.begin();
- for (auto t = obj->_trait.begin(); t != obj->_trait.end() && i != menu.element.end(); ++t, ++i) {
+ auto i = menu._element.begin();
+ for (auto t = obj->_trait.begin(); t != obj->_trait.end() && i != menu._element.end(); ++t, ++i) {
i->draw();
if (t->_unread)
g_engine->_imageManager->notifyDraw(i->x + i->w, i->y);
}
- for (; i != menu.element.end(); ++i)
+ for (; i != menu._element.end(); ++i)
i->draw();
if (select > -1 && (unsigned int)select < obj->_trait.size())
desc.draw(obj->_trait[select]._desc);
} else
- for (auto &i : menu.element)
+ for (auto &i : menu._element)
i.draw();
}
void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event) {
int choice = menu.handleEvents(Event);
if (choice >= 0) {
- for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
+ for (auto i = menu._element.begin(); i != menu._element.end(); ++i)
i->state(false);
- menu.element[choice].state(true);
+ menu._element[choice].state(true);
select = choice;
if (obj != nullptr) {
@@ -119,17 +119,17 @@ void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const SDL_Event &E
#endif
void TraitMenu::Cache(const pyrodactyl::people::Person &obj) {
- auto e = menu.element.begin();
+ auto e = menu._element.begin();
- for (auto i = obj._trait.begin(); i != obj._trait.end() && e != menu.element.end(); ++i, ++e)
+ for (auto i = obj._trait.begin(); i != obj._trait.end() && e != menu._element.end(); ++i, ++e)
e->cache(*i);
- for (; e != menu.element.end(); ++e)
+ for (; e != menu._element.end(); ++e)
e->empty();
}
void TraitMenu::Clear() {
- for (auto e = menu.element.begin(); e != menu.element.end(); ++e)
+ for (auto e = menu._element.begin(); e != menu._element.end(); ++e)
e->empty();
}
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index de3b3d1be01..e94ce4c7300 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -75,7 +75,7 @@ void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
}
// Create a copy of all the tooltips
- for (auto i = _menu.element.begin(); i != _menu.element.end(); ++i)
+ for (auto i = _menu._element.begin(); i != _menu._element.end(); ++i)
_tooltip.push_back(i->_tooltip._text);
setTooltip();
@@ -87,29 +87,29 @@ void HUD::draw(pyrodactyl::event::Info &info, const Common::String &id) {
_menu.draw();
if (info._unread._journal) {
- g_engine->_imageManager->draw(_menu.element[HS_JOURNAL].x + _menu.element[HS_JOURNAL].w - _clip.w / 2,
- _menu.element[HS_JOURNAL].y - _clip.h / 2, _notifyAnim, &_clip);
+ g_engine->_imageManager->draw(_menu._element[HS_JOURNAL].x + _menu._element[HS_JOURNAL].w - _clip.w / 2,
+ _menu._element[HS_JOURNAL].y - _clip.h / 2, _notifyAnim, &_clip);
}
if (info._unread._inventory) {
- g_engine->_imageManager->draw(_menu.element[HS_INV].x + _menu.element[HS_INV].w - _clip.w / 2,
- _menu.element[HS_INV].y - _clip.h / 2, _notifyAnim, &_clip);
+ g_engine->_imageManager->draw(_menu._element[HS_INV].x + _menu._element[HS_INV].w - _clip.w / 2,
+ _menu._element[HS_INV].y - _clip.h / 2, _notifyAnim, &_clip);
}
if (info._unread._trait) {
- g_engine->_imageManager->draw(_menu.element[HS_CHAR].x + _menu.element[HS_CHAR].w - _clip.w / 2,
- _menu.element[HS_CHAR].y - _clip.h / 2, _notifyAnim, &_clip);
+ g_engine->_imageManager->draw(_menu._element[HS_CHAR].x + _menu._element[HS_CHAR].w - _clip.w / 2,
+ _menu._element[HS_CHAR].y - _clip.h / 2, _notifyAnim, &_clip);
}
if (info._unread._map) {
- g_engine->_imageManager->draw(_menu.element[HS_MAP].x + _menu.element[HS_MAP].w - _clip.w / 2,
- _menu.element[HS_MAP].y - _clip.h / 2, _notifyAnim, &_clip);
+ g_engine->_imageManager->draw(_menu._element[HS_MAP].x + _menu._element[HS_MAP].w - _clip.w / 2,
+ _menu._element[HS_MAP].y - _clip.h / 2, _notifyAnim, &_clip);
}
//#endif
}
void HUD::internalEvents(bool showMap) {
- _menu.element[HS_MAP]._visible = showMap;
+ _menu._element[HS_MAP]._visible = showMap;
if (_timer.TargetReached()) {
_clip.x += _clip.w;
@@ -159,16 +159,16 @@ HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Even
void HUD::State(const int &val) {
int count = 0;
- for (auto i = _menu.element.begin(); i != _menu.element.end(); ++i, ++count)
+ for (auto i = _menu._element.begin(); i != _menu._element.end(); ++i, ++count)
i->state(val == count);
}
void HUD::setTooltip() {
unsigned int count = 0;
- for (auto i = _menu.element.begin(); i != _menu.element.end() && count < _tooltip.size(); ++i, ++count)
+ for (auto i = _menu._element.begin(); i != _menu._element.end() && count < _tooltip.size(); ++i, ++count)
i->_tooltip._text = _tooltip[count] + " (" + i->_hotkey.name() + ")";
- _menu.element[HS_PAUSE]._tooltip._text = _tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->getAssociatedKey(IG_PAUSE) + ")";
+ _menu._element[HS_PAUSE]._tooltip._text = _tooltip[HS_PAUSE] + " (" + g_engine->_inputManager->getAssociatedKey(IG_PAUSE) + ")";
}
void HUD::setUI() {
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 823d4657990..49bcdf3d339 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -97,7 +97,7 @@ public:
void internalEvents(bool showMap);
void playerImg(const StateButtonImage &img) {
- _menu.element[HS_CHAR].img(img);
+ _menu._element[HS_CHAR].img(img);
}
void State(const int &val);
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 5b05821fd5c..d4dfb273a48 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -56,7 +56,7 @@ void Journal::load(const Common::String &filename) {
if (nodeValid("quest_list", node))
_ref.load(node->first_node("quest_list"));
- _category.UseKeyboard(true);
+ _category.useKeyboard(true);
}
}
}
@@ -89,10 +89,10 @@ void Journal::init(const Common::String &id) {
// Purpose: Select a category
//------------------------------------------------------------------------
void Journal::select(const Common::String &id, const int &choice) {
- for (unsigned int i = 0; i < _category.element.size(); ++i)
- _category.element[i].state(false);
+ for (unsigned int i = 0; i < _category._element.size(); ++i)
+ _category._element[i].state(false);
- _category.element[choice].state(true);
+ _category._element[choice].state(true);
_select = choice;
// Always find valid journal group first
@@ -114,7 +114,7 @@ void Journal::draw(const Common::String &id) {
for (auto &jo : _journal)
if (jo._id == id) {
int count = 0;
- for (auto i = _category.element.begin(); i != _category.element.end() && count < JE_TOTAL; ++i, ++count)
+ for (auto i = _category._element.begin(); i != _category._element.end() && count < JE_TOTAL; ++i, ++count)
if (jo._menu[count].unread)
g_engine->_imageManager->notifyDraw(i->x + i->w, i->y);
@@ -130,7 +130,7 @@ void Journal::draw(const Common::String &id) {
//------------------------------------------------------------------------
bool Journal::handleEvents(const Common::String &id, const Common::Event &event) {
int choice = _category.handleEvents(event);
- if (choice >= 0 && (unsigned int)choice < _category.element.size())
+ if (choice >= 0 && (unsigned int)choice < _category._element.size())
select(id, choice);
// Check if select is valid
@@ -238,7 +238,7 @@ void Journal::open(const Common::String &id, const JournalCategory &category, co
// Always find valid journal group first
for (auto &jo : _journal)
if (jo._id == id) {
- if (category >= 0 && category < _category.element.size()) {
+ if (category >= 0 && category < _category._element.size()) {
// If category passes the valid check, select it
select(id, category);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 525f4091f4a..29c93151fb9 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -47,43 +47,43 @@ void Map::load(const Common::String &filename, pyrodactyl::event::Info &info) {
if (nodeValid(node)) {
if (nodeValid("img", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("img");
- loadNum(speed, "speed", imgnode);
+ loadNum(_speed, "speed", imgnode);
for (auto n = imgnode->first_node("map"); n != NULL; n = n->next_sibling("map"))
- map.push_back(n);
+ _map.push_back(n);
}
if (nodeValid("fg", node))
- fg.load(node->first_node("fg"));
+ _fg.load(node->first_node("fg"));
if (nodeValid("dim", node)) {
- loadNum(camera.w, "x", node->first_node("dim"));
- loadNum(camera.h, "y", node->first_node("dim"));
+ loadNum(_camera.w, "x", node->first_node("dim"));
+ loadNum(_camera.h, "y", node->first_node("dim"));
}
if (nodeValid("pos", node))
- pos.load(node->first_node("pos"));
+ _pos.load(node->first_node("pos"));
if (nodeValid("scroll", node))
- scroll.load(node->first_node("scroll"));
+ _scroll.load(node->first_node("scroll"));
if (nodeValid("marker", node))
- marker.load(node->first_node("marker"));
+ _marker.load(node->first_node("marker"));
if (nodeValid("title", node))
- title.load(node->first_node("title"));
+ _title.load(node->first_node("title"));
if (nodeValid("locations", node))
- travel.load(node->first_node("locations"));
+ _travel.load(node->first_node("locations"));
if (nodeValid("overlay", node))
- bu_overlay.load(node->first_node("overlay"));
+ _buOverlay.load(node->first_node("overlay"));
}
}
- SetImage(cur, true);
- Update(info);
- CalcBounds();
+ setImage(_cur, true);
+ update(info);
+ calcBounds();
}
//------------------------------------------------------------------------
@@ -92,118 +92,118 @@ void Map::load(const Common::String &filename, pyrodactyl::event::Info &info) {
void Map::draw(pyrodactyl::event::Info &info) {
// The map graphic is clipped to fit inside the UI
- img_bg.draw(pos.x, pos.y, &camera);
+ _imgBg.draw(_pos.x, _pos.y, &_camera);
- if (overlay) {
+ if (_overlay) {
// The overlay needs to be clipped as well, so we must find the intersection of the camera and the clip itself
- for (auto &i : map[cur].reveal) {
+ for (auto &i : _map[_cur]._reveal) {
Rect r = i;
- int X = pos.x + i.x - camera.x, Y = pos.y + i.y - camera.y;
+ int X = _pos.x + i.x - _camera.x, Y = _pos.y + i.y - _camera.y;
// Do not draw any area of the clip that is outside the camera bounds
// If we're outside the left edges, we need to cull the left point
- if (X < pos.x) {
- X += camera.x - i.x;
- r.x += camera.x - i.x;
- r.w -= camera.x - i.x;
+ if (X < _pos.x) {
+ X += _camera.x - i.x;
+ r.x += _camera.x - i.x;
+ r.w -= _camera.x - i.x;
if (r.w < 0)
r.w = 0;
}
- if (Y < pos.y) {
- Y += camera.y - i.y;
- r.y += camera.y - i.y;
- r.h -= camera.y - i.y;
+ if (Y < _pos.y) {
+ Y += _camera.y - i.y;
+ r.y += _camera.y - i.y;
+ r.h -= _camera.y - i.y;
if (r.h < 0)
r.h = 0;
}
// If we're outside the right edge, we need to cull the width and height
- if (X + r.w > pos.x + camera.w)
- r.w = pos.x + camera.w - X;
- if (Y + r.h > pos.y + camera.h)
- r.h = pos.y + camera.h - Y;
+ if (X + r.w > _pos.x + _camera.w)
+ r.w = _pos.x + _camera.w - X;
+ if (Y + r.h > _pos.y + _camera.h)
+ r.h = _pos.y + _camera.h - Y;
- img_overlay.draw(X, Y, &r);
+ _imgOverlay.draw(X, Y, &r);
}
}
- travel.draw(camera.x - pos.x, camera.y - pos.y);
+ _travel.draw(_camera.x - _pos.x, _camera.y - _pos.y);
- fg.draw();
- bu_overlay.draw();
+ _fg.draw();
+ _buOverlay.draw();
- title._text = info.curLocName();
- title.draw();
+ _title._text = info.curLocName();
+ _title.draw();
- marker.draw(pos, player_pos, camera);
+ _marker.draw(_pos, _playerPos, _camera);
- scroll.draw();
+ _scroll.draw();
}
//------------------------------------------------------------------------
// Purpose: Center the world map on a spot
//------------------------------------------------------------------------
-void Map::Center(const Vector2i &vec) {
- camera.x = vec.x - camera.w / 2;
- camera.y = vec.y - camera.h / 2;
- Validate();
+void Map::center(const Vector2i &vec) {
+ _camera.x = vec.x - _camera.w / 2;
+ _camera.y = vec.y - _camera.h / 2;
+ validate();
}
//------------------------------------------------------------------------
// Purpose: Keep the camera in bounds and decide marker visibility
//------------------------------------------------------------------------
-void Map::Validate() {
+void Map::validate() {
// Make all scroll buttons visible first
- for (auto &i : scroll.element)
+ for (auto &i : _scroll._element)
i._visible = true;
// Keep camera in bounds
- if (camera.x + camera.w > size.x)
- camera.x = size.x - camera.w;
- if (camera.y + camera.h > size.y)
- camera.y = size.y - camera.h;
- if (camera.x < 0)
- camera.x = 0;
- if (camera.y < 0)
- camera.y = 0;
+ if (_camera.x + _camera.w > _size.x)
+ _camera.x = _size.x - _camera.w;
+ if (_camera.y + _camera.h > _size.y)
+ _camera.y = _size.y - _camera.h;
+ if (_camera.x < 0)
+ _camera.x = 0;
+ if (_camera.y < 0)
+ _camera.y = 0;
// decide visibility of scroll buttons
- scroll.element[DIRECTION_RIGHT]._visible = !(camera.x == size.x - camera.w);
- scroll.element[DIRECTION_DOWN]._visible = !(camera.y == size.y - camera.h);
- scroll.element[DIRECTION_LEFT]._visible = !(camera.x == 0);
- scroll.element[DIRECTION_UP]._visible = !(camera.y == 0);
+ _scroll._element[DIRECTION_RIGHT]._visible = !(_camera.x == _size.x - _camera.w);
+ _scroll._element[DIRECTION_DOWN]._visible = !(_camera.y == _size.y - _camera.h);
+ _scroll._element[DIRECTION_LEFT]._visible = !(_camera.x == 0);
+ _scroll._element[DIRECTION_UP]._visible = !(_camera.y == 0);
}
//------------------------------------------------------------------------
// Purpose: Move
//------------------------------------------------------------------------
-void Map::Move(const Common::Event &Event) {
+void Map::move(const Common::Event &event) {
// Reset the velocity to avoid weirdness
- vel.x = 0;
- vel.y = 0;
+ _vel.x = 0;
+ _vel.y = 0;
// We don't use the result, but this keeps the button states up to date
- scroll.handleEvents(Event);
+ _scroll.handleEvents(event);
- switch (Event.type) {
+ switch (event.type) {
case Common::EVENT_LBUTTONDOWN:
case Common::EVENT_RBUTTONDOWN: {
bool click = false;
int count = 0;
- for (auto &i : scroll.element) {
+ for (auto &i : _scroll._element) {
if (i.Contains(g_engine->_mouse->_button)) {
if (count == DIRECTION_UP)
- vel.y = -1 * speed;
+ _vel.y = -1 * _speed;
else if (count == DIRECTION_DOWN)
- vel.y = speed;
+ _vel.y = _speed;
else if (count == DIRECTION_RIGHT)
- vel.x = speed;
+ _vel.x = _speed;
else if (count == DIRECTION_LEFT)
- vel.x = -1 * speed;
+ _vel.x = -1 * _speed;
click = true;
}
@@ -211,23 +211,23 @@ void Map::Move(const Common::Event &Event) {
}
if (!click) {
- pan = true;
- vel.x = 0;
- vel.y = 0;
+ _pan = true;
+ _vel.x = 0;
+ _vel.y = 0;
} else
- pan = false;
+ _pan = false;
} break;
case Common::EVENT_LBUTTONUP:
case Common::EVENT_RBUTTONUP:
- pan = false;
+ _pan = false;
break;
case Common::EVENT_MOUSEMOVE:
- if (pan) {
- camera.x -= g_engine->_mouse->_rel.x;
- camera.y -= g_engine->_mouse->_rel.y;
- Validate();
+ if (_pan) {
+ _camera.x -= g_engine->_mouse->_rel.x;
+ _camera.y -= g_engine->_mouse->_rel.y;
+ validate();
}
break;
default:
@@ -328,34 +328,34 @@ void Map::Move(const SDL_Event &Event) {
//------------------------------------------------------------------------
void Map::internalEvents(pyrodactyl::event::Info &info) {
// The map overlay and button state should be in sync
- bu_overlay._state = overlay;
+ _buOverlay._state = _overlay;
- camera.x += vel.x;
- camera.y += vel.y;
- Validate();
+ _camera.x += _vel.x;
+ _camera.y += _vel.y;
+ validate();
- for (auto &i : travel.element)
- i._visible = i.x >= camera.x && i.y >= camera.y;
+ for (auto &i : _travel._element)
+ i._visible = i.x >= _camera.x && i.y >= _camera.y;
- marker.internalEvents(pos, player_pos, camera, bounds);
+ _marker.internalEvents(_pos, _playerPos, _camera, _bounds);
}
//------------------------------------------------------------------------
// Purpose: Handle Events
//------------------------------------------------------------------------
-bool Map::handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event) {
- int choice = travel.handleEvents(Event, -1 * camera.x, -1 * camera.y);
+bool Map::handleEvents(pyrodactyl::event::Info &info, const Common::Event &event) {
+ int choice = _travel.handleEvents(event, -1 * _camera.x, -1 * _camera.y);
if (choice >= 0) {
- cur_loc = travel.element[choice].loc;
- pan = false;
+ _curLoc = _travel._element[choice]._loc;
+ _pan = false;
return true;
}
- marker.handleEvents(pos, player_pos, camera, Event);
+ _marker.handleEvents(_pos, _playerPos, _camera, event);
- Move(Event);
- if (bu_overlay.handleEvents(Event) == BUAC_LCLICK)
- overlay = bu_overlay._state;
+ move(event);
+ if (_buOverlay.handleEvents(event) == BUAC_LCLICK)
+ _overlay = _buOverlay._state;
return false;
}
@@ -382,86 +382,86 @@ bool Map::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
}
#endif
-void Map::SetImage(const unsigned int &val, const bool &force) {
- if (force || (cur != val && val < map.size())) {
- cur = val;
+void Map::setImage(const unsigned int &val, const bool &force) {
+ if (force || (_cur != val && val < _map.size())) {
+ _cur = val;
- img_bg.deleteImage();
- img_overlay.deleteImage();
+ _imgBg.deleteImage();
+ _imgOverlay.deleteImage();
- img_bg.load(map[cur].path_bg);
- img_overlay.load(map[cur].path_overlay);
+ _imgBg.load(_map[_cur]._pathBg);
+ _imgOverlay.load(_map[_cur]._pathOverlay);
- size.x = img_bg.w();
- size.y = img_bg.h();
+ _size.x = _imgBg.w();
+ _size.y = _imgBg.h();
- marker.Clear();
- for (auto &i : map[cur].dest)
- marker.AddButton(i.name, i.pos.x, i.pos.y);
+ _marker.clear();
+ for (auto &i : _map[_cur]._dest)
+ _marker.addButton(i._name, i._pos.x, i._pos.y);
- marker.AssignPaths();
+ _marker.assignPaths();
}
}
//------------------------------------------------------------------------
// Purpose: Select the marker corresponding to a quest title
//------------------------------------------------------------------------
-void Map::SelectDest(const Common::String &name) {
- marker.SelectDest(name);
+void Map::selectDest(const Common::String &name) {
+ _marker.selectDest(name);
}
//------------------------------------------------------------------------
// Purpose: Update the status of the fast travel buttons
//------------------------------------------------------------------------
-void Map::Update(pyrodactyl::event::Info &info) {
- for (auto &i : travel.element) {
- i.unlock.evaluate(info);
- i._visible = i.unlock.result();
+void Map::update(pyrodactyl::event::Info &info) {
+ for (auto &i : _travel._element) {
+ i._unlock.evaluate(info);
+ i._visible = i._unlock.result();
}
}
//------------------------------------------------------------------------
// Purpose: Add a rectangle to the revealed world map data
//------------------------------------------------------------------------
-void Map::RevealAdd(const int &id, const Rect &area) {
- if ((unsigned int)id < map.size()) {
- for (auto i = map[id].reveal.begin(); i != map[id].reveal.end(); ++i)
+void Map::revealAdd(const int &id, const Rect &area) {
+ if ((unsigned int)id < _map.size()) {
+ for (auto i = _map[id]._reveal.begin(); i != _map[id]._reveal.end(); ++i)
if (*i == area)
return;
- map[id].reveal.push_back(area);
+ _map[id]._reveal.push_back(area);
}
}
//------------------------------------------------------------------------
// Purpose: Add or remove a destination marker from the world map
//------------------------------------------------------------------------
-void Map::DestAdd(const Common::String &name, const int &x, const int &y) {
- if (cur < map.size()) {
- for (auto i = map[cur].dest.begin(); i != map[cur].dest.end(); ++i) {
- if (i->name == name) {
- i->pos.x = x;
- i->pos.y = y;
+void Map::destAdd(const Common::String &name, const int &x, const int &y) {
+ if (_cur < _map.size()) {
+ for (auto i = _map[_cur]._dest.begin(); i != _map[_cur]._dest.end(); ++i) {
+ if (i->_name == name) {
+ i->_pos.x = x;
+ i->_pos.y = y;
return;
}
}
- map[cur].DestAdd(name, x, y);
- marker.AddButton(name, x, y);
- marker.AssignPaths();
+ _map[_cur].destAdd(name, x, y);
+ _marker.addButton(name, x, y);
+ _marker.assignPaths();
}
}
-void Map::DestDel(const Common::String &name) {
- if (cur < map.size()) {
- for (auto i = map[cur].dest.begin(); i != map[cur].dest.end(); ++i) {
- if (i->name == name) {
- map[cur].dest.erase(i);
+void Map::destDel(const Common::String &name) {
+ if (_cur < _map.size()) {
+ for (auto i = _map[_cur]._dest.begin(); i != _map[_cur]._dest.end(); ++i) {
+ if (i->_name == name) {
+ _map[_cur]._dest.erase(i);
break;
}
}
- marker.Erase(name);
+ _marker.erase(name);
}
}
@@ -471,10 +471,10 @@ void Map::DestDel(const Common::String &name) {
void Map::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "map");
- child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(cur)));
- saveBool(overlay, "overlay", doc, child);
+ child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(_cur)));
+ saveBool(_overlay, "overlay", doc, child);
- for (auto r = map.begin(); r != map.end(); ++r) {
+ for (auto r = _map.begin(); r != _map.end(); ++r) {
rapidxml::xml_node<char> *child_data = doc.allocate_node(rapidxml::node_element, "data");
r->saveState(doc, child_data);
child->append_node(child_data);
@@ -486,16 +486,16 @@ void Map::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *roo
void Map::loadState(rapidxml::xml_node<char> *node) {
if (nodeValid("map", node)) {
rapidxml::xml_node<char> *mapnode = node->first_node("map");
- loadBool(overlay, "overlay", mapnode);
+ loadBool(_overlay, "overlay", mapnode);
- int val = cur;
+ int val = _cur;
loadNum(val, "cur", mapnode);
- auto r = map.begin();
- for (rapidxml::xml_node<char> *n = mapnode->first_node("data"); n != NULL && r != map.end(); n = n->next_sibling("data"), ++r)
+ auto r = _map.begin();
+ for (rapidxml::xml_node<char> *n = mapnode->first_node("data"); n != NULL && r != _map.end(); n = n->next_sibling("data"), ++r)
r->loadState(n);
- SetImage(val, true);
+ setImage(val, true);
}
}
@@ -503,17 +503,17 @@ void Map::loadState(rapidxml::xml_node<char> *node) {
// Purpose: Reset the UI positions in response to change in resolution
//------------------------------------------------------------------------
void Map::setUI() {
- pos.setUI();
- fg.setUI();
+ _pos.setUI();
+ _fg.setUI();
- travel.setUI();
- marker.setUI();
+ _travel.setUI();
+ _marker.setUI();
- bu_overlay.setUI();
- scroll.setUI();
- title.setUI();
+ _buOverlay.setUI();
+ _scroll.setUI();
+ _title.setUI();
- CalcBounds();
+ calcBounds();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index d8c77e47184..75fe4106b4d 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -48,99 +48,100 @@ namespace pyrodactyl {
namespace ui {
class Map {
// We have multiple world maps, each with their own data
- Common::Array<MapData> map;
+ Common::Array<MapData> _map;
// Index of the currently visible map
- unsigned int cur;
+ unsigned int _cur;
// The currently loaded map background image
- pyrodactyl::image::Image img_bg, img_overlay;
+ pyrodactyl::image::Image _imgBg, _imgOverlay;
// The position at which map image has to be drawn
- Element pos;
+ Element _pos;
// Foreground image of the map
- ImageData fg;
+ ImageData _fg;
// size = Dimensions of the map image
// mouse = The current coordinates of the mouse
// vel = The speed at which the map is moving
- Vector2i size, mouse, vel;
+ Vector2i _size, _mouse, _vel;
// The reference speed of the camera movement
- int speed;
+ int _speed;
// The pan toggle is used when the mouse is down and moving simultaneously
// overlay = true if we are showing a more detailed world map
- bool pan, overlay;
+ bool _pan, _overlay;
// The camera size and position for the map
// Bounds is the area we draw the map elements for
- Rect camera, bounds;
+ Rect _camera, _bounds;
// The button to toggle between showing the overlay or not
- ToggleButton bu_overlay;
+ ToggleButton _buOverlay;
// All data for drawing map markers
- MapMarkerMenu marker;
+ MapMarkerMenu _marker;
// The map name is drawn here
- HoverInfo title;
+ HoverInfo _title;
// The buttons for scrolling the map (only visible if there is area to scroll)
- ButtonMenu scroll;
+ ButtonMenu _scroll;
// The menu for fast travel locations
- MapButtonMenu travel;
+ MapButtonMenu _travel;
- void CalcBounds() {
- bounds.x = pos.x;
- bounds.y = pos.y;
- bounds.w = camera.w;
- bounds.h = camera.h;
+ void calcBounds() {
+ _bounds.x = _pos.x;
+ _bounds.y = _pos.y;
+ _bounds.w = _camera.w;
+ _bounds.h = _camera.h;
}
public:
// The currently selected location
- Common::String cur_loc;
+ Common::String _curLoc;
// The coordinates of the player's current location
- Vector2i player_pos;
+ Vector2i _playerPos;
Map() {
- speed = 1;
- pan = false;
- cur = 0;
- overlay = true;
+ _speed = 1;
+ _pan = false;
+ _cur = 0;
+ _overlay = true;
}
+
~Map() {
- img_bg.deleteImage();
- img_overlay.deleteImage();
+ _imgBg.deleteImage();
+ _imgOverlay.deleteImage();
}
void load(const Common::String &filename, pyrodactyl::event::Info &info);
void draw(pyrodactyl::event::Info &info);
- bool handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
+ bool handleEvents(pyrodactyl::event::Info &info, const Common::Event &event);
#if 0
bool handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
#endif
void internalEvents(pyrodactyl::event::Info &info);
- void Center(const Vector2i &pos);
- void Move(const Common::Event &Event);
+ void center(const Vector2i &pos);
+ void move(const Common::Event &event);
#if 0
void Move(const SDL_Event &Event);
#endif
- void Validate();
+ void validate();
- void RevealAdd(const int &id, const Rect &area);
- void DestAdd(const Common::String &name, const int &x, const int &y);
- void DestDel(const Common::String &name);
- void SelectDest(const Common::String &name);
+ void revealAdd(const int &id, const Rect &area);
+ void destAdd(const Common::String &name, const int &x, const int &y);
+ void destDel(const Common::String &name);
+ void selectDest(const Common::String &name);
- void Update(pyrodactyl::event::Info &info);
- void SetImage(const unsigned int &val, const bool &force = false);
+ void update(pyrodactyl::event::Info &info);
+ void setImage(const unsigned int &val, const bool &force = false);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/mapbutton.h b/engines/crab/ui/mapbutton.h
index 4fa129f386c..77c3878d625 100644
--- a/engines/crab/ui/mapbutton.h
+++ b/engines/crab/ui/mapbutton.h
@@ -42,10 +42,10 @@ namespace ui {
class MapButton : public Button {
public:
// The id of the location
- Common::String loc;
+ Common::String _loc;
// Conditions needed for the location to be unlocked in world map
- pyrodactyl::event::TriggerSet unlock;
+ pyrodactyl::event::TriggerSet _unlock;
MapButton() {}
~MapButton() {}
@@ -53,9 +53,9 @@ public:
void load(rapidxml::xml_node<char> *node) {
Button::load(node);
- loadStr(loc, "id", node);
+ loadStr(_loc, "id", node);
if (nodeValid("unlock", node, false))
- unlock.load(node->first_node("unlock"));
+ _unlock.load(node->first_node("unlock"));
}
};
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 415507840ce..2c7144f7293 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -49,42 +49,46 @@ template<typename T>
class Menu {
protected:
// The index of current selected option and highlighted option
- int hover_index;
+ int _hoverIndex;
// The order in which a keyboard or gamepad traverses the menu
- Common::Array<unsigned int> path;
+ Common::Array<unsigned int> _path;
// Are keyboard buttons enabled?
- bool use_keyboard;
+ bool _useKeyboard;
// Has a key been pressed?
- enum InputDevice { KEYBOARD,
- MOUSE } latest_input;
+ enum InputDevice {
+ KEYBOARD,
+ MOUSE
+ } _latestInput;
// Do the paths use horizontal, vertical or both types of input for keyboard traversal
- enum PathType { PATH_DEFAULT,
- PATH_HORIZONTAL,
- PATH_VERTICAL } path_type;
+ enum PathType {
+ PATH_DEFAULT,
+ PATH_HORIZONTAL,
+ PATH_VERTICAL
+ } _pathType;
//------------------------------------------------------------------------
// Purpose: Find the next element in our path
//------------------------------------------------------------------------
- void Next() {
- if (hover_index == -1) {
- for (unsigned int pos = 0; pos < path.size(); pos++)
- if (element[path[pos]]._visible == true) {
- hover_index = path[pos];
+ void next() {
+ if (_hoverIndex == -1) {
+ for (unsigned int pos = 0; pos < _path.size(); pos++)
+ if (_element[_path[pos]]._visible == true) {
+ _hoverIndex = _path[pos];
break;
}
} else {
unsigned int curpos = 0;
- for (; curpos < path.size(); curpos++)
- if ((int)path[curpos] == hover_index)
+ for (; curpos < _path.size(); curpos++)
+ if ((int)_path[curpos] == _hoverIndex)
break;
- for (unsigned int nextloc = (curpos + 1) % element.size(); nextloc != curpos; nextloc = (nextloc + 1) % element.size())
- if (element[nextloc]._visible == true) {
- hover_index = path[nextloc];
+ for (unsigned int nextloc = (curpos + 1) % _element.size(); nextloc != curpos; nextloc = (nextloc + 1) % _element.size())
+ if (_element[nextloc]._visible == true) {
+ _hoverIndex = _path[nextloc];
break;
}
}
@@ -93,26 +97,26 @@ protected:
//------------------------------------------------------------------------
// Purpose: Find the previous element in our path
//------------------------------------------------------------------------
- void Prev() {
- if (hover_index == -1) {
- for (unsigned int pos = 0; pos < path.size(); pos++)
- if (element[path[pos]]._visible == true) {
- hover_index = path[pos];
+ void prev() {
+ if (_hoverIndex == -1) {
+ for (unsigned int pos = 0; pos < _path.size(); pos++)
+ if (_element[_path[pos]]._visible == true) {
+ _hoverIndex = _path[pos];
break;
}
} else {
unsigned int curpos = 0;
- for (; curpos < path.size(); curpos++)
- if ((int)path[curpos] == hover_index)
+ for (; curpos < _path.size(); curpos++)
+ if ((int)_path[curpos] == _hoverIndex)
break;
int nextloc = curpos - 1;
while (nextloc != (int)curpos) {
if (nextloc < 0)
- nextloc = element.size() - 1;
+ nextloc = _element.size() - 1;
- if (element[nextloc]._visible == true) {
- hover_index = path[nextloc];
+ if (_element[nextloc]._visible == true) {
+ _hoverIndex = _path[nextloc];
break;
}
@@ -124,43 +128,43 @@ protected:
//------------------------------------------------------------------------
// Purpose: Handle keyboard input
//------------------------------------------------------------------------
- int HandleKeyboard(const Common::Event &Event) {
+ int handleKeyboard(const Common::Event &event) {
using namespace pyrodactyl::input;
if (g_engine->_inputManager->getKeyBindingMode() != KBM_UI) {
g_engine->_inputManager->setKeyBindingMode(KBM_UI);
}
- if (!element.empty()) {
- if (path_type != PATH_HORIZONTAL) {
+ if (!_element.empty()) {
+ if (_pathType != PATH_HORIZONTAL) {
if (g_engine->_inputManager->state(IU_DOWN)) {
- Next();
- latest_input = KEYBOARD;
+ next();
+ _latestInput = KEYBOARD;
} else if (g_engine->_inputManager->state(IU_UP)) {
- Prev();
- latest_input = KEYBOARD;
+ prev();
+ _latestInput = KEYBOARD;
}
}
- if (path_type != PATH_VERTICAL) {
+ if (_pathType != PATH_VERTICAL) {
if (g_engine->_inputManager->state(IU_RIGHT)) {
- Next();
- latest_input = KEYBOARD;
+ next();
+ _latestInput = KEYBOARD;
} else if (g_engine->_inputManager->state(IU_LEFT)) {
- Prev();
- latest_input = KEYBOARD;
+ prev();
+ _latestInput = KEYBOARD;
}
}
- if (g_engine->_inputManager->state(IU_ACCEPT) && hover_index != -1)
- return hover_index;
+ if (g_engine->_inputManager->state(IU_ACCEPT) && _hoverIndex != -1)
+ return _hoverIndex;
// We pressed a key, which means we have to update the hovering status
- if (latest_input == KEYBOARD) {
+ if (_latestInput == KEYBOARD) {
// Update hover status of keys according to the current index
int i = 0;
- for (auto it = element.begin(); it != element.end(); ++it, ++i)
- it->_hoverKey = (i == hover_index);
+ for (auto it = _element.begin(); it != _element.end(); ++it, ++i)
+ it->_hoverKey = (i == _hoverIndex);
}
}
@@ -213,25 +217,25 @@ protected:
public:
// The collection of buttons in the menu
- Common::Array<T> element;
+ Common::Array<T> _element;
Menu() {
- hover_index = -1;
- use_keyboard = false;
- latest_input = MOUSE;
- path_type = PATH_DEFAULT;
+ _hoverIndex = -1;
+ _useKeyboard = false;
+ _latestInput = MOUSE;
+ _pathType = PATH_DEFAULT;
}
~Menu() {}
void reset() {
- latest_input = MOUSE;
- hover_index = -1;
- for (auto b = element.begin(); b != element.end(); ++b)
+ _latestInput = MOUSE;
+ _hoverIndex = -1;
+ for (auto b = _element.begin(); b != _element.end(); ++b)
b->reset();
}
void setUI() {
- for (auto i = element.begin(); i != element.end(); ++i)
+ for (auto i = _element.begin(); i != _element.end(); ++i)
i->setUI();
}
@@ -243,11 +247,11 @@ public:
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
T b;
b.load(n);
- element.push_back(b);
+ _element.push_back(b);
}
- loadBool(use_keyboard, "keyboard", node, false);
- AssignPaths();
+ loadBool(_useKeyboard, "keyboard", node, false);
+ assignPaths();
}
}
@@ -256,10 +260,10 @@ public:
// The reason this function doesn't declare its own Event object is because
// a menu might not be the only object in a game state
//------------------------------------------------------------------------
- int handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
+ int handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0) {
// The keyboard/joystick event handling bit
- if (use_keyboard) {
- int result = HandleKeyboard(Event);
+ if (_useKeyboard) {
+ int result = handleKeyboard(event);
// We have accepted a menu option using the keyboard
if (result != -1) {
@@ -271,17 +275,17 @@ public:
}
// Check if we have moved or clicked the mouse
- if (Common::isMouseEvent(Event)) {
+ if (Common::isMouseEvent(event)) {
// Since the player is moving the mouse, we have to recalculate hover index at every opportunity
- hover_index = -1;
- latest_input = MOUSE;
+ _hoverIndex = -1;
+ _latestInput = MOUSE;
}
// The mouse and hotkey event handling bit
int i = 0;
- for (auto it = element.begin(); it != element.end(); ++it, ++i) {
+ for (auto it = _element.begin(); it != _element.end(); ++it, ++i) {
// We clicked on a button using the mouse
- if (it->handleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
+ if (it->handleEvents(event, xOffset, yOffset) == BUAC_LCLICK) {
// Reset the menu state
reset();
g_engine->_inputManager->setKeyBindingMode(pyrodactyl::input::KBM_GAME);
@@ -290,18 +294,18 @@ public:
// We did not click a button, however we did hover over the button
// However if we are use keyboard to browse through the menu, hovering is forgotten until we move the mouse again
- if (it->_hoverMouse && latest_input == MOUSE) {
- hover_index = i;
+ if (it->_hoverMouse && _latestInput == MOUSE) {
+ _hoverIndex = i;
// The latest input is the mouse, which means we have to forget the keyboard hover states
- for (auto e = element.begin(); e != element.end(); ++e)
+ for (auto e = _element.begin(); e != _element.end(); ++e)
e->_hoverKey = false;
}
}
- if (latest_input == KEYBOARD) {
+ if (_latestInput == KEYBOARD) {
// The latest input is the keyboard, which means we have to forget the mouse hover states
- for (auto it = element.begin(); it != element.end(); ++it)
+ for (auto it = _element.begin(); it != _element.end(); ++it)
it->_hoverMouse = false;
}
return -1;
@@ -368,53 +372,61 @@ public:
// Purpose: Draw the menu
//------------------------------------------------------------------------
void draw(const int &XOffset = 0, const int &YOffset = 0) {
- for (auto it = element.begin(); it != element.end(); ++it)
+ for (auto it = _element.begin(); it != _element.end(); ++it)
it->draw(XOffset, YOffset);
}
//------------------------------------------------------------------------
// Purpose: Get info about the menu
//------------------------------------------------------------------------
- void UseKeyboard(const bool &val) { use_keyboard = val; }
- void Clear() { element.clear(); }
- int HoverIndex() { return hover_index; }
+ void useKeyboard(const bool &val) {
+ _useKeyboard = val;
+ }
+
+ void clear() {
+ _element.clear();
+ }
+
+ int hoverIndex() {
+ return _hoverIndex;
+ }
//------------------------------------------------------------------------
// Purpose: Assign traversal paths
//------------------------------------------------------------------------
- void AssignPaths() {
- path.clear();
+ void assignPaths() {
+ _path.clear();
// These variables are used to see if the X and Y values of buttons are the same or not
// Used to determine the path type of the menu
- bool same_x = true, same_y = true;
+ bool sameX = true, sameY = true;
- if (!element.empty()) {
- path.push_back(0);
+ if (!_element.empty()) {
+ _path.push_back(0);
- for (unsigned int i = 1; i < element.size(); i++) {
- path.push_back(i);
+ for (unsigned int i = 1; i < _element.size(); i++) {
+ _path.push_back(i);
- int prev_x = element[i - 1].x;
- int prev_y = element[i - 1].y;
+ int prevX = _element[i - 1].x;
+ int prevY = _element[i - 1].y;
- if (same_x && element[i].x != prev_x)
- same_x = false;
+ if (sameX && _element[i].x != prevX)
+ sameX = false;
- if (same_y && element[i].y != prev_y)
- same_y = false;
+ if (sameY && _element[i].y != prevY)
+ sameY = false;
}
}
- if (same_x) {
- if (same_y)
- path_type = PATH_DEFAULT;
+ if (sameX) {
+ if (sameY)
+ _pathType = PATH_DEFAULT;
else
- path_type = PATH_VERTICAL;
- } else if (same_y)
- path_type = PATH_HORIZONTAL;
+ _pathType = PATH_VERTICAL;
+ } else if (sameY)
+ _pathType = PATH_HORIZONTAL;
else
- path_type = PATH_DEFAULT;
+ _pathType = PATH_DEFAULT;
}
};
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 141e2230a7c..63b3809ed14 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -94,13 +94,13 @@ void QuestMenu::Add(const Common::String &title, const Common::String &txt) {
Quest q(title, txt, true, false);
quest.insert_at(0, q);
- menu.Add();
+ menu.add();
unread = true;
}
void QuestMenu::Add(const pyrodactyl::event::Quest &q) {
quest.insert_at(0, q);
- menu.Add();
+ menu.add();
}
//------------------------------------------------------------------------
@@ -108,7 +108,7 @@ void QuestMenu::Add(const pyrodactyl::event::Quest &q) {
//------------------------------------------------------------------------
void QuestMenu::Erase(const int &index) {
quest.erase(quest.begin() + index);
- menu.Erase();
+ menu.erase();
}
//------------------------------------------------------------------------
@@ -126,11 +126,11 @@ void QuestMenu::draw(Button &bu_map) {
menu.draw();
using namespace pyrodactyl::text;
- for (auto i = menu.Index(), count = 0u; i < menu.IndexPlusOne() && i < quest.size(); i++, count++) {
- auto base_x = menu.BaseX(count), base_y = menu.BaseY(count);
+ for (auto i = menu.index(), count = 0u; i < menu.indexPlusOne() && i < quest.size(); i++, count++) {
+ auto base_x = menu.baseX(count), base_y = menu.baseY(count);
// Only draw in _s color if we are on the same button and page
- if ((unsigned int)sel_bu == count && (unsigned int)sel_page == menu.CurrentPage())
+ if ((unsigned int)sel_bu == count && (unsigned int)sel_page == menu.currentPage())
g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i]._title, col_s, font, align);
else
g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i]._title, col_n, font, align);
@@ -156,16 +156,16 @@ bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const Co
int res = menu.handleEvents(Event);
if (res != -1) {
if (sel_bu >= 0 && sel_page >= 0)
- menu.Image(sel_bu, sel_page, img_n);
+ menu.image(sel_bu, sel_page, img_n);
sel_bu = res;
- sel_page = menu.CurrentPage();
- sel_quest = menu.Index() + sel_bu;
+ sel_page = menu.currentPage();
+ sel_quest = menu.index() + sel_bu;
quest[sel_quest]._unread = false;
text.reset();
- menu.Image(sel_bu, sel_page, img_s);
+ menu.image(sel_bu, sel_page, img_s);
}
if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
@@ -223,20 +223,20 @@ bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const SD
void QuestMenu::Select(const int &quest_index) {
if (quest_index >= 0 && (unsigned int)quest_index < quest.size()) {
if (sel_bu >= 0 && sel_page >= 0)
- menu.Image(sel_bu, sel_page, img_n);
+ menu.image(sel_bu, sel_page, img_n);
sel_quest = quest_index;
- sel_page = quest_index / menu.ElementsPerPage();
- menu.CurrentPage(sel_page);
- menu.UpdateInfo();
+ sel_page = quest_index / menu.elementsPerPage();
+ menu.currentPage(sel_page);
+ menu.updateInfo();
- sel_bu = quest_index % menu.ElementsPerPage();
+ sel_bu = quest_index % menu.elementsPerPage();
quest[quest_index]._unread = false;
text.reset();
- menu.Image(sel_bu, sel_page, img_s);
+ menu.image(sel_bu, sel_page, img_s);
}
}
@@ -265,7 +265,7 @@ void QuestMenu::loadState(rapidxml::xml_node<char> *node) {
Quest q;
q.loadState(n);
quest.push_back(q);
- menu.Add();
+ menu.add();
}
}
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index e495d0b06e9..3dcaf451553 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -82,8 +82,8 @@ public:
bool handleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event);
#endif
- void UseKeyboard(const bool &val) { menu.UseKeyboard(val); }
- void AssignPaths() { menu.AssignPaths(); }
+ void UseKeyboard(const bool &val) { menu.useKeyboard(val); }
+ void AssignPaths() { menu.assignPaths(); }
void Marker(const Common::String &title, const bool &val);
Commit: a9ccc1719f1c683b464b67f36a8e33aa855fd76d
https://github.com/scummvm/scummvm/commit/a9ccc1719f1c683b464b67f36a8e33aa855fd76d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make rest of the UI classes follow code formatting conventions
Changed paths:
engines/crab/event/gameeventmanager.cpp
engines/crab/game.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/journal.cpp
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 5a2916037c3..af593261491 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -376,7 +376,7 @@ void Manager::calcActiveSeq(Info &info, pyrodactyl::level::Level &level, const R
g_engine->_eventStore->_anim[_curEvent->_special].start();
break;
case EVENT_REPLY:
- _reply.Cache(info, g_engine->_eventStore->_con[_curEvent->_special]);
+ _reply.cache(info, g_engine->_eventStore->_con[_curEvent->_special]);
break;
default:
break;
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 8d99538094d..92299ff24b0 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -834,9 +834,9 @@ void Game::ToggleState(const State &s) {
// Only load help screen image if we have to
if (state == STATE_HELP)
- g_engine->_helpScreen->Refresh();
+ g_engine->_helpScreen->refresh();
else
- g_engine->_helpScreen->Clear();
+ g_engine->_helpScreen->clear();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index ff59312bde5..b7626769c76 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -471,9 +471,9 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
// If switching to help screen, load latest image otherwise remove it from memory
if (state == STATE_HELP)
- g_engine->_helpScreen->Refresh();
+ g_engine->_helpScreen->refresh();
else
- g_engine->_helpScreen->Clear();
+ g_engine->_helpScreen->clear();
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 1e0fe108ffd..98fe61c619f 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -147,10 +147,10 @@ void GeneralSettingMenu::draw() {
// Purpose: Revert to previously backed up settings
//------------------------------------------------------------------------
void GeneralSettingMenu::RestoreBackup() {
- _volMusic.RestoreBackup();
+ _volMusic.restoreBackup();
g_engine->_musicManager->volMusic(_volMusic.Value());
- _volEffects.RestoreBackup();
+ _volEffects.restoreBackup();
g_engine->_musicManager->volEffects(_volEffects.Value());
}
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 40a868e3487..501f3f476d2 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -68,8 +68,8 @@ public:
void setUI();
void CreateBackup() {
- _volMusic.CreateBackup();
- _volEffects.CreateBackup();
+ _volMusic.createBackup();
+ _volEffects.createBackup();
}
void RestoreBackup();
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index dc019207358..737c06cee0c 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -70,7 +70,7 @@ public:
void draw();
void setUI();
- void SetInfo() { _resolution.SetInfo(); }
+ void SetInfo() { _resolution.setInfo(); }
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index ee4b73e7068..e742317fe30 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -181,7 +181,7 @@ PauseSignal PauseMenu::handleEvents(const SDL_Event &Event, Button &back) {
#endif
bool PauseMenu::disableHotkeys() {
- return (_state == STATE_SAVE && _save.DisableHotkeys()) || (_state == STATE_OPTION && g_engine->_optionMenu->disableHotkeys());
+ return (_state == STATE_SAVE && _save.disableHotkeys()) || (_state == STATE_OPTION && g_engine->_optionMenu->disableHotkeys());
}
void PauseMenu::setUI() {
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 051bd568914..72ff112136c 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -165,7 +165,7 @@ void PersonHandler::opinionChange(pyrodactyl::event::Info &info, const Common::S
info.opinionGet(id, type, value);
// Now, send the new and old value of the object's opinion for drawing the change effect
- _opinion[type].Effect(value, old);
+ _opinion[type].effect(value, old);
_prev = id;
}
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index dcbcd108413..1a1ec7969f9 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -97,9 +97,9 @@ void PersonScreen::Cache(Info &info, const Common::String &id, pyrodactyl::level
_curSp = level.getSprite(id);
if (info.personValid(id))
- _menu.Cache(info.personGet(id));
+ _menu.cache(info.personGet(id));
else
- _menu.Clear();
+ _menu.clear();
}
void PersonScreen::setUI() {
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index 31f9659c2af..7015484ca04 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -37,19 +37,19 @@ using namespace pyrodactyl::image;
void ProgressBar::load(rapidxml::xml_node<char> *node) {
ClipButton::load(node);
- loadNum(notify_rate, "notify", node);
+ loadNum(_notifyRate, "notify", node);
if (nodeValid("effect", node)) {
rapidxml::xml_node<char> *effnode = node->first_node("effect");
- loadImgKey(inc, "inc", effnode);
- loadImgKey(dec, "dec", effnode);
- offset.load(effnode);
+ loadImgKey(_inc, "inc", effnode);
+ loadImgKey(_dec, "dec", effnode);
+ _offset.load(effnode);
}
if (nodeValid("desc", node)) {
rapidxml::xml_node<char> *descnode = node->first_node("desc");
for (rapidxml::xml_node<char> *n = descnode->first_node("above"); n != NULL; n = n->next_sibling("above"))
- ct.push_back(n);
+ _ct.push_back(n);
}
}
@@ -59,59 +59,59 @@ void ProgressBar::draw(const int &value, const int &max) {
return;
// Figure out which text to draw as caption
- for (auto &i : ct)
- if (value > i.val) {
- _caption._text = i.text;
+ for (auto &i : _ct)
+ if (value > i._val) {
+ _caption._text = i._text;
break;
}
// If we don't have to draw animations for changing value, just draw the bar
- if (!changed) {
+ if (!_changed) {
_clip.w = (g_engine->_imageManager->getTexture(_img._normal).w() * value) / max;
ClipButton::draw();
} else {
- _clip.w = (g_engine->_imageManager->getTexture(_img._normal).w() * cur) / max;
+ _clip.w = (g_engine->_imageManager->getTexture(_img._normal).w() * _cur) / max;
ClipButton::draw();
- switch (type) {
+ switch (_type) {
case INCREASE:
- g_engine->_imageManager->draw(x + _clip.w + offset.x, y + offset.y, inc);
- if (timer.TargetReached()) {
- cur++;
- timer.Start();
+ g_engine->_imageManager->draw(x + _clip.w + _offset.x, y + _offset.y, _inc);
+ if (_timer.TargetReached()) {
+ _cur++;
+ _timer.Start();
}
break;
case DECREASE:
- g_engine->_imageManager->draw(x + _clip.w + offset.x, y + offset.y, dec);
- if (timer.TargetReached()) {
- cur--;
- timer.Start();
+ g_engine->_imageManager->draw(x + _clip.w + _offset.x, y + _offset.y, _dec);
+ if (_timer.TargetReached()) {
+ _cur--;
+ _timer.Start();
}
break;
default:
break;
}
- if (cur == value)
- changed = false;
+ if (_cur == value)
+ _changed = false;
}
}
-void ProgressBar::Effect(const int &value, const int &prev) {
- old = prev;
- cur = prev;
+void ProgressBar::effect(const int &value, const int &prev) {
+ _old = prev;
+ _cur = prev;
if (value > prev) {
- changed = true;
- type = INCREASE;
- timer.Target(notify_rate * (value - prev));
+ _changed = true;
+ _type = INCREASE;
+ _timer.Target(_notifyRate * (value - prev));
} else if (value < prev) {
- changed = true;
- type = DECREASE;
- timer.Target(notify_rate * (prev - value));
+ _changed = true;
+ _type = DECREASE;
+ _timer.Target(_notifyRate * (prev - value));
} else {
- changed = false;
- type = NONE;
+ _changed = false;
+ _type = NONE;
}
}
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index ec6e710b768..323294d7c3f 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -41,72 +41,77 @@ namespace pyrodactyl {
namespace ui {
class ProgressBar : public ClipButton {
// Whenever the progress bar value is changed, we display a glowing effect
- Timer timer;
+ Timer _timer;
// The total time for which the change effect must be shown
- uint32 notify_rate;
+ uint32 _notifyRate;
// Are we currently displaying the effect?
- bool changed;
+ bool _changed;
// The effect also depends on if the change was positive or negative, so store the previous value
- int old;
+ int _old;
// If we are drawing an animation, we need to smoothly transition from old->value
// This stores the current progress
- int cur;
+ int _cur;
// The type of effect being drawn
- enum { NONE,
- INCREASE,
- DECREASE } type;
+ enum {
+ NONE,
+ INCREASE,
+ DECREASE
+ } _type;
// We reuse the button images for the 2 types of effect
- ImageKey inc, dec;
+ ImageKey _inc, _dec;
// Where to draw the effect
- Vector2i offset;
+ Vector2i _offset;
// The caption text changes depending on the value of the progress bar - we store all possible text here
struct CaptionText {
// The text to be drawn
- Common::String text;
+ Common::String _text;
// The above text is drawn only if the progress bar value is greater than this val
- int val;
+ int _val;
+
+ CaptionText() {
+ _val = 0;
+ }
- CaptionText() { val = 0; }
CaptionText(rapidxml::xml_node<char> *node) {
- if (!loadNum(val, "val", node))
- val = 0;
+ if (!loadNum(_val, "val", node))
+ _val = 0;
- if (!loadStr(text, "text", node))
- text = "";
+ if (!loadStr(_text, "text", node))
+ _text = "";
}
};
- Common::Array<CaptionText> ct;
+ Common::Array<CaptionText> _ct;
public:
ProgressBar() {
- old = 0;
- cur = 0;
- inc = 0;
- dec = 0;
- notify_rate = 5;
+ _old = 0;
+ _cur = 0;
+ _inc = 0;
+ _dec = 0;
+ _notifyRate = 5;
reset();
}
~ProgressBar() {}
// Reset the effect
void reset() {
- changed = false;
- type = NONE;
+ _changed = false;
+ _type = NONE;
}
void load(rapidxml::xml_node<char> *node);
void draw(const int &value, const int &max);
- void Effect(const int &value, const int &prev);
+ void effect(const int &value, const int &prev);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 2b26c868a10..5415f76ee3d 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -39,96 +39,96 @@ using namespace pyrodactyl::input;
void QuestText::load(rapidxml::xml_node<char> *node) {
ParagraphData::load(node);
- loadNum(col_s, "color_s", node);
+ loadNum(_colS, "color_s", node);
if (nodeValid("line", node))
- loadNum(lines_per_page, "page", node->first_node("line"));
+ loadNum(_linesPerPage, "page", node->first_node("line"));
if (nodeValid("inc", node))
- inc.load(node->first_node("inc"));
+ _inc.load(node->first_node("inc"));
if (nodeValid("img", node))
- img.load(node->first_node("img"));
+ _img.load(node->first_node("img"));
if (nodeValid("prev", node)) {
- prev.load(node->first_node("prev"));
- prev._hotkey.set(IU_PAGE_PREV);
+ _prev.load(node->first_node("prev"));
+ _prev._hotkey.set(IU_PAGE_PREV);
}
if (nodeValid("next", node)) {
- next.load(node->first_node("next"));
- next._hotkey.set(IU_PAGE_NEXT);
+ _next.load(node->first_node("next"));
+ _next._hotkey.set(IU_PAGE_NEXT);
}
if (nodeValid("status", node))
- status.load(node->first_node("status"));
+ _status.load(node->first_node("status"));
}
void QuestText::draw(pyrodactyl::event::Quest &q) {
// First, we must scan and find the part of the quest text we should draw
// Assign default values to start and stop
- start = 0;
- stop = q._text.size();
+ _start = 0;
+ _stop = q._text.size();
// Keep count of lines and pages - remember a single entry can take more than one line
- unsigned int page_count = 0, page_start = 0;
+ unsigned int pageCount = 0, pageStart = 0;
// Start from line 0, page 0 and scan the list of entries
- for (unsigned int i = 0, line_count = 0; i < q._text.size(); ++i) {
+ for (unsigned int i = 0, lineCount = 0; i < q._text.size(); ++i) {
// Increment the number of lines by one text entry
- line_count += (q._text[i].size() / _line.x) + 1;
+ lineCount += (q._text[i].size() / _line.x) + 1;
// If we go over the quota for lines per page, go to next page and reset line counter to 0
- if (line_count > lines_per_page) {
+ if (lineCount > _linesPerPage) {
// We are about to go to next page, stop at this entry
- if (page_count == current_page) {
- start = page_start;
- stop = i;
+ if (pageCount == _currentPage) {
+ _start = pageStart;
+ _stop = i;
}
- page_count++;
- line_count = 0;
+ pageCount++;
+ lineCount = 0;
// This is the start of the next page
- page_start = i;
+ pageStart = i;
}
}
// Used for the final page, because the page count won't be incremented for the last one
- if (page_count == current_page) {
- start = page_start;
- stop = q._text.size();
+ if (pageCount == _currentPage) {
+ _start = pageStart;
+ _stop = q._text.size();
}
// Find out how many pages the lines need
- total_page = page_count + 1;
+ _totalPage = pageCount + 1;
// Update the text
- status._text = (NumberToString(current_page + 1) + " of " + NumberToString(total_page));
+ _status._text = (NumberToString(_currentPage + 1) + " of " + NumberToString(_totalPage));
// Now, start drawing the quest
- status.draw();
+ _status.draw();
- if (current_page > 0)
- prev.draw();
+ if (_currentPage > 0)
+ _prev.draw();
- if (current_page < total_page - 1)
- next.draw();
+ if (_currentPage < _totalPage - 1)
+ _next.draw();
// Draw the current page of quest text
if (!q._text.empty()) {
// Count the number of lines, because a single entry can take more than one line
int count = 0;
- for (unsigned int i = start; i < (unsigned int)stop; ++i) {
- img.draw(inc.x * count, inc.y * count);
+ for (unsigned int i = _start; i < (unsigned int)_stop; ++i) {
+ _img.draw(_inc.x * count, _inc.y * count);
// Draw first entry in selected color, and older quest entries in standard color
if (i == 0)
- g_engine->_textManager->draw(x, y, q._text[i], col_s, _font, _align, _line.x, _line.y);
+ g_engine->_textManager->draw(x, y, q._text[i], _colS, _font, _align, _line.x, _line.y);
else
- ParagraphData::draw(q._text[i], inc.x * count, inc.y * count);
+ ParagraphData::draw(q._text[i], _inc.x * count, _inc.y * count);
// Count is reduced extra by the amount of lines it takes for the message to be drawn
count += (q._text[i].size() / _line.x) + 1;
@@ -136,15 +136,15 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
}
}
-void QuestText::handleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event) {
- if (current_page > 0 && prev.handleEvents(Event) == BUAC_LCLICK)
- current_page--;
+void QuestText::handleEvents(pyrodactyl::event::Quest &q, const Common::Event &event) {
+ if (_currentPage > 0 && _prev.handleEvents(event) == BUAC_LCLICK)
+ _currentPage--;
- if (current_page < total_page - 1 && next.handleEvents(Event) == BUAC_LCLICK) {
- current_page++;
+ if (_currentPage < _totalPage - 1 && _next.handleEvents(event) == BUAC_LCLICK) {
+ _currentPage++;
- if (current_page >= total_page)
- current_page = total_page - 1;
+ if (_currentPage >= _totalPage)
+ _currentPage = _totalPage - 1;
}
}
@@ -168,10 +168,10 @@ void QuestText::handleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event
void QuestText::setUI() {
ParagraphData::setUI();
- img.setUI();
- prev.setUI();
- next.setUI();
- status.setUI();
+ _img.setUI();
+ _prev.setUI();
+ _next.setUI();
+ _status.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index f21e44cd804..7011690af7f 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -44,45 +44,47 @@ namespace ui {
class QuestText : public ParagraphData {
protected:
// How much the text and bullet positions change per line
- Vector2i inc;
+ Vector2i _inc;
// Color of the highlighted quest
- int col_s;
+ int _colS;
// The coordinates for drawing image, which is like bullet points in the form of <Bullet> <Text>
- ImageData img;
+ ImageData _img;
// The lines per page, we split the quest text into multiple pages if we have to draw more than that
- unsigned int lines_per_page;
+ unsigned int _linesPerPage;
// Keep track of which page we are at, and total pages
- unsigned int current_page, total_page;
+ unsigned int _currentPage, _totalPage;
// The quest entries we start and stop the drawing at
- int start, stop;
+ int _start, _stop;
// The buttons for cycling between pages of the menu
- Button prev, next;
+ Button _prev, _next;
// Display "Page 1 of 3" style information for the menu
- HoverInfo status;
+ HoverInfo _status;
public:
QuestText() {
- col_s = 0;
- current_page = 0;
- start = 0;
- stop = 0;
- total_page = 1;
- lines_per_page = 10;
+ _colS = 0;
+ _currentPage = 0;
+ _start = 0;
+ _stop = 0;
+ _totalPage = 1;
+ _linesPerPage = 10;
}
void load(rapidxml::xml_node<char> *node);
// Reset the value of current page
- void reset() { current_page = 0; }
+ void reset() {
+ _currentPage = 0;
+ }
- void handleEvents(pyrodactyl::event::Quest &q, const Common::Event &Event);
+ void handleEvents(pyrodactyl::event::Quest &q, const Common::Event &event);
#if 0
void handleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event);
#endif
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index f961f93af32..81029183363 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -40,33 +40,36 @@ namespace pyrodactyl {
namespace ui {
class RadioButtonMenu : public Menu<RadioButton> {
// The description of the menu
- HoverInfo desc;
+ HoverInfo _desc;
// The selected radio button
- int select;
+ int _select;
public:
- RadioButtonMenu() { select = 0; }
+ RadioButtonMenu() {
+ _select = 0;
+ }
+
~RadioButtonMenu() {}
void load(rapidxml::xml_node<char> *node) {
if (nodeValid("desc", node))
- desc.load(node->first_node("desc"));
+ _desc.load(node->first_node("desc"));
if (nodeValid("menu", node))
Menu::load(node->first_node("menu"));
}
- void draw(const int &XOffset = 0, const int &YOffset = 0) {
- desc.draw(XOffset, YOffset);
- Menu::draw(XOffset, YOffset);
+ void draw(const int &xOffset = 0, const int &yOffset = 0) {
+ _desc.draw(xOffset, yOffset);
+ Menu::draw(xOffset, yOffset);
}
- int handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
- int result = Menu::handleEvents(Event, XOffset, YOffset);
+ int handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0) {
+ int result = Menu::handleEvents(event, xOffset, yOffset);
if (result >= 0) {
- select = result;
+ _select = result;
for (int i = 0; i < (int)_element.size(); ++i)
_element[i]._state = (i == result);
@@ -92,7 +95,7 @@ public:
void setUI() {
Menu::setUI();
- desc.setUI();
+ _desc.setUI();
}
};
} // End of namespace ui
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 52af018dbe2..68744c5e2d8 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -66,7 +66,7 @@ void ReplyButton::draw(const int &xOffset, const int &yOffset) {
}
}
-void ReplyButton::Cache(const Common::String &val, const int &spacing, const int &bottomEdge, Rect *parent) {
+void ReplyButton::cache(const Common::String &val, const int &spacing, const int &bottomEdge, Rect *parent) {
_text = val;
// Find out about the font
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index 68db40c649d..29c0baa5c83 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -72,7 +72,7 @@ public:
// Used to calculate size and set the string
// Spacing is the minimum space between buttons added in case of overflow
// Bottom edge is the y+h value of the previous choice
- void Cache(const Common::String &val, const int &spacing, const int &bottomEdge, Rect *parent);
+ void cache(const Common::String &val, const int &spacing, const int &bottomEdge, Rect *parent);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index e68dcbc93c7..469425f83f7 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -46,43 +46,43 @@ void ReplyMenu::load(const Common::String &filename) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("conversation");
if (nodeValid(node)) {
if (nodeValid("tone", node))
- tone.load(node->first_node("tone"));
+ _tone.load(node->first_node("tone"));
if (nodeValid("reply", node)) {
rapidxml::xml_node<char> *replynode = node->first_node("reply");
Menu<ReplyButton>::load(replynode->first_node("menu"));
- tone._value.resize(_element.size());
+ _tone._value.resize(_element.size());
- bg.load(replynode->first_node("bg"));
- loadNum(spacing, "spacing", replynode);
+ _bg.load(replynode->first_node("bg"));
+ loadNum(_spacing, "spacing", replynode);
}
}
}
}
-int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event) {
+int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::String &curId, PersonHandler &oh, const Common::Event &Event) {
// After that, check if the user has clicked on any reply option
int choice = Menu<ReplyButton>::handleEvents(Event);
if (choice >= 0 && (unsigned int)choice < dat._reply.size()) {
- bool play_sound = false;
+ bool playSound = false;
// Loop through any opinion changes required
for (auto &i : dat._reply[_element[choice]._index]._change) {
- if (i._id == cur_id) {
+ if (i._id == curId) {
// This is a special case because we also need to update the opinion bars
oh.opinionChange(info, i._id, OPI_LIKE, i._val[OPI_LIKE]);
oh.opinionChange(info, i._id, OPI_RESPECT, i._val[OPI_RESPECT]);
oh.opinionChange(info, i._id, OPI_FEAR, i._val[OPI_FEAR]);
- play_sound = true;
+ playSound = true;
} else {
info.opinionChange(i._id, OPI_LIKE, i._val[OPI_LIKE]);
info.opinionChange(i._id, OPI_RESPECT, i._val[OPI_RESPECT]);
info.opinionChange(i._id, OPI_FEAR, i._val[OPI_FEAR]);
- play_sound = true;
+ playSound = true;
}
}
- (void)play_sound;
+ (void)playSound;
#if 0
// Right now we play sound randomly
@@ -139,51 +139,51 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
#endif
void ReplyMenu::draw() {
- bg.draw();
- tone.draw(_hoverIndex);
+ _bg.draw();
+ _tone.draw(_hoverIndex);
// Draw the reply options
Menu<ReplyButton>::draw();
}
-void ReplyMenu::Cache(Info &info, ConversationData &dat) {
+void ReplyMenu::cache(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat) {
// Some replies are locked, which means the other replies move up and take their place -
// which is why we need two count variables
- unsigned int reply_count = 0, element_count = 0;
+ unsigned int replyCount = 0, elementCount = 0;
- for (auto i = dat._reply.begin(); i != dat._reply.end() && reply_count < dat._reply.size(); ++i, ++reply_count) {
+ for (auto i = dat._reply.begin(); i != dat._reply.end() && replyCount < dat._reply.size(); ++i, ++replyCount) {
if (i->_unlock.evaluate(info)) {
- _element[element_count]._visible = true;
- _element[element_count]._index = reply_count;
+ _element[elementCount]._visible = true;
+ _element[elementCount]._index = replyCount;
- tone._value[element_count] = dat._reply[reply_count]._tone;
+ _tone._value[elementCount] = dat._reply[replyCount]._tone;
- const InputType type = static_cast<InputType>(IU_REPLY_0 + element_count);
+ const InputType type = static_cast<InputType>(IU_REPLY_0 + elementCount);
Common::String text = g_engine->_inputManager->getAssociatedKey(type);
text += ". " + i->_text;
info.insertName(text);
- if (element_count == 0)
- _element[element_count].Cache(text, spacing, 0, &bg);
+ if (elementCount == 0)
+ _element[elementCount].cache(text, _spacing, 0, &_bg);
else
- _element[element_count].Cache(text, spacing, _element[element_count - 1].y + _element[element_count - 1].h, &bg);
+ _element[elementCount].cache(text, _spacing, _element[elementCount - 1].y + _element[elementCount - 1].h, &_bg);
// Increment the element count only if the reply is unlocked
// This means we will keep checking against element 0 until we find an unlocked reply
// e.g. if replies 0,1,2 are locked, then element[0] will get reply[3]
- element_count++;
+ elementCount++;
}
}
// Unused element buttons are hidden
- for (; element_count < _element.size(); element_count++)
- _element[element_count]._visible = false;
+ for (; elementCount < _element.size(); elementCount++)
+ _element[elementCount]._visible = false;
}
void ReplyMenu::setUI() {
Menu<ReplyButton>::setUI();
- bg.setUI();
- tone.setUI();
+ _bg.setUI();
+ _tone.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index 75241d7503e..2825111755f 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -47,29 +47,32 @@ namespace pyrodactyl {
namespace ui {
class ReplyMenu : public Menu<ReplyButton> {
// Data about the background image
- ImageData bg;
+ ImageData _bg;
// The minimum spacing between two reply choices
- int spacing;
+ int _spacing;
// The emotion indicator used to indicate the type of reply selected
- EmotionIndicator tone;
+ EmotionIndicator _tone;
public:
- ReplyMenu() { spacing = 20; }
+ ReplyMenu() {
+ _spacing = 20;
+ }
+
~ReplyMenu() {}
void load(const Common::String &filename);
int handleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
- const Common::String &cur_id, PersonHandler &oh, const Common::Event &Event);
+ const Common::String &curId, PersonHandler &oh, const Common::Event &Event);
#if 0
int handleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event);
#endif
void draw();
- void Cache(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat);
+ void cache(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat);
void setUI();
};
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 7e0fed51c26..1dea4d586dd 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -38,33 +38,33 @@ using namespace pyrodactyl::text;
using namespace pyrodactyl::ui;
void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
- cancel.load(node->first_node("cancel"));
- change.load(node->first_node("change"));
- custom.load(node->first_node("custom"));
+ _cancel.load(node->first_node("cancel"));
+ _change.load(node->first_node("change"));
+ _custom.load(node->first_node("custom"));
- info.load(node->first_node("info"));
- def_info = info._text;
+ _info.load(node->first_node("info"));
+ _defInfo = _info._text;
if (nodeValid("reference", node))
- ref.load(node->first_node("reference"));
+ _ref.load(node->first_node("reference"));
if (nodeValid("inc", node)) {
- inc.load(node->first_node("inc"));
- loadNum(columns, "columns", node->first_node("inc"));
+ _inc.load(node->first_node("inc"));
+ loadNum(_columns, "columns", node->first_node("inc"));
}
if (nodeValid("options", node)) {
- int count_slot = 0;
+ int countSlot = 0;
rapidxml::xml_node<char> *resnode = node->first_node("options");
- for (auto n = resnode->first_node("res"); n != NULL; n = n->next_sibling("res"), count_slot++) {
+ for (auto n = resnode->first_node("res"); n != NULL; n = n->next_sibling("res"), countSlot++) {
Dimension d;
loadNum(d.w, "x", n);
loadNum(d.h, "y", n);
if (g_engine->_screenSettings->ValidDimension(d)) {
- dim.push_back(d);
+ _dim.push_back(d);
Button b;
- b.init(ref, inc.x * (count_slot % columns), inc.y * (count_slot / columns));
+ b.init(_ref, _inc.x * (countSlot % _columns), _inc.y * (countSlot / _columns));
b._caption._text = NumberToString(d.w);
b._caption._text += " x ";
b._caption._text += NumberToString(d.h);
@@ -73,50 +73,50 @@ void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
}
}
- SetInfo();
+ setInfo();
loadBool(_useKeyboard, "keyboard", node, false);
assignPaths();
}
void ResolutionMenu::draw() {
- info.draw();
+ _info.draw();
- switch (state) {
+ switch (_state) {
case STATE_NORMAL:
- change.draw();
+ _change.draw();
break;
case STATE_CHANGE:
Menu::draw();
- cancel.draw();
- custom.draw();
+ _cancel.draw();
+ _custom.draw();
break;
default:
break;
}
}
-int ResolutionMenu::handleEvents(const Common::Event &Event) {
- switch (state) {
+int ResolutionMenu::handleEvents(const Common::Event &event) {
+ switch (_state) {
case STATE_NORMAL:
- if (change.handleEvents(Event) == BUAC_LCLICK)
- state = STATE_CHANGE;
+ if (_change.handleEvents(event) == BUAC_LCLICK)
+ _state = STATE_CHANGE;
break;
case STATE_CHANGE: {
- int choice = Menu::handleEvents(Event);
+ int choice = Menu::handleEvents(event);
if (choice >= 0) {
- g_engine->_screenSettings->cur = dim[choice];
- state = STATE_NORMAL;
+ g_engine->_screenSettings->cur = _dim[choice];
+ _state = STATE_NORMAL;
return 1;
}
- if (custom.handleEvents(Event) == BUAC_LCLICK) {
- state = STATE_NORMAL;
+ if (_custom.handleEvents(event) == BUAC_LCLICK) {
+ _state = STATE_NORMAL;
return 2;
}
- if (cancel.handleEvents(Event) == BUAC_LCLICK)
- state = STATE_NORMAL;
+ if (_cancel.handleEvents(event) == BUAC_LCLICK)
+ _state = STATE_NORMAL;
} break;
default:
break;
@@ -156,20 +156,20 @@ int ResolutionMenu::handleEvents(const SDL_Event &Event) {
}
#endif
-void ResolutionMenu::SetInfo() {
- info._text = def_info;
- info._text += NumberToString(g_engine->_screenSettings->cur.w);
- info._text += " x ";
- info._text += NumberToString(g_engine->_screenSettings->cur.h);
+void ResolutionMenu::setInfo() {
+ _info._text = _defInfo;
+ _info._text += NumberToString(g_engine->_screenSettings->cur.w);
+ _info._text += " x ";
+ _info._text += NumberToString(g_engine->_screenSettings->cur.h);
}
void ResolutionMenu::setUI() {
- cancel.setUI();
- change.setUI();
- custom.setUI();
+ _cancel.setUI();
+ _change.setUI();
+ _custom.setUI();
- info.setUI();
- ref.setUI();
+ _info.setUI();
+ _ref.setUI();
ButtonMenu::setUI();
}
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 3572e0da19a..3c23a00d7f9 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -43,28 +43,28 @@ class ResolutionMenu : public ButtonMenu {
enum State {
STATE_NORMAL,
STATE_CHANGE
- } state;
+ } _state;
- HoverInfo info;
- Common::String def_info;
- Button change, cancel, custom;
+ HoverInfo _info;
+ Common::String _defInfo;
+ Button _change, _cancel, _custom;
// Menu stores the button for each of the item in the dimension array
- Common::Array<Dimension> dim;
+ Common::Array<Dimension> _dim;
// The reference button for resolution
- Button ref;
+ Button _ref;
// How much the button is incremented by
- Vector2i inc;
+ Vector2i _inc;
// The number of rows and columns
- int columns;
+ int _columns;
public:
ResolutionMenu(void) {
- state = STATE_NORMAL;
- columns = 1;
+ _state = STATE_NORMAL;
+ _columns = 1;
}
~ResolutionMenu(void) {}
@@ -72,12 +72,12 @@ public:
void draw();
// Return 1 if one of resolution buttons is pressed, 2 if custom button is pressed, 0 otherwise
- int handleEvents(const Common::Event &Event);
+ int handleEvents(const Common::Event &event);
#if 0
int handleEvents(const SDL_Event &Event);
#endif
- void SetInfo();
+ void setInfo();
void setUI();
};
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 8bdc8b36d70..280c8185d76 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -37,14 +37,14 @@ using namespace pyrodactyl::input;
void GameSaveMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("name", node))
- ta_name.load(node->first_node("name"));
+ _taName.load(node->first_node("name"));
FileMenu<SaveFileData>::load(node);
}
-void GameSaveMenu::AddButton(const Common::String &p, unsigned int &slot_index, unsigned int &menu_index) {
+void GameSaveMenu::addButton(const Common::String &p, unsigned int &slotIndex, unsigned int &menuIndex) {
_slotInfo.push_back(SaveFileData(p));
- _menu.add(slot_index, menu_index);
+ _menu.add(slotIndex, menuIndex);
}
void GameSaveMenu::scanDir() {
@@ -55,13 +55,13 @@ void GameSaveMenu::scanDir() {
_slotInfo.clear();
_menu.clear();
- unsigned int count_slot = 0, count_menu = 0;
+ unsigned int countSlot = 0, countMenu = 0;
// For the save menu, the first slot is a "blank" slot - to create a new save file
- AddButton("CRAB_New Save" + g_engine->_filePath->save_ext, count_menu, count_slot);
+ addButton("CRAB_New Save" + g_engine->_filePath->save_ext, countMenu, countSlot);
for (const Common::String& save : saves) {
- AddButton(save, count_menu, count_slot);
+ addButton(save, countMenu, countSlot);
}
_menu.assignPaths();
@@ -69,41 +69,41 @@ void GameSaveMenu::scanDir() {
bool GameSaveMenu::handleEvents(const Common::Event &Event) {
int choice = -1;
- switch (state) {
+ switch (_state) {
case STATE_NORMAL:
choice = _menu.handleEvents(Event);
if (choice >= 0) {
- ta_name.x = _menu.curX(choice) + tdB[DATA_SAVENAME].x;
- ta_name.y = _menu.curY(choice) + tdB[DATA_SAVENAME].y;
+ _taName.x = _menu.curX(choice) + tdB[DATA_SAVENAME].x;
+ _taName.y = _menu.curY(choice) + tdB[DATA_SAVENAME].y;
- index = _menu.index() + choice;
+ _index = _menu.index() + choice;
- if (index != 0)
- ta_name._text = _slotInfo[index]._name;
+ if (_index != 0)
+ _taName._text = _slotInfo[_index]._name;
else
- ta_name._text = "";
+ _taName._text = "";
- state = STATE_NAME;
+ _state = STATE_NAME;
}
break;
case STATE_NAME:
if (g_engine->_inputManager->getKeyBindingMode() != input::KBM_UI)
g_engine->_inputManager->setKeyBindingMode(KBM_UI);
- if (ta_name.handleEvents(Event)) {
- if (index <= (int)_slotInfo.size() && index != 0)
- g_engine->getSaveFileManager()->removeSavefile(_slotInfo[index]._path);
+ if (_taName.handleEvents(Event)) {
+ if (_index <= (int)_slotInfo.size() && _index != 0)
+ g_engine->getSaveFileManager()->removeSavefile(_slotInfo[_index]._path);
- _selected = ta_name._text;
- state = STATE_NORMAL;
+ _selected = _taName._text;
+ _state = STATE_NORMAL;
reset();
g_engine->_inputManager->setKeyBindingMode(KBM_GAME);
return true;
}
if (g_engine->_inputManager->state(IU_BACK)) {
- ta_name._text = "New Save";
- state = STATE_NORMAL;
+ _taName._text = "New Save";
+ _state = STATE_NORMAL;
}
default:
break;
@@ -119,8 +119,8 @@ void GameSaveMenu::draw() {
float base_x = _menu.baseX(count), base_y = _menu.baseY(count);
tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
- if (i == (unsigned int)index && state == STATE_NAME)
- ta_name.draw();
+ if (i == (unsigned int)_index && _state == STATE_NAME)
+ _taName.draw();
else
tdB[DATA_SAVENAME].draw(_slotInfo[i]._name, base_x, base_y);
}
@@ -130,7 +130,7 @@ void GameSaveMenu::draw() {
void GameSaveMenu::setUI() {
FileMenu<SaveFileData>::setUI();
- ta_name.setUI();
+ _taName.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index aa66f586ccf..e651376c66e 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -43,25 +43,28 @@ class GameSaveMenu : public FileMenu<SaveFileData> {
enum State {
STATE_NORMAL,
STATE_NAME
- } state;
+ } _state;
// This stores the name of the save slot
- TextArea ta_name;
+ TextArea _taName;
// The index of the selected button
- int index;
+ int _index;
- void AddButton(const Common::String &p, unsigned int &slot_index, unsigned int &menu_index);
+ void addButton(const Common::String &p, unsigned int &slotIndex, unsigned int &menuIndex);
public:
GameSaveMenu() {
- state = STATE_NORMAL;
- index = 0;
+ _state = STATE_NORMAL;
+ _index = 0;
}
+
~GameSaveMenu() {}
void scanDir();
- bool DisableHotkeys() { return state == STATE_NAME; }
+ bool disableHotkeys() {
+ return _state == STATE_NAME;
+ }
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index b0555aae350..b2310b282f6 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -38,58 +38,58 @@ using namespace pyrodactyl::input;
void SlideShow::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
if (nodeValid("pos", node))
- pos.load(node->first_node("pos"));
+ _pos.load(node->first_node("pos"));
if (nodeValid("bg", node))
- bg.load(node->first_node("bg"));
+ _bg.load(node->first_node("bg"));
if (nodeValid("prev", node)) {
- prev.load(node->first_node("prev"));
- prev._hotkey.set(IU_PREV);
+ _prev.load(node->first_node("prev"));
+ _prev._hotkey.set(IU_PREV);
}
if (nodeValid("next", node)) {
- next.load(node->first_node("next"));
- next._hotkey.set(IU_NEXT);
+ _next.load(node->first_node("next"));
+ _next._hotkey.set(IU_NEXT);
}
- path.clear();
+ _path.clear();
for (auto n = node->first_node("slide"); n != NULL; n = n->next_sibling("slide")) {
Common::String p;
loadStr(p, "path", n);
- path.push_back(p);
+ _path.push_back(p);
}
- index = 0;
+ _index = 0;
- loadBool(usekeyboard, "keyboard", node, false);
+ loadBool(_usekeyboard, "keyboard", node, false);
}
}
void SlideShow::draw() {
- bg.draw();
- img.draw(pos.x, pos.y);
+ _bg.draw();
+ _img.draw(_pos.x, _pos.y);
- if (index > 0)
- prev.draw();
+ if (_index > 0)
+ _prev.draw();
- if (index < path.size() - 1)
- next.draw();
+ if (_index < _path.size() - 1)
+ _next.draw();
}
void SlideShow::handleEvents(const Common::Event &Event) {
using namespace pyrodactyl::input;
- if (index > 0)
- if (prev.handleEvents(Event) == BUAC_LCLICK) {
- index--;
- Refresh();
+ if (_index > 0)
+ if (_prev.handleEvents(Event) == BUAC_LCLICK) {
+ _index--;
+ refresh();
}
- if (index < path.size() - 1)
- if (next.handleEvents(Event) == BUAC_LCLICK) {
- index++;
- Refresh();
+ if (_index < _path.size() - 1)
+ if (_next.handleEvents(Event) == BUAC_LCLICK) {
+ _index++;
+ refresh();
}
}
@@ -111,8 +111,8 @@ void SlideShow::handleEvents(const SDL_Event &Event) {
}
#endif
-void SlideShow::Refresh() {
- warning("SlideShow::Refresh()");
+void SlideShow::refresh() {
+ warning("SlideShow::refresh()");
#if 0
img.Delete();
@@ -123,10 +123,10 @@ void SlideShow::Refresh() {
}
void SlideShow::setUI() {
- pos.setUI();
- bg.setUI();
- prev.setUI();
- next.setUI();
+ _pos.setUI();
+ _bg.setUI();
+ _prev.setUI();
+ _next.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 0d60ae03f58..f883deba171 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -42,32 +42,37 @@ namespace pyrodactyl {
namespace ui {
class SlideShow {
// The list of images and where they are located, and the current image
- Common::Array<Common::String> path;
+ Common::Array<Common::String> _path;
// We only load the current image in memory
- pyrodactyl::image::Image img;
+ pyrodactyl::image::Image _img;
// The index of our current image
- unsigned int index;
+ unsigned int _index;
// The position at which map image has to be drawn
- Element pos;
+ Element _pos;
// Background image of the slide show
- ImageData bg;
+ ImageData _bg;
- Button prev, next;
- bool usekeyboard;
+ Button _prev, _next;
+ bool _usekeyboard;
public:
SlideShow() {
- index = 0;
- usekeyboard = false;
+ _index = 0;
+ _usekeyboard = false;
}
- ~SlideShow() { Clear(); }
- void Refresh();
- void Clear() { img.deleteImage(); }
+ ~SlideShow() {
+ clear();
+ }
+
+ void refresh();
+ void clear() {
+ _img.deleteImage();
+ }
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index d992a902b38..d36abd88289 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -38,64 +38,64 @@ using namespace pyrodactyl::ui;
void TraitMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("dim", node)) {
rapidxml::xml_node<char> *dimnode = node->first_node("dim");
- loadNum(rows, "rows", dimnode);
- loadNum(cols, "cols", dimnode);
- size = rows * cols;
+ loadNum(_rows, "rows", dimnode);
+ loadNum(_cols, "cols", dimnode);
+ _size = _rows * _cols;
}
if (nodeValid("ref", node))
- ref.load(node->first_node("ref"));
+ _ref.load(node->first_node("ref"));
if (nodeValid("inc", node))
- inc.load(node->first_node("inc"));
+ _inc.load(node->first_node("inc"));
if (nodeValid("desc", node))
- desc.load(node->first_node("desc"));
+ _desc.load(node->first_node("desc"));
- for (unsigned int i = 0; i < size; ++i) {
+ for (unsigned int i = 0; i < _size; ++i) {
TraitButton b;
- b.init(ref, inc.x * (i % cols), inc.y * (i / cols));
- menu._element.push_back(b);
+ b.init(_ref, _inc.x * (i % _cols), _inc.y * (i / _cols));
+ _menu._element.push_back(b);
}
bool usekey = false;
loadBool(usekey, "keyboard", node);
- menu.useKeyboard(usekey);
+ _menu.useKeyboard(usekey);
- menu.assignPaths();
+ _menu.assignPaths();
}
void TraitMenu::draw(const pyrodactyl::people::Person *obj) {
if (obj != nullptr) {
- auto i = menu._element.begin();
- for (auto t = obj->_trait.begin(); t != obj->_trait.end() && i != menu._element.end(); ++t, ++i) {
+ auto i = _menu._element.begin();
+ for (auto t = obj->_trait.begin(); t != obj->_trait.end() && i != _menu._element.end(); ++t, ++i) {
i->draw();
if (t->_unread)
g_engine->_imageManager->notifyDraw(i->x + i->w, i->y);
}
- for (; i != menu._element.end(); ++i)
+ for (; i != _menu._element.end(); ++i)
i->draw();
- if (select > -1 && (unsigned int)select < obj->_trait.size())
- desc.draw(obj->_trait[select]._desc);
+ if (_select > -1 && (unsigned int)_select < obj->_trait.size())
+ _desc.draw(obj->_trait[_select]._desc);
} else
- for (auto &i : menu._element)
+ for (auto &i : _menu._element)
i.draw();
}
-void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event) {
- int choice = menu.handleEvents(Event);
+void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const Common::Event &event) {
+ int choice = _menu.handleEvents(event);
if (choice >= 0) {
- for (auto i = menu._element.begin(); i != menu._element.end(); ++i)
+ for (auto i = _menu._element.begin(); i != _menu._element.end(); ++i)
i->state(false);
- menu._element[choice].state(true);
- select = choice;
+ _menu._element[choice].state(true);
+ _select = choice;
if (obj != nullptr) {
- if (select > -1 && (unsigned int)select < obj->_trait.size())
- obj->_trait[select]._unread = false;
+ if (_select > -1 && (unsigned int)_select < obj->_trait.size())
+ obj->_trait[_select]._unread = false;
}
}
}
@@ -118,25 +118,25 @@ void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const SDL_Event &E
}
#endif
-void TraitMenu::Cache(const pyrodactyl::people::Person &obj) {
- auto e = menu._element.begin();
+void TraitMenu::cache(const pyrodactyl::people::Person &obj) {
+ auto e = _menu._element.begin();
- for (auto i = obj._trait.begin(); i != obj._trait.end() && e != menu._element.end(); ++i, ++e)
+ for (auto i = obj._trait.begin(); i != obj._trait.end() && e != _menu._element.end(); ++i, ++e)
e->cache(*i);
- for (; e != menu._element.end(); ++e)
+ for (; e != _menu._element.end(); ++e)
e->empty();
}
-void TraitMenu::Clear() {
- for (auto e = menu._element.begin(); e != menu._element.end(); ++e)
+void TraitMenu::clear() {
+ for (auto e = _menu._element.begin(); e != _menu._element.end(); ++e)
e->empty();
}
void TraitMenu::setUI() {
- ref.setUI();
- desc.setUI();
- menu.setUI();
+ _ref.setUI();
+ _desc.setUI();
+ _menu.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index 7e6e3f6ac6f..951baf43eb7 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -43,44 +43,48 @@ namespace pyrodactyl {
namespace ui {
class TraitMenu {
// The menu for displaying all the traits
- Menu<TraitButton> menu;
+ Menu<TraitButton> _menu;
// The reference button (from which all buttons are initialized)
- TraitButton ref;
+ TraitButton _ref;
// This vector stores the increments in x,y for each new button
- Vector2i inc;
+ Vector2i _inc;
// How to draw the selected trait description
- ParagraphData desc;
+ ParagraphData _desc;
// The selected trait, and size of the menu
- int select;
+ int _select;
// The size and dimensions of the menu
- unsigned int size, rows, cols;
+ unsigned int _size, _rows, _cols;
public:
TraitMenu() {
- select = -1;
- size = 1;
- rows = 1;
- cols = 1;
+ _select = -1;
+ _size = 1;
+ _rows = 1;
+ _cols = 1;
}
+
~TraitMenu() {}
- void reset() { select = -1; }
- void Clear();
+ void reset() {
+ _select = -1;
+ }
+
+ void clear();
void load(rapidxml::xml_node<char> *node);
void draw(const pyrodactyl::people::Person *obj);
- void handleEvents(pyrodactyl::people::Person *obj, const Common::Event &Event);
+ void handleEvents(pyrodactyl::people::Person *obj, const Common::Event &event);
#if 0
void handleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event);
#endif
- void Cache(const pyrodactyl::people::Person &obj);
+ void cache(const pyrodactyl::people::Person &obj);
void setUI();
};
} // End of namespace ui
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index d4dfb273a48..12fcf8ccf92 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -78,8 +78,8 @@ void Journal::init(const Common::String &id) {
g._id = id;
for (int i = 0; i < JE_TOTAL; ++i) {
g._menu[i] = _ref;
- g._menu[i].UseKeyboard(true);
- g._menu[i].AssignPaths();
+ g._menu[i].useKeyboard(true);
+ g._menu[i].assignPaths();
}
_journal.push_back(g);
}
@@ -98,7 +98,7 @@ void Journal::select(const Common::String &id, const int &choice) {
// Always find valid journal group first
for (auto &jo : _journal)
if (jo._id == id) {
- jo._menu[choice].unread = false;
+ jo._menu[choice]._unread = false;
break;
}
}
@@ -115,7 +115,7 @@ void Journal::draw(const Common::String &id) {
if (jo._id == id) {
int count = 0;
for (auto i = _category._element.begin(); i != _category._element.end() && count < JE_TOTAL; ++i, ++count)
- if (jo._menu[count].unread)
+ if (jo._menu[count]._unread)
g_engine->_imageManager->notifyDraw(i->x + i->w, i->y);
if (_select >= 0 && _select < JE_TOTAL)
@@ -173,15 +173,15 @@ void Journal::add(const Common::String &id, const Common::String &category, cons
for (auto &jo : _journal)
if (jo._id == id) {
if (category == JE_CUR_NAME) {
- jo._menu[JE_CUR].Add(title, text);
+ jo._menu[JE_CUR].add(title, text);
} else if (category == JE_DONE_NAME) {
- jo._menu[JE_DONE].Add(title, text);
+ jo._menu[JE_DONE].add(title, text);
} else if (category == JE_PEOPLE_NAME) {
- jo._menu[JE_PEOPLE].Add(title, text);
+ jo._menu[JE_PEOPLE].add(title, text);
} else if (category == JE_LOCATION_NAME) {
- jo._menu[JE_LOCATION].Add(title, text);
+ jo._menu[JE_LOCATION].add(title, text);
} else if (category == JE_HISTORY_NAME) {
- jo._menu[JE_HISTORY].Add(title, text);
+ jo._menu[JE_HISTORY].add(title, text);
}
break;
@@ -195,7 +195,7 @@ void Journal::marker(const Common::String &id, const Common::String &title, cons
// Always find valid journal group first
for (auto &jo : _journal)
if (jo._id == id) {
- jo._menu[JE_CUR].Marker(title, val);
+ jo._menu[JE_CUR].marker(title, val);
break;
}
}
@@ -218,13 +218,13 @@ void Journal::move(const Common::String &id, const Common::String &title, const
if (jo._id == id) {
// Find the quest chain in the source menu
unsigned int index = 0;
- for (auto i = jo._menu[source].quest.begin(); i != jo._menu[source].quest.end(); ++i, ++index)
+ for (auto i = jo._menu[source]._quest.begin(); i != jo._menu[source]._quest.end(); ++i, ++index)
if (i->_title == title)
break;
- if (index < jo._menu[source].quest.size()) {
- jo._menu[destination].Add(jo._menu[source].quest[index]);
- jo._menu[source].Erase(index);
+ if (index < jo._menu[source]._quest.size()) {
+ jo._menu[destination].add(jo._menu[source]._quest[index]);
+ jo._menu[source].erase(index);
}
break;
@@ -245,10 +245,10 @@ void Journal::open(const Common::String &id, const JournalCategory &category, co
// Perform validity check on select, just in case
if (_select > 0 && _select < JE_TOTAL) {
// Search for the title with same name
- for (unsigned int num = 0; num < jo._menu[_select].quest.size(); ++num)
- if (jo._menu[_select].quest[num]._title == title) {
+ for (unsigned int num = 0; num < jo._menu[_select]._quest.size(); ++num)
+ if (jo._menu[_select]._quest[num]._title == title) {
// Found it, switch to this
- jo._menu[_select].Select(num);
+ jo._menu[_select].select(num);
break;
}
}
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 63b3809ed14..be4290b69f5 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -37,14 +37,14 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::event;
QuestMenu::QuestMenu() {
- sel_quest = -1;
- sel_page = -1;
- sel_bu = -1;
- align = ALIGN_LEFT;
- col_n = 0;
- col_s = 0;
- unread = false;
- font = 0;
+ _selQuest = -1;
+ _selPage = -1;
+ _selBu = -1;
+ _align = ALIGN_LEFT;
+ _colN = 0;
+ _colS = 0;
+ _unread = false;
+ _font = 0;
}
//------------------------------------------------------------------------
@@ -53,38 +53,38 @@ QuestMenu::QuestMenu() {
void QuestMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
if (nodeValid("menu", node))
- menu.load(node->first_node("menu"));
+ _menu.load(node->first_node("menu"));
if (nodeValid("tab", node)) {
rapidxml::xml_node<char> *tabnode = node->first_node("tab");
- loadNum(font, "font", tabnode);
- loadAlign(align, tabnode);
- off_title.load(tabnode);
- off_unread.load(tabnode->first_node("unread"));
+ loadNum(_font, "font", tabnode);
+ loadAlign(_align, tabnode);
+ _offTitle.load(tabnode);
+ _offUnread.load(tabnode->first_node("unread"));
if (nodeValid("normal", tabnode)) {
rapidxml::xml_node<char> *nornode = tabnode->first_node("normal");
- img_n.load(nornode);
+ _imgN.load(nornode);
//loadColor(col_n, nornode);
}
if (nodeValid("select", tabnode)) {
rapidxml::xml_node<char> *selnode = tabnode->first_node("select");
- img_s.load(selnode);
+ _imgS.load(selnode);
//loadColor(col_s, selnode);
}
}
if (nodeValid("text", node))
- text.load(node->first_node("text"));
+ _text.load(node->first_node("text"));
}
}
//------------------------------------------------------------------------
// Purpose: Add an entry to the menu
//------------------------------------------------------------------------
-void QuestMenu::Add(const Common::String &title, const Common::String &txt) {
- for (auto i = quest.begin(); i != quest.end(); ++i)
+void QuestMenu::add(const Common::String &title, const Common::String &txt) {
+ for (auto i = _quest.begin(); i != _quest.end(); ++i)
if (i->_title == title) // We already have the quest entry
{
i->_text.insert_at(0, txt); // Just add the new string to the start of the quest messages and return
@@ -93,59 +93,59 @@ void QuestMenu::Add(const Common::String &title, const Common::String &txt) {
}
Quest q(title, txt, true, false);
- quest.insert_at(0, q);
- menu.add();
- unread = true;
+ _quest.insert_at(0, q);
+ _menu.add();
+ _unread = true;
}
-void QuestMenu::Add(const pyrodactyl::event::Quest &q) {
- quest.insert_at(0, q);
- menu.add();
+void QuestMenu::add(const pyrodactyl::event::Quest &q) {
+ _quest.insert_at(0, q);
+ _menu.add();
}
//------------------------------------------------------------------------
// Purpose: Remove an entry from the menu
//------------------------------------------------------------------------
-void QuestMenu::Erase(const int &index) {
- quest.erase(quest.begin() + index);
- menu.erase();
+void QuestMenu::erase(const int &index) {
+ _quest.erase(_quest.begin() + index);
+ _menu.erase();
}
//------------------------------------------------------------------------
// Purpose: Indicate that this quest has an associated map marker in world map
//------------------------------------------------------------------------
-void QuestMenu::Marker(const Common::String &title, const bool &val) {
- for (auto i = quest.begin(); i != quest.end(); ++i)
+void QuestMenu::marker(const Common::String &title, const bool &val) {
+ for (auto i = _quest.begin(); i != _quest.end(); ++i)
if (i->_title == title)
i->_marker = val;
}
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
-void QuestMenu::draw(Button &bu_map) {
- menu.draw();
+void QuestMenu::draw(Button &buMap) {
+ _menu.draw();
using namespace pyrodactyl::text;
- for (auto i = menu.index(), count = 0u; i < menu.indexPlusOne() && i < quest.size(); i++, count++) {
- auto base_x = menu.baseX(count), base_y = menu.baseY(count);
+ for (auto i = _menu.index(), count = 0u; i < _menu.indexPlusOne() && i < _quest.size(); i++, count++) {
+ auto base_x = _menu.baseX(count), base_y = _menu.baseY(count);
// Only draw in _s color if we are on the same button and page
- if ((unsigned int)sel_bu == count && (unsigned int)sel_page == menu.currentPage())
- g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i]._title, col_s, font, align);
+ if ((unsigned int)_selBu == count && (unsigned int)_selPage == _menu.currentPage())
+ g_engine->_textManager->draw(base_x + _offTitle.x, base_y + _offTitle.y, _quest[i]._title, _colS, _font, _align);
else
- g_engine->_textManager->draw(base_x + off_title.x, base_y + off_title.y, quest[i]._title, col_n, font, align);
+ g_engine->_textManager->draw(base_x + _offTitle.x, base_y + _offTitle.y, _quest[i]._title, _colN, _font, _align);
- if (quest[i]._unread) {
+ if (_quest[i]._unread) {
using namespace pyrodactyl::image;
- g_engine->_imageManager->draw(base_x + off_unread.x, base_y + off_unread.y, g_engine->_imageManager->_notify);
+ g_engine->_imageManager->draw(base_x + _offUnread.x, base_y + _offUnread.y, g_engine->_imageManager->_notify);
}
}
- if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
- text.draw(quest[sel_quest]);
+ if (_selQuest >= 0 && (unsigned int)_selQuest < _quest.size()) {
+ _text.draw(_quest[_selQuest]);
- if (quest[sel_quest]._marker)
- bu_map.draw();
+ if (_quest[_selQuest]._marker)
+ buMap.draw();
}
}
@@ -153,30 +153,30 @@ void QuestMenu::draw(Button &bu_map) {
// Purpose: Handle user input
//------------------------------------------------------------------------
bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event) {
- int res = menu.handleEvents(Event);
+ int res = _menu.handleEvents(Event);
if (res != -1) {
- if (sel_bu >= 0 && sel_page >= 0)
- menu.image(sel_bu, sel_page, img_n);
+ if (_selBu >= 0 && _selPage >= 0)
+ _menu.image(_selBu, _selPage, _imgN);
- sel_bu = res;
- sel_page = menu.currentPage();
- sel_quest = menu.index() + sel_bu;
+ _selBu = res;
+ _selPage = _menu.currentPage();
+ _selQuest = _menu.index() + _selBu;
- quest[sel_quest]._unread = false;
- text.reset();
+ _quest[_selQuest]._unread = false;
+ _text.reset();
- menu.image(sel_bu, sel_page, img_s);
+ _menu.image(_selBu, _selPage, _imgS);
}
- if (sel_quest >= 0 && (unsigned int)sel_quest < quest.size()) {
- if (quest[sel_quest]._marker)
+ if (_selQuest >= 0 && (unsigned int)_selQuest < _quest.size()) {
+ if (_quest[_selQuest]._marker)
if (bu_map.handleEvents(Event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
- map_title = quest[sel_quest]._title;
+ map_title = _quest[_selQuest]._title;
return true;
}
- text.handleEvents(quest[sel_quest], Event);
+ _text.handleEvents(_quest[_selQuest], Event);
}
return false;
@@ -220,23 +220,23 @@ bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const SD
//------------------------------------------------------------------------
// Purpose: Select an entry
//------------------------------------------------------------------------
-void QuestMenu::Select(const int &quest_index) {
- if (quest_index >= 0 && (unsigned int)quest_index < quest.size()) {
- if (sel_bu >= 0 && sel_page >= 0)
- menu.image(sel_bu, sel_page, img_n);
+void QuestMenu::select(const int &questIndex) {
+ if (questIndex >= 0 && (unsigned int)questIndex < _quest.size()) {
+ if (_selBu >= 0 && _selPage >= 0)
+ _menu.image(_selBu, _selPage, _imgN);
- sel_quest = quest_index;
+ _selQuest = questIndex;
- sel_page = quest_index / menu.elementsPerPage();
- menu.currentPage(sel_page);
- menu.updateInfo();
+ _selPage = questIndex / _menu.elementsPerPage();
+ _menu.currentPage(_selPage);
+ _menu.updateInfo();
- sel_bu = quest_index % menu.elementsPerPage();
+ _selBu = questIndex % _menu.elementsPerPage();
- quest[quest_index]._unread = false;
- text.reset();
+ _quest[questIndex]._unread = false;
+ _text.reset();
- menu.image(sel_bu, sel_page, img_s);
+ _menu.image(_selBu, _selPage, _imgS);
}
}
@@ -246,9 +246,9 @@ void QuestMenu::Select(const int &quest_index) {
void QuestMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- saveBool(unread, "unread", doc, child);
+ saveBool(_unread, "unread", doc, child);
- for (auto q = quest.begin(); q != quest.end(); ++q)
+ for (auto q = _quest.begin(); q != _quest.end(); ++q)
q->saveState(doc, child);
root->append_node(child);
@@ -258,14 +258,14 @@ void QuestMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char
// Purpose: Load state from file
//------------------------------------------------------------------------
void QuestMenu::loadState(rapidxml::xml_node<char> *node) {
- loadBool(unread, "unread", node);
+ loadBool(_unread, "unread", node);
- quest.clear();
+ _quest.clear();
for (auto n = node->first_node("quest"); n != NULL; n = n->next_sibling("quest")) {
Quest q;
q.loadState(n);
- quest.push_back(q);
- menu.add();
+ _quest.push_back(q);
+ _menu.add();
}
}
@@ -273,8 +273,8 @@ void QuestMenu::loadState(rapidxml::xml_node<char> *node) {
// Purpose: Reposition UI elements
//------------------------------------------------------------------------
void QuestMenu::setUI() {
- menu.setUI();
- text.setUI();
+ _menu.setUI();
+ _text.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 3dcaf451553..b93ab3d89fe 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -43,55 +43,60 @@ namespace pyrodactyl {
namespace ui {
class QuestMenu {
// The collection of quest pages
- PageButtonMenu menu;
+ PageButtonMenu _menu;
// The currently selected quest for reading
- int sel_quest;
+ int _selQuest;
// The currently selected page
- int sel_page;
+ int _selPage;
// The currently selected button in the page menu
- int sel_bu;
+ int _selBu;
// For drawing quest text
- QuestText text;
+ QuestText _text;
// For drawing quest tabs
- FontKey font;
- Align align;
- int col_n, col_s;
- ButtonImage img_n, img_s;
- Vector2i off_title, off_unread;
+ FontKey _font;
+ Align _align;
+ int _colN, _colS;
+ ButtonImage _imgN, _imgS;
+ Vector2i _offTitle, _offUnread;
public:
// All the quests currently in this menu
- Common::Array<pyrodactyl::event::Quest> quest;
+ Common::Array<pyrodactyl::event::Quest> _quest;
// Keep track of unread notifications for each category button
- bool unread;
+ bool _unread;
QuestMenu();
~QuestMenu() {}
void load(rapidxml::xml_node<char> *node);
- void draw(Button &bu_map);
+ void draw(Button &buMap);
bool handleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event);
#if 0
bool handleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event);
#endif
- void UseKeyboard(const bool &val) { menu.useKeyboard(val); }
- void AssignPaths() { menu.assignPaths(); }
+ void useKeyboard(const bool &val) {
+ _menu.useKeyboard(val);
+ }
- void Marker(const Common::String &title, const bool &val);
+ void assignPaths() {
+ _menu.assignPaths();
+ }
- void Add(const Common::String &title, const Common::String &txt);
- void Add(const pyrodactyl::event::Quest &q);
- void Erase(const int &index);
+ void marker(const Common::String &title, const bool &val);
- void Select(const int &quest_index);
+ void add(const Common::String &title, const Common::String &txt);
+ void add(const pyrodactyl::event::Quest &q);
+ void erase(const int &index);
+
+ void select(const int &questIndex);
void saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_node<char> *root, const char *name);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index a6c6d0f77e3..28eb9b10815 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -37,49 +37,49 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::image;
using namespace pyrodactyl::input;
-void Slider::load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val) {
+void Slider::load(rapidxml::xml_node<char> *node, const int &min, const int &max, const int &val) {
if (nodeValid(node)) {
- knob.load(node->first_node("knob"), false);
- bar.load(node->first_node("bar"));
+ _knob.load(node->first_node("knob"), false);
+ _bar.load(node->first_node("bar"));
- knob.y = bar.y;
- knob.w = g_engine->_imageManager->getTexture(knob._img._normal).w();
- knob.h = g_engine->_imageManager->getTexture(knob._img._normal).h();
- knob._canmove = true;
+ _knob.y = _bar.y;
+ _knob.w = g_engine->_imageManager->getTexture(_knob._img._normal).w();
+ _knob.h = g_engine->_imageManager->getTexture(_knob._img._normal).h();
+ _knob._canmove = true;
- min = Min;
- max = Max;
- Value(Val);
+ _min = min;
+ _max = max;
+ _value = val;
- caption.load(node->first_node("caption"), &bar);
+ _caption.load(node->first_node("caption"), &_bar);
}
- CreateBackup();
+ createBackup();
}
bool Slider::handleEvents(const Common::Event &Event) {
// A person is moving the knob
- if (knob.handleEvents(Event) == BUAC_GRABBED) {
- int dx = g_engine->_mouse->_motion.x - bar.x;
+ if (_knob.handleEvents(Event) == BUAC_GRABBED) {
+ int dx = g_engine->_mouse->_motion.x - _bar.x;
if (dx < 0)
dx = 0;
- else if (dx > (bar.w - knob.w))
- dx = (bar.w - knob.w);
+ else if (dx > (_bar.w - _knob.w))
+ dx = (_bar.w - _knob.w);
- knob.x = bar.x + dx;
- knob.y = bar.y;
+ _knob.x = _bar.x + dx;
+ _knob.y = _bar.y;
- value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
+ _value = _min + (((_max - _min) * (_knob.x - _bar.x)) / (_bar.w - _knob.w));
return true;
}
// If a person clicks on the slider bar, the knob needs to travel there
- if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && bar.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
- knob.x = g_engine->_mouse->_button.x;
- knob.y = bar.y;
+ if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && _bar.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
+ _knob.x = g_engine->_mouse->_button.x;
+ _knob.y = _bar.y;
- value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
+ _value = _min + (((_max - _min) * (_knob.x - _bar.x)) / (_bar.w - _knob.w));
return true;
}
@@ -118,31 +118,31 @@ bool Slider::handleEvents(const SDL_Event &Event) {
#endif
void Slider::draw() {
- bar.draw();
- caption.draw(false);
- knob.draw();
+ _bar.draw();
+ _caption.draw(false);
+ _knob.draw();
}
-void Slider::Value(const int val) {
- value = val;
+void Slider::value(const int val) {
+ _value = val;
- if (value < min)
- value = min;
- else if (value > max)
- value = max;
+ if (_value < _min)
+ _value = _min;
+ else if (_value > _max)
+ _value = _max;
- knob.x = bar.x + ((bar.w - knob.w) * (value - min)) / (max - min);
+ _knob.x = _bar.x + ((_bar.w - _knob.w) * (_value - _min)) / (_max - _min);
}
void Slider::setUI() {
- bar.setUI();
- knob.setUI();
- caption.setUI(&bar);
-
- knob.x = bar.x + ((bar.w - knob.w) * value / (max - min));
- knob.y = bar.y;
- knob.w = g_engine->_imageManager->getTexture(knob._img._normal).w();
- knob.h = g_engine->_imageManager->getTexture(knob._img._normal).h();
+ _bar.setUI();
+ _knob.setUI();
+ _caption.setUI(&_bar);
+
+ _knob.x = _bar.x + ((_bar.w - _knob.w) * _value / (_max - _min));
+ _knob.y = _bar.y;
+ _knob.w = g_engine->_imageManager->getTexture(_knob._img._normal).w();
+ _knob.h = g_engine->_imageManager->getTexture(_knob._img._normal).h();
}
} // End of namespace Crab
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 2dc8d1730dc..96601795e66 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -43,30 +43,31 @@ namespace pyrodactyl {
namespace ui {
class Slider {
// The value of the slider and the backup
- int value, backup;
+ int _value, _backup;
// The slider bar position and dimensions
- ImageData bar;
+ ImageData _bar;
// The slider knob
- Button knob;
+ Button _knob;
// Caption for the slider
- Caption caption;
+ Caption _caption;
// The maximum and minimum values for the slider
- int max, min;
+ int _max, _min;
public:
Slider() {
- max = 100;
- min = 0;
- Value((max - min) / 2);
- backup = value;
+ _max = 100;
+ _min = 0;
+ _value = ((_max - _min) / 2);
+ _backup = _value;
}
+
~Slider() {}
- void load(rapidxml::xml_node<char> *node, const int &Min, const int &Max, const int &Val);
+ void load(rapidxml::xml_node<char> *node, const int &min, const int &max, const int &val);
bool handleEvents(const Common::Event &Event);
#if 0
@@ -76,11 +77,16 @@ public:
void draw();
- int Value() { return value; }
- void Value(const int val);
+ int Value() { return _value; }
+ void value(const int val);
+
+ void createBackup() {
+ _backup = _value;
+ }
- void CreateBackup() { backup = value; }
- void RestoreBackup() { Value(backup); }
+ void restoreBackup() {
+ _value = _backup;
+ }
void setUI();
};
Commit: a7e3ecff2aaf4ae3b234ee2e160253a90fa89739
https://github.com/scummvm/scummvm/commit/a7e3ecff2aaf4ae3b234ee2e160253a90fa89739
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make app class follow code formatting conventions
Changed paths:
engines/crab/app.cpp
engines/crab/app.h
engines/crab/crab.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index ae28e4fc5c1..ced4e054f41 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -33,7 +33,7 @@
namespace Crab {
-bool App::Init() {
+bool App::init() {
#if 0
// Load all SDL subsystems and the TrueType font subsystem
@@ -119,19 +119,19 @@ bool App::Init() {
#endif
// Initialize and load input
- LoadSettings("res/settings.xml");
+ loadSettings("res/settings.xml");
g_engine->_screenSettings->in_game = false;
return true;
}
-void App::Run() {
- Init();
+void App::run() {
+ init();
// State IDs
- GameStateID CurrentStateID = GAMESTATE_NULL, NextStateID = GAMESTATE_TITLE;
- bool ShouldChangeState = true;
+ GameStateID currentStateId = GAMESTATE_NULL, nextStateId = GAMESTATE_TITLE;
+ bool shouldChangeState = true;
// Set the current game state object
- GameState *CurrentState = NULL;
+ GameState *currentState = NULL;
Timer fps;
Common::Event e;
int fpscount = 0, fpsval = 1, lasts = 0;
@@ -139,25 +139,25 @@ void App::Run() {
_game = new Game();
// While the user hasn't quit - This is the main game loop
- while (CurrentStateID != GAMESTATE_EXIT && !SHOULD_QUIT) {
+ while (currentStateId != GAMESTATE_EXIT && !SHOULD_QUIT) {
// Start the frame timer
fps.Start();
// Change state if needed
- if (ShouldChangeState) {
+ if (shouldChangeState) {
// Delete the current state
- if (CurrentState != _game) {
- delete CurrentState;
- CurrentState = nullptr;
+ if (currentState != _game) {
+ delete currentState;
+ currentState = nullptr;
}
- if (NextStateID == GAMESTATE_EXIT)
+ if (nextStateId == GAMESTATE_EXIT)
break;
// Change the state
- switch (NextStateID) {
+ switch (nextStateId) {
case GAMESTATE_TITLE:
- CurrentState = new Splash();
+ currentState = new Splash();
g_engine->_screenSettings->in_game = false;
// Now apply all settings - except resolution because that's already set at the start
@@ -169,18 +169,18 @@ void App::Run() {
break;
case GAMESTATE_MAIN_MENU:
- CurrentState = new MainMenu();
+ currentState = new MainMenu();
g_engine->_screenSettings->in_game = false;
break;
case GAMESTATE_NEW_GAME:
_game->StartNewGame();
- CurrentState = _game;
+ currentState = _game;
g_engine->_screenSettings->in_game = true;
break;
case GAMESTATE_LOAD_GAME:
- CurrentState = _game;
+ currentState = _game;
g_engine->_screenSettings->in_game = true;
break;
@@ -190,17 +190,17 @@ void App::Run() {
}
// Change the current state ID
- CurrentStateID = NextStateID;
+ currentStateId = nextStateId;
// NULL the next state ID
- NextStateID = GAMESTATE_NULL;
+ nextStateId = GAMESTATE_NULL;
// No need to change state until further notice
- ShouldChangeState = false;
+ shouldChangeState = false;
}
// Do state InternalEvents
- CurrentState->internalEvents(ShouldChangeState, NextStateID);
+ currentState->internalEvents(shouldChangeState, nextStateId);
#if 0
while (SDL_PollEvent(&Event)) {
@@ -241,18 +241,18 @@ void App::Run() {
}
// Do state Event handling
- CurrentState->handleEvents(e, ShouldChangeState, NextStateID);
+ currentState->handleEvents(e, shouldChangeState, nextStateId);
}
// Do we have to reposition our interface?
if (g_engine->_screenSettings->change_interface) {
- CurrentState->setUI();
+ currentState->setUI();
g_engine->_screenSettings->change_interface = false;
}
// Do state Drawing
- CurrentState->draw();
+ currentState->draw();
#if 0
if (GameDebug) {
@@ -274,7 +274,7 @@ void App::Run() {
} else
++fpscount;
- if (CurrentStateID >= 0)
+ if (currentStateId >= 0)
g_engine->_textManager->draw(0, 0, NumberToString(fpsval).c_str(), 0);
//const Graphics::ManagedSurface *s = g_engine->_renderSurface;
//g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
@@ -296,12 +296,12 @@ void App::Run() {
}
}
- if (CurrentState != _game)
- delete CurrentState;
+ if (currentState != _game)
+ delete currentState;
delete _game;
}
-void App::LoadSettings(const Common::String &filename) {
+void App::loadSettings(const Common::String &filename) {
XMLDoc settings(filename);
if (settings.ready()) {
rapidxml::xml_node<char> *node = settings.doc()->first_node("settings");
diff --git a/engines/crab/app.h b/engines/crab/app.h
index e50dfbbd2a9..6a6f750d40b 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -49,7 +49,7 @@ class App {
private:
Game *_game;
- void LoadSettings(const Common::String &filename);
+ void loadSettings(const Common::String &filename);
public:
App(void) {
#if 0
@@ -61,9 +61,9 @@ public:
}
~App(void);
- bool Init();
- void Run();
- Game *GetGame() const {
+ bool init();
+ void run();
+ Game *getGame() const {
return _game;
}
};
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 5ad88313a9c..4585a91651f 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -146,7 +146,7 @@ Common::Error CrabEngine::run() {
_app = new App();
- _app->Run();
+ _app->run();
return Common::kNoError;
}
@@ -161,7 +161,7 @@ Common::Error CrabEngine::saveGameState(int slot, const Common::String &desc, bo
if (!saveFile)
return Common::kWritingFailed;
- _app->GetGame()->saveState(saveFile);
+ _app->getGame()->saveState(saveFile);
getMetaEngine()->appendExtendedSave(saveFile, getTotalPlayTime(), desc, isAutosave);
saveFile->finalize();
@@ -178,7 +178,7 @@ Common::Error CrabEngine::loadGameState(int slot) {
if (!saveFile)
return Common::kReadingFailed;
- _app->GetGame()->loadState(saveFile);
+ _app->getGame()->loadState(saveFile);
ExtendedSavegameHeader header;
if (MetaEngine::readSavegameHeader(saveFile, &header))
setTotalPlayTime(header.playtime);
Commit: 2451b030a8ca401898e6394cb493b58d17cc90cd
https://github.com/scummvm/scummvm/commit/2451b030a8ca401898e6394cb493b58d17cc90cd
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make collision.[cpp, h] follow code formatting conventions
Changed paths:
engines/crab/ai/spriteai.cpp
engines/crab/collision.cpp
engines/crab/collision.h
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 21ce87cc24a..d32e215b7af 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -168,7 +168,7 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
// Find the nearest exit
for (auto &i : areaExit) {
// Compare distance to the rough center of each exit
- int dist = Distance2D(_pos.x, _pos.y, i._dim.rect.x + i._dim.rect.w / 2, i._dim.rect.y + i._dim.rect.h / 2);
+ int dist = distance2D(_pos.x, _pos.y, i._dim.rect.x + i._dim.rect.w / 2, i._dim.rect.y + i._dim.rect.h / 2);
if (dist < min_dist) {
min_dist = dist;
diff --git a/engines/crab/collision.cpp b/engines/crab/collision.cpp
index 84a76e8886b..f9d3510ecf4 100644
--- a/engines/crab/collision.cpp
+++ b/engines/crab/collision.cpp
@@ -33,13 +33,13 @@
namespace Crab {
// Find if a line and a rectangle intersect
-bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect) {
+bool collideLineRect(int p0X, int p0Y, int p1X, int p1Y, const Rect &rect) {
int q0_x = rect.x;
int q0_y = rect.y;
int q1_x = rect.x + rect.w;
int q1_y = rect.y;
- if (CollideLine<int>(p0_x, p0_y, p1_x, p1_y, q0_x, q0_y, q1_x, q1_y))
+ if (CollideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
return true;
q0_x = rect.x;
@@ -47,7 +47,7 @@ bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect) {
q1_x = rect.x;
q1_y = rect.y + rect.h;
- if (CollideLine<int>(p0_x, p0_y, p1_x, p1_y, q0_x, q0_y, q1_x, q1_y))
+ if (CollideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
return true;
q0_x = rect.x + rect.w;
@@ -55,7 +55,7 @@ bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect) {
q1_x = rect.x + rect.w;
q1_y = rect.y + rect.h;
- if (CollideLine<int>(p0_x, p0_y, p1_x, p1_y, q0_x, q0_y, q1_x, q1_y))
+ if (CollideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
return true;
q0_x = rect.x;
@@ -63,20 +63,20 @@ bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect) {
q1_x = rect.x + rect.w;
q1_y = rect.y + rect.h;
- if (CollideLine<int>(p0_x, p0_y, p1_x, p1_y, q0_x, q0_y, q1_x, q1_y))
+ if (CollideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
return true;
return false;
}
// Find if there is a clear line of sight between two rectangles
-bool LineOfSight(const Rect &a, const Rect &b, const Rect &obstacle) {
+bool lineOfSight(const Rect &a, const Rect &b, const Rect &obstacle) {
int p0_x = a.x;
int p0_y = a.y;
int p1_x = b.x;
int p1_y = b.y;
- if (CollideLineRect(p0_x, p0_y, p1_x, p1_y, obstacle))
+ if (collideLineRect(p0_x, p0_y, p1_x, p1_y, obstacle))
return false;
p0_x = a.x + a.w;
@@ -84,7 +84,7 @@ bool LineOfSight(const Rect &a, const Rect &b, const Rect &obstacle) {
p1_x = b.x + b.w;
p1_y = b.y;
- if (CollideLineRect(p0_x, p0_y, p1_x, p1_y, obstacle))
+ if (collideLineRect(p0_x, p0_y, p1_x, p1_y, obstacle))
return false;
p0_x = a.x;
@@ -92,7 +92,7 @@ bool LineOfSight(const Rect &a, const Rect &b, const Rect &obstacle) {
p1_x = b.x;
p1_y = b.y + b.h;
- if (CollideLineRect(p0_x, p0_y, p1_x, p1_y, obstacle))
+ if (collideLineRect(p0_x, p0_y, p1_x, p1_y, obstacle))
return false;
p0_x = a.x + a.w;
@@ -100,7 +100,7 @@ bool LineOfSight(const Rect &a, const Rect &b, const Rect &obstacle) {
p1_x = b.x + b.w;
p1_y = b.y + b.h;
- if (CollideLineRect(p0_x, p0_y, p1_x, p1_y, obstacle))
+ if (collideLineRect(p0_x, p0_y, p1_x, p1_y, obstacle))
return false;
return true;
diff --git a/engines/crab/collision.h b/engines/crab/collision.h
index 5579ca7ecb9..d6701ba3711 100644
--- a/engines/crab/collision.h
+++ b/engines/crab/collision.h
@@ -38,15 +38,15 @@
namespace Crab {
// Find if a line and a rectangle intersect
-bool CollideLineRect(int p0_x, int p0_y, int p1_x, int p1_y, const Rect &rect);
+bool collideLineRect(int p0X, int p0Y, int p1X, int p1Y, const Rect &rect);
// Find if there is a clear line of sight between two rectangles
-bool LineOfSight(const Rect &a, const Rect &b, const Rect &obstacle);
+bool lineOfSight(const Rect &a, const Rect &b, const Rect &obstacle);
// Find the distance between two points
template<typename T>
-double Distance2D(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y) {
- return sqrt((p0_x - p1_x) * (p0_x - p1_x) + (p0_y - p1_y) * (p0_y - p1_y));
+double distance2D(const T &p0X, const T &p0Y, const T &p1X, const T &p1Y) {
+ return sqrt((p0X - p1X) * (p0X - p1X) + (p0Y - p1Y) * (p0Y - p1Y));
}
} // End of namespace Crab
Commit: 5e1e95bc98587ef52585ff24a9c37cfa0014560b
https://github.com/scummvm/scummvm/commit/5e1e95bc98587ef52585ff24a9c37cfa0014560b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove duplicate copyright headers
Changed paths:
engines/crab/console.h
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/detection.cpp
engines/crab/detection.h
engines/crab/detection_tables.h
engines/crab/metaengine.cpp
engines/crab/metaengine.h
diff --git a/engines/crab/console.h b/engines/crab/console.h
index 1371bdff91e..b14a259cf6f 100644
--- a/engines/crab/console.h
+++ b/engines/crab/console.h
@@ -1,34 +1,3 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 4585a91651f..5c6326e42c7 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -19,37 +19,6 @@
*
*/
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-
#include "crab/crab.h"
#include "common/config-manager.h"
#include "common/debug-channels.h"
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 40061cd437d..93137acfd7e 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -19,36 +19,6 @@
*
*/
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
#ifndef CRAB_H
#define CRAB_H
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
index a71eeb4bbc7..53ed7feaaed 100644
--- a/engines/crab/detection.cpp
+++ b/engines/crab/detection.cpp
@@ -19,36 +19,6 @@
*
*/
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
#include "base/plugins.h"
#include "engines/advancedDetector.h"
diff --git a/engines/crab/detection.h b/engines/crab/detection.h
index ec1894f1968..ebaa6c9f17f 100644
--- a/engines/crab/detection.h
+++ b/engines/crab/detection.h
@@ -19,36 +19,6 @@
*
*/
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
#ifndef CRAB_DETECTION_H
#define CRAB_DETECTION_H
diff --git a/engines/crab/detection_tables.h b/engines/crab/detection_tables.h
index 7d33bbb7205..27ff95ac140 100644
--- a/engines/crab/detection_tables.h
+++ b/engines/crab/detection_tables.h
@@ -19,36 +19,6 @@
*
*/
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
namespace Crab {
const PlainGameDescriptor crabGames[] = {
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index 32cb7a86100..8ceec4a9762 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -19,36 +19,6 @@
*
*/
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
#include "common/translation.h"
#include "crab/crab.h"
diff --git a/engines/crab/metaengine.h b/engines/crab/metaengine.h
index 1c5e5559f5f..7e78149ce39 100644
--- a/engines/crab/metaengine.h
+++ b/engines/crab/metaengine.h
@@ -19,36 +19,6 @@
*
*/
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
#ifndef CRAB_METAENGINE_H
#define CRAB_METAENGINE_H
Commit: 9ec832a165fbe645fa989adcbf4ad0d4ad59f229
https://github.com/scummvm/scummvm/commit/9ec832a165fbe645fa989adcbf4ad0d4ad59f229
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Timer class follow code formatting conventions
Changed paths:
engines/crab/GameClock.h
engines/crab/ai/movement.cpp
engines/crab/ai/spriteai.cpp
engines/crab/animation/PopUp.cpp
engines/crab/animation/PopUp.h
engines/crab/animation/animation.cpp
engines/crab/animation/animation.h
engines/crab/animation/fightmoves.cpp
engines/crab/animation/walkframes.cpp
engines/crab/animation/walkframes.h
engines/crab/app.cpp
engines/crab/level/level_load.cpp
engines/crab/timer.cpp
engines/crab/timer.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/hud.cpp
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 667732c6532..65f1599b1a6 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -46,7 +46,7 @@ public:
void Start(uint32 initial_time = 0) {
start = initial_time;
- timer.Start();
+ timer.start();
}
void Start(const Common::String &str) {
@@ -73,7 +73,7 @@ public:
}
Common::String GetTime() {
- uint32 ms = start + timer.Ticks();
+ uint32 ms = start + timer.ticks();
uint32 x = ms / 1000;
uint32 seconds = x % 60;
diff --git a/engines/crab/ai/movement.cpp b/engines/crab/ai/movement.cpp
index 690ce4934f2..dd65d4530ed 100644
--- a/engines/crab/ai/movement.cpp
+++ b/engines/crab/ai/movement.cpp
@@ -52,11 +52,11 @@ bool MovementSet::internalEvents(const Rect rect) {
// If we are at the current waypoint, get to the next waypoint
if (_path[_cur]._target.Collide(rect)) {
_cur = (_cur + 1) % _path.size();
- _timer.Start();
+ _timer.start();
}
// Wait according to the delay value in the node
- if (_timer.Ticks() >= _path[_cur]._delay)
+ if (_timer.ticks() >= _path[_cur]._delay)
return true;
}
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index d32e215b7af..b3a81d8d944 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -262,8 +262,8 @@ void Sprite::flyAround(const Rect &camera, const SpriteConstant &sc) {
_aiData._walk._enabled = false;
// Start the timer, set a semi-random time
- _aiData._walk._timer.Target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
- _aiData._walk._timer.Start();
+ _aiData._walk._timer.target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
+ _aiData._walk._timer.start();
}
}
// Flying towards the right edge
@@ -273,21 +273,21 @@ void Sprite::flyAround(const Rect &camera, const SpriteConstant &sc) {
_aiData._walk._enabled = false;
// Start the timer, set a semi-random time
- _aiData._walk._timer.Target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
- _aiData._walk._timer.Start();
+ _aiData._walk._timer.target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
+ _aiData._walk._timer.start();
}
}
move(sc);
} else {
// Safety condition in case timer isn't running
- if (!_aiData._walk._timer.Started())
- _aiData._walk._timer.Start();
+ if (!_aiData._walk._timer.started())
+ _aiData._walk._timer.start();
// Is it time to start flying?
- if (_aiData._walk._timer.TargetReached()) {
+ if (_aiData._walk._timer.targetReached()) {
// Stop the timer
- _aiData._walk._timer.Stop();
+ _aiData._walk._timer.stop();
// Decide if the sprite flies from the left or right of the camera
if (g_engine->getRandomNumber(1)) {
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 14cdbb58f4c..d1e191edfee 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -71,8 +71,8 @@ void PopUpCollection::load(rapidxml::xml_node<char> *node) {
bool PopUp::internalEvents(pyrodactyl::event::Info &info, const Common::String &playerId,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq) {
if (_visible.evaluate(info) || _startedShow) {
- if (_delay.TargetReached()) {
- if (_duration.TargetReached(g_engine->_screenSettings->text_speed)) {
+ if (_delay.targetReached()) {
+ if (_duration.targetReached(g_engine->_screenSettings->text_speed)) {
_show = false;
for (auto &i : _effect)
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index fae49213776..7edb7433496 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -80,8 +80,8 @@ struct PopUp {
void reset() {
_show = false;
_startedShow = false;
- _delay.Stop();
- _duration.Stop();
+ _delay.stop();
+ _duration.stop();
}
void load(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index 719e9fb9722..bd32a54fa16 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -42,20 +42,20 @@ Animation::Animation(rapidxml::xml_node<char> *node) {
}
void Animation::draw() {
- uint32 timestamp = _timer.Ticks();
+ uint32 timestamp = _timer.ticks();
for (auto i = _frame.begin(); i != _frame.end(); ++i)
i->draw(timestamp);
}
bool Animation::internalEvents(DrawType &gameDraw) {
- uint32 timestamp = _timer.Ticks();
+ uint32 timestamp = _timer.ticks();
for (auto i = _frame.begin(); i != _frame.end(); ++i) {
DrawType result = i->internalEvents(timestamp);
// if (result != DRAW_SAME)
gameDraw = result;
}
- return _timer.Ticks() >= _length;
+ return _timer.ticks() >= _length;
}
void Animation::reset() {
diff --git a/engines/crab/animation/animation.h b/engines/crab/animation/animation.h
index 9cb78eee051..69c562f0a86 100644
--- a/engines/crab/animation/animation.h
+++ b/engines/crab/animation/animation.h
@@ -63,7 +63,7 @@ public:
bool internalEvents(DrawType &gameDraw);
void start() {
reset();
- _timer.Start();
+ _timer.start();
}
};
} // End of namespace anim
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 645c93fe984..8449ed95a4f 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -46,7 +46,7 @@ FightMoves::FightMoves() {
_frameTotal = 0;
_move.clear();
- _timer.Start();
+ _timer.start();
}
//------------------------------------------------------------------------
@@ -107,9 +107,9 @@ FrameUpdateResult FightMoves::updateFrame(const Direction &d) {
if (_frameCur < _frameTotal && _frameCur < _move[_cur]._frames[d]._frame.size()) {
// Has the current frame finished playing?
// OR Is this the first frame of the move?
- if (_timer.Ticks() >= _move[_cur]._frames[d]._frame[_frameCur]._repeat || _start) {
+ if (_timer.ticks() >= _move[_cur]._frames[d]._frame[_frameCur]._repeat || _start) {
_frameCur++;
- _timer.Start();
+ _timer.start();
_start = false;
return FUR_SUCCESS;
@@ -165,7 +165,7 @@ bool FightMoves::forceUpdate(const unsigned int &index, pyrodactyl::input::Fight
} else
input.reset();
- _timer.Start();
+ _timer.start();
_start = true;
g_engine->_musicManager->playEffect(_move[_cur]._eff._activate, 0);
return true;
diff --git a/engines/crab/animation/walkframes.cpp b/engines/crab/animation/walkframes.cpp
index 87447782591..ad66661d7f6 100644
--- a/engines/crab/animation/walkframes.cpp
+++ b/engines/crab/animation/walkframes.cpp
@@ -57,8 +57,8 @@ void WalkFrames::load(rapidxml::xml_node<char> *node) {
// Purpose: Used for walking inside levels
//------------------------------------------------------------------------
bool WalkFrames::updateClip(Direction d, bool reset) {
- if (_timer.Ticks() > _set[_cur].frames[d].currentFrame()._repeat || reset) {
- _timer.Start();
+ if (_timer.ticks() > _set[_cur].frames[d].currentFrame()._repeat || reset) {
+ _timer.start();
return _set[_cur].frames[d].updateClip();
}
@@ -67,19 +67,19 @@ bool WalkFrames::updateClip(Direction d, bool reset) {
void WalkFrames::resetClip(Direction d) {
_set[_cur].frames[d].reset();
- _timer.Start();
+ _timer.start();
}
//------------------------------------------------------------------------
// Purpose: Used inside dialog box
//------------------------------------------------------------------------
void WalkFrames::updateClip(WalkAnimType type, Direction d) {
- if (!_timer.Started())
- _timer.Start();
+ if (!_timer.started())
+ _timer.start();
- if (_timer.Ticks() > _set[type].frames[d].currentFrame()._repeat) {
+ if (_timer.ticks() > _set[type].frames[d].currentFrame()._repeat) {
_set[type].frames[d].updateClip();
- _timer.Start();
+ _timer.start();
}
}
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index f5145245f6f..c0d1ee0ad99 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -76,7 +76,7 @@ class WalkFrames {
public:
WalkFrames() {
_cur = WT_STAND;
- _timer.Start();
+ _timer.start();
}
~WalkFrames() {}
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index ced4e054f41..43ad788a458 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -141,7 +141,7 @@ void App::run() {
// While the user hasn't quit - This is the main game loop
while (currentStateId != GAMESTATE_EXIT && !SHOULD_QUIT) {
// Start the frame timer
- fps.Start();
+ fps.start();
// Change state if needed
if (shouldChangeState) {
@@ -286,11 +286,11 @@ void App::run() {
#endif
// Cap the frame rate
- if (fps.Ticks() < 1000u / g_engine->_screenSettings->fps) {
+ if (fps.ticks() < 1000u / g_engine->_screenSettings->fps) {
#if 0
SDL_Delay((1000u / g_engine->_screenSettings->fps) - fps.Ticks());
#endif
- uint32 delay = (1000u / g_engine->_screenSettings->fps) - fps.Ticks();
+ uint32 delay = (1000u / g_engine->_screenSettings->fps) - fps.ticks();
//warning("Delay by %d ms", delay);
g_system->delayMillis(delay);
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index c4c065bb1f2..0538f64aabd 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -134,7 +134,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
// Set the timer target for the first time
//s.ai_data.walk.timer.Target(sc_default.fly.delay_min + (gRandom.Num() % sc_default.fly.delay_max));
- s._aiData._walk._timer.Target(_scDefault._fly._delayMax);
+ s._aiData._walk._timer.target(_scDefault._fly._delayMax);
_fly.push_back(s);
}
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index 888d6e586ec..e92fb70f487 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -28,7 +28,6 @@
*
*/
-
//=============================================================================
// Author: Arvind
// Purpose: Timer functions
@@ -39,94 +38,94 @@ namespace Crab {
Timer::Timer() {
// Initialize the variables
- start_ticks = 0;
- paused_ticks = 0;
- target_ticks = 0;
- target_valid = false;
- paused = false;
- started = false;
+ _startTicks = 0;
+ _pausedTicks = 0;
+ _targetTicks = 0;
+ _targetValid = false;
+ _paused = false;
+ _started = false;
}
void Timer::load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo) {
- target_valid = loadNum(target_ticks, name, node, echo);
+ _targetValid = loadNum(_targetTicks, name, node, echo);
}
-void Timer::Start() {
+void Timer::start() {
// Start the timer
- started = true;
+ _started = true;
// Resume the timer
- paused = false;
+ _paused = false;
// Get the current clock time
#if 0
start_ticks = SDL_GetTicks();
#endif
- start_ticks = g_system->getMillis();
+ _startTicks = g_system->getMillis();
}
-void Timer::Stop() {
+void Timer::stop() {
// Stop the timer
- started = false;
+ _started = false;
// Resume the timer
- paused = false;
+ _paused = false;
}
-uint32 Timer::Ticks() {
+uint32 Timer::ticks() {
// If the timer is running
- if (started == true) {
+ if (_started == true) {
// If the timer is paused
- if (paused == true) {
+ if (_paused == true) {
// Return the number of ticks when the timer was paused
- return paused_ticks;
+ return _pausedTicks;
} else {
// Return the current time minus the start time
#if 0
return SDL_GetTicks() - start_ticks;
#endif
- return g_system->getMillis() - start_ticks;
+ return g_system->getMillis() - _startTicks;
}
}
// If the timer isn't running
return 0;
}
-void Timer::Pause() {
+void Timer::pause() {
// If the timer is running and isn't already paused
- if ((started == true) && (paused == false)) {
+ if ((_started == true) && (_paused == false)) {
// Pause the timer
- paused = true;
+ _paused = true;
// Calculate the paused ticks
#if 0
paused_ticks = SDL_GetTicks() - start_ticks;
#endif
- paused_ticks = g_system->getMillis() - start_ticks;
+ _pausedTicks = g_system->getMillis() - _startTicks;
}
}
-void Timer::Resume() {
+void Timer::resume() {
// If the timer is paused
- if (paused == true) {
+ if (_paused == true) {
// Resume the timer
- paused = false;
+ _paused = false;
// Reset the starting ticks
#if 0
start_ticks = SDL_GetTicks() - paused_ticks;
#endif
- paused_ticks = g_system->getMillis() - start_ticks;
+ _pausedTicks = g_system->getMillis() - _startTicks;
// Reset the paused ticks
- paused_ticks = 0;
+ _pausedTicks = 0;
}
}
-bool Timer::TargetReached(const float &factor) {
- if (!started)
- Start();
+bool Timer::targetReached(const float &factor) {
+ if (!_started)
+ start();
- if (target_valid && Ticks() >= (target_ticks / factor))
+ if (_targetValid && ticks() >= (_targetTicks / factor))
return true;
return false;
diff --git a/engines/crab/timer.h b/engines/crab/timer.h
index afb89053bf6..c54446e2547 100644
--- a/engines/crab/timer.h
+++ b/engines/crab/timer.h
@@ -44,50 +44,61 @@ namespace Crab {
class Timer {
private:
// The clock time when the timer started
- uint32 start_ticks;
+ uint32 _startTicks;
// The ticks stored when the timer was paused
- uint32 paused_ticks;
+ uint32 _pausedTicks;
// Since most timers usually only check one value, we might as well as store it here
- uint32 target_ticks;
+ uint32 _targetTicks;
// See if we have a target loaded or set
- bool target_valid;
+ bool _targetValid;
// The timer status
- bool paused;
- bool started;
+ bool _paused;
+ bool _started;
public:
// Initialize variables
Timer();
- void Target(const uint32 &val) {
- target_valid = true;
- target_ticks = val;
+
+ void target(const uint32 &val) {
+ _targetValid = true;
+ _targetTicks = val;
}
void load(rapidxml::xml_node<char> *node, const Common::String &name, const bool &echo = true);
// The various clock actions
- void Start();
- void Stop();
- void Pause();
- void Resume();
+ void start();
+ void stop();
+ void pause();
+ void resume();
// Gets the timer's time
- uint32 Ticks();
+ uint32 ticks();
// Get the time remaining
- uint32 RemainingTicks() { return target_ticks - Ticks(); }
+ uint32 remainingTicks() {
+ return _targetTicks - ticks();
+ }
// Have we reached the target yet?
- bool TargetReached(const float &factor = 1.0f);
+ bool targetReached(const float &factor = 1.0f);
// Checks the status of the timer
- bool Started() { return started; }
- bool Paused() { return paused; }
- bool TargetValid() { return target_valid; }
+ bool started() {
+ return _started;
+ }
+
+ bool paused() {
+ return _paused;
+ }
+
+ bool targetValid() {
+ return _targetValid;
+ }
};
} // End of namespace Crab
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 0fc2989e8ac..887f18418a5 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -138,7 +138,7 @@ void OptionMenu::draw(Button &back) {
break;
case STATE_CONFIRM:
_noticeRes.draw();
- _countdown.draw(NumberToString(_timer.RemainingTicks() / 1000));
+ _countdown.draw(NumberToString(_timer.remainingTicks() / 1000));
break;
default:
break;
@@ -164,7 +164,7 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
int result = _gfx.handleEvents(event);
if (result == 1) {
_state = STATE_CONFIRM;
- _timer.Start();
+ _timer.start();
g_engine->_screenSettings->SetResolution();
_gfx.SetInfo();
} else if (result == 2)
@@ -193,7 +193,7 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
if (_promptH.handleEvents(event, true) || _accept.handleEvents(event) == BUAC_LCLICK) {
g_engine->_screenSettings->cur.h = StringToNumber<int>(_promptH._text);
_state = STATE_CONFIRM;
- _timer.Start();
+ _timer.start();
g_engine->_screenSettings->SetResolution();
_gfx.SetInfo();
} else if (_cancel.handleEvents(event) == BUAC_LCLICK) {
@@ -206,7 +206,7 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
case STATE_CONFIRM:
if (_accept.handleEvents(event)) {
_state = STATE_GRAPHICS;
- _timer.Stop();
+ _timer.stop();
} else if (_cancel.handleEvents(event)) {
g_engine->_screenSettings->RestoreBackup();
g_engine->_screenSettings->SetResolution();
@@ -372,7 +372,7 @@ void OptionMenu::internalEvents() {
_gfx.internalEvents();
_general.internalEvents();
- if (_state == STATE_CONFIRM && _timer.TargetReached()) {
+ if (_state == STATE_CONFIRM && _timer.targetReached()) {
g_engine->_screenSettings->RestoreBackup();
g_engine->_screenSettings->SetResolution();
_gfx.SetInfo();
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index 7015484ca04..f84659bf96b 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -76,16 +76,16 @@ void ProgressBar::draw(const int &value, const int &max) {
switch (_type) {
case INCREASE:
g_engine->_imageManager->draw(x + _clip.w + _offset.x, y + _offset.y, _inc);
- if (_timer.TargetReached()) {
+ if (_timer.targetReached()) {
_cur++;
- _timer.Start();
+ _timer.start();
}
break;
case DECREASE:
g_engine->_imageManager->draw(x + _clip.w + _offset.x, y + _offset.y, _dec);
- if (_timer.TargetReached()) {
+ if (_timer.targetReached()) {
_cur--;
- _timer.Start();
+ _timer.start();
}
break;
default:
@@ -104,11 +104,11 @@ void ProgressBar::effect(const int &value, const int &prev) {
if (value > prev) {
_changed = true;
_type = INCREASE;
- _timer.Target(_notifyRate * (value - prev));
+ _timer.target(_notifyRate * (value - prev));
} else if (value < prev) {
_changed = true;
_type = DECREASE;
- _timer.Target(_notifyRate * (prev - value));
+ _timer.target(_notifyRate * (prev - value));
} else {
_changed = false;
_type = NONE;
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index e94ce4c7300..67253ec28cb 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -69,7 +69,7 @@ void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
_clip.load(animnode);
_timer.load(animnode, "delay");
- _timer.Start();
+ _timer.start();
}
}
}
@@ -111,13 +111,13 @@ void HUD::draw(pyrodactyl::event::Info &info, const Common::String &id) {
void HUD::internalEvents(bool showMap) {
_menu._element[HS_MAP]._visible = showMap;
- if (_timer.TargetReached()) {
+ if (_timer.targetReached()) {
_clip.x += _clip.w;
if (_clip.x >= g_engine->_imageManager->getTexture(_notifyAnim).w())
_clip.x = 0;
- _timer.Start();
+ _timer.start();
}
}
Commit: 70125787146279a7c02fc6834cd12d77682ab008
https://github.com/scummvm/scummvm/commit/70125787146279a7c02fc6834cd12d77682ab008
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Splash class follow code formatting conventions
Changed paths:
engines/crab/splash.cpp
engines/crab/splash.h
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 8786bdacb29..01166d091b7 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -42,35 +42,35 @@ namespace Crab {
//------------------------------------------------------------------------
Splash::Splash() {
// Load the background
- background.load("res/gfx/pyrodactyl.png");
+ _background.load("res/gfx/pyrodactyl.png");
setUI();
- load_complete = false;
- first_run = true;
+ _loadComplete = false;
+ _firstRun = true;
}
//------------------------------------------------------------------------
// Purpose: Destructor
//------------------------------------------------------------------------
Splash::~Splash() {
- background.deleteImage();
+ _background.deleteImage();
}
//------------------------------------------------------------------------
// Purpose: Event/Input Independent InternalEvents
//------------------------------------------------------------------------
-void Splash::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
- if (first_run == false) {
+void Splash::internalEvents(bool &shouldChangeState, GameStateID &newStateId) {
+ if (_firstRun == false) {
g_engine->_loadingScreen->load();
g_engine->_imageManager->init();
g_engine->_textManager->init();
- load_complete = true;
+ _loadComplete = true;
}
// Have we loaded everything? If yes, time to exit
- if (load_complete) {
- ShouldChangeState = true;
- NewStateID = GAMESTATE_MAIN_MENU;
+ if (_loadComplete) {
+ shouldChangeState = true;
+ newStateId = GAMESTATE_MAIN_MENU;
return;
}
}
@@ -79,8 +79,8 @@ void Splash::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
// Purpose: Drawing function
//------------------------------------------------------------------------
void Splash::draw() {
- background.draw(x, y);
- first_run = false;
+ _background.draw(_x, _y);
+ _firstRun = false;
}
//------------------------------------------------------------------------
@@ -88,8 +88,8 @@ void Splash::draw() {
//------------------------------------------------------------------------
void Splash::setUI() {
warning("ScreenSettings cur w : %d h : %d", g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h);
- x = (g_engine->_screenSettings->cur.w - background.w()) / 2;
- y = (g_engine->_screenSettings->cur.h - background.h()) / 2;
+ _x = (g_engine->_screenSettings->cur.w - _background.w()) / 2;
+ _y = (g_engine->_screenSettings->cur.h - _background.h()) / 2;
}
}
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 1b8c7691749..6203b61bc92 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -51,16 +51,16 @@ namespace Crab {
// Purpose: Splash screen class
//------------------------------------------------------------------------
class Splash : public GameState {
- pyrodactyl::image::Image background;
+ pyrodactyl::image::Image _background;
- int x, y;
- bool first_run, load_complete;
+ int _x, _y;
+ bool _firstRun, _loadComplete;
public:
Splash();
~Splash();
- void handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {}
- void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
+ void handleEvents(Common::Event &event, bool &shouldChangeState, GameStateID &newStateId) {}
+ void internalEvents(bool &shouldChangeState, GameStateID &newStateId);
void draw();
void setUI();
Commit: 10d18367ed208fe01b05574808b65d165b1637fa
https://github.com/scummvm/scummvm/commit/10d18367ed208fe01b05574808b65d165b1637fa
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make FileSystem and Game class follow code formatting conventions
Changed paths:
engines/crab/XMLDoc.cpp
engines/crab/app.cpp
engines/crab/filesystem.cpp
engines/crab/filesystem.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gamestate_container.h
engines/crab/image/Image.cpp
engines/crab/mainmenu.h
engines/crab/splash.h
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index 2fa5b0715f2..73bc7a3e85d 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -45,7 +45,7 @@ void XMLDoc::load(const Common::String &filename) {
if (ready())
_doc.clear();
- if (FileOpen(path, _text) && _text)
+ if (fileOpen(path, _text) && _text)
_doc.parse<0>(_text);
}
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 43ad788a458..16e9ca7cbd5 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -174,7 +174,7 @@ void App::run() {
break;
case GAMESTATE_NEW_GAME:
- _game->StartNewGame();
+ _game->startNewGame();
currentState = _game;
g_engine->_screenSettings->in_game = true;
break;
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index 9e43bd89f9c..bbc17e90f56 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -32,7 +32,7 @@
namespace Crab {
-bool FileOpen(const Common::Path &path, char *&data) {
+bool fileOpen(const Common::Path &path, char *&data) {
if (path.empty())
return false;
@@ -58,7 +58,7 @@ bool FileOpen(const Common::Path &path, char *&data) {
return true;
}
-bool FileOpen(const Common::Path &path, Common::File *file) {
+bool fileOpen(const Common::Path &path, Common::File *file) {
if (path.empty())
return false;
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index 09aca49d005..5aace0e55dc 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -33,8 +33,8 @@
#include "crab/common_header.h"
namespace Crab {
-bool FileOpen(const Common::Path &path, char *&data);
-bool FileOpen(const Common::Path &path, Common::File *file);
+bool fileOpen(const Common::Path &path, char *&data);
+bool fileOpen(const Common::Path &path, Common::File *file);
#if 0
bool PathCompare(const boost::filesystem::path &p1, const boost::filesystem::path &p2);
#endif
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 92299ff24b0..b6cbadd22c0 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -40,35 +40,35 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
// Purpose: Loading stuff
//------------------------------------------------------------------------
-void Game::StartNewGame() {
- Init(g_engine->_filePath->mod_cur);
- LoadLevel(info.curLocID());
- info.ironMan(g_engine->_tempData->ironman);
- savefile.ironman = g_engine->_tempData->filename;
- clock.Start();
- hud._pause.updateMode(info.ironMan());
-
- CreateSaveGame(SAVEGAME_EVENT);
+void Game::startNewGame() {
+ init(g_engine->_filePath->mod_cur);
+ loadLevel(_info.curLocID());
+ _info.ironMan(g_engine->_tempData->ironman);
+ _savefile._ironman = g_engine->_tempData->filename;
+ _clock.Start();
+ _hud._pause.updateMode(_info.ironMan());
+
+ createSaveGame(SAVEGAME_EVENT);
}
-void Game::LoadGame() {
- Init(g_engine->_filePath->mod_cur);
+void Game::loadGame() {
+ init(g_engine->_filePath->mod_cur);
}
-void Game::Init(const Common::String &filename) {
+void Game::init(const Common::String &filename) {
g_engine->_loadingScreen->Dim();
g_engine->_eventStore->clear();
- game_over.clear(false);
- state = STATE_GAME;
- savefile.auto_slot = false;
- gem.init();
- info.Init();
+ _gameOver.clear(false);
+ _state = STATE_GAME;
+ _savefile._autoSlot = false;
+ _gem.init();
+ _info.Init();
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("config");
- info.load(node);
+ _info.load(node);
Common::String path;
if (nodeValid("level", node)) {
@@ -78,19 +78,19 @@ void Game::Init(const Common::String &filename) {
if (nodeValid("hud", node)) {
loadStr(path, "layout", node->first_node("hud"));
- hud.load(path, level._talkNotify, level._destMarker);
+ _hud.load(path, _level._talkNotify, _level._destMarker);
}
if (nodeValid("sprite", node)) {
loadStr(path, "animation", node->first_node("sprite"));
- level.loadMoves(path);
+ _level.loadMoves(path);
loadStr(path, "constant", node->first_node("sprite"));
- level.loadConst(path);
+ _level.loadConst(path);
}
if (nodeValid("event", node)) {
- gem.load(node->first_node("event"), pop_default);
+ _gem.load(node->first_node("event"), _popDefault);
loadStr(path, "store", node->first_node("event"));
g_engine->_eventStore->load(path);
@@ -98,22 +98,22 @@ void Game::Init(const Common::String &filename) {
if (nodeValid("map", node)) {
loadStr(path, "layout", node->first_node("map"));
- map.load(path, info);
+ _map.load(path, _info);
}
if (nodeValid("save", node))
- savefile.load(node->first_node("save"));
+ _savefile.load(node->first_node("save"));
if (nodeValid("debug", node)) {
loadStr(path, "layout", node->first_node("debug"));
- debug_console.load(path);
+ _debugConsole.load(path);
}
}
_isInited = true;
}
-bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
+bool Game::loadLevel(const Common::String &id, int playerX, int playerY) {
if (g_engine->_filePath->level.contains(id)) {
g_engine->_loadingScreen->draw();
@@ -125,28 +125,28 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
}
// Load the level itself
- level._pop = pop_default;
- level.load(g_engine->_filePath->level[id].layout, info, game_over, player_x, player_y);
+ _level._pop = _popDefault;
+ _level.load(g_engine->_filePath->level[id].layout, _info, _gameOver, playerX, playerY);
// Set the current location
- info.curLocID(id);
- info.curLocName(g_engine->_filePath->level[id].name);
- map._playerPos = level._mapLoc;
+ _info.curLocID(id);
+ _info.curLocName(g_engine->_filePath->level[id].name);
+ _map._playerPos = _level._mapLoc;
// Update and center the world map to the player current position
- map.update(info);
- map.center(map._playerPos);
+ _map.update(_info);
+ _map.center(_map._playerPos);
// If this is our first time visiting a level, reveal the associated area on the world map
- map.revealAdd(level._mapClip._id, level._mapClip._rect);
+ _map.revealAdd(_level._mapClip._id, _level._mapClip._rect);
// Initialize inventory
- info._inv.init(level.playerId());
+ _info._inv.init(_level.playerId());
// Initialize journal
- info._journal.init(level.playerId());
+ _info._journal.init(_level.playerId());
- level.preDraw();
+ _level.preDraw();
return true;
}
@@ -156,71 +156,71 @@ bool Game::LoadLevel(const Common::String &id, int player_x, int player_y) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- g_engine->_mouse->handleEvents(Event);
+void Game::handleEvents(Common::Event &event, bool &shouldChangeState, GameStateID &newStateId) {
+ g_engine->_mouse->handleEvents(event);
// if (GameDebug)
// debug_console.handleEvents(Event);
- if (!debug_console.restrictInput()) {
- if (state == STATE_LOSE_MENU) {
- switch (hud._gom.handleEvents(Event)) {
+ if (!_debugConsole.restrictInput()) {
+ if (_state == STATE_LOSE_MENU) {
+ switch (_hud._gom.handleEvents(event)) {
case 0:
- state = STATE_LOSE_LOAD;
+ _state = STATE_LOSE_LOAD;
break;
case 1:
- Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
+ quit(shouldChangeState, newStateId, GAMESTATE_MAIN_MENU);
break;
default:
break;
}
- } else if (state == STATE_LOSE_LOAD) {
- if (g_engine->_loadMenu->handleEvents(Event)) {
- ShouldChangeState = true;
- NewStateID = GAMESTATE_LOAD_GAME;
+ } else if (_state == STATE_LOSE_LOAD) {
+ if (g_engine->_loadMenu->handleEvents(event)) {
+ shouldChangeState = true;
+ newStateId = GAMESTATE_LOAD_GAME;
return;
}
- if (hud._pausekey.handleEvents(Event) || hud._back.handleEvents(Event) == BUAC_LCLICK)
- state = STATE_LOSE_MENU;
+ if (_hud._pausekey.handleEvents(event) || _hud._back.handleEvents(event) == BUAC_LCLICK)
+ _state = STATE_LOSE_MENU;
} else {
- if (!gem.eventInProgress() && !hud._pause.disableHotkeys()) {
- switch (hud.handleEvents(info, Event)) {
+ if (!_gem.eventInProgress() && !_hud._pause.disableHotkeys()) {
+ switch (_hud.handleEvents(_info, event)) {
case HS_MAP:
- ToggleState(STATE_MAP);
+ toggleState(STATE_MAP);
break;
case HS_PAUSE:
- ToggleState(STATE_PAUSE);
+ toggleState(STATE_PAUSE);
break;
case HS_CHAR:
- ToggleState(STATE_CHARACTER);
- gem._per.Cache(info, level.playerId(), level);
+ toggleState(STATE_CHARACTER);
+ _gem._per.Cache(_info, _level.playerId(), _level);
break;
case HS_JOURNAL:
- ToggleState(STATE_JOURNAL);
+ toggleState(STATE_JOURNAL);
break;
case HS_INV:
- ToggleState(STATE_INVENTORY);
+ toggleState(STATE_INVENTORY);
break;
default:
break;
}
}
- if (state == STATE_GAME) {
- if (gem.eventInProgress()) {
- gem.handleEvents(info, level.playerId(), Event, hud, level, event_res);
- if (ApplyResult())
- Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
+ if (_state == STATE_GAME) {
+ if (_gem.eventInProgress()) {
+ _gem.handleEvents(_info, _level.playerId(), event, _hud, _level, _eventRes);
+ if (applyResult())
+ quit(shouldChangeState, newStateId, GAMESTATE_MAIN_MENU);
} else {
// Update the talk key state
- info._talkKeyDown = g_engine->_inputManager->state(IG_TALK) || level.containsClick(info.lastPerson(), Event);
+ _info._talkKeyDown = g_engine->_inputManager->state(IG_TALK) || _level.containsClick(_info.lastPerson(), event);
- level.handleEvents(info, Event);
+ _level.handleEvents(_info, event);
- if (!game_over.empty() && game_over.evaluate(info)) {
- state = STATE_LOSE_MENU;
- hud._gom.reset();
+ if (!_gameOver.empty() && _gameOver.evaluate(_info)) {
+ _state = STATE_LOSE_MENU;
+ _hud._gom.reset();
return;
}
@@ -236,20 +236,20 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
}
#endif
- if (hud._pausekey.handleEvents(Event))
- ToggleState(STATE_PAUSE);
+ if (_hud._pausekey.handleEvents(event))
+ toggleState(STATE_PAUSE);
}
- } else if (state == STATE_PAUSE) {
- switch (hud._pause.handleEvents(Event, hud._back)) {
+ } else if (_state == STATE_PAUSE) {
+ switch (_hud._pause.handleEvents(event, _hud._back)) {
case PS_RESUME:
- ToggleState(STATE_GAME);
- hud.setTooltip();
+ toggleState(STATE_GAME);
+ _hud.setTooltip();
break;
case PS_SAVE:
- CreateSaveGame(SAVEGAME_NORMAL);
- ToggleState(STATE_GAME);
- hud.setTooltip();
+ createSaveGame(SAVEGAME_NORMAL);
+ toggleState(STATE_GAME);
+ _hud.setTooltip();
break;
case PS_LOAD:
//ShouldChangeState = true;
@@ -257,49 +257,49 @@ void Game::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameState
return;
case PS_HELP:
- ToggleState(STATE_HELP);
+ toggleState(STATE_HELP);
break;
case PS_QUIT_MENU:
- CreateSaveGame(SAVEGAME_EXIT);
- Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
+ createSaveGame(SAVEGAME_EXIT);
+ quit(shouldChangeState, newStateId, GAMESTATE_MAIN_MENU);
break;
case PS_QUIT_GAME:
- CreateSaveGame(SAVEGAME_EXIT);
- Quit(ShouldChangeState, NewStateID, GAMESTATE_EXIT);
+ createSaveGame(SAVEGAME_EXIT);
+ quit(shouldChangeState, newStateId, GAMESTATE_EXIT);
break;
default:
break;
}
} else {
- if (hud._back.handleEvents(Event) == BUAC_LCLICK)
- ToggleState(STATE_GAME);
+ if (_hud._back.handleEvents(event) == BUAC_LCLICK)
+ toggleState(STATE_GAME);
- switch (state) {
+ switch (_state) {
case STATE_MAP:
- if (map.handleEvents(info, Event)) {
+ if (_map.handleEvents(_info, event)) {
// We need to load the new level
- LoadLevel(map._curLoc);
- ToggleState(STATE_GAME);
+ loadLevel(_map._curLoc);
+ toggleState(STATE_GAME);
}
break;
case STATE_JOURNAL:
- if (info._journal.handleEvents(level.playerId(), Event)) {
+ if (_info._journal.handleEvents(_level.playerId(), event)) {
// This means we selected the "find on map" button, so we need to:
// switch to the world map, and highlight the appropriate quest marker
- map.selectDest(info._journal._markerTitle);
- ToggleState(STATE_MAP);
+ _map.selectDest(_info._journal._markerTitle);
+ toggleState(STATE_MAP);
}
break;
case STATE_CHARACTER:
- gem._per.handleEvents(info, level.playerId(), Event);
+ _gem._per.handleEvents(_info, _level.playerId(), event);
break;
case STATE_INVENTORY:
- info._inv.handleEvents(level.playerId(), Event);
+ _info._inv.handleEvents(_level.playerId(), event);
break;
case STATE_HELP:
- g_engine->_helpScreen->handleEvents(Event);
+ g_engine->_helpScreen->handleEvents(event);
default:
break;
}
@@ -466,31 +466,31 @@ void Game::handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &
//------------------------------------------------------------------------
// Purpose: InternalEvents
//------------------------------------------------------------------------
-void Game::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
- switch (state) {
+void Game::internalEvents(bool &shouldChangeState, GameStateID &newStateId) {
+ switch (_state) {
case STATE_GAME:
- hud.internalEvents(level.showMap());
- event_res.clear();
+ _hud.internalEvents(_level.showMap());
+ _eventRes.clear();
{
// HACK: Since sequences can only be ended in GameEventManager, we use this empty array
// to get effects to work for levels
- Common::Array<pyrodactyl::event::EventSeqInfo> end_seq;
- ApplyResult(level.internalEvents(info, event_res, end_seq, gem.eventInProgress()));
+ Common::Array<pyrodactyl::event::EventSeqInfo> endSeq;
+ applyResult(_level.internalEvents(_info, _eventRes, endSeq, _gem.eventInProgress()));
}
- gem.internalEvents(info, level, event_res);
- info._talkKeyDown = false;
+ _gem.internalEvents(_info, _level, _eventRes);
+ _info._talkKeyDown = false;
- if (ApplyResult())
- Quit(ShouldChangeState, NewStateID, GAMESTATE_MAIN_MENU);
+ if (applyResult())
+ quit(shouldChangeState, newStateId, GAMESTATE_MAIN_MENU);
break;
case STATE_MAP:
- map.internalEvents(info);
+ _map.internalEvents(_info);
break;
case STATE_CHARACTER:
- gem._per.internalEvents();
+ _gem._per.internalEvents();
break;
default:
break;
@@ -500,111 +500,111 @@ void Game::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
// Purpose: Draw
//------------------------------------------------------------------------
void Game::draw() {
- if (gem._drawGame)
- level.draw(info);
+ if (_gem._drawGame)
+ _level.draw(_info);
else
g_engine->_imageManager->blackScreen();
- switch (state) {
+ switch (_state) {
case STATE_GAME:
- if (gem.eventInProgress())
- gem.draw(info, hud, level);
+ if (_gem.eventInProgress())
+ _gem.draw(_info, _hud, _level);
else
- hud.draw(info, level.playerId());
+ _hud.draw(_info, _level.playerId());
break;
case STATE_PAUSE:
g_engine->_imageManager->dimScreen();
- hud._pause.draw(hud._back);
- hud.draw(info, level.playerId());
+ _hud._pause.draw(_hud._back);
+ _hud.draw(_info, _level.playerId());
break;
case STATE_MAP:
g_engine->_imageManager->dimScreen();
- map.draw(info);
- hud.draw(info, level.playerId());
- hud._back.draw();
+ _map.draw(_info);
+ _hud.draw(_info, _level.playerId());
+ _hud._back.draw();
break;
case STATE_JOURNAL:
g_engine->_imageManager->dimScreen();
- info._journal.draw(level.playerId());
- hud.draw(info, level.playerId());
- hud._back.draw();
+ _info._journal.draw(_level.playerId());
+ _hud.draw(_info, _level.playerId());
+ _hud._back.draw();
break;
case STATE_CHARACTER:
g_engine->_imageManager->dimScreen();
- gem._per.draw(info, level.playerId());
- hud.draw(info, level.playerId());
- hud._back.draw();
+ _gem._per.draw(_info, _level.playerId());
+ _hud.draw(_info, _level.playerId());
+ _hud._back.draw();
break;
case STATE_INVENTORY:
g_engine->_imageManager->dimScreen();
- info.invDraw(level.playerId());
- hud.draw(info, level.playerId());
- hud._back.draw();
+ _info.invDraw(_level.playerId());
+ _hud.draw(_info, _level.playerId());
+ _hud._back.draw();
break;
case STATE_HELP:
g_engine->_imageManager->dimScreen();
g_engine->_helpScreen->draw();
- hud._back.draw();
- hud.draw(info, level.playerId());
+ _hud._back.draw();
+ _hud.draw(_info, _level.playerId());
break;
case STATE_LOSE_MENU:
- hud._gom.draw();
+ _hud._gom.draw();
break;
case STATE_LOSE_LOAD:
g_engine->_loadMenu->draw();
- hud._back.draw();
+ _hud._back.draw();
break;
default:
break;
}
if (GameDebug)
- debug_console.draw(info);
+ _debugConsole.draw(_info);
g_engine->_mouse->draw();
}
//------------------------------------------------------------------------
// Purpose: Apply results of events and levels
//------------------------------------------------------------------------
-bool Game::ApplyResult() {
+bool Game::applyResult() {
using namespace pyrodactyl::event;
- for (auto i = event_res.begin(); i != event_res.end(); ++i) {
+ for (auto i = _eventRes.begin(); i != _eventRes.end(); ++i) {
switch (i->_type) {
case ER_MAP:
if (i->_val == "img")
- map.setImage(i->_y);
+ _map.setImage(i->_y);
else if (i->_val == "pos") {
- map._playerPos.x = i->_x;
- map._playerPos.y = i->_y;
+ _map._playerPos.x = i->_x;
+ _map._playerPos.y = i->_y;
}
break;
case ER_DEST:
if (i->_x < 0 || i->_y < 0) {
- info._journal.marker(level.playerId(), i->_val, false);
- map.destDel(i->_val);
+ _info._journal.marker(_level.playerId(), i->_val, false);
+ _map.destDel(i->_val);
} else {
- map.destAdd(i->_val, i->_x, i->_y);
- info._journal.marker(level.playerId(), i->_val, true);
- info._unread._map = true;
+ _map.destAdd(i->_val, i->_x, i->_y);
+ _info._journal.marker(_level.playerId(), i->_val, true);
+ _info._unread._map = true;
}
break;
case ER_IMG:
- PlayerImg();
+ playerImg();
break;
case ER_TRAIT:
if (i->_x == 42)
- info.traitDel(i->_val, i->_y);
+ _info.traitDel(i->_val, i->_y);
else
- info.traitAdd(i->_val, i->_y);
+ _info.traitAdd(i->_val, i->_y);
break;
case ER_LEVEL:
if (i->_val == "Map")
- ToggleState(STATE_MAP);
+ toggleState(STATE_MAP);
else
- LoadLevel(i->_val, i->_x, i->_y);
+ loadLevel(i->_val, i->_x, i->_y);
break;
case ER_MOVE:
- for (auto &o : level._objects) {
+ for (auto &o : _level._objects) {
if (i->_val == o.id()) {
o.x(i->_x);
o.y(i->_y);
@@ -614,20 +614,20 @@ bool Game::ApplyResult() {
break;
case ER_PLAYER:
// First stop the movement of the current player sprite
- level.playerStop();
+ _level.playerStop();
// Then swap to the new id
- level.playerId(i->_val, i->_x, i->_y);
+ _level.playerId(i->_val, i->_x, i->_y);
// Stop the new player sprite's movement as well
- level.playerStop();
+ _level.playerStop();
break;
case ER_SAVE:
- CreateSaveGame(SAVEGAME_EVENT);
+ createSaveGame(SAVEGAME_EVENT);
break;
case ER_SYNC:
- level.calcProperties(info);
- map.update(info);
+ _level.calcProperties(_info);
+ _map.update(_info);
break;
case ER_QUIT:
g_engine->_tempData->credits = (i->_val == "credits");
@@ -637,22 +637,22 @@ bool Game::ApplyResult() {
}
}
- gem._per.Cache(info, level.playerId(), level);
- event_res.clear();
+ _gem._per.Cache(_info, _level.playerId(), _level);
+ _eventRes.clear();
return false;
}
-void Game::ApplyResult(LevelResult result) {
+void Game::applyResult(LevelResult result) {
switch (result.type) {
case LR_LEVEL:
if (result.val == "Map")
- ToggleState(STATE_MAP);
+ toggleState(STATE_MAP);
else
- LoadLevel(result.val, result.x, result.y);
+ loadLevel(result.val, result.x, result.y);
return;
case LR_GAMEOVER:
- state = STATE_LOSE_MENU;
- hud._gom.reset();
+ _state = STATE_LOSE_MENU;
+ _hud._gom.reset();
break;
default:
break;
@@ -664,7 +664,7 @@ void Game::ApplyResult(LevelResult result) {
//------------------------------------------------------------------------
void Game::loadState(Common::SeekableReadStream *stream) {
if (!_isInited)
- LoadGame();
+ loadGame();
Common::String data = stream->readString();
// +1 to include > as well
@@ -681,33 +681,33 @@ void Game::loadState(Common::SeekableReadStream *stream) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("save");
if (nodeValid(node)) {
- info.loadIronMan(node);
- loadStr(savefile.ironman, "file", node);
- hud._pause.updateMode(info.ironMan());
+ _info.loadIronMan(node);
+ loadStr(_savefile._ironman, "file", node);
+ _hud._pause.updateMode(_info.ironMan());
if (nodeValid("events", node))
- gem.loadState(node->first_node("events"));
+ _gem.loadState(node->first_node("events"));
if (nodeValid("info", node))
- info.loadState(node->first_node("info"));
+ _info.loadState(node->first_node("info"));
if (nodeValid("map", node))
- map.loadState(node->first_node("map"));
+ _map.loadState(node->first_node("map"));
- PlayerImg();
+ playerImg();
Common::String loc;
loadStr(loc, "loc_id", node);
- LoadLevel(loc);
+ loadLevel(loc);
if (nodeValid("level", node))
- level.loadState(node->first_node("level"));
+ _level.loadState(node->first_node("level"));
- gem._per.Cache(info, level.playerId(), level);
+ _gem._per.Cache(_info, _level.playerId(), _level);
Common::String playtime;
loadStr(playtime, "time", node);
- clock.Start(playtime);
+ _clock.Start(playtime);
}
}
}
@@ -728,49 +728,49 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
doc.append_node(root);
// Save location id
- Common::String loc = info.curLocID();
+ Common::String loc = _info.curLocID();
root->append_attribute(doc.allocate_attribute("loc_id", loc.c_str()));
// Save location name
- Common::String loc_name = info.curLocName();
+ Common::String loc_name = _info.curLocName();
root->append_attribute(doc.allocate_attribute("loc_name", loc_name.c_str()));
// Save player character name
Common::String char_name;
- if (info.personValid(level.playerId()))
- char_name = info.personGet(level.playerId())._name;
+ if (_info.personValid(_level.playerId()))
+ char_name = _info.personGet(_level.playerId())._name;
root->append_attribute(doc.allocate_attribute("char_name", char_name.c_str()));
// Difficulty
Common::String diff = "Normal";
- if (info.ironMan())
+ if (_info.ironMan())
diff = "Iron Man";
root->append_attribute(doc.allocate_attribute("diff", diff.c_str()));
// Save file used if iron man
- root->append_attribute(doc.allocate_attribute("file", savefile.ironman.c_str()));
+ root->append_attribute(doc.allocate_attribute("file", _savefile._ironman.c_str()));
// Preview image used
- root->append_attribute(doc.allocate_attribute("preview", level._previewPath.c_str()));
+ root->append_attribute(doc.allocate_attribute("preview", _level._previewPath.c_str()));
// Time played
- Common::String playtime = clock.GetTime();
+ Common::String playtime = _clock.GetTime();
root->append_attribute(doc.allocate_attribute("time", playtime.c_str()));
rapidxml::xml_node<char> *child_gem = doc.allocate_node(rapidxml::node_element, "events");
- gem.saveState(doc, child_gem);
+ _gem.saveState(doc, child_gem);
root->append_node(child_gem);
rapidxml::xml_node<char> *child_info = doc.allocate_node(rapidxml::node_element, "info");
- info.saveState(doc, child_info);
+ _info.saveState(doc, child_info);
root->append_node(child_info);
rapidxml::xml_node<char> *child_map = doc.allocate_node(rapidxml::node_element, "map");
- map.saveState(doc, child_map);
+ _map.saveState(doc, child_map);
root->append_node(child_map);
rapidxml::xml_node<char> *child_level = doc.allocate_node(rapidxml::node_element, "level");
- level.saveState(doc, child_level);
+ _level.saveState(doc, child_level);
root->append_node(child_level);
Common::String xml_as_string;
@@ -814,26 +814,26 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
//------------------------------------------------------------------------
// Purpose: Quit the game
//------------------------------------------------------------------------
-void Game::Quit(bool &ShouldChangeState, GameStateID &NewStateID, const GameStateID &NewStateVal) {
- ShouldChangeState = true;
- NewStateID = NewStateVal;
+void Game::quit(bool &shouldChangeState, GameStateID &newStateId, const GameStateID &newStateVal) {
+ shouldChangeState = true;
+ newStateId = newStateVal;
g_engine->_imageManager->loadMap(g_engine->_filePath->mainmenu_r);
}
//------------------------------------------------------------------------
// Purpose: Change our internal state
//------------------------------------------------------------------------
-void Game::ToggleState(const State &s) {
- if (state != s)
- state = s;
+void Game::toggleState(const State &s) {
+ if (_state != s)
+ _state = s;
else
- state = STATE_GAME;
+ _state = STATE_GAME;
// This is because game is the first state, the rest are in order
- hud.State(state - 1);
- hud._pause.reset();
+ _hud.State(_state - 1);
+ _hud._pause.reset();
// Only load help screen image if we have to
- if (state == STATE_HELP)
+ if (_state == STATE_HELP)
g_engine->_helpScreen->refresh();
else
g_engine->_helpScreen->clear();
@@ -842,7 +842,7 @@ void Game::ToggleState(const State &s) {
//------------------------------------------------------------------------
// Purpose: Use this function to actually save your games
//------------------------------------------------------------------------
-void Game::CreateSaveGame(const SaveGameType &savetype) {
+void Game::createSaveGame(const SaveGameType &savetype) {
#if 0
// Disregard type in iron man mode, we only save to one file
if (info.IronMan())
@@ -876,15 +876,15 @@ void Game::CreateSaveGame(const SaveGameType &savetype) {
}
void Game::setUI() {
- map.setUI();
- hud.setUI();
+ _map.setUI();
+ _hud.setUI();
g_engine->_loadMenu->setUI();
g_engine->_optionMenu->setUI();
- gem.setUI();
- info.setUI();
- level.setUI();
+ _gem.setUI();
+ _info.setUI();
+ _level.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 9edd963ae91..d36a5d70815 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -59,7 +59,7 @@ private:
STATE_HELP,
STATE_LOSE_MENU,
STATE_LOSE_LOAD
- } state;
+ } _state;
enum SaveGameType {
SAVEGAME_NORMAL, // Save the game normally when user uses the save menu
@@ -70,71 +70,73 @@ private:
// These things don't need to be saved
bool _isInited;
- pyrodactyl::ui::HUD hud;
- Common::Array<pyrodactyl::event::EventResult> event_res;
- pyrodactyl::ui::ParagraphData pop_default;
- pyrodactyl::ui::DebugConsole debug_console;
+ pyrodactyl::ui::HUD _hud;
+ Common::Array<pyrodactyl::event::EventResult> _eventRes;
+ pyrodactyl::ui::ParagraphData _popDefault;
+ pyrodactyl::ui::DebugConsole _debugConsole;
// These things need to be saved
- pyrodactyl::ui::Map map;
- pyrodactyl::event::Manager gem;
- pyrodactyl::event::Info info;
- pyrodactyl::level::Level level;
- pyrodactyl::event::TriggerSet game_over;
+ pyrodactyl::ui::Map _map;
+ pyrodactyl::event::Manager _gem;
+ pyrodactyl::event::Info _info;
+ pyrodactyl::level::Level _level;
+ pyrodactyl::event::TriggerSet _gameOver;
// Keeps track of the time player has spent in the game
- GameClock clock;
+ GameClock _clock;
// The name of the auto save and quick save files
struct SaveFile {
- bool auto_slot;
- Common::String auto_1, auto_2, auto_quit, quick, ironman;
+ bool _autoSlot;
+ Common::String _auto1, _auto2, _autoQuit, _quick, _ironman;
- SaveFile() : auto_1("AutoSave 1"), auto_2("AutoSave 2"), auto_quit("AutoSave"), quick("Quick Save") { auto_slot = false; }
+ SaveFile() : _auto1("autoSave 1"), _auto2("autoSave 2"), _autoQuit("autoSave"), _quick("Quick Save") { _autoSlot = false; }
void load(rapidxml::xml_node<char> *node) {
- loadStr(auto_1, "auto_1", node);
- loadStr(auto_2, "auto_2", node);
- loadStr(auto_quit, "quit", node);
- loadStr(quick, "quick", node);
+ loadStr(_auto1, "auto_1", node);
+ loadStr(_auto2, "auto_2", node);
+ loadStr(_autoQuit, "quit", node);
+ loadStr(_quick, "quick", node);
}
- } savefile;
+ } _savefile;
- static void Quit(bool &ShouldChangeState, GameStateID &NewStateID, const GameStateID &NewStateVal);
+ static void quit(bool &shouldChangeState, GameStateID &newStateId, const GameStateID &newStateVal);
- bool ApplyResult();
- void ApplyResult(LevelResult result);
+ bool applyResult();
+ void applyResult(LevelResult result);
// Load a level
- bool LoadLevel(const Common::String &id, int player_x = -1, int player_y = -1);
+ bool loadLevel(const Common::String &id, int playerX = -1, int playerY = -1);
- void ToggleState(const State &s);
+ void toggleState(const State &s);
// A nice simple function for saving games
- void CreateSaveGame(const SaveGameType &savetype);
+ void createSaveGame(const SaveGameType &savetype);
- Common::String FullPath(const Common::String &filename) {
+ Common::String fullPath(const Common::String &filename) {
Common::String res = "CRAB_" + filename;
res += g_engine->_filePath->save_ext;
return res;
}
// Load the current player image
- void PlayerImg() { hud.playerImg(g_engine->_eventStore->_img[info.playerImg()]); }
+ void playerImg() {
+ _hud.playerImg(g_engine->_eventStore->_img[_info.playerImg()]);
+ }
public:
Game() : _isInited(false) {}
- void Init(const Common::String &filename);
+ void init(const Common::String &filename);
- void StartNewGame();
- void LoadGame();
+ void startNewGame();
+ void loadGame();
- void handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
+ void handleEvents(Common::Event &event, bool &shouldChangeState, GameStateID &newStateId);
#if 0
void handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
- void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
+ void internalEvents(bool &shouldChangeState, GameStateID &newStateId);
void draw();
void loadState(Common::SeekableReadStream *stream);
@@ -142,7 +144,9 @@ public:
// Raw function to save game to file - generally, using the CreateSaveGame function is recommended
void saveState(Common::SeekableWriteStream *stream);
- void AutoSave() { CreateSaveGame(SAVEGAME_EXIT); }
+ void autoSave() {
+ createSaveGame(SAVEGAME_EXIT);
+ }
void setUI();
};
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index adca3a28e77..016322d7183 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -49,7 +49,7 @@ public:
virtual void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
virtual void draw() = 0;
virtual void setUI() = 0;
- virtual void AutoSave() = 0;
+ virtual void autoSave() = 0;
virtual ~GameState(){};
};
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index e86375fcf6b..04faedce945 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -65,7 +65,7 @@ bool Image::load(const Common::String &path) {
Common::File file;
ImageDecoder decoder;
- if (FileOpen(path, &file) && decoder.loadStream(file)) {
+ if (fileOpen(path, &file) && decoder.loadStream(file)) {
_texture = new Graphics::ManagedSurface(decoder.getSurface()->w, decoder.getSurface()->h, *g_engine->_format);
_texture->blitFrom(decoder.getSurface());
_w = _texture->w;
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 9c325e20f36..8b29d2ab4d8 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -136,7 +136,7 @@ public:
void setUI();
// We don't need to save game state here
- void AutoSave() {}
+ void autoSave() {}
};
} // End of namespace Crab
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 6203b61bc92..3b9a83210e5 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -65,7 +65,7 @@ public:
void setUI();
// We don't need to save game state here
- void AutoSave() {}
+ void autoSave() {}
};
}
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index e53db4718d9..b6d9ec25b24 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -70,7 +70,7 @@ void TextManager::init() {
TTF_SetFontHinting(font[pos], TTF_HINTING_LIGHT);
#endif
Common::File file;
- FileOpen(path->value(), &file);
+ fileOpen(path->value(), &file);
_font[pos] = Graphics::loadTTFFont(file, StringToNumber<int>(size->value()));
}
}
Commit: b58ad50f97cfc0147a91ee58b1bd840ab3888c55
https://github.com/scummvm/scummvm/commit/b58ad50f97cfc0147a91ee58b1bd840ab3888c55
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make misc classes follow code formatting conventions
Changed paths:
engines/crab/GameClock.h
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/LevelResult.h
engines/crab/Line.h
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGraphNode.h
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/Polygon.cpp
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/ai/spriteai.cpp
engines/crab/animation/PopUp.cpp
engines/crab/animation/sprite.cpp
engines/crab/app.cpp
engines/crab/crab.h
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/effect.cpp
engines/crab/event/gameevent.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/event/trigger.cpp
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gamestate_container.h
engines/crab/gametype.h
engines/crab/image/ImageManager.cpp
engines/crab/level/level.cpp
engines/crab/level/level_ai.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/loaders.h
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
engines/crab/numstr.h
engines/crab/people/trait.cpp
engines/crab/splash.cpp
engines/crab/text/TextManager.cpp
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/DevConsole.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/Inventory.cpp
engines/crab/ui/ModMenu.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/PageMenu.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/element.cpp
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 65f1599b1a6..6f9e430a270 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -37,43 +37,43 @@
namespace Crab {
class GameClock {
- Timer timer;
- uint32 start;
- Common::String seperator;
+ Timer _timer;
+ uint32 _start;
+ Common::String _seperator;
public:
- GameClock() : seperator(" : ") { start = 0; }
+ GameClock() : _seperator(" : ") { _start = 0; }
- void Start(uint32 initial_time = 0) {
- start = initial_time;
- timer.start();
+ void start(uint32 initialTime = 0) {
+ _start = initialTime;
+ _timer.start();
}
- void Start(const Common::String &str) {
+ void start(const Common::String &str) {
uint32 ms = 0, hr = 0, min = 0, sec = 0;
- Common::String str_hrs, str_min, str_sec;
+ Common::String strHrs, strMin, strSec;
- size_t found_1 = str.findFirstOf(seperator);
- if (found_1 > 0 && found_1 != Common::String::npos) {
- str_hrs = str.substr(0, found_1);
- hr = StringToNumber<uint32>(str_hrs);
+ size_t found1 = str.findFirstOf(_seperator);
+ if (found1 > 0 && found1 != Common::String::npos) {
+ strHrs = str.substr(0, found1);
+ hr = stringToNumber<uint32>(strHrs);
- size_t found_2 = str.findFirstOf(seperator);
- if (found_2 > 0 && found_2 != Common::String::npos) {
- str_sec = str.substr(found_2 + 1, Common::String::npos);
- sec = StringToNumber<uint32>(str_sec);
+ size_t found2 = str.findFirstOf(_seperator);
+ if (found2 > 0 && found2 != Common::String::npos) {
+ strSec = str.substr(found2 + 1, Common::String::npos);
+ sec = stringToNumber<uint32>(strSec);
- str_min = str.substr(found_1 + seperator.size(), found_2 - (2 * seperator.size()));
- min = StringToNumber<uint32>(str_min);
+ strMin = str.substr(found1 + _seperator.size(), found2 - (2 * _seperator.size()));
+ min = stringToNumber<uint32>(strMin);
}
}
ms = 3600000 * hr + 60000 * min + 1000 * sec;
- Start(ms);
+ start(ms);
}
- Common::String GetTime() {
- uint32 ms = start + timer.ticks();
+ Common::String getTime() {
+ uint32 ms = _start + _timer.ticks();
uint32 x = ms / 1000;
uint32 seconds = x % 60;
@@ -81,13 +81,13 @@ public:
uint32 minutes = x % 60;
uint32 hours = x / 60;
- Common::String time_str = NumberToString(hours);
- time_str += seperator;
- time_str += NumberToString(minutes);
- time_str += seperator;
- time_str += NumberToString(seconds);
+ Common::String timeStr = numberToString(hours);
+ timeStr += _seperator;
+ timeStr += numberToString(minutes);
+ timeStr += _seperator;
+ timeStr += numberToString(seconds);
- return time_str;
+ return timeStr;
}
};
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index 140c3ce948c..591b9a8c8ae 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -40,23 +40,23 @@ StringPool *gStrPool;
// Generate random numbers using this
//RandomNumberGen gRandom;
-FilePaths::FilePaths() : common("res/levels/common.xml"),
- mod_path("mods/"),
- mod_ext(".unrmod"),
- mod_cur("res/default.xml"),
- mainmenu_l("res/layout/main_menu_l.xml"),
- mainmenu_r("res/layout/main_menu_r.xml"),
- sound_effect("res/sounds/effects.xml"),
- sound_music("res/sounds/music.xml"),
- font("res/fonts/fonts.xml"),
- icon("res/gfx/icon.bmp"),
- save_dir("save/"),
- save_ext(".unr"),
- shaders("res/shaders/list.xml"),
- colors("res/gfx/colors.xml"),
- current_r("res/layout/main_menu_r.xml") {
- level.clear();
- loaded = false;
+FilePaths::FilePaths() : _common("res/levels/common.xml"),
+ _modPath("mods/"),
+ _modExt(".unrmod"),
+ _modCur("res/default.xml"),
+ _mainmenuL("res/layout/main_menu_l.xml"),
+ _mainmenuR("res/layout/main_menu_r.xml"),
+ _soundEffect("res/sounds/effects.xml"),
+ _soundMusic("res/sounds/music.xml"),
+ _font("res/fonts/fonts.xml"),
+ _icon("res/gfx/icon.bmp"),
+ _saveDir("save/"),
+ _saveExt(".unr"),
+ _shaders("res/shaders/list.xml"),
+ _colors("res/gfx/colors.xml"),
+ _currentR("res/layout/main_menu_r.xml") {
+ _level.clear();
+ _loaded = false;
#if 0
char *path = SDL_GetPrefPath("Pyrodactyl", "Unrest");
@@ -64,11 +64,11 @@ FilePaths::FilePaths() : common("res/levels/common.xml"),
SDL_free(path);
#endif
warning("FilePaths::FilePaths() setting appdata directory to game dir");
- appdata = "./";
+ _appdata = "./";
}
-void FilePaths::LoadLevel(const Common::String &filename) {
- level.clear();
+void FilePaths::loadLevel(const Common::String &filename) {
+ _level.clear();
XMLDoc lev_list(filename);
if (lev_list.ready()) {
rapidxml::xml_node<char> *node = lev_list.doc()->first_node("world");
@@ -80,7 +80,7 @@ void FilePaths::LoadLevel(const Common::String &filename) {
Common::String id;
loadStr(id, "id", n);
- level[id] = l;
+ _level[id] = l;
}
}
}
@@ -90,56 +90,56 @@ void FilePaths::load(const Common::String &filename) {
if (settings.ready()) {
rapidxml::xml_node<char> *node = settings.doc()->first_node("paths");
- if (nodeValid(node) && !loaded) {
+ if (nodeValid(node) && !_loaded) {
if (nodeValid("icon", node)) {
rapidxml::xml_node<char> *iconode = node->first_node("icon");
- icon = iconode->value();
+ _icon = iconode->value();
}
if (nodeValid("common", node)) {
rapidxml::xml_node<char> *commonnode = node->first_node("common");
- common = commonnode->value();
+ _common = commonnode->value();
}
if (nodeValid("font", node)) {
rapidxml::xml_node<char> *fontnode = node->first_node("font");
- font = fontnode->value();
+ _font = fontnode->value();
}
if (nodeValid("shader", node)) {
rapidxml::xml_node<char> *shadnode = node->first_node("shader");
- shaders = shadnode->value();
+ _shaders = shadnode->value();
}
if (nodeValid("color", node)) {
rapidxml::xml_node<char> *colnode = node->first_node("color");
- colors = colnode->value();
+ _colors = colnode->value();
}
if (nodeValid("mod", node)) {
rapidxml::xml_node<char> *modnode = node->first_node("mod");
- loadStr(mod_path, "path", modnode);
- loadStr(mod_ext, "ext", modnode);
- loadStr(mod_cur, "cur", modnode);
+ loadStr(_modPath, "path", modnode);
+ loadStr(_modExt, "ext", modnode);
+ loadStr(_modCur, "cur", modnode);
}
if (nodeValid("main_menu", node)) {
rapidxml::xml_node<char> *menunode = node->first_node("main_menu");
- loadStr(mainmenu_l, "l", menunode);
- loadStr(mainmenu_r, "r", menunode);
- current_r = mainmenu_r;
+ loadStr(_mainmenuL, "l", menunode);
+ loadStr(_mainmenuR, "r", menunode);
+ _currentR = _mainmenuR;
}
if (nodeValid("sound", node)) {
rapidxml::xml_node<char> *soundnode = node->first_node("sound");
- loadStr(sound_effect, "effect", soundnode);
- loadStr(sound_music, "music", soundnode);
+ loadStr(_soundEffect, "effect", soundnode);
+ loadStr(_soundMusic, "music", soundnode);
}
if (nodeValid("save", node)) {
rapidxml::xml_node<char> *savenode = node->first_node("save");
- loadStr(save_dir, "dir", savenode);
- loadStr(save_ext, "ext", savenode);
+ loadStr(_saveDir, "dir", savenode);
+ loadStr(_saveExt, "ext", savenode);
Common::String custom_path;
if (loadStr(custom_path, "custom", savenode)) {
@@ -155,7 +155,7 @@ void FilePaths::load(const Common::String &filename) {
}
}
- loaded = true;
+ _loaded = true;
}
}
}
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 6895d141071..490896bfa8e 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -40,84 +40,86 @@ namespace Crab {
// The index for all levels in the game
struct LevelPath {
// The file paths
- Common::String layout, asset;
+ Common::String _layout, _asset;
// The name of the level
- Common::String name;
+ Common::String _name;
- LevelPath() : layout(""), asset(""), name("") {}
+ LevelPath() : _layout(""), _asset(""), _name("") {}
void load(rapidxml::xml_node<char> *node) {
- loadStr(name, "name", node);
- loadStr(layout, "layout", node);
- loadStr(asset, "res", node);
+ loadStr(_name, "name", node);
+ loadStr(_layout, "layout", node);
+ loadStr(_asset, "res", node);
}
};
// Stores all layout paths for the game
struct FilePaths {
// Resources common to all levels and states
- Common::String common;
+ Common::String _common;
// Mod file location, current mod and their extension
- Common::String mod_path, mod_ext, mod_cur;
+ Common::String _modPath, _modExt, _modCur;
// Main menu resources
- Common::String mainmenu_l, mainmenu_r;
+ Common::String _mainmenuL, _mainmenuR;
// Sounds
- Common::String sound_effect, sound_music;
+ Common::String _soundEffect, _soundMusic;
// Fonts and window icon file
- Common::String font, icon;
+ Common::String _font, _icon;
// Save directory and extension
- Common::String save_dir, save_ext;
+ Common::String _saveDir, _saveExt;
// The location of the shader index file
- Common::String shaders;
+ Common::String _shaders;
// The location of the color index file
- Common::String colors;
+ Common::String _colors;
// The list of levels in the game
- Common::HashMap<Common::String, LevelPath> level;
+ Common::HashMap<Common::String, LevelPath> _level;
// The file path of the current resource file
- Common::String current_r;
+ Common::String _currentR;
// The application data path (where saves and settings are stored)
- Common::String appdata;
+ Common::String _appdata;
// Has this been loaded?
- bool loaded;
+ bool _loaded;
FilePaths();
void load(const Common::String &filename);
- void LoadLevel(const Common::String &filename);
+ void loadLevel(const Common::String &filename);
};
// Storage pool used for saving numbers as strings
class StringPool {
// Store integer strings here
// std::unordered_map<int, Common::String> pool_i;
- Common::HashMap<int, Common::String> pool_i;
+ Common::HashMap<int, Common::String> poolI;
// Store floating point strings here
struct FloatString {
- float val;
- Common::String str;
+ float _val;
+ Common::String _str;
- FloatString() { val = 0.0f; }
+ FloatString() {
+ _val = 0.0f;
+ }
};
// std::list<FloatString> pool_f;
- Common::List<FloatString> pool_f;
+ Common::List<FloatString> poolF;
public:
StringPool() {
- pool_i.clear();
- pool_f.clear();
+ poolI.clear();
+ poolF.clear();
}
const char *Get(const int &num) {
@@ -127,24 +129,24 @@ public:
return pool_i[num].c_str();
#endif
- if (pool_i.contains(num) == false)
- pool_i[num] = NumberToString<int>(num);
+ if (poolI.contains(num) == false)
+ poolI[num] = numberToString<int>(num);
- return pool_i.getVal(num).c_str();
+ return poolI.getVal(num).c_str();
}
const char *FGet(const float &num) {
- for (auto &i : pool_f)
- if (i.val == num)
- return i.str.c_str();
+ for (auto &i : poolF)
+ if (i._val == num)
+ return i._str.c_str();
FloatString fs;
- fs.val = num;
+ fs._val = num;
//fs.str = NumberToString<float>(num);
- pool_f.push_back(fs);
+ poolF.push_back(fs);
- auto ret = pool_f.back();
- return ret.str.c_str();
+ auto ret = poolF.back();
+ return ret._str.c_str();
}
};
@@ -167,17 +169,17 @@ struct TempValue {
// load button - hidden in iron man
// exit - saves and exits in iron man
// quick save and quick load - operate on the iron man file in iron man mode
- bool ironman;
+ bool _ironman;
// This is the filename a player chose when selecting "new game" + iron man mode
- Common::String filename;
+ Common::String _filename;
// We use this to see whether the player is exiting to main menu or to credits
- bool credits;
+ bool _credits;
- TempValue() : filename("No IronMan") {
- ironman = false;
- credits = false;
+ TempValue() : _filename("No IronMan") {
+ _ironman = false;
+ _credits = false;
}
};
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index d5e02886703..50c2aadbbac 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -36,19 +36,21 @@
namespace Crab {
-enum LevelResultType { LR_NONE,
- LR_LEVEL,
- LR_GAMEOVER };
+enum LevelResultType {
+ LR_NONE,
+ LR_LEVEL,
+ LR_GAMEOVER
+};
struct LevelResult {
- LevelResultType type;
- Common::String val;
- int x, y;
-
- LevelResult() : val("") {
- type = LR_NONE;
- x = -1;
- y = -1;
+ LevelResultType _type;
+ Common::String _val;
+ int _x, _y;
+
+ LevelResult() : _val("") {
+ _type = LR_NONE;
+ _x = -1;
+ _y = -1;
}
};
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index b03d38d9afc..170e029e17a 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -39,28 +39,28 @@ namespace Crab {
// Find if 2 lines intersect and store the point of intersection
template<typename T>
-bool CollideLine(const T &p0_x, const T &p0_y, const T &p1_x, const T &p1_y,
- const T &p2_x, const T &p2_y, const T &p3_x, const T &p3_y,
+bool CollideLine(const T &p0X, const T &p0Y, const T &p1X, const T &p1Y,
+ const T &p2X, const T &p2Y, const T &p3X, const T &p3Y,
T *x = NULL, T *y = NULL) {
Vector2D<T> s1, s2;
- s1.x = p1_x - p0_x;
- s1.y = p1_y - p0_y;
- s2.x = p3_x - p2_x;
- s2.y = p3_y - p2_y;
+ s1.x = p1X - p0X;
+ s1.y = p1Y - p0Y;
+ s2.x = p3X - p2X;
+ s2.y = p3Y - p2Y;
float d = (-s2.x * s1.y + s1.x * s2.y);
if (d != 0) {
float s, t;
- s = (-s1.y * (p0_x - p2_x) + s1.x * (p0_y - p2_y)) / d;
- t = (s2.x * (p0_y - p2_y) - s2.y * (p0_x - p2_x)) / d;
+ s = (-s1.y * (p0X - p2X) + s1.x * (p0Y - p2Y)) / d;
+ t = (s2.x * (p0Y - p2Y) - s2.y * (p0X - p2X)) / d;
if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
// Collision detected
if (x != NULL)
- *x = p0_x + (t * s1.x);
+ *x = p0X + (t * s1.x);
if (y != NULL)
- *y = p0_y + (t * s1.y);
+ *y = p0Y + (t * s1.y);
return true;
}
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index d7db75b9031..24edada350f 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -42,25 +42,25 @@ void LoadingScreen::load() {
if (nodeValid("screens", node)) {
rapidxml::xml_node<char> *scrnode = node->first_node("screens");
for (auto n = scrnode->first_node("screen"); n != NULL; n = n->next_sibling("screen"))
- screen.push_back(n);
+ _screen.push_back(n);
}
if (nodeValid("text", node))
- text.load(node->first_node("text"), "img");
+ _text.load(node->first_node("text"), "img");
}
}
}
void LoadingScreen::draw() {
// Change to a random screen
- Change();
+ change();
// Draw the current screen
- if (cur < screen.size())
- screen[cur].draw();
+ if (_cur < _screen.size())
+ _screen[_cur].draw();
// Draw the loading text
- text.draw((g_engine->_screenSettings->cur.w - text.w()) / 2, (g_engine->_screenSettings->cur.h - text.h()) / 2);
+ _text.draw((g_engine->_screenSettings->_cur.w - _text.w()) / 2, (g_engine->_screenSettings->_cur.h - _text.h()) / 2);
g_engine->_screen->update();
@@ -68,7 +68,7 @@ void LoadingScreen::draw() {
//SDL_RenderPresent(gRenderer);
}
-void LoadingScreen::Dim() {
+void LoadingScreen::dim() {
#if 0
// This is used when starting or loading a game from the main menu in order to dim the screen
// until an actual loading screen is drawn
@@ -82,10 +82,10 @@ void LoadingScreen::Dim() {
}
void LoadingScreen::Quit() {
- text.deleteImage();
+ _text.deleteImage();
- for (auto i = screen.begin(); i != screen.end(); ++i)
- i->Delete();
+ for (auto i = _screen.begin(); i != _screen.end(); ++i)
+ i->clear();
}
} // End of namespace Crab
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index fb01ec6ca87..3cfe53d54a6 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -41,33 +41,41 @@ namespace Crab {
class LoadingScreen {
struct Screen {
// The background image
- pyrodactyl::image::Image bg;
+ pyrodactyl::image::Image _bg;
- Screen(rapidxml::xml_node<char> *node) { bg.load(node, "bg"); }
- void Delete() { bg.deleteImage(); }
- void draw() { bg.draw((g_engine->_screenSettings->cur.w - bg.w()) / 2, (g_engine->_screenSettings->cur.h - bg.h()) / 2); }
+ Screen(rapidxml::xml_node<char> *node) {
+ _bg.load(node, "bg");
+ }
+
+ void clear() {
+ _bg.deleteImage();
+ }
+
+ void draw() {
+ _bg.draw((g_engine->_screenSettings->_cur.w - _bg.w()) / 2, (g_engine->_screenSettings->_cur.h - _bg.h()) / 2);
+ }
};
// The different loading screens
- Common::Array<Screen> screen;
+ Common::Array<Screen> _screen;
// The current loading screen
- unsigned int cur;
+ unsigned int _cur;
// The text image (says loading)
- pyrodactyl::image::Image text;
+ pyrodactyl::image::Image _text;
public:
- LoadingScreen() { cur = 0; };
+ LoadingScreen() { _cur = 0; };
~LoadingScreen(){};
- void Change() {
- cur = g_engine->getRandomNumber(screen.size() - 1);
+ void change() {
+ _cur = g_engine->getRandomNumber(_screen.size() - 1);
}
void load();
void draw();
- void Dim();
+ void dim();
void Quit();
};
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index ec240ca7e1d..892797e310f 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -33,124 +33,124 @@
namespace Crab {
-PathfindingAgent::PathfindingAgent(void) : nodeQueue(compareNodes) {
- grid = NULL;
+PathfindingAgent::PathfindingAgent(void) : _nodeQueue(compareNodes) {
+ _grid = NULL;
- destinationSet = false;
- destinationReachable = false;
- nodeBufferDistance = 1.0f;
- solutionFound = noSolution = false;
+ _destinationSet = false;
+ _destinationReachable = false;
+ _nodeBufferDistance = 1.0f;
+ _solutionFound = _noSolution = false;
- m_pStartTile = nullptr;
- m_pGoalTile = nullptr;
- m_pClickedTile = nullptr;
+ _startTile = nullptr;
+ _goalTile = nullptr;
+ _clickedTile = nullptr;
}
PathfindingAgent::~PathfindingAgent(void) {
}
void PathfindingAgent::initialize(PathfindingGrid *g) {
- grid = g;
+ _grid = g;
- nodeBufferDistance = grid->GetCellSize().x / 2.0f;
+ _nodeBufferDistance = _grid->getCellSize().x / 2.0f;
- nodeBufferDistance *= nodeBufferDistance;
+ _nodeBufferDistance *= _nodeBufferDistance;
}
-void PathfindingAgent::SetDestination(Vector2i d, bool r) {
+void PathfindingAgent::setDestination(Vector2i d, bool r) {
Vector2f iVec = Vector2f((float)d.x, (float)d.y);
- SetDestination(iVec, r);
+ setDestination(iVec, r);
}
-void PathfindingAgent::SetDestination(Vector2i d) {
- SetDestination(d, true);
+void PathfindingAgent::setDestination(Vector2i d) {
+ setDestination(d, true);
}
-void PathfindingAgent::SetDestination(Vector2f d) {
- SetDestination(d, true);
+void PathfindingAgent::setDestination(Vector2f d) {
+ setDestination(d, true);
}
-void PathfindingAgent::SetDestination(Vector2f d, bool r) {
- if (grid == NULL)
+void PathfindingAgent::setDestination(Vector2f d, bool r) {
+ if (_grid == NULL)
return;
- destination = d;
+ _destination = d;
// TODO: This could be optimized to cache the route somehow... (SZ)
reset();
- m_pStartTile = grid->GetNodeAtPoint(position);
+ _startTile = _grid->getNodeAtPoint(_position);
// m_pGoalTile = grid->GetNodeAtPoint(d);
// I am now tracking the goal node and the clicked tile separately to solve problems
// with hangups and trying to reach un-reachable destinations.
- m_pClickedTile = grid->GetNodeAtPoint(d);
- m_pGoalTile = grid->GetNearestOpenNode(d, position);
+ _clickedTile = _grid->getNodeAtPoint(d);
+ _goalTile = _grid->getNearestOpenNode(d, _position);
PlannerNode *startingNode = new PlannerNode();
- startingNode->SetLocation(m_pStartTile);
- startingNode->SetHCost((position - destination).Magnitude());
- startingNode->SetFinalCost((position - destination).Magnitude());
- startingNode->SetGivenCost(0.0);
+ startingNode->setLocation(_startTile);
+ startingNode->setHCost((_position - _destination).Magnitude());
+ startingNode->setFinalCost((_position - _destination).Magnitude());
+ startingNode->setGivenCost(0.0);
- nodeQueue.push(startingNode);
- m_mCreatedList[m_pStartTile] = (startingNode);
+ _nodeQueue.push(startingNode);
+ _createdList[_startTile] = (startingNode);
- destinationSet = true;
- solutionFound = noSolution = false;
+ _destinationSet = true;
+ _solutionFound = _noSolution = false;
- destinationReachable = r;
+ _destinationReachable = r;
}
-void PathfindingAgent::Update(long timeslice) {
+void PathfindingAgent::update(long timeslice) {
long prevTime = g_system->getMillis();
long time = timeslice;
double dTempCost;
- if (solutionFound) {
+ if (_solutionFound) {
if (m_vSolution.size() > 0) {
- float distSqr = (position - m_vSolution.back()->GetPosition()).MagSqr();
- if (distSqr < nodeBufferDistance) // Have to find the right deadzone buffer
+ float distSqr = (_position - m_vSolution.back()->getPosition()).MagSqr();
+ if (distSqr < _nodeBufferDistance) // Have to find the right deadzone buffer
{
m_vSolution.pop_back();
}
}
if (m_vSolution.size() > 0) {
- immediateDest = Vector2i(m_vSolution.back()->GetPosition().x, m_vSolution.back()->GetPosition().y);
+ _immediateDest = Vector2i(m_vSolution.back()->getPosition().x, m_vSolution.back()->getPosition().y);
} else {
- if (destinationReachable)
- immediateDest = Vector2i((int)destination.x, (int)destination.y);
+ if (_destinationReachable)
+ _immediateDest = Vector2i((int)_destination.x, (int)_destination.y);
else
- immediateDest = Vector2i((int)position.x, (int)position.y);
+ _immediateDest = Vector2i((int)_position.x, (int)_position.y);
}
return;
}
// No nodes, no pathing.
- if (nodeQueue.empty()) {
+ if (_nodeQueue.empty()) {
return;
}
Common::StableMap<PathfindingGraphNode *, PlannerNode *>::iterator currentIter;
do {
- PlannerNode *current = nodeQueue.front();
- nodeQueue.pop();
+ PlannerNode *current = _nodeQueue.front();
+ _nodeQueue.pop();
- if (current->GetLocation() == m_pGoalTile)
+ if (current->getLocation() == _goalTile)
//|| //We're done.
{
// m_vSolution = getSolution();
m_vSolution = getPrunedSolution(NULL);
- solutionFound = true;
+ _solutionFound = true;
return;
- } else if (current->GetLocation()->GetMovementCost() > 0 && current->GetLocation()->AdjacentToNode(m_pClickedTile) && m_pClickedTile->GetMovementCost() < 0) {
- m_vSolution = getPrunedSolution(current->GetLocation());
- solutionFound = true;
+ } else if (current->getLocation()->getMovementCost() > 0 && current->getLocation()->adjacentToNode(_clickedTile) && _clickedTile->getMovementCost() < 0) {
+ m_vSolution = getPrunedSolution(current->getLocation());
+ _solutionFound = true;
return;
}
@@ -163,49 +163,49 @@ void PathfindingAgent::Update(long timeslice) {
// {
Common::Array<PathfindingGraphNode *>::iterator i;
- for (i = current->location->neighborNodes.begin(); i != current->location->neighborNodes.end(); ++i) {
+ for (i = current->_location->_neighborNodes.begin(); i != current->_location->_neighborNodes.end(); ++i) {
// Get the new tile to check
//_checkTile = m_pTileMap->getTile(current->GetLocation()->getRow() + x, current->GetLocation()->getColumn() + y);
- if ((*i)->GetMovementCost() > 0) {
+ if ((*i)->getMovementCost() > 0) {
// Compute the temp given cost
- dTempCost = current->GetGivenCost() + ((*i)->GetMovementCost() * distExact((*i), current->GetLocation()));
+ dTempCost = current->getGivenCost() + ((*i)->getMovementCost() * distExact((*i), current->getLocation()));
// If it's a duplicate...
- currentIter = m_mCreatedList.find((*i));
- if (currentIter != m_mCreatedList.end()) {
- if (dTempCost < currentIter->second->GetGivenCost()) {
+ currentIter = _createdList.find((*i));
+ if (currentIter != _createdList.end()) {
+ if (dTempCost < currentIter->second->getGivenCost()) {
// If the current planner node has already been added, but the current path is cheaper,
// replace it.
- nodeQueue.remove(currentIter->second);
+ _nodeQueue.remove(currentIter->second);
- currentIter->second->SetGivenCost(dTempCost);
- currentIter->second->SetFinalCost(
- currentIter->second->GetHCost() * 1.1 +
- currentIter->second->GetGivenCost());
+ currentIter->second->setGivenCost(dTempCost);
+ currentIter->second->setFinalCost(
+ currentIter->second->getHCost() * 1.1 +
+ currentIter->second->getGivenCost());
- currentIter->second->SetParent(current);
+ currentIter->second->setParent(current);
- nodeQueue.push(currentIter->second);
+ _nodeQueue.push(currentIter->second);
}
}
// Otherwise...
else {
PlannerNode *successor = new PlannerNode();
- successor->SetLocation((*i));
+ successor->setLocation((*i));
// Set the new heuristic (distance from node to the goal)
- successor->SetHCost(distExact((*i), m_pGoalTile));
- successor->SetGivenCost(dTempCost);
+ successor->setHCost(distExact((*i), _goalTile));
+ successor->setGivenCost(dTempCost);
// Final cost is the distance to goal (scaled by 10%) plus the distance of the path.
- successor->SetFinalCost(successor->GetHCost() * 1.1 + successor->GetGivenCost());
+ successor->setFinalCost(successor->getHCost() * 1.1 + successor->getGivenCost());
- successor->SetParent(current);
+ successor->setParent(current);
- m_mCreatedList[(*i)] = (successor);
- nodeQueue.push(successor); // When the node is pushed onto the PriorityQueue it ends up beings sorted cheapest -> most expensive
+ _createdList[(*i)] = (successor);
+ _nodeQueue.push(successor); // When the node is pushed onto the PriorityQueue it ends up beings sorted cheapest -> most expensive
}
}
}
@@ -219,11 +219,11 @@ void PathfindingAgent::Update(long timeslice) {
}
} while (!isDone() && (time >= 0 || timeslice == 0));
- noSolution = true; // You can't get there from here (SZ)
+ _noSolution = true; // You can't get there from here (SZ)
}
bool PathfindingAgent::isDone() const {
- if (nodeQueue.empty())
+ if (_nodeQueue.empty())
return true;
return false;
@@ -232,26 +232,26 @@ bool PathfindingAgent::isDone() const {
// Clear everything.
void PathfindingAgent::reset() {
Common::StableMap<PathfindingGraphNode *, PlannerNode *>::iterator iter;
- if (!m_mCreatedList.empty()) {
- for (iter = m_mCreatedList.begin(); iter != m_mCreatedList.end(); ++iter) {
+ if (!_createdList.empty()) {
+ for (iter = _createdList.begin(); iter != _createdList.end(); ++iter) {
delete (*iter).second;
}
}
- nodeQueue.clear();
- m_mCreatedList.clear();
+ _nodeQueue.clear();
+ _createdList.clear();
m_vSolution.clear();
- solutionFound = false;
+ _solutionFound = false;
- m_pGoalTile = NULL;
- m_pStartTile = NULL;
+ _goalTile = NULL;
+ _startTile = NULL;
}
void PathfindingAgent::shutdown() {
reset();
- grid = NULL;
+ _grid = NULL;
}
Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getSolution(PathfindingGraphNode *destNode) const {
@@ -259,25 +259,25 @@ Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getSolution(
PlannerNode *current = NULL;
- if (m_mCreatedList.find(m_pGoalTile) != m_mCreatedList.end()) {
- current = m_mCreatedList.find(m_pGoalTile)->second;
+ if (_createdList.find(_goalTile) != _createdList.end()) {
+ current = _createdList.find(_goalTile)->second;
}
// If the dest node passed in is not null, that means we did not reach the goal but came close
// so we should start with that node instead when we are constructing our path
else if (destNode != NULL) {
- current = m_mCreatedList.find(destNode)->second;
+ current = _createdList.find(destNode)->second;
}
// Iterate through the planner nodes to create a vector to return.
while (current) {
- if (current->GetLocation() != m_pStartTile) {
+ if (current->getLocation() != _startTile) {
// You don't have to path to the start
- if (current->GetLocation() != m_pStartTile)
- temp.push_back(current->GetLocation());
+ if (current->getLocation() != _startTile)
+ temp.push_back(current->getLocation());
}
- current = current->GetParent();
+ current = current->getParent();
}
return temp;
@@ -290,11 +290,11 @@ Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSol
// Any node that is not adjacent to an obstacle or an obstacle corner can be removed.
for (int i = 0; (unsigned int)i < temp.size(); ++i) {
- if (!temp[i]->AdjacentToObstacle()) {
+ if (!temp[i]->adjacentToObstacle()) {
if (i > 0 && (unsigned int)i < temp.size() - 1) {
// This check to see if the node is a "corner" to an obstacle that should not be pruned
// to prevent hanging on corners.
- Common::Array<PathfindingGraphNode *> corners = grid->CornerCheck(temp[i - 1], temp[i + 1]);
+ Common::Array<PathfindingGraphNode *> corners = _grid->cornerCheck(temp[i - 1], temp[i + 1]);
if (corners.size() == 0) {
Common::Array<PathfindingGraphNode const *>::iterator theEnd = Common::remove(returnVec.begin(), returnVec.end(), temp[i]);
@@ -308,25 +308,25 @@ Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSol
}
double PathfindingAgent::distSquared(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB) {
- Vector2f vecTo = tileA->GetPosition() - tileB->GetPosition();
+ Vector2f vecTo = tileA->getPosition() - tileB->getPosition();
return vecTo.MagSqr();
}
double PathfindingAgent::distExact(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB) {
- Vector2f vecTo = tileA->GetPosition() - tileB->GetPosition();
+ Vector2f vecTo = tileA->getPosition() - tileB->getPosition();
return vecTo.Magnitude();
}
// This keeps the PriorityQueue organized based on the cost of the paths.
bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB) {
- return nodeA->GetFinalCost() > nodeB->GetFinalCost();
+ return nodeA->getFinalCost() > nodeB->getFinalCost();
}
-bool PathfindingAgent::AdjacentToGoal(PathfindingGraphNode *node) {
- for (auto iter : node->neighborNodes) {
- if (iter == m_pGoalTile) {
+bool PathfindingAgent::adjacentToGoal(PathfindingGraphNode *node) {
+ for (auto iter : node->_neighborNodes) {
+ if (iter == _goalTile) {
return true;
}
}
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index b313e026cff..cb273ce9f89 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -40,79 +40,118 @@ namespace Crab {
// This class represents the actual pathfinding and following agent that utilizes
// the pathfinding grid
class PlannerNode {
- PlannerNode *parent;
- PlannerNode *child;
+ PlannerNode *_parent;
+ PlannerNode *_child;
- double cost; // Heuristic cost equivalent to cost to reach goal from planner node's position.
- double finalCost; // Final cost of route through the planner node. Used to determine optimal path.
- double givenCost; // The current distance of the route.
+ double _cost; // Heuristic cost equivalent to cost to reach goal from planner node's position.
+ double _finalCost; // Final cost of route through the planner node. Used to determine optimal path.
+ double _givenCost; // The current distance of the route.
public:
- PathfindingGraphNode *location;
+ PathfindingGraphNode *_location;
PlannerNode() {
- location = NULL;
- parent = NULL;
- child = NULL;
- cost = 0;
- finalCost = 0;
- givenCost = 0;
+ _location = NULL;
+ _parent = NULL;
+ _child = NULL;
+ _cost = 0;
+ _finalCost = 0;
+ _givenCost = 0;
}
~PlannerNode() {}
- PathfindingGraphNode *GetLocation(void) { return location; }
- PlannerNode *GetParent(void) { return parent; }
- PlannerNode *GetChild(void) { return child; }
- double GetHCost(void) const { return cost; }
- double GetFinalCost(void) const { return finalCost; }
- double GetGivenCost(void) const { return givenCost; }
-
- void SetLocation(PathfindingGraphNode *loc) { location = loc; }
- void SetParent(PlannerNode *p) { parent = p; }
- void SetChild(PlannerNode *c) { child = c; }
- void SetHCost(double c) { cost = c; }
- void SetFinalCost(double c) { finalCost = c; }
- void SetGivenCost(double c) { givenCost = c; }
+ PathfindingGraphNode *getLocation(void) {
+ return _location;
+ }
+
+ PlannerNode *getParent(void) {
+ return _parent;
+ }
+
+ PlannerNode *getChild(void) {
+ return _child;
+ }
+
+ double getHCost(void) const {
+ return _cost;
+ }
+
+ double getFinalCost(void) const {
+ return _finalCost;
+ }
+
+ double getGivenCost(void) const {
+ return _givenCost;
+ }
+
+ void setLocation(PathfindingGraphNode *loc) {
+ _location = loc;
+ }
+
+ void setParent(PlannerNode *p) {
+ _parent = p;
+ }
+
+ void setChild(PlannerNode *c) {
+ _child = c;
+ }
+
+ void setHCost(double c) {
+ _cost = c;
+ }
+
+ void setFinalCost(double c) {
+ _finalCost = c;
+ }
+
+ void setGivenCost(double c) {
+ _givenCost = c;
+ }
};
class PathfindingAgent {
- Vector2f position;
- Vector2f prevPosition; // Used to determine that we are making progress toward the goal
- Vector2i immediateDest; // The next stop on the AI's path
+ Vector2f _position;
+ Vector2f _prevPosition; // Used to determine that we are making progress toward the goal
+ Vector2i _immediateDest; // The next stop on the AI's path
- bool destinationSet; // Was a destination specified.
- bool destinationReachable; // Can the agent actually get to the destination?
+ bool _destinationSet; // Was a destination specified.
+ bool _destinationReachable; // Can the agent actually get to the destination?
- float nodeBufferDistance; // How much leeway is there for reaching the destination
+ float _nodeBufferDistance; // How much leeway is there for reaching the destination
public:
PathfindingAgent();
~PathfindingAgent();
- PathfindingGrid *grid;
+ PathfindingGrid *_grid;
- Vector2f destination;
+ Vector2f _destination;
- PathfindingGraphNode *m_pStartTile; // The system originally used tiles, but this one uses discreet points.
- PathfindingGraphNode *m_pGoalTile; // The tile we are trying to reach. May not be the tile that was clicked if the clicked tile is blocked.
- PathfindingGraphNode *m_pClickedTile; // The tile that was clicked. If it is open, it will be the goal node.
+ PathfindingGraphNode *_startTile; // The system originally used tiles, but this one uses discreet points.
+ PathfindingGraphNode *_goalTile; // The tile we are trying to reach. May not be the tile that was clicked if the clicked tile is blocked.
+ PathfindingGraphNode *_clickedTile; // The tile that was clicked. If it is open, it will be the goal node.
- bool solutionFound;
- bool noSolution;
+ bool _solutionFound;
+ bool _noSolution;
Common::Array<PathfindingGraphNode const *> m_vSolution;
- void SetNodeBufferDistance(float w) { nodeBufferDistance = w; }
- float GetNodeBufferDistance() { return nodeBufferDistance; }
+ void setNodeBufferDistance(float w) {
+ _nodeBufferDistance = w;
+ }
+
+ float getNodeBufferDistance() {
+ return _nodeBufferDistance;
+ }
// Added for Greedy search
double distSquared(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB);
// Added for A* search
double distExact(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB);
- PriorityQueue<PlannerNode> nodeQueue;
+ PriorityQueue<PlannerNode> _nodeQueue;
- Common::StableMap<PathfindingGraphNode *, PlannerNode *> m_mCreatedList;
+ Common::StableMap<PathfindingGraphNode *, PlannerNode *> _createdList;
// void SetSprite(pyrodactyl::anim::Sprite* s){entitySprite = s;}
@@ -124,22 +163,34 @@ public:
//! to access each tile's location and weight data.
void initialize(PathfindingGrid *g);
- void SetDestination(Vector2f d);
- void SetDestination(Vector2f d, bool r);
- void SetDestination(Vector2i d);
- void SetDestination(Vector2i d, bool r);
+ void setDestination(Vector2f d);
+ void setDestination(Vector2f d, bool r);
+ void setDestination(Vector2i d);
+ void setDestination(Vector2i d, bool r);
+
+ void setPosition(Vector2f p) {
+ _position = p;
+ }
+
+ void setPrevPosition(Vector2f p) {
+ _prevPosition = p;
+ }
- void SetPosition(Vector2f p) { position = p; }
- void SetPrevPosition(Vector2f p) { prevPosition = p; }
- Vector2f GetPosition() { return position; }
+ Vector2f getPosition() {
+ return _position;
+ }
- bool PositionChanged() { return position != prevPosition; }
+ bool positionChanged() {
+ return _position != _prevPosition;
+ }
- Vector2i GetImmediateDest() { return immediateDest; }
+ Vector2i getImmediateDest() {
+ return _immediateDest;
+ }
//! \brief Performs the main part of the algorithm until the specified time has elapsed or
//! no nodes are left open.
- void Update(long timeslice);
+ void update(long timeslice);
//! \brief Returns <code>true</code> if and only if no nodes are left open.
//!
@@ -160,7 +211,7 @@ public:
void shutdown();
// Returns true if the node connects to the goal node
- bool AdjacentToGoal(PathfindingGraphNode *node);
+ bool adjacentToGoal(PathfindingGraphNode *node);
};
bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB);
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 78f73bb5c97..69e3328a1b0 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -33,58 +33,58 @@
namespace Crab {
PathfindingGraphNode::PathfindingGraphNode(void) {
- id = -1;
- movementCost = -1.0f;
+ _id = -1;
+ _movementCost = -1.0f;
}
-PathfindingGraphNode::PathfindingGraphNode(Vector2f pos, int i) : position(pos) {
- id = i;
- movementCost = -1.0f;
+PathfindingGraphNode::PathfindingGraphNode(Vector2f pos, int i) : _position(pos) {
+ _id = i;
+ _movementCost = -1.0f;
}
PathfindingGraphNode::~PathfindingGraphNode(void) {
}
-void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode *node) {
- AddNeighbor(node, false);
+void PathfindingGraphNode::addNeighbor(PathfindingGraphNode *node) {
+ addNeighbor(node, false);
}
-void PathfindingGraphNode::AddNeighbor(PathfindingGraphNode *node, bool ignoreDistance) {
+void PathfindingGraphNode::addNeighbor(PathfindingGraphNode *node, bool ignoreDistance) {
// You can't be your own neighbor. Sorry.
- if (node->id == this->id)
+ if (node->_id == this->_id)
return;
// Make sure that the node is not already a neighbor (SZ)
- for (unsigned int i = 0; i < neighborNodes.size(); ++i) {
- if (neighborNodes[i]->id == node->id) {
+ for (unsigned int i = 0; i < _neighborNodes.size(); ++i) {
+ if (_neighborNodes[i]->_id == node->_id) {
return;
}
}
- neighborNodes.push_back(node);
+ _neighborNodes.push_back(node);
// Determine the cost.
if (ignoreDistance) {
- neighborCosts.push_back(node->movementCost);
+ _neighborCosts.push_back(node->_movementCost);
} else {
- Vector2f distVec = node->position - this->position;
+ Vector2f distVec = node->_position - this->_position;
- neighborCosts.push_back(distVec.Magnitude() * node->movementCost);
+ _neighborCosts.push_back(distVec.Magnitude() * node->_movementCost);
}
}
-bool PathfindingGraphNode::AdjacentToObstacle() const {
- for (auto iter = neighborNodes.begin(); iter != neighborNodes.end(); ++iter) {
- if ((*iter)->GetMovementCost() < 0)
+bool PathfindingGraphNode::adjacentToObstacle() const {
+ for (auto iter = _neighborNodes.begin(); iter != _neighborNodes.end(); ++iter) {
+ if ((*iter)->getMovementCost() < 0)
return true;
}
return false;
}
-bool PathfindingGraphNode::AdjacentToNode(PathfindingGraphNode *otherNode) {
- for (unsigned int i = 0; i < neighborNodes.size(); ++i) {
- if (neighborNodes[i] == otherNode)
+bool PathfindingGraphNode::adjacentToNode(PathfindingGraphNode *otherNode) {
+ for (unsigned int i = 0; i < _neighborNodes.size(); ++i) {
+ if (_neighborNodes[i] == otherNode)
return true;
}
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
index 27ddc01bc55..0a1068b82b7 100644
--- a/engines/crab/PathfindingGraphNode.h
+++ b/engines/crab/PathfindingGraphNode.h
@@ -41,17 +41,17 @@ namespace Crab {
class PathfindingGraphNode {
friend class PathfindingGrid;
- int id; // Each ID will be assigned when the pathfinding graph is generated and will identify each node.
+ int _id; // Each ID will be assigned when the pathfinding graph is generated and will identify each node.
- float movementCost; // 1 is open terrain, >1 is impeding terrain, <0 is completely obstructed
+ float _movementCost; // 1 is open terrain, >1 is impeding terrain, <0 is completely obstructed
- Vector2f position; // Position of the node
+ Vector2f _position; // Position of the node
- Rect collisionRect; // Represents spaced covered by the node.
+ Rect _collisionRect; // Represents spaced covered by the node.
public:
- Common::Array<PathfindingGraphNode *> neighborNodes;
- Common::Array<float> neighborCosts; // The movement cost for the neighbor nodes (distance to the node X the nodes movement cost)
+ Common::Array<PathfindingGraphNode *> _neighborNodes;
+ Common::Array<float> _neighborCosts; // The movement cost for the neighbor nodes (distance to the node X the nodes movement cost)
// This is stored to prevent having to recalculate each frame.
PathfindingGraphNode(void);
@@ -59,25 +59,32 @@ public:
~PathfindingGraphNode(void);
- float GetMovementCost() { return movementCost; }
- Vector2f GetPosition() const { return position; }
+ float getMovementCost() {
+ return _movementCost;
+ }
+
+ Vector2f getPosition() const {
+ return _position;
+ }
// Adds node to neighbor vector and cost to neighbor costs
- void AddNeighbor(PathfindingGraphNode *node);
+ void addNeighbor(PathfindingGraphNode *node);
// Same as above, but does not calculate distance. Used when all nodes
// are equidistant
- void AddNeighbor(PathfindingGraphNode *node, bool ignoreDistance);
+ void addNeighbor(PathfindingGraphNode *node, bool ignoreDistance);
// const Common::Array< PathfindingGraphNode*>& GetNeighbors() const;
- Rect GetRect() const { return collisionRect; }
+ Rect getRect() const {
+ return _collisionRect;
+ }
// Return true if the node is adjacent to a blocked node
- bool AdjacentToObstacle() const;
+ bool adjacentToObstacle() const;
// Return true if the node is adjacent to the otherNode
- bool AdjacentToNode(PathfindingGraphNode *otherNode);
+ bool adjacentToNode(PathfindingGraphNode *otherNode);
};
} // End of namespace Crab
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 7966b6e5b77..5812614e0c1 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -36,16 +36,16 @@ namespace Crab {
using namespace TMX;
PathfindingGrid::PathfindingGrid(void) {
- blockedCost = BLOCKED;
- openCost = OPEN;
- stairsCost = STAIRS;
- nodes = nullptr;
+ _blockedCost = BLOCKED;
+ _openCost = OPEN;
+ _stairsCost = STAIRS;
+ _nodes = nullptr;
- dimensions.x = 0;
- dimensions.y = 0;
+ _dimensions.x = 0;
+ _dimensions.y = 0;
- cellSize.x = 0.0;
- cellSize.y = 0.0;
+ _cellSize.x = 0.0;
+ _cellSize.y = 0.0;
}
PathfindingGrid::~PathfindingGrid(void) {
@@ -53,48 +53,48 @@ PathfindingGrid::~PathfindingGrid(void) {
}
void PathfindingGrid::reset() {
- for (int x = 0; x < dimensions.x; ++x) {
- delete[] nodes[x];
+ for (int x = 0; x < _dimensions.x; ++x) {
+ delete[] _nodes[x];
}
- delete[] nodes;
- nodes = nullptr;
+ delete[] _nodes;
+ _nodes = nullptr;
- dimensions.x = 0;
- dimensions.y = 0;
+ _dimensions.x = 0;
+ _dimensions.y = 0;
- cellSize.x = 0.0;
- cellSize.y = 0.0;
+ _cellSize.x = 0.0;
+ _cellSize.y = 0.0;
}
-void PathfindingGrid::SetupNodes(TMXMap map) {
+void PathfindingGrid::setupNodes(TMX::TMXMap map) {
// delete nodes if they exist
reset();
- dimensions.x = map._pathRows; // Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
- dimensions.y = map._pathCols;
+ _dimensions.x = map._pathRows; // Logically, this is incorrect but it matches the format of cols and rows used elsewhere (SZ)
+ _dimensions.y = map._pathCols;
- cellSize.x = (float)map._pathSize.x;
- cellSize.y = (float)map._pathSize.y;
+ _cellSize.x = (float)map._pathSize.x;
+ _cellSize.y = (float)map._pathSize.y;
// Check to see if the costs have been loaded from the level file.
// If not, assign to defaults.
if (map._movementCosts._noWalk != 0) {
- blockedCost = map._movementCosts._noWalk;
+ _blockedCost = map._movementCosts._noWalk;
}
if (map._movementCosts._open != 0) {
- openCost = map._movementCosts._open;
+ _openCost = map._movementCosts._open;
}
if (map._movementCosts._stairs != 0) {
- stairsCost = map._movementCosts._stairs;
+ _stairsCost = map._movementCosts._stairs;
}
- nodes = new PathfindingGraphNode *[dimensions.x];
+ _nodes = new PathfindingGraphNode *[_dimensions.x];
// Allocate some nodes!
// TODO: probably want to change this to a one chunk allocation...
- for (int i = 0; i < dimensions.x; ++i) {
- nodes[i] = new PathfindingGraphNode[dimensions.y];
+ for (int i = 0; i < _dimensions.x; ++i) {
+ _nodes[i] = new PathfindingGraphNode[_dimensions.y];
}
// Fill up those nodes!
@@ -104,40 +104,40 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
Vector2f topLeftPos = pos;
// Initialize the nodes
- for (int x = 0; x < dimensions.x; ++x) {
- for (int y = 0; y < dimensions.y; ++y) {
+ for (int x = 0; x < _dimensions.x; ++x) {
+ for (int y = 0; y < _dimensions.y; ++y) {
// PathfindingGraphNode* newNode = new PathfindingGraphNode(pos, idCounter++);
// nodes[x][y] = *newNode;
- nodes[x][y].collisionRect = Rect(pos.x, pos.y, cellSize.x, cellSize.y);
+ _nodes[x][y]._collisionRect = Rect(pos.x, pos.y, _cellSize.x, _cellSize.y);
- nodes[x][y].position.x = pos.x + cellSize.x / 2.0f;
- nodes[x][y].position.y = pos.y + cellSize.y / 2.0f;
- nodes[x][y].id = idCounter++;
+ _nodes[x][y]._position.x = pos.x + _cellSize.x / 2.0f;
+ _nodes[x][y]._position.y = pos.y + _cellSize.y / 2.0f;
+ _nodes[x][y]._id = idCounter++;
- nodes[x][y].movementCost = openCost;
- nodes[x][y].neighborCosts.reserve(4); // since its a square based grid, 4 is the greatest number of costs and nodes possible.
- nodes[x][y].neighborNodes.reserve(4);
+ _nodes[x][y]._movementCost = _openCost;
+ _nodes[x][y]._neighborCosts.reserve(4); // since its a square based grid, 4 is the greatest number of costs and nodes possible.
+ _nodes[x][y]._neighborNodes.reserve(4);
- pos.y += cellSize.y;
+ pos.y += _cellSize.y;
Common::Array<Shape> noWalk = map.areaNoWalk();
// Check if the square should count as blocked
for (auto i = noWalk.begin(); i != noWalk.end(); ++i) {
- if (i->Collide(nodes[x][y].collisionRect).intersect) {
- nodes[x][y].movementCost = (float)blockedCost;
+ if (i->Collide(_nodes[x][y]._collisionRect).intersect) {
+ _nodes[x][y]._movementCost = (float)_blockedCost;
break;
}
}
// Check for stairs if the cell isn't blocked
- if (nodes[x][y].movementCost >= 0.0f) {
+ if (_nodes[x][y]._movementCost >= 0.0f) {
Common::Array<pyrodactyl::level::Stairs> stairs = map.areaStairs();
for (auto i = stairs.begin(); i != stairs.end(); ++i) {
- if (i->Collide(nodes[x][y].collisionRect).intersect) {
- nodes[x][y].movementCost = (float)stairsCost;
+ if (i->Collide(_nodes[x][y]._collisionRect).intersect) {
+ _nodes[x][y]._movementCost = (float)_stairsCost;
break;
}
}
@@ -147,16 +147,16 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
// since the highest cost collider in any given tile would be used for the path cost. (SZ)
}
- pos.x += cellSize.x;
+ pos.x += _cellSize.x;
pos.y = topLeftPos.y;
}
// Connect the nodes
- for (int x = 0; x < dimensions.x; ++x) {
- for (int y = 0; y < dimensions.y; ++y) {
+ for (int x = 0; x < _dimensions.x; ++x) {
+ for (int y = 0; y < _dimensions.y; ++y) {
// Check horizontal
- if (x < dimensions.x - 1) {
- ConnectNodes(&nodes[x][y], &nodes[x + 1][y]);
+ if (x < _dimensions.x - 1) {
+ connectNodes(&_nodes[x][y], &_nodes[x + 1][y]);
// Check diagonals
// This causes hangups since the collider has a greater width to take into account when traveling
@@ -178,8 +178,8 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
}*/
}
// Check vertical
- if (y < dimensions.y - 1) {
- ConnectNodes(&nodes[x][y], &nodes[x][y + 1]);
+ if (y < _dimensions.y - 1) {
+ connectNodes(&_nodes[x][y], &_nodes[x][y + 1]);
}
}
}
@@ -202,26 +202,26 @@ void PathfindingGrid::SetupNodes(TMXMap map) {
// }
}
-void PathfindingGrid::ConnectNodes(PathfindingGraphNode *node1, PathfindingGraphNode *node2) {
- node1->AddNeighbor(node2, true);
- node2->AddNeighbor(node1, true);
+void PathfindingGrid::connectNodes(PathfindingGraphNode *node1, PathfindingGraphNode *node2) {
+ node1->addNeighbor(node2, true);
+ node2->addNeighbor(node1, true);
}
-PathfindingGraphNode *PathfindingGrid::GetNodeAtPoint(Vector2f point) {
- int x = (int)floor(point.x / cellSize.x);
- int y = (int)floor(point.y / cellSize.y);
+PathfindingGraphNode *PathfindingGrid::getNodeAtPoint(Vector2f point) {
+ int x = (int)floor(point.x / _cellSize.x);
+ int y = (int)floor(point.y / _cellSize.y);
- return &nodes[x][y];
+ return &_nodes[x][y];
}
-Common::Array<PathfindingGraphNode *> PathfindingGrid::CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2) {
+Common::Array<PathfindingGraphNode *> PathfindingGrid::cornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2) {
Common::Array<PathfindingGraphNode *> returnNodes;
// Iterat through both nodes neighbors. If a blocked neighbor is found that is shared between the two,
// It is a corner to them.
- for (auto iter : node1->neighborNodes) {
- for (auto iter2 : node2->neighborNodes) {
- if (iter == iter2 && iter->movementCost < 0) {
+ for (auto iter : node1->_neighborNodes) {
+ for (auto iter2 : node2->_neighborNodes) {
+ if (iter == iter2 && iter->_movementCost < 0) {
if (returnNodes.size() == 0 || (*(Common::find(returnNodes.begin(), returnNodes.end(), iter))) == NULL)
returnNodes.push_back(iter);
}
@@ -231,10 +231,10 @@ Common::Array<PathfindingGraphNode *> PathfindingGrid::CornerCheck(const Pathfin
return returnNodes;
}
-PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vector2f comparePos) {
- PathfindingGraphNode *startNode = GetNodeAtPoint(nodePos);
+PathfindingGraphNode *PathfindingGrid::getNearestOpenNode(Vector2f nodePos, Vector2f comparePos) {
+ PathfindingGraphNode *startNode = getNodeAtPoint(nodePos);
- if (startNode->GetMovementCost() > 0) // If the clicked node is open, we're done!
+ if (startNode->getMovementCost() > 0) // If the clicked node is open, we're done!
return startNode;
PathfindingGraphNode *returnNode = NULL;
@@ -249,8 +249,8 @@ PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vect
// Iterate through the nodes, check if they are open then check their distance from the compare point.
while (!checkNodes.empty()) {
- if (checkNodes.front()->GetMovementCost() > 0) {
- float distance = (comparePos - checkNodes.front()->GetPosition()).MagSqr();
+ if (checkNodes.front()->getMovementCost() > 0) {
+ float distance = (comparePos - checkNodes.front()->getPosition()).MagSqr();
if (shortestDistance == 0.0f || distance) // If this is the new shortest distance, this becomes the new return.
{
@@ -259,11 +259,11 @@ PathfindingGraphNode *PathfindingGrid::GetNearestOpenNode(Vector2f nodePos, Vect
returnNode = checkNodes.front();
}
} else {
- for (unsigned int i = 0; i < checkNodes.front()->neighborNodes.size(); ++i) {
+ for (unsigned int i = 0; i < checkNodes.front()->_neighborNodes.size(); ++i) {
// If the neighbor hasn't been checked yet, add it to the list to check.
- if (Common::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->neighborNodes[i]) == allUsedNodes.end()) {
- allUsedNodes.push_back(checkNodes.front()->neighborNodes[i]);
- checkNodes.push_back(checkNodes.front()->neighborNodes[i]);
+ if (Common::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->_neighborNodes[i]) == allUsedNodes.end()) {
+ allUsedNodes.push_back(checkNodes.front()->_neighborNodes[i]);
+ checkNodes.push_back(checkNodes.front()->_neighborNodes[i]);
}
}
}
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index d2d6f59e6b2..64af8bbb430 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -44,13 +44,13 @@ class TMXMap;
class PathfindingGrid {
friend class PathfindingGraphNode;
- PathfindingGraphNode **nodes; // 2D array of nodes (size is [dimensions.x][dimensions.y]
+ PathfindingGraphNode **_nodes; // 2D array of nodes (size is [dimensions.x][dimensions.y]
- Vector2i dimensions; // rows and columns of nodes.
- Vector2f cellSize; // size of a cell in width and height
+ Vector2i _dimensions; // rows and columns of nodes.
+ Vector2f _cellSize; // size of a cell in width and height
// Neighbor node1 to node2.
- void ConnectNodes(PathfindingGraphNode *node1, PathfindingGraphNode *node2);
+ void connectNodes(PathfindingGraphNode *node1, PathfindingGraphNode *node2);
public:
// these are the default graph node costs.
@@ -60,33 +60,39 @@ public:
static const int STAIRS = 5;
// These are the actual data members used to assign costs. (SZ)
- int blockedCost;
- int openCost;
- int stairsCost;
+ int _blockedCost;
+ int _openCost;
+ int _stairsCost;
PathfindingGrid(void);
~PathfindingGrid(void);
void reset();
- void SetupNodes(TMX::TMXMap map);
+ void setupNodes(TMX::TMXMap map);
// Return the node at the given point (SZ)
- PathfindingGraphNode *GetNodeAtPoint(Vector2f point);
+ PathfindingGraphNode *getNodeAtPoint(Vector2f point);
// Return the node at the given coordinates (SZ)
- PathfindingGraphNode *GetNodeAtCoords(int x, int y) { return &nodes[x][y]; }
+ PathfindingGraphNode *getNodeAtCoords(int x, int y) {
+ return &_nodes[x][y];
+ }
- Vector2i GetDimensions() { return dimensions; }
+ Vector2i getDimensions() {
+ return _dimensions;
+ }
- Vector2f GetCellSize() { return cellSize; }
+ Vector2f getCellSize() {
+ return _cellSize;
+ }
// Returns the nearest open node to the compare spot, starting with the given nodePos
// and iterating through its neighbors. (SZ)
- PathfindingGraphNode *GetNearestOpenNode(Vector2f nodePos, Vector2f comparePos);
+ PathfindingGraphNode *getNearestOpenNode(Vector2f nodePos, Vector2f comparePos);
// Return true if two nodes share and adjacency to the same blocked node.
// Can be used to find corners that shouldn't be cut.
- Common::Array<PathfindingGraphNode *> CornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2);
+ Common::Array<PathfindingGraphNode *> cornerCheck(const PathfindingGraphNode *node1, const PathfindingGraphNode *node2);
};
} // End of namespace Crab
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 23b94c52826..afe5f99861a 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -42,8 +42,8 @@ float IntervalDistance(float minA, float maxA, float minB, float maxB) {
void Polygon2D::AddPoint(const Vector2f &ref, const Common::String &x, const Common::String &y, Vector2f &min, Vector2f &max) {
Vector2f p;
- p.x = ref.x + StringToNumber<float>(x);
- p.y = ref.y + StringToNumber<float>(y);
+ p.x = ref.x + stringToNumber<float>(x);
+ p.y = ref.y + stringToNumber<float>(y);
if (p.x < min.x)
min.x = p.x;
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index d1b9b90871b..1f92c4781ee 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -40,24 +40,24 @@ Graphics::Surface *gRendererSurface = nullptr;
//SDL_Window *gWindow = nullptr;
void ScreenSettings::load(rapidxml::xml_node<char> *node) {
- loadNum(cur.w, "w", node);
- loadNum(cur.h, "h", node);
- loadNum(fps, "fps", node);
- loadNum(gamma, "gamma", node);
- loadNum(text_speed, "text_speed", node);
-
- loadBool(vsync, "vsync", node);
- loadBool(border, "border", node);
- loadBool(fullscreen, "fullscreen", node);
- loadBool(save_on_exit, "save_on_exit", node);
- loadBool(mouse_trap, "mouse_trap", node);
- loadBool(quality, "quality", node);
-
- SetVideoFlags();
- CreateBackup();
+ loadNum(_cur.w, "w", node);
+ loadNum(_cur.h, "h", node);
+ loadNum(_fps, "fps", node);
+ loadNum(_gamma, "gamma", node);
+ loadNum(_textSpeed, "text_speed", node);
+
+ loadBool(_vsync, "vsync", node);
+ loadBool(_border, "border", node);
+ loadBool(_fullscreen, "fullscreen", node);
+ loadBool(_saveOnExit, "save_on_exit", node);
+ loadBool(_mouseTrap, "mouse_trap", node);
+ loadBool(_quality, "quality", node);
+
+ setVideoFlags();
+ createBackup();
}
-void ScreenSettings::SetVideoFlags() {
+void ScreenSettings::setVideoFlags() {
#if 0
if (fullscreen) {
// Window border doesn't matter in fullscreen mode
@@ -71,25 +71,25 @@ void ScreenSettings::SetVideoFlags() {
#endif
}
-void ScreenSettings::CreateBackup() {
- backup = *this;
+void ScreenSettings::createBackup() {
+ _backup = *this;
}
-void ScreenSettings::RestoreBackup() {
- fps = backup.fps;
- cur = backup.cur;
- fullscreen = backup.fullscreen;
- border = backup.border;
- vsync = backup.vsync;
- gamma = backup.gamma;
- videoflags = backup.videoflags;
- save_on_exit = backup.save_on_exit;
- quality = backup.quality;
- mouse_trap = backup.mouse_trap;
- text_speed = backup.text_speed;
+void ScreenSettings::restoreBackup() {
+ _fps = _backup._fps;
+ _cur = _backup._cur;
+ _fullscreen = _backup._fullscreen;
+ _border = _backup._border;
+ _vsync = _backup._vsync;
+ _gamma = _backup._gamma;
+ _videoflags = _backup._videoflags;
+ _saveOnExit = _backup._saveOnExit;
+ _quality = _backup._quality;
+ _mouseTrap = _backup._mouseTrap;
+ _textSpeed = _backup._textSpeed;
}
-void ScreenSettings::SetResolution() {
+void ScreenSettings::setResolution() {
#if 0
// Check the current window flags
Uint32 flags = SDL_GetWindowFlags(gWindow);
@@ -109,14 +109,14 @@ void ScreenSettings::SetResolution() {
#endif
}
-void ScreenSettings::SetFullscreen() {
- SetVideoFlags();
+void ScreenSettings::setFullscreen() {
+ setVideoFlags();
#if 0
SDL_SetWindowFullscreen(gWindow, videoflags);
#endif
}
-void ScreenSettings::SetWindowBorder() {
+void ScreenSettings::setWindowBorder() {
#if 0
if (border)
SDL_SetWindowBordered(gWindow, SDL_TRUE);
@@ -125,7 +125,7 @@ void ScreenSettings::SetWindowBorder() {
#endif
}
-void ScreenSettings::SetVsync() {
+void ScreenSettings::setVsync() {
#if 0
if (vsync)
SDL_SetHint("SDL_HINT_RENDER_VSYNC", "1");
@@ -134,7 +134,7 @@ void ScreenSettings::SetVsync() {
#endif
}
-void ScreenSettings::SetMouseTrap() {
+void ScreenSettings::setMouseTrap() {
#if 0
if (mouse_trap)
SDL_SetRelativeMouseMode(SDL_TRUE);
@@ -144,25 +144,25 @@ void ScreenSettings::SetMouseTrap() {
}
void ScreenSettings::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("version", gStrPool->Get(version)));
+ root->append_attribute(doc.allocate_attribute("version", gStrPool->Get(_version)));
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "screen");
- child->append_attribute(doc.allocate_attribute("w", gStrPool->Get(cur.w)));
- child->append_attribute(doc.allocate_attribute("h", gStrPool->Get(cur.h)));
- child->append_attribute(doc.allocate_attribute("fps", gStrPool->Get(fps)));
+ child->append_attribute(doc.allocate_attribute("w", gStrPool->Get(_cur.w)));
+ child->append_attribute(doc.allocate_attribute("h", gStrPool->Get(_cur.h)));
+ child->append_attribute(doc.allocate_attribute("fps", gStrPool->Get(_fps)));
- child->append_attribute(doc.allocate_attribute("gamma", gStrPool->FGet(gamma)));
- child->append_attribute(doc.allocate_attribute("text_speed", gStrPool->FGet(text_speed)));
+ child->append_attribute(doc.allocate_attribute("gamma", gStrPool->FGet(_gamma)));
+ child->append_attribute(doc.allocate_attribute("text_speed", gStrPool->FGet(_textSpeed)));
- saveBool(vsync, "vsync", doc, child);
- saveBool(border, "border", doc, child);
- saveBool(fullscreen, "fullscreen", doc, child);
- saveBool(save_on_exit, "save_on_exit", doc, child);
- saveBool(quality, "quality", doc, child);
- saveBool(mouse_trap, "mouse_trap", doc, child);
+ saveBool(_vsync, "vsync", doc, child);
+ saveBool(_border, "border", doc, child);
+ saveBool(_fullscreen, "fullscreen", doc, child);
+ saveBool(_saveOnExit, "save_on_exit", doc, child);
+ saveBool(_quality, "quality", doc, child);
+ saveBool(_mouseTrap, "mouse_trap", doc, child);
root->append_node(child);
- CreateBackup();
+ createBackup();
}
} // End of namespace Crab
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index 73b2d05a41d..aa57dad5d9d 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -59,93 +59,95 @@ struct Dimension {
class ScreenAttributes {
public:
// Frames per second
- int fps;
+ int _fps;
// The current screen dimensions
- Dimension cur;
+ Dimension _cur;
// The minimum dimension where we draw the image without scaling
// Any lower than this and we draw at the minimum resolution, then scale it down
// Dimension min;
// Is the window full-screen?
- bool fullscreen;
+ bool _fullscreen;
// Does the window have a border?
- bool border;
+ bool _border;
// Is vertical sync enabled?
- bool vsync;
+ bool _vsync;
// The brightness of a window
- float gamma;
+ float _gamma;
// The video flags
- uint32 videoflags;
+ uint32 _videoflags;
// should we save on exit?
- bool save_on_exit;
+ bool _saveOnExit;
// This flag is true if we want to load high quality images, false otherwise
- bool quality;
+ bool _quality;
// Is the mouse trapped within the window
- bool mouse_trap;
+ bool _mouseTrap;
// The text speed (used only for popup text)
- float text_speed;
+ float _textSpeed;
ScreenAttributes() {
- fps = 60;
- fullscreen = false;
- border = true;
- vsync = true;
- save_on_exit = true;
- quality = true;
- mouse_trap = false;
- gamma = 1.0f;
- text_speed = 1.0f;
- videoflags = 0; //SDL_WINDOW_SHOWN;
+ _fps = 60;
+ _fullscreen = false;
+ _border = true;
+ _vsync = true;
+ _saveOnExit = true;
+ _quality = true;
+ _mouseTrap = false;
+ _gamma = 1.0f;
+ _textSpeed = 1.0f;
+ _videoflags = 0; //SDL_WINDOW_SHOWN;
}
};
// Screen attributes
class ScreenSettings : public ScreenAttributes {
// A backup of the attributes
- ScreenAttributes backup;
+ ScreenAttributes _backup;
public:
// The desktop dimensions
- Dimension desktop;
+ Dimension _desktop;
// True if we are in game, false otherwise
- bool in_game;
+ bool _inGame;
// Set to true when we have to call setUI() for rearranging UI after a resolution change
- bool change_interface;
+ bool _changeInterface;
// The version of the settings
- unsigned int version;
+ unsigned int _version;
ScreenSettings() {
- in_game = false;
- version = 0;
- change_interface = false;
+ _inGame = false;
+ _version = 0;
+ _changeInterface = false;
}
~ScreenSettings() {}
- bool ValidDimension(Dimension d) { return d.w <= desktop.w && d.h <= desktop.h; }
+ bool validDimension(Dimension d) {
+ return d.w <= _desktop.w && d.h <= _desktop.h;
+ }
- void SetVideoFlags();
- void CreateBackup();
- void RestoreBackup();
+ void setVideoFlags();
+ void createBackup();
+ void restoreBackup();
- void SetResolution();
- void SetFullscreen();
- void SetWindowBorder();
- void SetVsync();
- void SetGamma() { }//SDL_SetWindowBrightness(gWindow, gamma); }
- void SetMouseTrap();
+ void setResolution();
+ void setFullscreen();
+ void setWindowBorder();
+ void setVsync();
+ void setGamma() { }//SDL_SetWindowBrightness(gWindow, gamma); }
+ void setMouseTrap();
void load(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 049368e0ad4..9b046ec89d5 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -80,18 +80,18 @@ bool MapLayer::load(const Common::String &path, rapidxml::xml_node<char> *node)
else if (n == "autoshow" && v == "true")
_type = LAYER_AUTOSHOW;
else if (n == "x") {
- _pos.x = StringToNumber<int>(v);
+ _pos.x = stringToNumber<int>(v);
} else if (n == "y") {
- _pos.y = StringToNumber<int>(v);
+ _pos.y = stringToNumber<int>(v);
} else if (n == "w") {
- _pos.w = StringToNumber<int>(v);
+ _pos.w = stringToNumber<int>(v);
} else if (n == "h") {
- _pos.h = StringToNumber<int>(v);
+ _pos.h = stringToNumber<int>(v);
} else if (n == "scroll_rate_x") {
- _rate.x = StringToNumber<float>(v);
+ _rate.x = stringToNumber<float>(v);
_type = LAYER_PARALLAX;
} else if (n == "scroll_rate_y") {
- _rate.y = StringToNumber<float>(v);
+ _rate.y = stringToNumber<float>(v);
_type = LAYER_PARALLAX;
}
}
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index c06d4a63bbc..756b0be8ef3 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -366,9 +366,9 @@ void TMXMap::collideWithTrigger(const Rect rect, Common::Array<int> &collisionTa
bool TMXMap::collideWithExit(const Rect rect, LevelResult &res) {
for (auto i = _areaExit.begin(); i != _areaExit.end(); ++i)
if (i->_dim.Collide(rect).intersect) {
- res.val = i->_name;
- res.x = i->_entry.x;
- res.y = i->_entry.y;
+ res._val = i->_name;
+ res._x = i->_entry.x;
+ res._y = i->_entry.y;
return true;
}
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index b3a81d8d944..6f6652394a2 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -72,15 +72,15 @@ void Sprite::moveToDestPathfinding(pyrodactyl::event::Info &info, const SpriteCo
Rect b = boundRect();
// Use to provide a bit of leeway with reaching the goal.
- _pathing.SetNodeBufferDistance((b.w * b.w) / 2.0f);
+ _pathing.setNodeBufferDistance((b.w * b.w) / 2.0f);
// IF we either have a solution, have reached our destination, and it was our final destination OR
// IF there is no solution OR
// IF we haven't yet found a solution
// THEN stop.
- if ((moveToLocPathfinding(_aiData._dest, playerSpeed, sc) && _pathing.solutionFound &&
- _pathing.GetImmediateDest() == Vector2i(_pathing.destination.x, _pathing.destination.y)) ||
- _pathing.noSolution || !_pathing.solutionFound) {
+ if ((moveToLocPathfinding(_aiData._dest, playerSpeed, sc) && _pathing._solutionFound &&
+ _pathing.getImmediateDest() == Vector2i(_pathing._destination.x, _pathing._destination.y)) ||
+ _pathing._noSolution || !_pathing._solutionFound) {
_aiData._dest._active = false;
xVel(0.0f);
yVel(0.0f);
@@ -118,14 +118,14 @@ bool Sprite::moveToLoc(Vector2i &dest, const float &velocity, const SpriteConsta
bool Sprite::moveToLocPathfinding(Vector2i &dest, const float &velocity, const SpriteConstant &sc) {
// Rect b = BoundRect();
- Vector2i immediateDest = _pathing.GetImmediateDest();
+ Vector2i immediateDest = _pathing.getImmediateDest();
- Vector2f vecTo = Vector2f((float)immediateDest.x, (float)immediateDest.y) - _pathing.GetPosition();
+ Vector2f vecTo = Vector2f((float)immediateDest.x, (float)immediateDest.y) - _pathing.getPosition();
// If the destination is not the pathing goal, we must reach it exactly before moving on.
- if (immediateDest != Vector2i(_pathing.destination.x, _pathing.destination.y)) {
+ if (immediateDest != Vector2i(_pathing._destination.x, _pathing._destination.y)) {
Timer fps;
- float deltaTime = 1.0f / (float)g_engine->_screenSettings->fps;
+ float deltaTime = 1.0f / (float)g_engine->_screenSettings->_fps;
// Project how far we will travel next frame.
Vector2f velVec = Vector2f(sc._walkVelMod.x * velocity * deltaTime, sc._walkVelMod.y * velocity * deltaTime);
@@ -140,7 +140,7 @@ bool Sprite::moveToLocPathfinding(Vector2i &dest, const float &velocity, const S
yVel(0.0f);
}
} else {
- Vector2i loc = _pathing.GetImmediateDest();
+ Vector2i loc = _pathing.getImmediateDest();
moveToLoc(loc, velocity, sc);
}
@@ -175,7 +175,7 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
// Set the destination of sprite to this exit
_aiData.dest(i._dim.rect.x + i._dim.rect.w / 2, i._dim.rect.y + i._dim.rect.h / 2);
- _pathing.SetDestination(Vector2f((float)_aiData._dest.x, (float)_aiData._dest.y));
+ _pathing.setDestination(Vector2f((float)_aiData._dest.x, (float)_aiData._dest.y));
}
}
}
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index d1e191edfee..7cd5e8fd029 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -72,7 +72,7 @@ bool PopUp::internalEvents(pyrodactyl::event::Info &info, const Common::String &
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq) {
if (_visible.evaluate(info) || _startedShow) {
if (_delay.targetReached()) {
- if (_duration.targetReached(g_engine->_screenSettings->text_speed)) {
+ if (_duration.targetReached(g_engine->_screenSettings->_textSpeed)) {
_show = false;
for (auto &i : _effect)
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index fd87857d89b..08f843a85b5 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -293,21 +293,21 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
if (_pathing.m_vSolution.size() > 0) {
for (auto iter = _pathing.m_vSolution.begin(); iter != _pathing.m_vSolution.end(); ++iter) {
bool nextToWall = false;
- for (auto neighbor = (*iter)->neighborNodes.begin(); neighbor != (*iter)->neighborNodes.end(); ++neighbor) {
- if ((*neighbor)->GetMovementCost() < 0 || (*neighbor)->GetMovementCost() > 1) {
+ for (auto neighbor = (*iter)->_neighborNodes.begin(); neighbor != (*iter)->_neighborNodes.end(); ++neighbor) {
+ if ((*neighbor)->getMovementCost() < 0 || (*neighbor)->getMovementCost() > 1) {
nextToWall = true;
break;
}
}
if (nextToWall)
- (*iter)->GetRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
+ (*iter)->getRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
else
- (*iter)->GetRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
+ (*iter)->getRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
}
- _pathing.m_pGoalTile->GetRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
- _pathing.m_pStartTile->GetRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
+ _pathing._goalTile->getRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
+ _pathing._startTile->getRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
// Draw adjacencies to the goal tile.
/* for(auto neighbor = _pathing.m_pGoalTile->neighborNodes.begin(); neighbor != _pathing.m_pGoalTile->neighborNodes.end(); ++neighbor)
@@ -315,8 +315,8 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
(*neighbor)->GetRect().draw(-camera.x, -camera.y, 200, 0, 0, 254);
}*/
}
- Rect destinationRect = Rect((int)_pathing.destination.x - 5,
- (int)_pathing.destination.y - 5,
+ Rect destinationRect = Rect((int)_pathing._destination.x - 5,
+ (int)_pathing._destination.y - 5,
10,
10);
destinationRect.draw(-camera.x, -camera.y, 0, 200, 0, 254);
@@ -468,7 +468,7 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
//------------------------------------------------------------------------
void Sprite::setDestPathfinding(const Vector2i &dest, bool reachable) {
_aiData.dest(dest, true);
- _pathing.SetDestination(dest, reachable);
+ _pathing.setDestination(dest, reachable);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 16e9ca7cbd5..b756c01f715 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -120,7 +120,7 @@ bool App::init() {
// Initialize and load input
loadSettings("res/settings.xml");
- g_engine->_screenSettings->in_game = false;
+ g_engine->_screenSettings->_inGame = false;
return true;
}
@@ -158,30 +158,30 @@ void App::run() {
switch (nextStateId) {
case GAMESTATE_TITLE:
currentState = new Splash();
- g_engine->_screenSettings->in_game = false;
+ g_engine->_screenSettings->_inGame = false;
// Now apply all settings - except resolution because that's already set at the start
- g_engine->_screenSettings->SetFullscreen();
- g_engine->_screenSettings->SetWindowBorder();
- g_engine->_screenSettings->SetVsync();
- g_engine->_screenSettings->SetGamma();
- g_engine->_screenSettings->SetMouseTrap();
+ g_engine->_screenSettings->setFullscreen();
+ g_engine->_screenSettings->setWindowBorder();
+ g_engine->_screenSettings->setVsync();
+ g_engine->_screenSettings->setGamma();
+ g_engine->_screenSettings->setMouseTrap();
break;
case GAMESTATE_MAIN_MENU:
currentState = new MainMenu();
- g_engine->_screenSettings->in_game = false;
+ g_engine->_screenSettings->_inGame = false;
break;
case GAMESTATE_NEW_GAME:
_game->startNewGame();
currentState = _game;
- g_engine->_screenSettings->in_game = true;
+ g_engine->_screenSettings->_inGame = true;
break;
case GAMESTATE_LOAD_GAME:
currentState = _game;
- g_engine->_screenSettings->in_game = true;
+ g_engine->_screenSettings->_inGame = true;
break;
default:
@@ -246,9 +246,9 @@ void App::run() {
// Do we have to reposition our interface?
- if (g_engine->_screenSettings->change_interface) {
+ if (g_engine->_screenSettings->_changeInterface) {
currentState->setUI();
- g_engine->_screenSettings->change_interface = false;
+ g_engine->_screenSettings->_changeInterface = false;
}
// Do state Drawing
@@ -275,7 +275,7 @@ void App::run() {
++fpscount;
if (currentStateId >= 0)
- g_engine->_textManager->draw(0, 0, NumberToString(fpsval).c_str(), 0);
+ g_engine->_textManager->draw(0, 0, numberToString(fpsval).c_str(), 0);
//const Graphics::ManagedSurface *s = g_engine->_renderSurface;
//g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
g_engine->_screen->update();
@@ -286,11 +286,11 @@ void App::run() {
#endif
// Cap the frame rate
- if (fps.ticks() < 1000u / g_engine->_screenSettings->fps) {
+ if (fps.ticks() < 1000u / g_engine->_screenSettings->_fps) {
#if 0
SDL_Delay((1000u / g_engine->_screenSettings->fps) - fps.Ticks());
#endif
- uint32 delay = (1000u / g_engine->_screenSettings->fps) - fps.ticks();
+ uint32 delay = (1000u / g_engine->_screenSettings->_fps) - fps.ticks();
//warning("Delay by %d ms", delay);
g_system->delayMillis(delay);
}
@@ -307,7 +307,7 @@ void App::loadSettings(const Common::String &filename) {
rapidxml::xml_node<char> *node = settings.doc()->first_node("settings");
if (nodeValid(node)) {
// Load the version
- loadNum(g_engine->_screenSettings->version, "version", node);
+ loadNum(g_engine->_screenSettings->_version, "version", node);
// Load screen settings
if (nodeValid("screen", node))
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 93137acfd7e..41eb1a78d73 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -129,7 +129,7 @@ public:
return true;
}
bool canSaveGameStateCurrently() override {
- return _screenSettings->in_game;
+ return _screenSettings->_inGame;
}
/**
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 6b6ba24d1bb..050dbb1b7e8 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -86,11 +86,11 @@ void EventSeqGroup::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<
void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *i = node->first_node("end"); i != NULL; i = i->next_sibling("end"))
- endSeq(StringToNumber<unsigned int>(i->value()));
+ endSeq(stringToNumber<unsigned int>(i->value()));
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set"))
if (n->first_attribute("name") != NULL) {
- unsigned int id = StringToNumber<unsigned int>(n->first_attribute("name")->value());
+ unsigned int id = stringToNumber<unsigned int>(n->first_attribute("name")->value());
if (_seq.contains(id) > 0)
_seq[id].loadState(n);
}
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 111720d592d..008ff1bfc37 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -134,11 +134,11 @@ void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
void EventSequence::loadState(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *curid = node->first_attribute("current");
if (curid != NULL)
- _cur = StringToNumber<unsigned int>(curid->value());
+ _cur = stringToNumber<unsigned int>(curid->value());
_next.clear();
for (auto n = node->first_node("next"); n != NULL; n = n->next_sibling("next"))
- _next.push_back(StringToNumber<unsigned int>(n->value()));
+ _next.push_back(stringToNumber<unsigned int>(n->value()));
if (_next.empty())
_next.push_back(0);
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 8774b6647cb..f456c526ce2 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -142,7 +142,7 @@ void Info::varSet(const Common::String &name, const Common::String &val) {
if (assignToVar)
varGet(val, varVal);
else
- varVal = StringToNumber<int>(val);
+ varVal = stringToNumber<int>(val);
_var[name] = varVal;
}
@@ -368,7 +368,7 @@ void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
void Info::loadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *v = node->first_node("var"); v != NULL; v = v->next_sibling("var"))
- _var[v->first_attribute("id")->value()] = StringToNumber<int>(v->first_attribute("val")->value());
+ _var[v->first_attribute("id")->value()] = stringToNumber<int>(v->first_attribute("val")->value());
for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object")) {
Common::String id;
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 3a463d45e77..36d775320d5 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -112,11 +112,11 @@ void Effect::changeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::Op
// Only bother if the person exists and has a valid opinion
if (info.opinionGet(_subject, opType, oldOp)) {
if (_operation == "=")
- info.opinionSet(_subject, opType, StringToNumber<int>(_val));
+ info.opinionSet(_subject, opType, stringToNumber<int>(_val));
else if (_operation == "+")
- info.opinionChange(_subject, opType, StringToNumber<int>(_val));
+ info.opinionChange(_subject, opType, stringToNumber<int>(_val));
else if (_operation == "-")
- info.opinionChange(_subject, opType, -1 * StringToNumber<int>(_val));
+ info.opinionChange(_subject, opType, -1 * stringToNumber<int>(_val));
int newOp = 0;
info.opinionGet(_subject, opType, newOp);
@@ -138,13 +138,13 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
else if (_operation == "del")
info.varDel(_subject);
else if (_operation == "+")
- info.varAdd(_subject, StringToNumber<int>(_val));
+ info.varAdd(_subject, stringToNumber<int>(_val));
else if (_operation == "-")
- info.varSub(_subject, StringToNumber<int>(_val));
+ info.varSub(_subject, stringToNumber<int>(_val));
else if (_operation == "*")
- info.varMul(_subject, StringToNumber<int>(_val));
+ info.varMul(_subject, stringToNumber<int>(_val));
else if (_operation == "/")
- info.varDiv(_subject, StringToNumber<int>(_val));
+ info.varDiv(_subject, stringToNumber<int>(_val));
break;
case EFF_JOURNAL:
@@ -196,7 +196,7 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
case EFF_HEALTH: {
using namespace pyrodactyl::stat;
- int num = StringToNumber<int>(_val);
+ int num = stringToNumber<int>(_val);
if (_operation == "=")
info.statSet(_subject, STAT_HEALTH, num);
@@ -209,7 +209,7 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
case EFF_SOUND:
if (_subject == "music") {
if (_operation == "play") {
- MusicKey m = StringToNumber<MusicKey>(_val);
+ MusicKey m = stringToNumber<MusicKey>(_val);
g_engine->_musicManager->playMusic(m);
} else if (_operation == "stop")
g_engine->_musicManager->stop();
@@ -218,7 +218,7 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
else if (_operation == "resume")
g_engine->_musicManager->resume();
} else
- g_engine->_musicManager->playEffect(StringToNumber<ChunkKey>(_val), 0);
+ g_engine->_musicManager->playEffect(stringToNumber<ChunkKey>(_val), 0);
break;
case EFF_MONEY:
@@ -244,8 +244,8 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
} else {
EventResult r;
r._val = _subject;
- r._x = StringToNumber<int>(_operation);
- r._y = StringToNumber<int>(_val);
+ r._x = stringToNumber<int>(_operation);
+ r._y = stringToNumber<int>(_val);
switch (_type) {
case EFF_MOVE:
@@ -259,7 +259,7 @@ bool Effect::execute(pyrodactyl::event::Info &info, const Common::String &player
break;
case EFF_IMG:
r._type = ER_IMG;
- info.playerImg(StringToNumber<int>(_val));
+ info.playerImg(stringToNumber<int>(_val));
break;
case EFF_TRAIT:
r._type = ER_TRAIT;
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index d03a99d86f5..99a6d89d17e 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -78,7 +78,7 @@ void GameEvent::load(rapidxml::xml_node<char> *node) {
_next.clear();
for (rapidxml::xml_node<char> *i = node->first_node("next"); i != NULL; i = i->next_sibling("next"))
if (i->first_attribute("id") != NULL)
- _next.push_back(StringToNumber<EventID>(i->first_attribute("id")->value()));
+ _next.push_back(stringToNumber<EventID>(i->first_attribute("id")->value()));
_effect.clear();
for (rapidxml::xml_node<char> *it = node->first_node("effect"); it != NULL; it = it->next_sibling("effect")) {
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index af593261491..c6a4f4b69d1 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -393,7 +393,7 @@ void Manager::endSequence(const Common::String &curloc) {
if (i->_cur)
_eventMap[curloc].endSeq(_activeSeq);
else if (_eventMap.contains(i->_loc) > 0)
- _eventMap[i->_loc].endSeq(StringToNumber<unsigned int>(i->_val));
+ _eventMap[i->_loc].endSeq(stringToNumber<unsigned int>(i->_val));
_activeSeq = UINT_MAX;
_endSeq.clear();
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 9c83287524d..938a0b2782b 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -132,11 +132,11 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
Person p;
if (info.personGet(_subject, p)) {
if (_target == "like")
- return evaluate(p._opinion._val[OPI_LIKE], StringToNumber<int>(_val));
+ return evaluate(p._opinion._val[OPI_LIKE], stringToNumber<int>(_val));
else if (_target == "fear")
- return evaluate(p._opinion._val[OPI_FEAR], StringToNumber<int>(_val));
+ return evaluate(p._opinion._val[OPI_FEAR], stringToNumber<int>(_val));
else if (_target == "respect")
- return evaluate(p._opinion._val[OPI_RESPECT], StringToNumber<int>(_val));
+ return evaluate(p._opinion._val[OPI_RESPECT], stringToNumber<int>(_val));
}
}
break;
@@ -150,7 +150,7 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
break;
case TRIG_RECT:
- return info.collideWithTrigger(_subject, StringToNumber<int>(_val));
+ return info.collideWithTrigger(_subject, stringToNumber<int>(_val));
case TRIG_STAT: {
StatType ty = stringToStatType(_target);
@@ -161,14 +161,14 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
if (compareToVar)
info.statGet(_val, ty, value);
else
- value = StringToNumber<int>(_val);
+ value = stringToNumber<int>(_val);
return evaluate(sub, value);
}
break;
case TRIG_DIFF:
- return evaluate(info.ironMan(), StringToNumber<int>(_val));
+ return evaluate(info.ironMan(), stringToNumber<int>(_val));
case TRIG_TRAIT:
if (info.personValid(_target)) {
@@ -188,7 +188,7 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
if (compare_to_var)
info.varGet(_val, var_val);
else
- var_val = StringToNumber<int>(_val);
+ var_val = stringToNumber<int>(_val);
return evaluate(var_sub, var_val);
}
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index b6cbadd22c0..430d5d34b15 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -41,22 +41,22 @@ using namespace pyrodactyl::input;
// Purpose: Loading stuff
//------------------------------------------------------------------------
void Game::startNewGame() {
- init(g_engine->_filePath->mod_cur);
+ init(g_engine->_filePath->_modCur);
loadLevel(_info.curLocID());
- _info.ironMan(g_engine->_tempData->ironman);
- _savefile._ironman = g_engine->_tempData->filename;
- _clock.Start();
+ _info.ironMan(g_engine->_tempData->_ironman);
+ _savefile._ironman = g_engine->_tempData->_filename;
+ _clock.start();
_hud._pause.updateMode(_info.ironMan());
createSaveGame(SAVEGAME_EVENT);
}
void Game::loadGame() {
- init(g_engine->_filePath->mod_cur);
+ init(g_engine->_filePath->_modCur);
}
void Game::init(const Common::String &filename) {
- g_engine->_loadingScreen->Dim();
+ g_engine->_loadingScreen->dim();
g_engine->_eventStore->clear();
_gameOver.clear(false);
_state = STATE_GAME;
@@ -73,7 +73,7 @@ void Game::init(const Common::String &filename) {
Common::String path;
if (nodeValid("level", node)) {
loadStr(path, "list", node->first_node("level"));
- g_engine->_filePath->LoadLevel(path);
+ g_engine->_filePath->loadLevel(path);
}
if (nodeValid("hud", node)) {
@@ -114,23 +114,23 @@ void Game::init(const Common::String &filename) {
}
bool Game::loadLevel(const Common::String &id, int playerX, int playerY) {
- if (g_engine->_filePath->level.contains(id)) {
+ if (g_engine->_filePath->_level.contains(id)) {
g_engine->_loadingScreen->draw();
// Load the assets local to this level
// If the filename is same as the previous one, skip loading
- if (g_engine->_filePath->current_r != g_engine->_filePath->level[id].asset) {
- g_engine->_filePath->current_r = g_engine->_filePath->level[id].asset;
- g_engine->_imageManager->loadMap(g_engine->_filePath->level[id].asset);
+ if (g_engine->_filePath->_currentR != g_engine->_filePath->_level[id]._asset) {
+ g_engine->_filePath->_currentR = g_engine->_filePath->_level[id]._asset;
+ g_engine->_imageManager->loadMap(g_engine->_filePath->_level[id]._asset);
}
// Load the level itself
_level._pop = _popDefault;
- _level.load(g_engine->_filePath->level[id].layout, _info, _gameOver, playerX, playerY);
+ _level.load(g_engine->_filePath->_level[id]._layout, _info, _gameOver, playerX, playerY);
// Set the current location
_info.curLocID(id);
- _info.curLocName(g_engine->_filePath->level[id].name);
+ _info.curLocName(g_engine->_filePath->_level[id]._name);
_map._playerPos = _level._mapLoc;
// Update and center the world map to the player current position
@@ -630,7 +630,7 @@ bool Game::applyResult() {
_map.update(_info);
break;
case ER_QUIT:
- g_engine->_tempData->credits = (i->_val == "credits");
+ g_engine->_tempData->_credits = (i->_val == "credits");
return true;
default:
break;
@@ -643,12 +643,12 @@ bool Game::applyResult() {
}
void Game::applyResult(LevelResult result) {
- switch (result.type) {
+ switch (result._type) {
case LR_LEVEL:
- if (result.val == "Map")
+ if (result._val == "Map")
toggleState(STATE_MAP);
else
- loadLevel(result.val, result.x, result.y);
+ loadLevel(result._val, result._x, result._y);
return;
case LR_GAMEOVER:
_state = STATE_LOSE_MENU;
@@ -707,7 +707,7 @@ void Game::loadState(Common::SeekableReadStream *stream) {
Common::String playtime;
loadStr(playtime, "time", node);
- _clock.Start(playtime);
+ _clock.start(playtime);
}
}
}
@@ -754,7 +754,7 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
root->append_attribute(doc.allocate_attribute("preview", _level._previewPath.c_str()));
// Time played
- Common::String playtime = _clock.GetTime();
+ Common::String playtime = _clock.getTime();
root->append_attribute(doc.allocate_attribute("time", playtime.c_str()));
rapidxml::xml_node<char> *child_gem = doc.allocate_node(rapidxml::node_element, "events");
@@ -817,7 +817,7 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
void Game::quit(bool &shouldChangeState, GameStateID &newStateId, const GameStateID &newStateVal) {
shouldChangeState = true;
newStateId = newStateVal;
- g_engine->_imageManager->loadMap(g_engine->_filePath->mainmenu_r);
+ g_engine->_imageManager->loadMap(g_engine->_filePath->_mainmenuR);
}
//------------------------------------------------------------------------
// Purpose: Change our internal state
diff --git a/engines/crab/game.h b/engines/crab/game.h
index d36a5d70815..092bb651ee9 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -115,7 +115,7 @@ private:
Common::String fullPath(const Common::String &filename) {
Common::String res = "CRAB_" + filename;
- res += g_engine->_filePath->save_ext;
+ res += g_engine->_filePath->_saveExt;
return res;
}
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index 016322d7183..012023b8833 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -45,8 +45,8 @@ namespace Crab {
//------------------------------------------------------------------------
class GameState {
public:
- virtual void handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) = 0;
- virtual void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) = 0;
+ virtual void handleEvents(Common::Event &event, bool &shouldChangeState, GameStateID &newStateId) = 0;
+ virtual void internalEvents(bool &shouldChangeState, GameStateID &newStateId) = 0;
virtual void draw() = 0;
virtual void setUI() = 0;
virtual void autoSave() = 0;
diff --git a/engines/crab/gametype.h b/engines/crab/gametype.h
index d9a5c97b42f..1f44a16ce45 100644
--- a/engines/crab/gametype.h
+++ b/engines/crab/gametype.h
@@ -58,9 +58,11 @@ enum StatType {
} // End of namespace pyrodactyl
-enum Align { ALIGN_LEFT,
- ALIGN_CENTER,
- ALIGN_RIGHT };
+enum Align {
+ ALIGN_LEFT,
+ ALIGN_CENTER,
+ ALIGN_RIGHT
+};
enum Direction {
// An invalid direction, used for collisions
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index f92cbae7b8b..720586a73cc 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -61,7 +61,7 @@ void ImageManager::loadMap(const Common::String &filename, const MapID &mapid) {
bool valid = false;
Common::String path;
- if (!g_engine->_screenSettings->quality)
+ if (!g_engine->_screenSettings->_quality)
valid = loadStr(path, "path_low", n, false);
if (!valid)
@@ -90,10 +90,10 @@ bool ImageManager::init() {
quit();
// Load common assets
- loadMap(g_engine->_filePath->common, MAP_COMMON);
+ loadMap(g_engine->_filePath->_common, MAP_COMMON);
// Load main menu assets
- loadMap(g_engine->_filePath->current_r, MAP_CURRENT);
+ loadMap(g_engine->_filePath->_currentR, MAP_CURRENT);
_invalidImg = _map[MAP_COMMON][0];
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 7766c77e825..dee7edd51d9 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -57,7 +57,7 @@ void Level::reset() {
_background.clear();
_fly.clear();
- Camera(0, 0, g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h);
+ Camera(0, 0, g_engine->_screenSettings->_cur.w, g_engine->_screenSettings->_cur.h);
_showmap.set(true);
_insideExit = false;
@@ -167,8 +167,8 @@ void Level::playerId(const Common::String &ID, const int &x, const int &y) {
// Purpose: Rearrange stuff after resolution change
//------------------------------------------------------------------------
void Level::setUI() {
- _camera.w = g_engine->_screenSettings->cur.w;
- _camera.h = g_engine->_screenSettings->cur.h;
+ _camera.w = g_engine->_screenSettings->_cur.w;
+ _camera.h = g_engine->_screenSettings->_cur.h;
setCamera();
}
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 11a2c9b2fda..fed1ffbec89 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -54,7 +54,7 @@ LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result
if (playerInCombat(info)) {
_insideExit = true;
} else if (_insideExit == false) {
- lResult.type = LR_LEVEL;
+ lResult._type = LR_LEVEL;
return lResult;
}
} else {
@@ -69,12 +69,12 @@ LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result
if (eventInProgress)
playerStop();
else
- think(info, result, endSeq, lResult.val);
+ think(info, result, endSeq, lResult._val);
- if (lResult.val != "")
- info.lastPerson(lResult.val);
- else if (collidingWithObject(info, lResult.val))
- info.lastPerson(lResult.val);
+ if (lResult._val != "")
+ info.lastPerson(lResult._val);
+ else if (collidingWithObject(info, lResult._val))
+ info.lastPerson(lResult._val);
else
info.lastPerson("");
@@ -91,7 +91,7 @@ void Level::think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event
// Only bother if the sprite is visible
if (i->visible()) {
// TODO: Find a place where this should be initialized... (SZ)
- if (i->_pathing.grid == NULL)
+ if (i->_pathing._grid == NULL)
i->_pathing.initialize(&_pathfindingGrid);
// If a sprite is dead, nothing else matters
@@ -105,8 +105,8 @@ void Level::think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event
} else if (info.state(i->id()) != PST_KO) {
Rect boundRect = i->boundRect();
- i->_pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
- i->_pathing.Update(0);
+ i->_pathing.setPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
+ i->_pathing.update(0);
// For the AI sprites
if (index != _playerIndex) {
@@ -140,8 +140,8 @@ void Level::think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event
// For the player sprite
boundRect = i->boundRect();
- i->_pathing.SetPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
- i->_pathing.Update(0);
+ i->_pathing.setPosition(Vector2f((float)(boundRect.x + boundRect.w / 2), (float)boundRect.y + boundRect.h / 2));
+ i->_pathing.update(0);
i->moveToDestPathfinding(info, _scDefault);
}
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index b690435303c..f7f80136a9a 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -246,8 +246,8 @@ void Level::setCamera() {
Vector2i focus = _objects[_playerIndex].camFocus();
// Center the camera over the player
- _camera.x = focus.x - (g_engine->_screenSettings->cur.w / 2);
- _camera.y = focus.y - (g_engine->_screenSettings->cur.h / 2);
+ _camera.x = focus.x - (g_engine->_screenSettings->_cur.w / 2);
+ _camera.y = focus.y - (g_engine->_screenSettings->_cur.h / 2);
// Keep the camera in bounds
if (_camera.x > _terrain.w() - _camera.w)
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 0538f64aabd..ebd2ea3822b 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -81,7 +81,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
_terrain.load(path, tmxfile);
// Remember to load the terrain data before constructing the pathfinding grid
- _pathfindingGrid.SetupNodes(_terrain);
+ _pathfindingGrid.setupNodes(_terrain);
_terrain._grid = &_pathfindingGrid;
@@ -187,7 +187,7 @@ void Level::loadMoves(const Common::String &filename) {
// See if there is an alternate moveset for low quality setting
// If no, just load the regular one
- if (!g_engine->_screenSettings->quality) {
+ if (!g_engine->_screenSettings->_quality) {
if (!loadStr(_animSet[pos], "path_low", n))
loadStr(_animSet[pos], "path", n);
} else
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index c9f6f43aaaa..38356b69ad9 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -51,7 +51,7 @@ bool loadStr(Common::String &val, const Common::String &name, rapidxml::xml_node
template<typename T>
bool loadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
if (node->first_attribute(name.c_str()) != NULL)
- val = StringToNumber<T>(node->first_attribute(name.c_str())->value());
+ val = stringToNumber<T>(node->first_attribute(name.c_str())->value());
else {
/*if (echo)
{
@@ -68,7 +68,7 @@ bool loadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node,
template<typename T>
bool loadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
if (node->first_attribute(name.c_str()) != NULL)
- val = static_cast<T>(StringToNumber<int>(node->first_attribute(name.c_str())->value()));
+ val = static_cast<T>(stringToNumber<int>(node->first_attribute(name.c_str())->value()));
else {
/*if (echo)
{
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index b7626769c76..b0457785195 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -43,22 +43,22 @@ using namespace pyrodactyl::ui;
// Purpose: Constructor
//------------------------------------------------------------------------
MainMenu::MainMenu() {
- XMLDoc conf(g_engine->_filePath->mainmenu_l);
+ XMLDoc conf(g_engine->_filePath->_mainmenuL);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("main_menu");
if (nodeValid(node)) {
- me_main.load(node->first_node("main"));
- logo.load(node->first_node("logo"));
+ _meMain.load(node->first_node("main"));
+ _logo.load(node->first_node("logo"));
- back.load(node->first_node("back"));
+ _back.load(node->first_node("back"));
if (!g_engine->_optionMenu->_loaded) {
g_engine->_optionMenu->load(node->first_node("option")->first_attribute("path")->value());
g_engine->_optionMenu->_loaded = true;
}
- mod.load(node->first_node("mod")->first_attribute("path")->value());
- credits.load(node->first_node("credits")->first_attribute("path")->value());
+ _mod.load(node->first_node("mod")->first_attribute("path")->value());
+ _credits.load(node->first_node("credits")->first_attribute("path")->value());
{
XMLDoc loadconf(node->first_node("load")->first_attribute("path")->value());
@@ -82,13 +82,13 @@ MainMenu::MainMenu() {
rapidxml::xml_node<char> *snode = node->first_node("scene");
if (nodeValid("bg", snode))
- bg.load(snode->first_node("bg"));
+ _bg.load(snode->first_node("bg"));
if (nodeValid("lights", snode)) {
rapidxml::xml_node<char> *lnode = snode->first_node("lights");
for (rapidxml::xml_node<char> *n = lnode->first_node("img"); n != NULL; n = n->next_sibling("img"))
- lights.push_back(n);
+ _lights.push_back(n);
}
}
@@ -96,36 +96,36 @@ MainMenu::MainMenu() {
rapidxml::xml_node<char> *dinode = node->first_node("difficulty");
if (nodeValid("bg", dinode))
- diff.bg.load(dinode->first_node("bg"));
+ _diff._bg.load(dinode->first_node("bg"));
if (nodeValid("menu", dinode))
- diff.menu.load(dinode->first_node("menu"));
+ _diff._menu.load(dinode->first_node("menu"));
if (nodeValid("heading", dinode))
- diff.heading.load(dinode->first_node("heading"));
+ _diff._heading.load(dinode->first_node("heading"));
}
if (nodeValid("prompt", node)) {
rapidxml::xml_node<char> *prnode = node->first_node("prompt");
- save.load(prnode);
+ _save.load(prnode);
if (nodeValid("warning", prnode))
- warning.load(prnode->first_node("warning"));
+ _warning.load(prnode->first_node("warning"));
if (nodeValid("bg", prnode))
- bg_save.load(prnode->first_node("bg"));
+ _bgSave.load(prnode->first_node("bg"));
if (nodeValid("accept", prnode))
- accept.load(prnode->first_node("accept"));
+ _accept.load(prnode->first_node("accept"));
if (nodeValid("cancel", prnode))
- cancel.load(prnode->first_node("cancel"));
+ _cancel.load(prnode->first_node("cancel"));
}
if (nodeValid("music", node)) {
- loadNum(music_key.normal, "normal", node->first_node("music"));
- loadNum(music_key.credits, "credits", node->first_node("music"));
+ loadNum(_musicKey._normal, "normal", node->first_node("music"));
+ loadNum(_musicKey._credits, "credits", node->first_node("music"));
}
#ifdef UNREST_DEMO
@@ -142,58 +142,58 @@ MainMenu::MainMenu() {
}
}
- if (g_engine->_tempData->credits)
- ChangeState(STATE_CREDITS, true);
+ if (g_engine->_tempData->_credits)
+ changeState(STATE_CREDITS, true);
else
- ChangeState(STATE_NORMAL, true);
+ changeState(STATE_NORMAL, true);
- g_engine->_tempData->credits = false;
- g_engine->_filePath->current_r = g_engine->_filePath->mainmenu_r;
+ g_engine->_tempData->_credits = false;
+ g_engine->_filePath->_currentR = g_engine->_filePath->_mainmenuR;
}
//------------------------------------------------------------------------
// Purpose: Event/input handling Events
//------------------------------------------------------------------------
-void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- g_engine->_mouse->handleEvents(Event);
+void MainMenu::handleEvents(Common::Event &event, bool &shouldChangeState, GameStateID &newStateId) {
+ g_engine->_mouse->handleEvents(event);
- if (state != STATE_CREDITS) {
- int choice = me_main.handleEvents(Event);
+ if (_state != STATE_CREDITS) {
+ int choice = _meMain.handleEvents(event);
if (choice >= 0) {
- for (unsigned i = 0; i < me_main._element.size(); ++i)
- me_main._element[i].state(i == (unsigned int)choice);
+ for (unsigned i = 0; i < _meMain._element.size(); ++i)
+ _meMain._element[i].state(i == (unsigned int)choice);
switch (choice) {
case 0:
if (g_engine->_loadMenu->selectNewestFile()) {
- ChangeState(STATE_NORMAL);
- ShouldChangeState = true;
- NewStateID = GAMESTATE_LOAD_GAME;
+ changeState(STATE_NORMAL);
+ shouldChangeState = true;
+ newStateId = GAMESTATE_LOAD_GAME;
}
break;
case 1:
- ChangeState(STATE_DIFF);
+ changeState(STATE_DIFF);
break;
case 2:
- ChangeState(STATE_LOAD);
+ changeState(STATE_LOAD);
g_engine->_loadMenu->scanDir();
break;
case 3:
- ChangeState(STATE_OPTIONS);
+ changeState(STATE_OPTIONS);
break;
case 4:
- ChangeState(STATE_MOD);
+ changeState(STATE_MOD);
break;
case 5:
- ChangeState(STATE_HELP);
+ changeState(STATE_HELP);
break;
case 6:
- ChangeState(STATE_CREDITS);
- credits.reset();
+ changeState(STATE_CREDITS);
+ _credits.reset();
break;
case 7:
- ShouldChangeState = true;
- NewStateID = GAMESTATE_EXIT;
+ shouldChangeState = true;
+ newStateId = GAMESTATE_EXIT;
break;
default:
break;
@@ -210,7 +210,7 @@ void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
}
#endif
- switch (state) {
+ switch (_state) {
#ifdef UNREST_DEMO
case STATE_NORMAL:
if (steam.handleEvents(Event) == BUAC_LCLICK) {
@@ -225,59 +225,59 @@ void MainMenu::handleEvents(Common::Event &Event, bool &ShouldChangeState, GameS
break;
#endif
case STATE_OPTIONS:
- if (g_engine->_optionMenu->handleEvents(back, Event))
- ChangeState(STATE_NORMAL);
+ if (g_engine->_optionMenu->handleEvents(_back, event))
+ changeState(STATE_NORMAL);
break;
case STATE_CREDITS:
- if (credits.handleEvents(Event))
- ChangeState(STATE_NORMAL);
+ if (_credits.handleEvents(event))
+ changeState(STATE_NORMAL);
break;
case STATE_LOAD:
if (!g_engine->loadGameDialog())
- ChangeState(STATE_NORMAL);
+ changeState(STATE_NORMAL);
else {
- ShouldChangeState = true;
- NewStateID = GAMESTATE_LOAD_GAME;
+ shouldChangeState = true;
+ newStateId = GAMESTATE_LOAD_GAME;
return;
}
break;
case STATE_DIFF: {
- int choice = diff.menu.handleEvents(Event);
+ int choice = _diff._menu.handleEvents(event);
// First menu option is Non-iron man, second is iron man
// For the second choice, we must display a prompt to choose the name of the save game
if (choice == 0) {
- g_engine->_tempData->ironman = false;
- ShouldChangeState = true;
- NewStateID = GAMESTATE_NEW_GAME;
+ g_engine->_tempData->_ironman = false;
+ shouldChangeState = true;
+ newStateId = GAMESTATE_NEW_GAME;
} else if (choice == 1)
- ChangeState(STATE_SAVENAME);
+ changeState(STATE_SAVENAME);
} break;
case STATE_SAVENAME:
- if (save.handleEvents(Event) || accept.handleEvents(Event)) {
- if (save._text != "") {
- g_engine->_tempData->filename = save._text;
- g_engine->_tempData->ironman = true;
- ShouldChangeState = true;
- NewStateID = GAMESTATE_NEW_GAME;
+ if (_save.handleEvents(event) || _accept.handleEvents(event)) {
+ if (_save._text != "") {
+ g_engine->_tempData->_filename = _save._text;
+ g_engine->_tempData->_ironman = true;
+ shouldChangeState = true;
+ newStateId = GAMESTATE_NEW_GAME;
} else
debug("Please enter a valid filename for the iron man save.");
- } else if (cancel.handleEvents(Event))
- ChangeState(STATE_DIFF);
+ } else if (_cancel.handleEvents(event))
+ changeState(STATE_DIFF);
break;
case STATE_MOD:
- if (mod.handleEvents(Event))
- ChangeState(STATE_NORMAL);
+ if (_mod.handleEvents(event))
+ changeState(STATE_NORMAL);
break;
case STATE_HELP:
- g_engine->_helpScreen->handleEvents(Event);
+ g_engine->_helpScreen->handleEvents(event);
break;
default:
@@ -420,12 +420,12 @@ void MainMenu::handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
-void MainMenu::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID) {
+void MainMenu::internalEvents(bool &shouldChangeState, GameStateID &newStateId) {
// Make the lights flicker
- for (auto &i : lights)
+ for (auto &i : _lights)
i.internalEvents();
- if (state == STATE_OPTIONS)
+ if (_state == STATE_OPTIONS)
g_engine->_optionMenu->internalEvents();
}
@@ -433,44 +433,44 @@ void MainMenu::internalEvents(bool &ShouldChangeState, GameStateID &NewStateID)
// Purpose: We need to toggle button visibility
// and enable/disable keyboard for each state change
//------------------------------------------------------------------------
-void MainMenu::ChangeState(MenuState ms, const bool &start) {
+void MainMenu::changeState(MenuState ms, const bool &start) {
// Start = true means this is the first run, and no music is playing
// Just play the appropriate music
if (start) {
if (ms == STATE_CREDITS)
- g_engine->_musicManager->playMusic(music_key.credits);
+ g_engine->_musicManager->playMusic(_musicKey._credits);
else
- g_engine->_musicManager->playMusic(music_key.normal);
+ g_engine->_musicManager->playMusic(_musicKey._normal);
} else {
// This is not our first run, which means some music track is already playing
// Only change tracks when going from main menu->credits or credits->main menu
- if (state == STATE_CREDITS && ms != STATE_CREDITS)
- g_engine->_musicManager->playMusic(music_key.normal);
- else if (state != STATE_CREDITS && ms == STATE_CREDITS)
- g_engine->_musicManager->playMusic(music_key.credits);
+ if (_state == STATE_CREDITS && ms != STATE_CREDITS)
+ g_engine->_musicManager->playMusic(_musicKey._normal);
+ else if (_state != STATE_CREDITS && ms == STATE_CREDITS)
+ g_engine->_musicManager->playMusic(_musicKey._credits);
}
// Set current state
- state = ms;
+ _state = ms;
// We are entering the normal state, i.e outside all menus - reset color of menu items
- if (state == STATE_NORMAL) {
- for (unsigned i = 0; i < me_main._element.size(); ++i)
- me_main._element[i].state(false);
+ if (_state == STATE_NORMAL) {
+ for (unsigned i = 0; i < _meMain._element.size(); ++i)
+ _meMain._element[i].state(false);
}
// Enable keyboard navigation if outside all menus, otherwise disable it
- me_main.useKeyboard((state == STATE_NORMAL));
+ _meMain.useKeyboard((_state == STATE_NORMAL));
// Continue button is only enabled if there is a save to load
- me_main._element[0]._visible = !g_engine->_loadMenu->empty();
+ _meMain._element[0]._visible = !g_engine->_loadMenu->empty();
// Enable credits and quit button if outside all menus, otherwise disable it
- me_main._element[6]._visible = (state == STATE_NORMAL);
- me_main._element[7]._visible = (state == STATE_NORMAL);
+ _meMain._element[6]._visible = (_state == STATE_NORMAL);
+ _meMain._element[7]._visible = (_state == STATE_NORMAL);
// If switching to help screen, load latest image otherwise remove it from memory
- if (state == STATE_HELP)
+ if (_state == STATE_HELP)
g_engine->_helpScreen->refresh();
else
g_engine->_helpScreen->clear();
@@ -480,23 +480,23 @@ void MainMenu::ChangeState(MenuState ms, const bool &start) {
// Purpose: Drawing function
//------------------------------------------------------------------------
void MainMenu::draw() {
- bg.draw();
+ _bg.draw();
- for (auto &i : lights)
+ for (auto &i : _lights)
i.draw();
- switch (state) {
+ switch (_state) {
case STATE_NORMAL:
// Draw the logo
- logo.draw();
+ _logo.draw();
// Draw the game name and mod path if a mod is loaded
- if (g_engine->_filePath->mod_cur != "res/default.xml") {
- g_engine->_textManager->draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
+ if (g_engine->_filePath->_modCur != "res/default.xml") {
+ g_engine->_textManager->draw(g_engine->_screenSettings->_cur.w / 2, g_engine->_screenSettings->_cur.h / 2, "Unrest", 0, 0, ALIGN_CENTER);
//g_engine->_textManager->draw(g_engine->_screenSettings->cur.w / 2, g_engine->_screenSettings->cur.h / 2 + 50, g_engine->_filePath->mod_cur, 5, 1, ALIGN_CENTER);
}
- me_main.draw();
+ _meMain.draw();
#ifdef UNREST_DEMO
g_engine->_textManager->draw(logo.x + logo.w, logo.y + logo.h / 2, "Demo", 0, 0, ALIGN_CENTER);
@@ -506,41 +506,41 @@ void MainMenu::draw() {
break;
case STATE_OPTIONS:
- g_engine->_optionMenu->draw(back);
- me_main.draw();
+ g_engine->_optionMenu->draw(_back);
+ _meMain.draw();
break;
case STATE_CREDITS:
- credits.draw();
+ _credits.draw();
break;
case STATE_DIFF:
- diff.bg.draw();
- diff.heading.draw();
- diff.menu.draw();
- back.draw();
- me_main.draw();
+ _diff._bg.draw();
+ _diff._heading.draw();
+ _diff._menu.draw();
+ _back.draw();
+ _meMain.draw();
break;
case STATE_SAVENAME:
- bg_save.draw();
- warning.draw();
- save.draw();
- accept.draw();
- cancel.draw();
- me_main.draw();
+ _bgSave.draw();
+ _warning.draw();
+ _save.draw();
+ _accept.draw();
+ _cancel.draw();
+ _meMain.draw();
break;
case STATE_MOD:
- mod.draw();
- back.draw();
- me_main.draw();
+ _mod.draw();
+ _back.draw();
+ _meMain.draw();
break;
case STATE_HELP:
g_engine->_helpScreen->draw();
- back.draw();
- me_main.draw();
+ _back.draw();
+ _meMain.draw();
break;
default:
@@ -551,30 +551,30 @@ void MainMenu::draw() {
}
void MainMenu::setUI() {
- me_main.setUI();
- logo.setUI();
+ _meMain.setUI();
+ _logo.setUI();
- back.setUI();
+ _back.setUI();
g_engine->_optionMenu->setUI();
- mod.setUI();
+ _mod.setUI();
g_engine->_loadMenu->setUI();
g_engine->_helpScreen->setUI();
- credits.setUI();
+ _credits.setUI();
- accept.setUI();
- cancel.setUI();
+ _accept.setUI();
+ _cancel.setUI();
- bg.setUI();
- for (auto &i : lights)
+ _bg.setUI();
+ for (auto &i : _lights)
i.setUI();
- diff.menu.setUI();
- diff.bg.setUI();
- diff.heading.setUI();
+ _diff._menu.setUI();
+ _diff._bg.setUI();
+ _diff._heading.setUI();
- save.setUI();
- warning.setUI();
- bg_save.setUI();
+ _save.setUI();
+ _warning.setUI();
+ _bgSave.setUI();
#ifdef UNREST_DEMO
steam.setUI();
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 8b29d2ab4d8..d5ef3b283e8 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -65,55 +65,55 @@ class MainMenu : public GameState {
STATE_SAVENAME,
STATE_MOD,
STATE_HELP
- } state;
+ } _state;
// This image covers the whole screen and is drawn centered on screen
- pyrodactyl::ui::ImageData bg;
+ pyrodactyl::ui::ImageData _bg;
// The lights on the background image
- Common::Array<pyrodactyl::ui::AlphaImage> lights;
+ Common::Array<pyrodactyl::ui::AlphaImage> _lights;
// The game logo
- pyrodactyl::ui::ImageData logo;
+ pyrodactyl::ui::ImageData _logo;
// Data for the difficulty menu
struct
{
- pyrodactyl::ui::ImageData bg;
- pyrodactyl::ui::HoverInfo heading;
- pyrodactyl::ui::ButtonMenu menu;
- } diff;
+ pyrodactyl::ui::ImageData _bg;
+ pyrodactyl::ui::HoverInfo _heading;
+ pyrodactyl::ui::ButtonMenu _menu;
+ } _diff;
// Main menu
- pyrodactyl::ui::Menu<pyrodactyl::ui::StateButton> me_main;
+ pyrodactyl::ui::Menu<pyrodactyl::ui::StateButton> _meMain;
// The back button is common and is used for all menus here (except credits and main menu)
- pyrodactyl::ui::Button back;
+ pyrodactyl::ui::Button _back;
// Mod menu
- pyrodactyl::ui::ModMenu mod;
+ pyrodactyl::ui::ModMenu _mod;
// Game credits
- pyrodactyl::ui::CreditScreen credits;
+ pyrodactyl::ui::CreditScreen _credits;
// The save game name prompt for iron man
- pyrodactyl::ui::TextArea save;
+ pyrodactyl::ui::TextArea _save;
// The background image and position of the prompt, along with the warning message displayed
// and buttons for accept and cancel
- pyrodactyl::ui::ImageData bg_save;
- pyrodactyl::ui::HoverInfo warning;
- pyrodactyl::ui::Button accept, cancel;
+ pyrodactyl::ui::ImageData _bgSave;
+ pyrodactyl::ui::HoverInfo _warning;
+ pyrodactyl::ui::Button _accept, _cancel;
// Music for the main menu
struct MainMenuMusic {
- pyrodactyl::music::MusicKey normal, credits;
+ pyrodactyl::music::MusicKey _normal, _credits;
MainMenuMusic() {
- normal = -1;
- credits = -1;
+ _normal = -1;
+ _credits = -1;
}
- } music_key;
+ } _musicKey;
#ifdef UNREST_DEMO
// UI elements related to the demo
@@ -124,15 +124,15 @@ public:
MainMenu();
~MainMenu() {}
- void handleEvents(Common::Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
+ void handleEvents(Common::Event &event, bool &shouldChangeState, GameStateID &newStateId);
#if 0
void handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
#endif
- void internalEvents(bool &ShouldChangeState, GameStateID &NewStateID);
+ void internalEvents(bool &shouldChangeState, GameStateID &newStateId);
void draw();
- void ChangeState(MenuState ms, const bool &start = false);
+ void changeState(MenuState ms, const bool &start = false);
void setUI();
// We don't need to save game state here
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 79fa25b5805..c5eaa1e6d33 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -35,24 +35,24 @@
namespace Crab {
template<typename T>
-Common::String NumberToString(T Number) {
+Common::String numberToString(T number) {
Common::String res;
- const T Num = Number;
+ const T num = number;
- if (Number == 0) {
+ if (number == 0) {
return "0";
}
- if (Number < 0)
- Number = -Number;
+ if (number < 0)
+ number = -number;
- while (Number > 0) {
- T d = Number % 10;
+ while (number > 0) {
+ T d = number % 10;
res += ('0' + d);
- Number /= 10;
+ number /= 10;
}
- if (Num < 0)
+ if (num < 0)
res += "-";
// reverse string
@@ -64,40 +64,40 @@ Common::String NumberToString(T Number) {
}
template<typename T>
-inline T StringToNumber(char *Text) {
+inline T stringToNumber(char *text) {
int res = 0;
- if (sscanf(Text, "%d", &res) > 0)
+ if (sscanf(text, "%d", &res) > 0)
return static_cast<T>(res); // static cast to deal with signed to unsigned conversions
return 0;
}
template<>
-inline float StringToNumber<float>(char *Text) {
+inline float stringToNumber<float>(char *text) {
float res = 0.0f;
- if (sscanf(Text, "%f", &res) > 0)
+ if (sscanf(text, "%f", &res) > 0)
return res;
return 0.0f;
}
template<>
-inline double StringToNumber<double>(char *Text) {
+inline double stringToNumber<double>(char *text) {
double res = 0.0;
- if (sscanf(Text, "%lf", &res) > 0)
+ if (sscanf(text, "%lf", &res) > 0)
return res;
return 0.0;
}
template<typename T>
-T StringToNumber(const Common::String &Text) {
- return StringToNumber<T>(const_cast<char *>(Text.c_str()));
+T stringToNumber(const Common::String &text) {
+ return stringToNumber<T>(const_cast<char *>(text.c_str()));
}
template<typename T>
-void GetPoint(T &v, Common::String &coords) {
+void getPoint(T &v, Common::String &coords) {
int comma = coords.findFirstOf(',');
- v._x = StringToNumber<int>(coords.substr(0, comma));
- v._y = StringToNumber<int>(coords.substr(comma + 1));
+ v._x = stringToNumber<int>(coords.substr(0, comma));
+ v._y = stringToNumber<int>(coords.substr(comma + 1));
}
} // End of namespace Crab
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 40323b687f1..7df24a03da7 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
void Trait::load(rapidxml::xml_node<char> *node) {
loadStr(_idStr, "id", node);
- _id = StringToNumber<int>(_idStr);
+ _id = stringToNumber<int>(_idStr);
loadStr(_name, "name", node);
loadStr(_desc, "desc", node);
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 01166d091b7..f161d9c46a8 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -87,9 +87,9 @@ void Splash::draw() {
// Purpose: Reset UI position
//------------------------------------------------------------------------
void Splash::setUI() {
- warning("ScreenSettings cur w : %d h : %d", g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h);
- _x = (g_engine->_screenSettings->cur.w - _background.w()) / 2;
- _y = (g_engine->_screenSettings->cur.h - _background.h()) / 2;
+ warning("ScreenSettings cur w : %d h : %d", g_engine->_screenSettings->_cur.w, g_engine->_screenSettings->_cur.h);
+ _x = (g_engine->_screenSettings->_cur.w - _background.w()) / 2;
+ _y = (g_engine->_screenSettings->_cur.h - _background.h()) / 2;
}
}
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index b6d9ec25b24..54e43a22323 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -44,7 +44,7 @@ void TextManager::init() {
quit();
// Load the list of fonts
- XMLDoc fontList(g_engine->_filePath->font);
+ XMLDoc fontList(g_engine->_filePath->_font);
if (fontList.ready()) {
rapidxml::xml_node<char> *node = fontList.doc()->first_node("fonts");
@@ -62,7 +62,7 @@ void TextManager::init() {
size = n->first_attribute("size");
if (id != NULL && path != NULL && size != NULL) {
- unsigned int pos = StringToNumber<unsigned int>(id->value());
+ unsigned int pos = stringToNumber<unsigned int>(id->value());
if (_font.size() <= pos)
_font.resize(pos + 1);
#if 0
@@ -71,12 +71,12 @@ void TextManager::init() {
#endif
Common::File file;
fileOpen(path->value(), &file);
- _font[pos] = Graphics::loadTTFFont(file, StringToNumber<int>(size->value()));
+ _font[pos] = Graphics::loadTTFFont(file, stringToNumber<int>(size->value()));
}
}
}
- _colpool.load(g_engine->_filePath->colors);
+ _colpool.load(g_engine->_filePath->_colors);
}
void TextManager::reset() {
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index a0e43e57f2e..57a3f74461a 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -37,8 +37,8 @@ using namespace pyrodactyl::ui;
using namespace pyrodactyl::text;
void CreditScreen::reset() {
- _start.x = g_engine->_screenSettings->cur.w / 2 - 150;
- _start.y = g_engine->_screenSettings->cur.h + 20;
+ _start.x = g_engine->_screenSettings->_cur.w / 2 - 150;
+ _start.y = g_engine->_screenSettings->_cur.h + 20;
_cur.x = _start.x;
_speed._cur = _speed._slow;
}
@@ -158,21 +158,21 @@ void CreditScreen::draw() {
if (i->_heading) {
_cur.y += _heading._inc;
- if (_cur.y > -30 && _cur.y < g_engine->_screenSettings->cur.h + 40) // Only draw text if it is actually visible on screen
+ if (_cur.y > -30 && _cur.y < g_engine->_screenSettings->_cur.h + 40) // Only draw text if it is actually visible on screen
g_engine->_textManager->draw(_cur.x, _cur.y, i->_text, _heading._color, _heading._font, _heading._align);
- } else if (_cur.y > -30 && _cur.y < g_engine->_screenSettings->cur.h + 40)
+ } else if (_cur.y > -30 && _cur.y < g_engine->_screenSettings->_cur.h + 40)
g_engine->_textManager->draw(_cur.x, _cur.y, i->_text, _paragraph._color, _paragraph._font, _paragraph._align);
// If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
- if (_cur.y > g_engine->_screenSettings->cur.h + 40)
+ if (_cur.y > g_engine->_screenSettings->_cur.h + 40)
break;
}
_start.y -= _speed._cur;
// Sanity check so that we don't scroll too high or low
- if (_start.y > g_engine->_screenSettings->cur.h + 40)
- _start.y = g_engine->_screenSettings->cur.h + 40;
+ if (_start.y > g_engine->_screenSettings->_cur.h + 40)
+ _start.y = g_engine->_screenSettings->_cur.h + 40;
else if (_start.y < INT_MIN + 10)
_start.y = INT_MIN + 10;
}
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index cfd3eead298..0f5aee76b6c 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -78,7 +78,7 @@ void DebugConsole::draw(pyrodactyl::event::Info &info) {
{
int temp = 0;
if (info.varGet(_varName, temp))
- _value.draw(NumberToString(temp));
+ _value.draw(numberToString(temp));
else
_value.draw("Does not exist.");
}
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index afb9df355e1..cbea9efe9b4 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -120,7 +120,7 @@ public:
warning("STUB: FileMenu::scanDir()");
Common::String res = "CRAB_*";
- res += g_engine->_filePath->save_ext;
+ res += g_engine->_filePath->_saveExt;
Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
_slotInfo.clear();
@@ -195,8 +195,8 @@ public:
hov[DATA_PLAYERNAME].load(offnode->first_node("player_name_title"));
}
- _extension = g_engine->_filePath->save_ext;
- _directory = (g_engine->_filePath->appdata + g_engine->_filePath->save_dir);
+ _extension = g_engine->_filePath->_saveExt;
+ _directory = (g_engine->_filePath->_appdata + g_engine->_filePath->_saveDir);
scanDir();
}
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 98fe61c619f..7daee56b26f 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -65,7 +65,7 @@ void GeneralSettingMenu::load(rapidxml::xml_node<char> *node) {
// Sync popup text value with actual value
for (auto &i : _textSpeed._element)
- i._state = (i._val == g_engine->_screenSettings->text_speed);
+ i._state = (i._val == g_engine->_screenSettings->_textSpeed);
}
//------------------------------------------------------------------------
@@ -80,16 +80,16 @@ void GeneralSettingMenu::handleEvents(const Common::Event &event) {
// No need to change screen here
if (_saveOnExit.handleEvents(event))
- g_engine->_screenSettings->save_on_exit = !g_engine->_screenSettings->save_on_exit;
+ g_engine->_screenSettings->_saveOnExit = !g_engine->_screenSettings->_saveOnExit;
if (_mouseTrap.handleEvents(event)) {
- g_engine->_screenSettings->mouse_trap = !g_engine->_screenSettings->mouse_trap;
- g_engine->_screenSettings->SetMouseTrap();
+ g_engine->_screenSettings->_mouseTrap = !g_engine->_screenSettings->_mouseTrap;
+ g_engine->_screenSettings->setMouseTrap();
}
int result = _textSpeed.handleEvents(event);
if (result >= 0)
- g_engine->_screenSettings->text_speed = _textSpeed._element[result]._val;
+ g_engine->_screenSettings->_textSpeed = _textSpeed._element[result]._val;
}
#if 0
@@ -122,8 +122,8 @@ void GeneralSettingMenu::handleEvents(const SDL_Event &Event) {
// Purpose: Sync our buttons with screen settings
//------------------------------------------------------------------------
void GeneralSettingMenu::internalEvents() {
- _saveOnExit._state = g_engine->_screenSettings->save_on_exit;
- _mouseTrap._state = g_engine->_screenSettings->mouse_trap;
+ _saveOnExit._state = g_engine->_screenSettings->_saveOnExit;
+ _mouseTrap._state = g_engine->_screenSettings->_mouseTrap;
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 59a71ef2312..48bf6736f2d 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -60,7 +60,7 @@ void GfxSettingMenu::load(rapidxml::xml_node<char> *node) {
}
if (nodeValid("brightness", node))
- _brightness.load(node->first_node("brightness"), 0, 100, g_engine->_screenSettings->gamma * 100);
+ _brightness.load(node->first_node("brightness"), 0, 100, g_engine->_screenSettings->_gamma * 100);
}
//------------------------------------------------------------------------
@@ -68,7 +68,7 @@ void GfxSettingMenu::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void GfxSettingMenu::draw() {
// Window border doesn't matter if you are in fullscreen
- if (!g_engine->_screenSettings->fullscreen)
+ if (!g_engine->_screenSettings->_fullscreen)
_border.draw();
// Draw toggle buttons
@@ -77,7 +77,7 @@ void GfxSettingMenu::draw() {
_vsync.draw();
// Quality and resolution can only be changed in the main menu
- if (!g_engine->_screenSettings->in_game) {
+ if (!g_engine->_screenSettings->_inGame) {
// Tree quality button
_quality.draw();
} else
@@ -93,31 +93,31 @@ void GfxSettingMenu::draw() {
int GfxSettingMenu::handleEvents(const Common::Event &event) {
if (_fullscreen.handleEvents(event)) {
// Setting video flags is necessary when toggling fullscreen
- g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
- g_engine->_screenSettings->SetFullscreen();
+ g_engine->_screenSettings->_fullscreen = !g_engine->_screenSettings->_fullscreen;
+ g_engine->_screenSettings->setFullscreen();
}
// Vsync doesn't need to set the change value
if (_vsync.handleEvents(event)) {
- g_engine->_screenSettings->vsync = !g_engine->_screenSettings->vsync;
- g_engine->_screenSettings->SetVsync();
+ g_engine->_screenSettings->_vsync = !g_engine->_screenSettings->_vsync;
+ g_engine->_screenSettings->setVsync();
}
// Quality and resolution can only be changed in the main menu
- if (!g_engine->_screenSettings->in_game) {
+ if (!g_engine->_screenSettings->_inGame) {
if (_quality.handleEvents(event))
- g_engine->_screenSettings->quality = !g_engine->_screenSettings->quality;
+ g_engine->_screenSettings->_quality = !g_engine->_screenSettings->_quality;
}
// Window border doesn't matter if you are in fullscreen
- if (_border.handleEvents(event) && !g_engine->_screenSettings->fullscreen) {
- g_engine->_screenSettings->border = !g_engine->_screenSettings->border;
- g_engine->_screenSettings->SetWindowBorder();
+ if (_border.handleEvents(event) && !g_engine->_screenSettings->_fullscreen) {
+ g_engine->_screenSettings->_border = !g_engine->_screenSettings->_border;
+ g_engine->_screenSettings->setWindowBorder();
}
if (_brightness.handleEvents(event)) {
- g_engine->_screenSettings->gamma = static_cast<float>(_brightness.Value()) / 100.0f;
- g_engine->_screenSettings->SetGamma();
+ g_engine->_screenSettings->_gamma = static_cast<float>(_brightness.Value()) / 100.0f;
+ g_engine->_screenSettings->setGamma();
}
return _resolution.handleEvents(event);
@@ -165,10 +165,10 @@ int GfxSettingMenu::handleEvents(const SDL_Event &Event) {
// Purpose: Keep button settings synced with our screen settings
//------------------------------------------------------------------------
void GfxSettingMenu::internalEvents() {
- _fullscreen._state = g_engine->_screenSettings->fullscreen;
- _vsync._state = g_engine->_screenSettings->vsync;
- _border._state = g_engine->_screenSettings->border;
- _quality._state = g_engine->_screenSettings->quality;
+ _fullscreen._state = g_engine->_screenSettings->_fullscreen;
+ _vsync._state = g_engine->_screenSettings->_vsync;
+ _border._state = g_engine->_screenSettings->_border;
+ _quality._state = g_engine->_screenSettings->_quality;
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index c02e9caa854..7ecaa7a8124 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -95,7 +95,7 @@ void Inventory::draw(Person &obj, const int &moneyVal) {
// helper.DrawInfo(obj);
_collection.draw(obj._id /*, helper*/);
- _money._caption._text = NumberToString(moneyVal);
+ _money._caption._text = numberToString(moneyVal);
_money.draw();
}
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index e089ca8cce9..1fa83bb1523 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -71,8 +71,8 @@ void ModMenu::load(const Common::String &filename) {
hov[DATA_WEBSITE].load(offnode->first_node("website_title"));
}
- _extension = g_engine->_filePath->mod_ext;
- _directory = g_engine->_filePath->mod_path;
+ _extension = g_engine->_filePath->_modExt;
+ _directory = g_engine->_filePath->_modPath;
scanDir();
}
}
@@ -80,7 +80,7 @@ void ModMenu::load(const Common::String &filename) {
bool ModMenu::handleEvents(const Common::Event &event) {
int choice = _menu.handleEvents(event);
if (choice >= 0) {
- g_engine->_filePath->mod_cur = _slotInfo[_menu.index() + choice]._path;
+ g_engine->_filePath->_modCur = _slotInfo[_menu.index() + choice]._path;
return true;
}
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 887f18418a5..de765536a1b 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -138,7 +138,7 @@ void OptionMenu::draw(Button &back) {
break;
case STATE_CONFIRM:
_noticeRes.draw();
- _countdown.draw(NumberToString(_timer.remainingTicks() / 1000));
+ _countdown.draw(numberToString(_timer.remainingTicks() / 1000));
break;
default:
break;
@@ -165,7 +165,7 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
if (result == 1) {
_state = STATE_CONFIRM;
_timer.start();
- g_engine->_screenSettings->SetResolution();
+ g_engine->_screenSettings->setResolution();
_gfx.SetInfo();
} else if (result == 2)
_state = STATE_ENTER_W;
@@ -181,23 +181,23 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
switch (_state) {
case STATE_ENTER_W:
if (_promptW.handleEvents(event, true) || _accept.handleEvents(event) == BUAC_LCLICK) {
- g_engine->_screenSettings->cur.w = StringToNumber<int>(_promptW._text);
+ g_engine->_screenSettings->_cur.w = stringToNumber<int>(_promptW._text);
_state = STATE_ENTER_H;
} else if (_cancel.handleEvents(event) == BUAC_LCLICK) {
- g_engine->_screenSettings->RestoreBackup();
+ g_engine->_screenSettings->restoreBackup();
_gfx.SetInfo();
_state = STATE_GRAPHICS;
}
break;
case STATE_ENTER_H:
if (_promptH.handleEvents(event, true) || _accept.handleEvents(event) == BUAC_LCLICK) {
- g_engine->_screenSettings->cur.h = StringToNumber<int>(_promptH._text);
+ g_engine->_screenSettings->_cur.h = stringToNumber<int>(_promptH._text);
_state = STATE_CONFIRM;
_timer.start();
- g_engine->_screenSettings->SetResolution();
+ g_engine->_screenSettings->setResolution();
_gfx.SetInfo();
} else if (_cancel.handleEvents(event) == BUAC_LCLICK) {
- g_engine->_screenSettings->RestoreBackup();
+ g_engine->_screenSettings->restoreBackup();
_gfx.SetInfo();
_state = STATE_GRAPHICS;
}
@@ -208,8 +208,8 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
_state = STATE_GRAPHICS;
_timer.stop();
} else if (_cancel.handleEvents(event)) {
- g_engine->_screenSettings->RestoreBackup();
- g_engine->_screenSettings->SetResolution();
+ g_engine->_screenSettings->restoreBackup();
+ g_engine->_screenSettings->setResolution();
_gfx.SetInfo();
_state = STATE_GRAPHICS;
}
@@ -373,8 +373,8 @@ void OptionMenu::internalEvents() {
_general.internalEvents();
if (_state == STATE_CONFIRM && _timer.targetReached()) {
- g_engine->_screenSettings->RestoreBackup();
- g_engine->_screenSettings->SetResolution();
+ g_engine->_screenSettings->restoreBackup();
+ g_engine->_screenSettings->setResolution();
_gfx.SetInfo();
_state = STATE_GRAPHICS;
}
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index c0b22be33db..954fcd7e102 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -157,9 +157,9 @@ public:
}
void updateInfo() {
- _info = NumberToString(_currentPage + 1);
+ _info = numberToString(_currentPage + 1);
_info += " of ";
- _info += NumberToString(_menu.size());
+ _info += numberToString(_menu.size());
}
void load(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 5415f76ee3d..9e001d18a14 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -105,7 +105,7 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
_totalPage = pageCount + 1;
// Update the text
- _status._text = (NumberToString(_currentPage + 1) + " of " + NumberToString(_totalPage));
+ _status._text = (numberToString(_currentPage + 1) + " of " + numberToString(_totalPage));
// Now, start drawing the quest
_status.draw();
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index 1dea4d586dd..a1f2432d08d 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -61,13 +61,13 @@ void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
loadNum(d.w, "x", n);
loadNum(d.h, "y", n);
- if (g_engine->_screenSettings->ValidDimension(d)) {
+ if (g_engine->_screenSettings->validDimension(d)) {
_dim.push_back(d);
Button b;
b.init(_ref, _inc.x * (countSlot % _columns), _inc.y * (countSlot / _columns));
- b._caption._text = NumberToString(d.w);
+ b._caption._text = numberToString(d.w);
b._caption._text += " x ";
- b._caption._text += NumberToString(d.h);
+ b._caption._text += numberToString(d.h);
_element.push_back(b);
}
}
@@ -105,7 +105,7 @@ int ResolutionMenu::handleEvents(const Common::Event &event) {
case STATE_CHANGE: {
int choice = Menu::handleEvents(event);
if (choice >= 0) {
- g_engine->_screenSettings->cur = _dim[choice];
+ g_engine->_screenSettings->_cur = _dim[choice];
_state = STATE_NORMAL;
return 1;
}
@@ -158,9 +158,9 @@ int ResolutionMenu::handleEvents(const SDL_Event &Event) {
void ResolutionMenu::setInfo() {
_info._text = _defInfo;
- _info._text += NumberToString(g_engine->_screenSettings->cur.w);
+ _info._text += numberToString(g_engine->_screenSettings->_cur.w);
_info._text += " x ";
- _info._text += NumberToString(g_engine->_screenSettings->cur.h);
+ _info._text += numberToString(g_engine->_screenSettings->_cur.h);
}
void ResolutionMenu::setUI() {
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 280c8185d76..b0fb70ea62f 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -49,7 +49,7 @@ void GameSaveMenu::addButton(const Common::String &p, unsigned int &slotIndex, u
void GameSaveMenu::scanDir() {
Common::String res = "CRAB_*";
- res += g_engine->_filePath->save_ext;
+ res += g_engine->_filePath->_saveExt;
Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
_slotInfo.clear();
@@ -58,7 +58,7 @@ void GameSaveMenu::scanDir() {
unsigned int countSlot = 0, countMenu = 0;
// For the save menu, the first slot is a "blank" slot - to create a new save file
- addButton("CRAB_New Save" + g_engine->_filePath->save_ext, countMenu, countSlot);
+ addButton("CRAB_New Save" + g_engine->_filePath->_saveExt, countMenu, countSlot);
for (const Common::String& save : saves) {
addButton(save, countMenu, countSlot);
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index e2b301e0751..6f0c38b341b 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -85,10 +85,10 @@ void Element::setUI(Rect *parent) {
if (parent == NULL) {
switch (_align.x) {
case ALIGN_CENTER:
- x = g_engine->_screenSettings->cur.w / 2 - w / 2 + _raw.x;
+ x = g_engine->_screenSettings->_cur.w / 2 - w / 2 + _raw.x;
break;
case ALIGN_RIGHT:
- x = g_engine->_screenSettings->cur.w - w + _raw.x;
+ x = g_engine->_screenSettings->_cur.w - w + _raw.x;
break;
default:
x = _raw.x;
@@ -97,10 +97,10 @@ void Element::setUI(Rect *parent) {
switch (_align.y) {
case ALIGN_CENTER:
- y = g_engine->_screenSettings->cur.h / 2 - h / 2 + _raw.y;
+ y = g_engine->_screenSettings->_cur.h / 2 - h / 2 + _raw.y;
break;
case ALIGN_RIGHT:
- y = g_engine->_screenSettings->cur.h - h + _raw.y;
+ y = g_engine->_screenSettings->_cur.h - h + _raw.y;
break;
default:
y = _raw.y;
Commit: b002ccd8df85b2593eb114477617d1962b89847c
https://github.com/scummvm/scummvm/commit/b002ccd8df85b2593eb114477617d1962b89847c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make remaining files follow code formatting conventions
Changed paths:
engines/crab/Line.cpp
engines/crab/Line.h
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGrid.cpp
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/PriorityQueue.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/Shape.cpp
engines/crab/Shape.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/ai/movement.cpp
engines/crab/ai/spriteai.cpp
engines/crab/animation/sprite.cpp
engines/crab/collision.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/button.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
engines/crab/ui/slider.cpp
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index 4fb5c16ea97..13a32151b98 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -36,7 +36,7 @@ namespace Crab {
//------------------------------------------------------------------------
// Purpose: Draw a line from start to end
//------------------------------------------------------------------------
-void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
+void drawLine(const int &x1, const int &y1, const int &x2, const int &y2,
const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
g_engine->_screen->drawLine(x1, y1, x2, y2, g_engine->_format->ARGBToColor(a, r, g, b));
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index 170e029e17a..2309fea8a2a 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -39,7 +39,7 @@ namespace Crab {
// Find if 2 lines intersect and store the point of intersection
template<typename T>
-bool CollideLine(const T &p0X, const T &p0Y, const T &p1X, const T &p1Y,
+bool collideLine(const T &p0X, const T &p0Y, const T &p1X, const T &p1Y,
const T &p2X, const T &p2Y, const T &p3X, const T &p3Y,
T *x = NULL, T *y = NULL) {
Vector2D<T> s1, s2;
@@ -70,7 +70,7 @@ bool CollideLine(const T &p0X, const T &p0Y, const T &p1X, const T &p1Y,
}
// Draw a line OpenGL style
-void DrawLine(const int &x1, const int &y1, const int &x2, const int &y2,
+void drawLine(const int &x1, const int &y1, const int &x2, const int &y2,
const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a);
} // End of namespace Crab
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 892797e310f..bf106f95794 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -111,15 +111,15 @@ void PathfindingAgent::update(long timeslice) {
double dTempCost;
if (_solutionFound) {
- if (m_vSolution.size() > 0) {
- float distSqr = (_position - m_vSolution.back()->getPosition()).MagSqr();
+ if (_vSolution.size() > 0) {
+ float distSqr = (_position - _vSolution.back()->getPosition()).MagSqr();
if (distSqr < _nodeBufferDistance) // Have to find the right deadzone buffer
{
- m_vSolution.pop_back();
+ _vSolution.pop_back();
}
}
- if (m_vSolution.size() > 0) {
- _immediateDest = Vector2i(m_vSolution.back()->getPosition().x, m_vSolution.back()->getPosition().y);
+ if (_vSolution.size() > 0) {
+ _immediateDest = Vector2i(_vSolution.back()->getPosition().x, _vSolution.back()->getPosition().y);
} else {
if (_destinationReachable)
_immediateDest = Vector2i((int)_destination.x, (int)_destination.y);
@@ -145,11 +145,11 @@ void PathfindingAgent::update(long timeslice) {
//|| //We're done.
{
// m_vSolution = getSolution();
- m_vSolution = getPrunedSolution(NULL);
+ _vSolution = getPrunedSolution(NULL);
_solutionFound = true;
return;
} else if (current->getLocation()->getMovementCost() > 0 && current->getLocation()->adjacentToNode(_clickedTile) && _clickedTile->getMovementCost() < 0) {
- m_vSolution = getPrunedSolution(current->getLocation());
+ _vSolution = getPrunedSolution(current->getLocation());
_solutionFound = true;
return;
}
@@ -240,7 +240,7 @@ void PathfindingAgent::reset() {
_nodeQueue.clear();
_createdList.clear();
- m_vSolution.clear();
+ _vSolution.clear();
_solutionFound = false;
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index cb273ce9f89..118ebd9eb39 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -134,7 +134,7 @@ public:
bool _solutionFound;
bool _noSolution;
- Common::Array<PathfindingGraphNode const *> m_vSolution;
+ Common::Array<PathfindingGraphNode const *> _vSolution;
void setNodeBufferDistance(float w) {
_nodeBufferDistance = w;
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 5812614e0c1..bc70069a0ba 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -125,7 +125,7 @@ void PathfindingGrid::setupNodes(TMX::TMXMap map) {
// Check if the square should count as blocked
for (auto i = noWalk.begin(); i != noWalk.end(); ++i) {
- if (i->Collide(_nodes[x][y]._collisionRect).intersect) {
+ if (i->collide(_nodes[x][y]._collisionRect)._intersect) {
_nodes[x][y]._movementCost = (float)_blockedCost;
break;
}
@@ -136,7 +136,7 @@ void PathfindingGrid::setupNodes(TMX::TMXMap map) {
Common::Array<pyrodactyl::level::Stairs> stairs = map.areaStairs();
for (auto i = stairs.begin(); i != stairs.end(); ++i) {
- if (i->Collide(_nodes[x][y]._collisionRect).intersect) {
+ if (i->collide(_nodes[x][y]._collisionRect)._intersect) {
_nodes[x][y]._movementCost = (float)_stairsCost;
break;
}
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index afe5f99861a..32076ff326b 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -40,7 +40,7 @@ float IntervalDistance(float minA, float maxA, float minB, float maxB) {
return minA - maxB;
}
-void Polygon2D::AddPoint(const Vector2f &ref, const Common::String &x, const Common::String &y, Vector2f &min, Vector2f &max) {
+void Polygon2D::addPoint(const Vector2f &ref, const Common::String &x, const Common::String &y, Vector2f &min, Vector2f &max) {
Vector2f p;
p.x = ref.x + stringToNumber<float>(x);
p.y = ref.y + stringToNumber<float>(y);
@@ -55,7 +55,7 @@ void Polygon2D::AddPoint(const Vector2f &ref, const Common::String &x, const Com
if (p.y > max.y)
max.y = p.y;
- point.push_back(p);
+ _point.push_back(p);
}
void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
@@ -67,7 +67,7 @@ void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
Vector2f min(std::numeric_limits<float>::max(), std::numeric_limits<float>::max());
Vector2f max(-std::numeric_limits<float>::max(), -std::numeric_limits<float>::max());
- point.clear();
+ _point.clear();
rapidxml::xml_node<char> *polynode = node->first_node("polygon");
if (polynode != NULL) {
Common::String points, x, y;
@@ -78,7 +78,7 @@ void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
if (*i == ',')
comma = true;
else if (*i == ' ') {
- AddPoint(ref, x, y, min, max);
+ addPoint(ref, x, y, min, max);
comma = false;
x.clear();
y.clear();
@@ -88,7 +88,7 @@ void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
x += *i;
}
- AddPoint(ref, x, y, min, max);
+ addPoint(ref, x, y, min, max);
bounds.x = min.x;
bounds.y = min.y;
@@ -96,54 +96,54 @@ void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
bounds.h = max.y - min.y;
}
- SetEdge();
+ setEdge();
}
-void Polygon2D::SetEdge() {
- edge.clear();
+void Polygon2D::setEdge() {
+ _edge.clear();
Vector2f p1, p2, res;
- for (unsigned int i = 0; i < point.size(); i++) {
- p1 = point[i];
- if (i + 1 >= point.size())
- p2 = point[0];
+ for (unsigned int i = 0; i < _point.size(); i++) {
+ p1 = _point[i];
+ if (i + 1 >= _point.size())
+ p2 = _point[0];
else
- p2 = point[i + 1];
+ p2 = _point[i + 1];
res.x = p2.x - p1.x;
res.y = p2.y - p1.y;
- edge.push_back(res);
+ _edge.push_back(res);
}
}
-Vector2f Polygon2D::Center() const {
+Vector2f Polygon2D::center() const {
Vector2f total;
- for (unsigned int i = 0; i < point.size(); i++) {
- total.x += point[i].x;
- total.y += point[i].y;
+ for (unsigned int i = 0; i < _point.size(); i++) {
+ total.x += _point[i].x;
+ total.y += _point[i].y;
}
Vector2f ret;
- if (point.size() > 0) {
- ret.x = total.x / point.size();
- ret.y = total.y / point.size();
+ if (_point.size() > 0) {
+ ret.x = total.x / _point.size();
+ ret.y = total.y / _point.size();
}
return ret;
}
-void Polygon2D::Offset(const float &x, const float &y) {
- for (auto i = point.begin(); i != point.end(); ++i) {
+void Polygon2D::offset(const float &x, const float &y) {
+ for (auto i = _point.begin(); i != _point.end(); ++i) {
i->x += x;
i->y += y;
}
}
-void Polygon2D::Project(const Vector2f &axis, float &min, float &max) const {
+void Polygon2D::project(const Vector2f &axis, float &min, float &max) const {
// To project a point on an axis use the dot product
- float d = axis.DotProduct(point[0]);
+ float d = axis.DotProduct(_point[0]);
min = d;
max = d;
- for (auto i = point.begin(); i != point.end(); ++i) {
+ for (auto i = _point.begin(); i != _point.end(); ++i) {
d = i->DotProduct(axis);
if (d < min)
@@ -153,32 +153,32 @@ void Polygon2D::Project(const Vector2f &axis, float &min, float &max) const {
}
}
-PolygonCollisionResult Polygon2D::Collide(const Rect &rect) {
+PolygonCollisionResult Polygon2D::collide(const Rect &rect) {
Polygon2D polyB;
Vector2f p;
p.x = rect.x;
p.y = rect.y;
- polyB.point.push_back(p);
+ polyB._point.push_back(p);
p.x = rect.x + rect.w;
p.y = rect.y;
- polyB.point.push_back(p);
+ polyB._point.push_back(p);
p.x = rect.x + rect.w;
p.y = rect.y + rect.h;
- polyB.point.push_back(p);
+ polyB._point.push_back(p);
p.x = rect.x;
p.y = rect.y + rect.h;
- polyB.point.push_back(p);
- polyB.SetEdge();
+ polyB._point.push_back(p);
+ polyB.setEdge();
- return Collide(polyB);
+ return collide(polyB);
}
-PolygonCollisionResult Polygon2D::Collide(const Polygon2D &polyB) {
+PolygonCollisionResult Polygon2D::collide(const Polygon2D &polyB) {
PolygonCollisionResult result;
- result.intersect = true;
+ result._intersect = true;
- int edgeCountA = edge.size();
- int edgeCountB = polyB.edge.size();
+ int edgeCountA = _edge.size();
+ int edgeCountB = polyB._edge.size();
float minIntervalDistance = std::numeric_limits<float>::max();
Vector2f translationAxis;
Vector2f e;
@@ -186,9 +186,9 @@ PolygonCollisionResult Polygon2D::Collide(const Polygon2D &polyB) {
// Loop through all the edges of both polygons
for (int edgeIndex = 0; edgeIndex < edgeCountA + edgeCountB; edgeIndex++) {
if (edgeIndex < edgeCountA)
- e = edge[edgeIndex];
+ e = _edge[edgeIndex];
else
- e = polyB.edge[edgeIndex - edgeCountA];
+ e = polyB._edge[edgeIndex - edgeCountA];
// ===== 1. Find if the Polygon2Ds are currently intersecting =====
@@ -201,14 +201,14 @@ PolygonCollisionResult Polygon2D::Collide(const Polygon2D &polyB) {
float minB = 0;
float maxA = 0;
float maxB = 0;
- Project(axis, minA, maxA);
- polyB.Project(axis, minB, maxB);
+ project(axis, minA, maxA);
+ polyB.project(axis, minB, maxB);
// Check if the Polygon2D projections are currently intersecting
float intervalDistance = IntervalDistance(minA, maxA, minB, maxB);
if (intervalDistance > 0) {
// If the Polygon2Ds are not intersecting and won't intersect, exit the loop
- result.intersect = false;
+ result._intersect = false;
break;
}
@@ -221,8 +221,8 @@ PolygonCollisionResult Polygon2D::Collide(const Polygon2D &polyB) {
translationAxis = axis;
Vector2f d, ca, cb;
- ca = Center();
- cb = polyB.Center();
+ ca = center();
+ cb = polyB.center();
d.x = ca.x - cb.x;
d.y = ca.y - cb.y;
@@ -237,36 +237,36 @@ PolygonCollisionResult Polygon2D::Collide(const Polygon2D &polyB) {
// The minimum translation vector can be used to push the Polygon2Ds apart.
// First moves the Polygon2Ds by their velocity
// then move polyA by MinimumTranslationVector.
- if (result.intersect) {
- result.mtv.x = translationAxis.x * minIntervalDistance;
- result.mtv.y = translationAxis.y * minIntervalDistance;
+ if (result._intersect) {
+ result._mtv.x = translationAxis.x * minIntervalDistance;
+ result._mtv.y = translationAxis.y * minIntervalDistance;
}
return result;
}
-bool Polygon2D::Contains(const float &X, const float &Y) {
+bool Polygon2D::contains(const float &x, const float &y) {
bool result = false;
- for (unsigned int i = 0, j = point.size() - 1; i < point.size(); j = i++) {
- if (((point[i].y > Y) != (point[j].y > Y)) &&
- (X < (point[j].x - point[i].x) * (Y - point[i].y) / (point[j].y - point[i].y) + point[i].x))
+ for (unsigned int i = 0, j = _point.size() - 1; i < _point.size(); j = i++) {
+ if (((_point[i].y > y) != (_point[j].y > y)) &&
+ (x < (_point[j].x - _point[i].x) * (y - _point[i].y) / (_point[j].y - _point[i].y) + _point[i].x))
result = !result;
}
return result;
}
-void Polygon2D::draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
+void Polygon2D::draw(const int &xOffset, const int &yOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
Vector2f p1, p2;
- for (unsigned int i = 0; i < point.size(); i++) {
- p1 = point[i];
- if (i + 1 >= point.size())
- p2 = point[0];
+ for (unsigned int i = 0; i < _point.size(); i++) {
+ p1 = _point[i];
+ if (i + 1 >= _point.size())
+ p2 = _point[0];
else
- p2 = point[i + 1];
+ p2 = _point[i + 1];
- DrawLine(p1.x + XOffset, p1.y + YOffset, p2.x + XOffset, p2.y + YOffset, r, g, b, a);
+ drawLine(p1.x + xOffset, p1.y + yOffset, p2.x + xOffset, p2.y + yOffset, r, g, b, a);
}
}
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index c39f98716d3..00216dc14f4 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -42,54 +42,60 @@ namespace Crab {
//------------------------------------------------------------------------
struct PolygonCollisionResult {
// Are the Polygons currently intersecting?
- bool intersect;
+ bool _intersect;
// The translation to apply to polygon A to push the polygons apart
// Also known as the minimum translation vector
- Vector2f mtv;
+ Vector2f _mtv;
- PolygonCollisionResult() { intersect = false; }
+ PolygonCollisionResult() {
+ _intersect = false;
+ }
};
//------------------------------------------------------------------------
// Purpose: A simple 2D Polygon class
//------------------------------------------------------------------------
class Polygon2D {
- void AddPoint(const Vector2f &ref, const Common::String &x, const Common::String &y, Vector2f &min, Vector2f &max);
+ void addPoint(const Vector2f &ref, const Common::String &x, const Common::String &y, Vector2f &min, Vector2f &max);
public:
// A list of all points
- Common::Array<Vector2f> point;
+ Common::Array<Vector2f> _point;
// A list of all edges
- Common::Array<Vector2f> edge;
+ Common::Array<Vector2f> _edge;
Polygon2D() {}
- Polygon2D(rapidxml::xml_node<char> *node, Rect &bounds) { load(node, bounds); }
+ Polygon2D(rapidxml::xml_node<char> *node, Rect &bounds) {
+ load(node, bounds);
+ }
// Returns the approximate axis aligned bounding box of the polygon
void load(rapidxml::xml_node<char> *node, Rect &bounds);
- void SetEdge();
+ void setEdge();
- Vector2f Center() const;
- void Offset(const float &x, const float &y);
- void Offset(const Vector2f &v) { Offset(v.x, v.y); }
+ Vector2f center() const;
+ void offset(const float &x, const float &y);
+ void offset(const Vector2f &v) {
+ offset(v.x, v.y);
+ }
// Check if Polygon2D A is going to collide with Polygon2D B for the given velocity
// PolyA is this polygon
- PolygonCollisionResult Collide(const Polygon2D &polyB);
+ PolygonCollisionResult collide(const Polygon2D &polyB);
// Code for collision with a rectangle
- PolygonCollisionResult Collide(const Rect &rect);
+ PolygonCollisionResult collide(const Rect &rect);
// Find if a point is inside this polygon
- bool Contains(const float &X, const float &Y);
+ bool contains(const float &x, const float &y);
// Calculate the projection of a polygon on an axis and returns it as a [min, max] interval
- void Project(const Vector2f &axis, float &min, float &max) const;
+ void project(const Vector2f &axis, float &min, float &max) const;
- void draw(const int &XOffset = 0, const int &YOffset = 0,
+ void draw(const int &xOffset = 0, const int &yOffset = 0,
const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0.0f, const uint8 &a = 255);
};
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index 7472b4bbe5e..c38429dd3a7 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -41,7 +41,7 @@ namespace Crab {
//! class template and the <a href="http://www.sgi.com/tech/stl/">STL</a> heap operations.
template<typename Node>
class PriorityQueue {
- Common::Array<Node *> open;
+ Common::Array<Node *> _open;
bool (*compare)(Node const *, Node const *);
public:
@@ -99,48 +99,48 @@ public:
};
template<typename Node>
-PriorityQueue<Node>::PriorityQueue(bool (*c)(Node const *, Node const *)) : open(), compare(c) {
+PriorityQueue<Node>::PriorityQueue(bool (*c)(Node const *, Node const *)) : _open(), compare(c) {
}
template<typename Node>
bool PriorityQueue<Node>::empty() const {
- return open.empty();
+ return _open.empty();
}
template<typename Node>
void PriorityQueue<Node>::clear() {
- open.clear();
+ _open.clear();
}
template<typename Node>
size_t PriorityQueue<Node>::size() const {
- return open.size();
+ return _open.size();
}
template<typename Node>
void PriorityQueue<Node>::push(Node *node) {
- open.insert(Common::upperBound(open.begin(), open.end(), node, compare), node);
+ _open.insert(Common::upperBound(_open.begin(), _open.end(), node, compare), node);
}
template<typename Node>
Node *PriorityQueue<Node>::front() const {
- return open.back();
+ return _open.back();
}
template<typename Node>
void PriorityQueue<Node>::pop() {
- open.pop_back();
+ _open.pop_back();
}
template<typename Node>
void PriorityQueue<Node>::remove(Node const *node) {
- open.erase(Common::remove(open.begin(), open.end(), node), open.end());
+ _open.erase(Common::remove(_open.begin(), _open.end(), node), _open.end());
}
template<typename Node>
void PriorityQueue<Node>::enumerate(Common::Array<Node const *> &sorted) const {
- sorted.resize(open.size());
- Common::copy(open.begin(), open.end(), sorted.begin());
+ sorted.resize(_open.size());
+ Common::copy(_open.begin(), _open.end(), sorted.begin());
}
} // End of namespace Crab
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index a80c1cfaa9c..b62053908b6 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -37,7 +37,7 @@ bool Rect::load(rapidxml::xml_node<char> *node, const bool &echo, const Common::
return loadNum(x, x_name, node, echo) && loadNum(y, y_name, node, echo) && loadNum(w, w_name, node, echo) && loadNum(h, h_name, node, echo);
}
-bool Rect::Collide(Rect box) {
+bool Rect::collide(Rect box) {
if (box.x + box.w < x)
return false; // just checking if their
if (box.x > x + w)
@@ -50,7 +50,7 @@ bool Rect::Collide(Rect box) {
return true; // bounding boxes intersect
}
-void Rect::Extend(Rect box) {
+void Rect::extend(Rect box) {
int left1 = x;
int right1 = x + w;
int top1 = y;
@@ -72,7 +72,7 @@ void Rect::Extend(Rect box) {
h = bottom1 - top1;
}
-Direction Rect::ResolveX(Rect collider) {
+Direction Rect::resolveX(Rect collider) {
// Check left edge of collider
if (x < collider.x && collider.x < x + w)
return DIRECTION_RIGHT;
@@ -84,7 +84,7 @@ Direction Rect::ResolveX(Rect collider) {
return DIRECTION_NONE;
}
-Direction Rect::ResolveY(Rect collider) {
+Direction Rect::resolveY(Rect collider) {
// Check top edge of collider
if (y < collider.y && collider.y < y + h)
return DIRECTION_DOWN;
@@ -96,7 +96,7 @@ Direction Rect::ResolveY(Rect collider) {
return DIRECTION_NONE;
}
-void Rect::Flip(const TextureFlipType &flip, const Vector2i &axis) {
+void Rect::flip(const TextureFlipType &flip, const Vector2i &axis) {
if (flip == FLIP_NONE)
return;
@@ -107,13 +107,13 @@ void Rect::Flip(const TextureFlipType &flip, const Vector2i &axis) {
y = 2 * axis.y - y - h;
}
-void Rect::draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
- int X = x + XOffset, Y = y + YOffset;
+void Rect::draw(const int &xOffset, const int &yOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
+ int X = x + xOffset, Y = y + yOffset;
- DrawLine(X, Y, X + w, Y, r, g, b, a);
- DrawLine(X, Y, X, Y + h, r, g, b, a);
- DrawLine(X + w, Y, X + w, Y + h, r, g, b, a);
- DrawLine(X, Y + h, X + w, Y + h, r, g, b, a);
+ drawLine(X, Y, X + w, Y, r, g, b, a);
+ drawLine(X, Y, X, Y + h, r, g, b, a);
+ drawLine(X + w, Y, X + w, Y + h, r, g, b, a);
+ drawLine(X, Y + h, X + w, Y + h, r, g, b, a);
}
void Rect::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index feedae38ace..13f025da0a3 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -58,32 +58,39 @@ struct Rect {
const Common::String &y_name = "y", const Common::String &w_name = "w", const Common::String &h_name = "h");
// Is this rectangle colliding with another rectangle?
- bool Collide(Rect box);
+ bool collide(Rect box);
// Extend this rectangle to fully contain another rectangle
- void Extend(Rect box);
+ void extend(Rect box);
// Resolving a collision means we need to correct the position of the target rectangle to just outside of the reference rectangle
// To do this, first we need to determine which edges of the rectangles are colliding
// Resolve a collision in the X plane
- Direction ResolveX(Rect collider);
+ Direction resolveX(Rect collider);
// Resolve a collision in the Y plane
- Direction ResolveY(Rect collider);
+ Direction resolveY(Rect collider);
// Does this rectangle contain a point?
- bool Contains(int X, int Y) { return (X > x && X < x + w && Y > y && Y < y + h); }
- bool Contains(Vector2i v) { return Contains(v.x, v.y); }
+ bool contains(int x1, int y1) {
+ return (x1 > x && x1 < x + w && y1 > y && y1 < y + h);
+ }
+
+ bool contains(Vector2i v) {
+ return contains(v.x, v.y);
+ }
// Does this rectangle contain another rectangle?
- bool Contains(Rect box) { return (x < box.x && x + w > box.x + box.w && y < box.y && y + h > box.y + box.h); }
+ bool contains(Rect box) {
+ return (x < box.x && x + w > box.x + box.w && y < box.y && y + h > box.y + box.h);
+ }
// Flip a rectangle with respect to an axis
- void Flip(const TextureFlipType &flip, const Vector2i &axis);
+ void flip(const TextureFlipType &flip, const Vector2i &axis);
// Draw the borders of the rectangle
- void draw(const int &XOffset = 0, const int &YOffset = 0, const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0, const uint8 &a = 255);
+ void draw(const int &xOffset = 0, const int &yOffset = 0, const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0, const uint8 &a = 255);
// Check if a rectangle is the same as another
bool operator==(const Rect &r) { return r.x == x && r.y == y && r.w == w && r.h == h; }
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index 709a4dee40b..6a052e30dd1 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -34,40 +34,40 @@ namespace Crab {
void Shape::load(rapidxml::xml_node<char> *node, const bool &echo) {
if (nodeValid("polygon", node, echo)) {
- type = SHAPE_POLYGON;
- poly.load(node, rect);
+ _type = SHAPE_POLYGON;
+ _poly.load(node, _rect);
} else {
- rect.load(node, echo, "x", "y", "width", "height");
+ _rect.load(node, echo, "x", "y", "width", "height");
if (nodeValid("ellipse", node, echo))
- type = SHAPE_ELLIPSE;
+ _type = SHAPE_ELLIPSE;
else
- type = SHAPE_RECT;
+ _type = SHAPE_RECT;
}
}
-CollisionData Shape::Collide(Rect box) {
+CollisionData Shape::collide(Rect box) {
CollisionData res;
- res.intersect = rect.Collide(box);
+ res._intersect = _rect.collide(box);
- if (res.intersect) {
- res.type = type;
- if (type == SHAPE_POLYGON) {
- PolygonCollisionResult pcr = poly.Collide(box);
- res.intersect = pcr.intersect;
- res.data.x = pcr.mtv.x;
- res.data.y = pcr.mtv.y;
+ if (res._intersect) {
+ res._type = _type;
+ if (_type == SHAPE_POLYGON) {
+ PolygonCollisionResult pcr = _poly.collide(box);
+ res._intersect = pcr._intersect;
+ res._data.x = pcr._mtv.x;
+ res._data.y = pcr._mtv.y;
return res;
} else
- res.data = rect;
+ res._data = _rect;
}
return res;
}
-bool Shape::Contains(const Vector2i &pos) {
- if (rect.Contains(pos)) {
- if (type == SHAPE_POLYGON)
- return poly.Contains(pos.x, pos.y);
+bool Shape::contains(const Vector2i &pos) {
+ if (_rect.contains(pos)) {
+ if (_type == SHAPE_POLYGON)
+ return _poly.contains(pos.x, pos.y);
else
return true;
}
@@ -75,11 +75,11 @@ bool Shape::Contains(const Vector2i &pos) {
return false;
}
-void Shape::draw(const int &XOffset, const int &YOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
- if (type == SHAPE_POLYGON)
- poly.draw(XOffset, YOffset, r, g, b, a);
+void Shape::draw(const int &xOffset, const int &yOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
+ if (_type == SHAPE_POLYGON)
+ _poly.draw(xOffset, yOffset, r, g, b, a);
else
- rect.draw(XOffset, YOffset, r, g, b, a);
+ _rect.draw(xOffset, yOffset, r, g, b, a);
}
} // End of namespace Crab
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index ec33994dcc3..658178b3e8d 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -37,47 +37,52 @@
namespace Crab {
// The kind of shape
-enum ShapeType { SHAPE_RECT,
- SHAPE_POLYGON,
- SHAPE_ELLIPSE };
+enum ShapeType {
+ SHAPE_RECT,
+ SHAPE_POLYGON,
+ SHAPE_ELLIPSE
+};
struct CollisionData {
// Store the type of shape
- ShapeType type;
+ ShapeType _type;
// Do the two shapes intersect?
- bool intersect;
+ bool _intersect;
// If Shape is Polygon, the .x and .y of this rectangle contain the minimum translation vector
// If Shape is Rectangle, this contains the colliding rectangle
- Rect data;
+ Rect _data;
CollisionData() {
- type = SHAPE_RECT;
- intersect = false;
+ _type = SHAPE_RECT;
+ _intersect = false;
}
};
class Shape {
public:
// The type of shape
- ShapeType type;
+ ShapeType _type;
// This stores both the ellipse and rectangle data
- Rect rect;
+ Rect _rect;
// This stores the polygon data
- Polygon2D poly;
+ Polygon2D _poly;
+
+ Shape() {
+ _type = SHAPE_RECT;
+ }
- Shape() { type = SHAPE_RECT; }
~Shape() {}
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- CollisionData Collide(Rect box);
+ CollisionData collide(Rect box);
- bool Contains(const Vector2i &pos);
+ bool contains(const Vector2i &pos);
- void draw(const int &XOffset = 0, const int &YOffset = 0,
+ void draw(const int &xOffset = 0, const int &yOffset = 0,
const uint8 &r = 0, const uint8 &g = 0, const uint8 &b = 0, const uint8 &a = 255);
};
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 756b0be8ef3..93a8f38fff3 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -319,29 +319,29 @@ void TMXMap::drawDebug(const Rect &camera) {
void TMXMap::collideWithNoWalk(const Rect boundingBox, Common::List<CollisionData> &colliders) {
CollisionData res;
for (auto i = _areaNowalk.begin(); i != _areaNowalk.end(); ++i) {
- res = i->Collide(boundingBox);
- if (res.intersect)
+ res = i->collide(boundingBox);
+ if (res._intersect)
colliders.push_back(res);
}
}
bool TMXMap::insideNoWalk(const Vector2i &pos) {
for (auto i = _areaNowalk.begin(); i != _areaNowalk.end(); ++i)
- if (i->Contains(pos))
+ if (i->contains(pos))
return true;
return false;
}
bool TMXMap::insideWalk(const Rect boundingBox) {
- if (_areaWalk.Contains(boundingBox))
+ if (_areaWalk.contains(boundingBox))
return true;
return false;
}
bool TMXMap::insideWalk(const Vector2i &pos) {
- if (_areaWalk.Contains(pos))
+ if (_areaWalk.contains(pos))
return true;
return false;
@@ -349,7 +349,7 @@ bool TMXMap::insideWalk(const Vector2i &pos) {
bool TMXMap::collideWithTrigger(const Rect rect, int index) {
if (_areaTrig.size() > (unsigned int)index)
- return _areaTrig[index].Collide(rect).intersect;
+ return _areaTrig[index].collide(rect)._intersect;
return false;
}
@@ -359,13 +359,13 @@ void TMXMap::collideWithTrigger(const Rect rect, Common::Array<int> &collisionTa
collisionTable.clear();
for (auto i = _areaTrig.begin(); i != _areaTrig.end(); ++i, ++index)
- if (i->Collide(rect).intersect)
+ if (i->collide(rect)._intersect)
collisionTable.push_back(index);
}
bool TMXMap::collideWithExit(const Rect rect, LevelResult &res) {
for (auto i = _areaExit.begin(); i != _areaExit.end(); ++i)
- if (i->_dim.Collide(rect).intersect) {
+ if (i->_dim.collide(rect)._intersect) {
res._val = i->_name;
res._x = i->_entry.x;
res._y = i->_entry.y;
@@ -377,7 +377,7 @@ bool TMXMap::collideWithExit(const Rect rect, LevelResult &res) {
bool TMXMap::collideWithStairs(const Rect rect, Vector2f &velMod) {
for (auto i = _areaStairs.begin(); i != _areaStairs.end(); ++i) {
- if (i->Collide(rect).intersect) {
+ if (i->collide(rect)._intersect) {
velMod = i->_modifier;
return true;
}
@@ -391,7 +391,7 @@ bool TMXMap::collideWithStairs(const Rect rect, Vector2f &velMod) {
bool TMXMap::collideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &music) {
for (auto i = _areaMusic.begin(); i != _areaMusic.end(); ++i) {
- if (i->Collide(rect).intersect) {
+ if (i->collide(rect)._intersect) {
music._id = i->_id;
music._track = i->_track;
music._loops = i->_loops;
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index ec8bd43f0bf..4b9a7049e53 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -134,8 +134,8 @@ void TileSetGroup::preDraw(MapLayer &layer, const Vector2i &tileSize, Graphics::
for (rOuter = layer._boundRect.begin(); rOuter != layer._boundRect.end(); ++rOuter) {
rInner = rOuter;
while (++rInner != layer._boundRect.end()) {
- if ((*rOuter).Collide(*rInner)) {
- rOuter->Extend(*rInner);
+ if ((*rOuter).collide(*rInner)) {
+ rOuter->extend(*rInner);
layer._boundRect.erase(rInner);
rInner = rOuter;
}
@@ -148,7 +148,7 @@ void TileSetGroup::forceDraw(MapLayer &layer, const Rect &camera, const Vector2i
if (layer._type == LAYER_IMAGE)
return;
- layer._collide = layer._pos.Collide(playerPos);
+ layer._collide = layer._pos.collide(playerPos);
// Normal and prop layers are drawn this way
// The row and column we start drawing at
@@ -216,7 +216,7 @@ void TileSetGroup::draw(MapLayer &layer, const Rect &camera, const Vector2i &til
_v.y += tileSize.y;
}
} else {
- layer._collide = layer._pos.Collide(playerPos);
+ layer._collide = layer._pos.collide(playerPos);
// If player is inside the layer bounds, draw normally - else skip drawing
if (layer._type == LAYER_AUTOHIDE && !layer._collide)
diff --git a/engines/crab/ai/movement.cpp b/engines/crab/ai/movement.cpp
index dd65d4530ed..7e57ef99ca6 100644
--- a/engines/crab/ai/movement.cpp
+++ b/engines/crab/ai/movement.cpp
@@ -50,7 +50,7 @@ void MovementSet::load(rapidxml::xml_node<char> *node) {
bool MovementSet::internalEvents(const Rect rect) {
if (_enabled) {
// If we are at the current waypoint, get to the next waypoint
- if (_path[_cur]._target.Collide(rect)) {
+ if (_path[_cur]._target.collide(rect)) {
_cur = (_cur + 1) % _path.size();
_timer.start();
}
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 6f6652394a2..9ef7acab189 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -111,7 +111,7 @@ bool Sprite::moveToLoc(Vector2i &dest, const float &velocity, const SpriteConsta
else
yVel(0.0f);
- return b.Contains(dest);
+ return b.contains(dest);
}
// Move toward the location using pathfinding.
@@ -168,12 +168,12 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
// Find the nearest exit
for (auto &i : areaExit) {
// Compare distance to the rough center of each exit
- int dist = distance2D(_pos.x, _pos.y, i._dim.rect.x + i._dim.rect.w / 2, i._dim.rect.y + i._dim.rect.h / 2);
+ int dist = distance2D(_pos.x, _pos.y, i._dim._rect.x + i._dim._rect.w / 2, i._dim._rect.y + i._dim._rect.h / 2);
if (dist < min_dist) {
min_dist = dist;
// Set the destination of sprite to this exit
- _aiData.dest(i._dim.rect.x + i._dim.rect.w / 2, i._dim.rect.y + i._dim.rect.h / 2);
+ _aiData.dest(i._dim._rect.x + i._dim._rect.w / 2, i._dim._rect.y + i._dim._rect.h / 2);
_pathing.setDestination(Vector2f((float)_aiData._dest.x, (float)_aiData._dest.y));
}
@@ -182,7 +182,7 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
} break;
case FLEESTATE_RUNTOEXIT: {
Rect b = boundRect();
- if (b.Contains(_aiData._dest)) {
+ if (b.contains(_aiData._dest)) {
// We have reached the exit, time to make the sprite disappear
_aiData._flee._state = FLEESTATE_DISAPPEAR;
break;
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 08f843a85b5..e1f744baa8a 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -126,21 +126,21 @@ void Sprite::resolveCollide() {
// NOTE: we don't check i->intersect here because we do that in the level functions
for (auto i = _collideData.begin(); i != _collideData.end(); ++i) {
Rect bounds = boundRect();
- if (i->type == SHAPE_POLYGON) {
- _pos.x -= i->data.x;
- _pos.y -= i->data.y;
+ if (i->_type == SHAPE_POLYGON) {
+ _pos.x -= i->_data.x;
+ _pos.y -= i->_data.y;
} else {
- Direction d = bounds.ResolveY(i->data);
+ Direction d = bounds.resolveY(i->_data);
if (d == DIRECTION_UP)
- _pos.y -= i->data.y + i->data.h - _animSet._bounds.y + _animSet.anchorY(_dir) + 1;
+ _pos.y -= i->_data.y + i->_data.h - _animSet._bounds.y + _animSet.anchorY(_dir) + 1;
else if (d == DIRECTION_DOWN)
- _pos.y -= i->data.y - bounds.h - _animSet._bounds.y + _animSet.anchorY(_dir) - 1;
+ _pos.y -= i->_data.y - bounds.h - _animSet._bounds.y + _animSet.anchorY(_dir) - 1;
- d = bounds.ResolveX(i->data);
+ d = bounds.resolveX(i->_data);
if (d == DIRECTION_LEFT)
- _pos.x -= i->data.x + i->data.w - _animSet._bounds.x + _animSet.anchorX(_dir) + 1;
+ _pos.x -= i->_data.x + i->_data.w - _animSet._bounds.x + _animSet.anchorX(_dir) + 1;
else if (d == DIRECTION_RIGHT)
- _pos.x -= i->data.x - bounds.w - _animSet._bounds.x + _animSet.anchorX(_dir) - 1;
+ _pos.x -= i->_data.x - bounds.w - _animSet._bounds.x + _animSet.anchorX(_dir) - 1;
}
}
@@ -153,7 +153,7 @@ void Sprite::resolveCollide() {
//------------------------------------------------------------------------
void Sprite::resolveInside(Rect collider) {
Rect bounds = boundRect();
- Direction d = bounds.ResolveX(collider);
+ Direction d = bounds.resolveX(collider);
if (d == DIRECTION_RIGHT)
_pos.x = collider.x - _animSet._bounds.x + _animSet.anchorX(_dir) + 1;
@@ -161,7 +161,7 @@ void Sprite::resolveInside(Rect collider) {
_pos.x = collider.x + collider.w - _animSet._bounds.x - bounds.w + _animSet.anchorX(_dir) - 1;
bounds = boundRect();
- d = bounds.ResolveY(collider);
+ d = bounds.resolveY(collider);
if (d == DIRECTION_DOWN)
_pos.y = collider.y - _animSet._bounds.y + _animSet.anchorY(_dir) + 1;
@@ -290,8 +290,8 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
g_engine->_textManager->draw(x + 120.0f, y - 60.0f, NumberToString(_aiData.dest.y), 0);*/
- if (_pathing.m_vSolution.size() > 0) {
- for (auto iter = _pathing.m_vSolution.begin(); iter != _pathing.m_vSolution.end(); ++iter) {
+ if (_pathing._vSolution.size() > 0) {
+ for (auto iter = _pathing._vSolution.begin(); iter != _pathing._vSolution.end(); ++iter) {
bool nextToWall = false;
for (auto neighbor = (*iter)->_neighborNodes.begin(); neighbor != (*iter)->_neighborNodes.end(); ++neighbor) {
if ((*neighbor)->getMovementCost() < 0 || (*neighbor)->getMovementCost() > 1) {
@@ -525,10 +525,10 @@ bool Sprite::fightCollide(Rect hitbox, Rect enemyBounds, Range &range, const Spr
Rect actualRange = rangeRect(bounds, range);
// The second part is a sanity check so the stray hitbox of a sprite 1000 pixels below does not cause damage
- if (hitbox.Collide(actualRange) && abs(bounds.y + bounds.h - enemyBounds.y - enemyBounds.h) < sc._planeW)
+ if (hitbox.collide(actualRange) && abs(bounds.y + bounds.h - enemyBounds.y - enemyBounds.h) < sc._planeW)
return true;
} else {
- if (hitbox.Collide(bounds) && abs(bounds.y + bounds.h - enemyBounds.y - enemyBounds.h) < sc._planeW)
+ if (hitbox.collide(bounds) && abs(bounds.y + bounds.h - enemyBounds.y - enemyBounds.h) < sc._planeW)
return true;
}
@@ -645,7 +645,7 @@ void Sprite::calcProperties(Info &info) {
bool Sprite::takingDamage(Sprite &sp, const SpriteConstant &sc) {
if (damageValid(sp, sc))
if (boxV().w > 0 && boxV().h > 0 && sp.boxD().w > 0 && sp.boxD().h > 0)
- if (boxV().Collide(sp.boxD()))
+ if (boxV().collide(sp.boxD()))
return true;
/*Common::String words = NumberToString(BoxV().x) + " " + NumberToString(BoxV().y)+ " " + NumberToString(BoxV().w)
diff --git a/engines/crab/collision.cpp b/engines/crab/collision.cpp
index f9d3510ecf4..33f6483b45c 100644
--- a/engines/crab/collision.cpp
+++ b/engines/crab/collision.cpp
@@ -39,7 +39,7 @@ bool collideLineRect(int p0X, int p0Y, int p1X, int p1Y, const Rect &rect) {
int q1_x = rect.x + rect.w;
int q1_y = rect.y;
- if (CollideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
+ if (collideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
return true;
q0_x = rect.x;
@@ -47,7 +47,7 @@ bool collideLineRect(int p0X, int p0Y, int p1X, int p1Y, const Rect &rect) {
q1_x = rect.x;
q1_y = rect.y + rect.h;
- if (CollideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
+ if (collideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
return true;
q0_x = rect.x + rect.w;
@@ -55,7 +55,7 @@ bool collideLineRect(int p0X, int p0Y, int p1X, int p1Y, const Rect &rect) {
q1_x = rect.x + rect.w;
q1_y = rect.y + rect.h;
- if (CollideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
+ if (collideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
return true;
q0_x = rect.x;
@@ -63,7 +63,7 @@ bool collideLineRect(int p0X, int p0Y, int p1X, int p1Y, const Rect &rect) {
q1_x = rect.x + rect.w;
q1_y = rect.y + rect.h;
- if (CollideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
+ if (collideLine<int>(p0X, p0Y, p1X, p1Y, q0_x, q0_y, q1_x, q1_y))
return true;
return false;
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index c5ba1dad913..b305e862d09 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -51,7 +51,7 @@ bool Level::containsClick(const Common::String &id, const Common::Event &event)
for (auto &i : _objects) {
Rect r = i.posRect();
- if (r.Contains(g_engine->_mouse->_motion.x + _camera.x, g_engine->_mouse->_motion.y + _camera.y)) {
+ if (r.contains(g_engine->_mouse->_motion.x + _camera.x, g_engine->_mouse->_motion.y + _camera.y)) {
// This is to show the sprite's name on top of their head
i._hover = true;
@@ -67,7 +67,7 @@ bool Level::containsClick(const Common::String &id, const Common::Event &event)
for (auto &i : _objects) {
if (i.id() == id) {
Rect r = i.posRect();
- if (r.Contains(g_engine->_mouse->_button.x + _camera.x, g_engine->_mouse->_button.y + _camera.y)) {
+ if (r.contains(g_engine->_mouse->_button.x + _camera.x, g_engine->_mouse->_button.y + _camera.y)) {
g_engine->_mouse->_hover = true;
return true;
}
@@ -152,7 +152,7 @@ bool Level::collidingWithObject(pyrodactyl::event::Info &info, Common::String &i
// Clip and bounding rectangles for the NPC sprite
Rect iPos = i->posRect(), iBound = i->boundRect();
- if (pPos.Collide(iPos) || iPos.Contains(pPos) || pBound.Collide(iBound) || iBound.Contains(pBound)) {
+ if (pPos.collide(iPos) || iPos.contains(pPos) || pBound.collide(iBound) || iBound.contains(pBound)) {
id = i->id();
return true;
}
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index f7f80136a9a..c878a215017 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -160,11 +160,11 @@ void Level::drawObjects(pyrodactyl::event::Info &info) {
if (a->_pos.y + a->_pos.h < obj->y() + obj->h()) {
for (auto &i : a->_boundRect) {
i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
- if (i.Collide(_objects[_playerIndex].posRect())) {
+ if (i.collide(_objects[_playerIndex].posRect())) {
g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, _objects[_playerIndex].posRect());
}
- if (i.Contains(_objects[_playerIndex]._aiData._dest)) {
+ if (i.contains(_objects[_playerIndex]._aiData._dest)) {
g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, newpos);
}
}
@@ -186,11 +186,11 @@ void Level::drawObjects(pyrodactyl::event::Info &info) {
for (; a != _terrain._prop.end(); ++a) {
for (auto &i : a->_boundRect) {
i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
- if (i.Collide(_objects[_playerIndex].posRect())) {
+ if (i.collide(_objects[_playerIndex].posRect())) {
g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, _objects[_playerIndex].posRect());
}
- if (i.Contains(_objects[_playerIndex]._aiData._dest)) {
+ if (i.contains(_objects[_playerIndex]._aiData._dest)) {
g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, newpos);
}
}
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 013994b6214..1b0337cd4cb 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -133,7 +133,7 @@ void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &playerPos
_player.w + _offset._marker.x,
_player.h + _offset._marker.y);
- _player._visible = bounds.Contains(r);
+ _player._visible = bounds.contains(r);
}
// Redefine p for marker buttons
@@ -144,7 +144,7 @@ void MapMarkerMenu::internalEvents(const Element &pos, const Vector2i &playerPos
Rect r(i.x + p.x - _offset._marker.x, i.y + p.y - _offset._marker.y,
i.w + _offset._marker.x, i.h + _offset._marker.y);
- i._visible = bounds.Contains(r);
+ i._visible = bounds.contains(r);
}
}
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index 2d5c91c9cb8..a493e47b8f2 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -151,7 +151,7 @@ ButtonAction Button::handleEvents(const Common::Event &Event, const int &xOffset
dim.y += yOffset;
if (_visible) {
- if (dim.Contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y)) {
+ if (dim.contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y)) {
_hoverMouse = true;
if (!_hoverPrev) {
@@ -171,11 +171,11 @@ ButtonAction Button::handleEvents(const Common::Event &Event, const int &xOffset
}
} else if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
// The g_engine->_mouse button pressed, then released, comprises of a click action
- if (dim.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y))
+ if (dim.contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y))
_mousePressed = true;
} else if ((Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP) && _mousePressed) {
reset();
- if (dim.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
+ if (dim.contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
_mousePressed = false;
if (Event.type == Common::EVENT_LBUTTONUP) {
g_engine->_musicManager->playEffect(_seClick, 0);
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 67253ec28cb..3ff6e2a83b7 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -122,7 +122,7 @@ void HUD::internalEvents(bool showMap) {
}
HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const Common::Event &event) {
- g_engine->_mouse->_insideHud = _bg.Contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y);
+ g_engine->_mouse->_insideHud = _bg.contains(g_engine->_mouse->_motion.x, g_engine->_mouse->_motion.y);
int choice = _menu.handleEvents(event);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 29c93151fb9..c5790e6f026 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -195,7 +195,7 @@ void Map::move(const Common::Event &event) {
bool click = false;
int count = 0;
for (auto &i : _scroll._element) {
- if (i.Contains(g_engine->_mouse->_button)) {
+ if (i.contains(g_engine->_mouse->_button)) {
if (count == DIRECTION_UP)
_vel.y = -1 * _speed;
else if (count == DIRECTION_DOWN)
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 28eb9b10815..fd779c04b70 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -75,7 +75,7 @@ bool Slider::handleEvents(const Common::Event &Event) {
}
// If a person clicks on the slider bar, the knob needs to travel there
- if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && _bar.Contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
+ if ((Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) && _bar.contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
_knob.x = g_engine->_mouse->_button.x;
_knob.y = _bar.y;
Commit: 0e829d92f96063549d89b642a22c5d941976abcc
https://github.com/scummvm/scummvm/commit/0e829d92f96063549d89b642a22c5d941976abcc
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename Quit() to quit() for cursor and LoadingScreen
Changed paths:
engines/crab/LoadingScreen.cpp
engines/crab/LoadingScreen.h
engines/crab/app.cpp
engines/crab/image/ImageManager.cpp
engines/crab/input/cursor.h
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 24edada350f..13f45e815ba 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -81,7 +81,7 @@ void LoadingScreen::dim() {
#endif
}
-void LoadingScreen::Quit() {
+void LoadingScreen::quit() {
_text.deleteImage();
for (auto i = _screen.begin(); i != _screen.end(); ++i)
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 3cfe53d54a6..39bebfc9515 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -76,7 +76,7 @@ public:
void load();
void draw();
void dim();
- void Quit();
+ void quit();
};
} // End of namespace Crab
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index b756c01f715..0ee5ec28031 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -326,8 +326,8 @@ App::~App() {
g_engine->_musicManager->quit();
g_engine->_textManager->quit();
g_engine->_inputManager->quit();
- g_engine->_loadingScreen->Quit();
- g_engine->_mouse->Quit();
+ g_engine->_loadingScreen->quit();
+ g_engine->_mouse->quit();
#if 0
// SteamAPI_Shutdown();
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 720586a73cc..4c08eeb2cb8 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -79,7 +79,7 @@ void ImageManager::loadMap(const Common::String &filename, const MapID &mapid) {
if (nodeValid("mouse", node, false)) {
using namespace pyrodactyl::input;
- g_engine->_mouse->Quit();
+ g_engine->_mouse->quit();
g_engine->_mouse->load(node->first_node("mouse"));
}
}
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index ab9f3182cb9..f8ecb4b07ec 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -73,7 +73,7 @@ public:
}
~Cursor() {}
- void Quit() {
+ void quit() {
_img.deleteImage();
_imgS.deleteImage();
_imgHover.deleteImage();
Commit: 512f11ec8fd613cc642f75b44aaa8a5cb36a3e58
https://github.com/scummvm/scummvm/commit/512f11ec8fd613cc642f75b44aaa8a5cb36a3e58
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix an error caused due to refactoring in effect
Changed paths:
engines/crab/event/effect.cpp
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 36d775320d5..1dd53110374 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -101,9 +101,9 @@ void Effect::load(rapidxml::xml_node<char> *node) {
} else
_type = EFF_VAR;
- loadStr(_subject, "_subject", node, echoSub);
+ loadStr(_subject, "subject", node, echoSub);
loadStr(_operation, "operation", node, echoOp);
- loadStr(_val, "_val", node, echoVal);
+ loadStr(_val, "val", node, echoVal);
}
void Effect::changeOpinion(pyrodactyl::event::Info &info, pyrodactyl::people::OpinionType opType) {
Commit: 39aa9d0e63a1f802163312f39a7cd24232cb7102
https://github.com/scummvm/scummvm/commit/39aa9d0e63a1f802163312f39a7cd24232cb7102
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port part of code responsible for sounds in ReplyMenu
Changed paths:
engines/crab/ui/ReplyMenu.cpp
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 469425f83f7..45e93de8709 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -82,17 +82,13 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
}
}
- (void)playSound;
-
-#if 0
// Right now we play sound randomly
- if (play_sound) {
- if (gRandom.Num() % 2 == 1)
- info.sound.rep_dec = true;
+ if (playSound) {
+ if (g_engine->getRandomNumber(1))
+ info._sound._repDec = true;
else
- info.sound.rep_inc = true;
+ info._sound._repInc = true;
}
-#endif
return dat._reply[_element[choice]._index]._nextid;
}
Commit: a0312e5db9a94c37da877f7a9ad69b79ba2f2564
https://github.com/scummvm/scummvm/commit/a0312e5db9a94c37da877f7a9ad69b79ba2f2564
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix code formatting in GameEventInfo
Changed paths:
engines/crab/event/GameEventInfo.cpp
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index f456c526ce2..94e7d8160f9 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -183,10 +183,8 @@ void Info::varDel(const Common::String &name) {
// Purpose: Get/Set person traits
//------------------------------------------------------------------------
void Info::traitAdd(const Common::String &perId, const int &traitId) {
- if (personValid(perId)) // Valid person id
- {
- if (traitId >= 0 && (unsigned int)traitId < g_engine->_eventStore->_trait.size()) // Valid trait id
- {
+ if (personValid(perId)) { // Valid person id
+ if (traitId >= 0 && (unsigned int)traitId < g_engine->_eventStore->_trait.size()) { // Valid trait id
// Check for duplicate traits, DONT award anything if duplicate found
Person *p = &personGet(perId);
@@ -202,10 +200,8 @@ void Info::traitAdd(const Common::String &perId, const int &traitId) {
}
void Info::traitDel(const Common::String &perId, const int &traitId) {
- if (personValid(perId)) // Valid person id
- {
- if (traitId > 0 && (unsigned int)traitId < g_engine->_eventStore->_trait.size()) // Valid trait id
- {
+ if (personValid(perId)) { // Valid person id
+ if (traitId > 0 && (unsigned int)traitId < g_engine->_eventStore->_trait.size()) { // Valid trait id
Person *p = &personGet(perId);
for (auto j = p->_trait.begin(); j != p->_trait.end(); ++j) {
Commit: 55de8b708fd2875d70e9fd468d5dfff28bd08f07
https://github.com/scummvm/scummvm/commit/55de8b708fd2875d70e9fd468d5dfff28bd08f07
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub code to load MusicManager
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 0ee5ec28031..85137533761 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -314,9 +314,7 @@ void App::loadSettings(const Common::String &filename) {
g_engine->_screenSettings->load(node->first_node("screen"));
// Start the sound subsystem
-#if 0
g_engine->_musicManager->load(node);
-#endif
}
}
}
Commit: 48ce6dc22a6d27be54885fb09f3df891fd811f28
https://github.com/scummvm/scummvm/commit/48ce6dc22a6d27be54885fb09f3df891fd811f28
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port code for playing sound effects and music
Changed paths:
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
engines/crab/music/musicparam.h
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 33fb17503c2..64da24657f6 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -32,6 +32,7 @@
#include "crab/music/MusicManager.h"
#include "crab/ScreenSettings.h"
#include "crab/XMLDoc.h"
+#include "crab/crab.h"
namespace Crab {
@@ -41,116 +42,103 @@ using namespace pyrodactyl::music;
// Purpose: Clear stored data
//------------------------------------------------------------------------
void MusicManager::freeMusic() {
- warning("STUB: MusicManager::freeMusic()");
-
-#if 0
- Mix_FreeMusic(bg.track);
-#endif
-
+ delete _musicHandle;
}
void MusicManager::freeChunk() {
- warning("STUB: MusicManager::freeChunk()");
-
-#if 0
- for (auto i = effect.begin(); i != effect.end(); ++i)
- Mix_FreeChunk(i->second);
-#endif
+ for (auto i = _effects.begin(); i != _effects.end(); ++i) {
+ i->_value->_file.close();
+ delete i->_value->_handle;
+ delete i->_value->_stream;
+ delete i->_value;
+ }
+ _effects.clear();
}
//------------------------------------------------------------------------
// Purpose: Play or queue music
//------------------------------------------------------------------------
void MusicManager::playMusic(const MusicKey &id) {
- warning("STUB: MusicManager::playMusic()");
-
-#if 0
- if (bg.id != id) {
- XMLDoc track_list(g_engine->_filePath->sound_music);
- if (track_list.ready()) {
- rapidxml::xml_node<char> *node = track_list.doc()->first_node("music");
+ if (_bg._id != id) {
+ XMLDoc trackList(g_engine->_filePath->_soundMusic);
+ if (trackList.ready()) {
+ rapidxml::xml_node<char> *node = trackList.doc()->first_node("music");
for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *att = n->first_attribute("id");
- if (att != NULL && id == StringToNumber<MusicKey>(att->value())) {
- bg.load(n);
+ if (att != NULL && id == stringToNumber<MusicKey>(att->value())) {
+ if (g_system->getMixer()->isSoundHandleActive(*_musicHandle))
+ g_system->getMixer()->stopHandle(*_musicHandle);
+ _bg.reset();
+ _bg.load(n);
break;
}
}
}
- if (bg.track != NULL)
- Mix_FadeInMusic(bg.track, -1, bg.fade_in_duration);
+ if (_bg._track != NULL)
+ g_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, _musicHandle, _bg._track, (int)_bg._id);
}
-#endif
-
}
//------------------------------------------------------------------------
// Purpose: Play or queue sound effects
//------------------------------------------------------------------------
void MusicManager::playEffect(const ChunkKey &id, const int &loops) {
- warning("STUB: MusicManager::playEffect()");
-
-#if 0
- if (effect.count(id) > 0)
- Mix_PlayChannel(-1, effect[id], loops);
-#endif
-
+ // I am not sure if the game uses a value of more than 0 anywhere.
+ // For now error out in case loops > 0.
+ assert(loops == 0);
+
+ if (_effects.contains((id))) {
+ EffectAudio *audio = _effects[id];
+ audio->_stream->rewind();
+ g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, audio->_handle, audio->_stream, id, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
+ }
}
//------------------------------------------------------------------------
// Purpose: Initialize the music subsystem (currently SDL_mixer) and load sound effects
//------------------------------------------------------------------------
bool MusicManager::load(rapidxml::xml_node<char> *node) {
- warning("STUB: MusicManager::load()");
+ _musicHandle = new Audio::SoundHandle();
-#if 0
// Initialize music parameters
- int volume_mus = 100, volume_eff = 100;
+ int volumeMus = 100, volumeEff = 100;
if (nodeValid("sound", node)) {
rapidxml::xml_node<char> *volnode = node->first_node("sound");
- loadNum(volume_mus, "music", volnode);
- loadNum(volume_eff, "effects", volnode);
- loadNum(freq, "frequency", volnode);
- loadNum(channels, "channels", volnode);
- loadNum(chunksize, "chunk_size", volnode);
- }
-
- // Start up audio
- const int audioflags = MIX_INIT_OGG;
- if ((Mix_Init(audioflags) & audioflags) != audioflags) {
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to initialize audio mixer", "Please install libsdl2_mixer", NULL);
- return false;
- }
-
- if (Mix_OpenAudio(freq, MIX_DEFAULT_FORMAT, channels, chunksize) == -1) {
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to open audio channels", "Please check settings", NULL);
- return false;
+ loadNum(volumeMus, "music", volnode);
+ loadNum(volumeEff, "effects", volnode);
+ loadNum(_freq, "frequency", volnode);
+ loadNum(_channels, "channels", volnode);
+ loadNum(_chunksize, "chunk_size", volnode);
}
// Set the volume from the settings
- VolEffects(volume_eff);
- VolMusic(volume_mus);
+ volEffects(volumeEff);
+ volMusic(volumeMus);
// Load sound effects
- XMLDoc track_list(g_engine->_filePath->sound_effect);
- if (track_list.ready()) {
- rapidxml::xml_node<char> *tnode = track_list.doc()->first_node("effects");
+ XMLDoc trackList(g_engine->_filePath->_soundEffect);
+ if (trackList.ready()) {
+ rapidxml::xml_node<char> *tnode = trackList.doc()->first_node("effects");
if (nodeValid(tnode)) {
- loadNum(notify, "notify", tnode);
- loadNum(rep_inc, "rep_inc", tnode);
- loadNum(rep_dec, "rep_dec", tnode);
+ loadNum(_notify, "notify", tnode);
+ loadNum(_repInc, "rep_inc", tnode);
+ loadNum(_repDec, "rep_dec", tnode);
for (auto n = tnode->first_node(); n != NULL; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
- if (id != NULL && path != NULL)
- effect[StringToNumber<ChunkKey>(id->value())] = Mix_LoadWAV(path->value());
+ if (id != NULL && path != NULL) {
+ EffectAudio *audio = new EffectAudio();
+ audio->_file.open(path->value());
+ audio->_handle = new Audio::SoundHandle();
+ audio->_stream = Audio::makeWAVStream(&audio->_file, DisposeAfterUse::NO);
+ _effects[stringToNumber<ChunkKey>(id->value())] = audio;
+ }
}
}
}
-#endif
return true;
}
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index 80d791129a9..58467b6cc0e 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -31,6 +31,8 @@
#ifndef CRAB_MUSICMANAGER_H
#define CRAB_MUSICMANAGER_H
+#include "audio/mixer.h"
+#include "audio/decoders/wave.h"
#include "crab/GameParam.h"
#include "crab/common_header.h"
#include "crab/music/musicparam.h"
@@ -40,9 +42,16 @@ namespace Crab {
namespace pyrodactyl {
namespace music {
class MusicManager {
+ struct EffectAudio {
+ Common::File _file;
+ Audio::SeekableAudioStream *_stream;
+ Audio::SoundHandle *_handle;
+ };
+
// The background music for our current level
MusicData _bg;
+ Common::HashMap<ChunkKey, EffectAudio *> _effects;
#if 0
// The sound effects in the game
std::unordered_map<ChunkKey, Mix_Chunk *> effect;
@@ -51,6 +60,8 @@ class MusicManager {
// Data about the audio
int _freq, _channels, _chunksize;
+ Audio::SoundHandle *_musicHandle;
+
public:
// The notification sound
ChunkKey _notify, _repInc, _repDec;
@@ -69,6 +80,8 @@ public:
(void)_freq;
(void)_channels;
(void)_chunksize;
+
+ _musicHandle = nullptr;
}
~MusicManager() {}
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index c69e18b8751..5f48bd5b4ef 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -30,8 +30,9 @@
#ifndef CRAB_MUSICPARAM_H
#define CRAB_MUSICPARAM_H
+#include "audio/audiostream.h"
+#include "audio/decoders/vorbis.h"
#include "crab/common_header.h"
-
#include "crab/loaders.h"
namespace Crab {
@@ -49,33 +50,34 @@ typedef unsigned int ChunkKey;
struct MusicData {
// The id of this track
MusicKey _id;
-
-#if 0
- // The track data
- Mix_Music *track;
-#endif
+ Audio::AudioStream *_track;
+ Common::File _file;
// Sound parameters
uint32 _fadeInDuration;
MusicData() {
+ reset();
+ }
+
+ void reset() {
_id = -1;
-#if 0
- track = nullptr;
-#endif
+ _track = nullptr;
_fadeInDuration = 100;
+
+ if (_file.isOpen()) {
+ _file.close();
+ }
}
void load(rapidxml::xml_node<char> *node) {
-#if 0
- loadNum(id, "id", node);
- loadNum(fade_in_duration, "fade_in", node);
-
- if (track != nullptr)
- Mix_FreeMusic(track);
+ loadNum(_id, "id", node);
+ loadNum(_fadeInDuration, "fade_in", node);
- track = Mix_LoadMUS(node->first_attribute("path")->value());
-#endif
+ _file.open(node->first_attribute("path")->value());
+ Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(&_file, DisposeAfterUse::NO);
+ // loops=0 means infinite here.
+ _track = Audio::makeLoopingAudioStream(stream, 0, 0, 0);
}
};
} // End of namespace music
Commit: 1d6ac072918ef0bab1c2a4fbda9b16e59a935a77
https://github.com/scummvm/scummvm/commit/1d6ac072918ef0bab1c2a4fbda9b16e59a935a77
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove extra pair of ()
Changed paths:
engines/crab/music/MusicManager.cpp
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 64da24657f6..923c68ad0c3 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -89,7 +89,7 @@ void MusicManager::playEffect(const ChunkKey &id, const int &loops) {
// For now error out in case loops > 0.
assert(loops == 0);
- if (_effects.contains((id))) {
+ if (_effects.contains(id)) {
EffectAudio *audio = _effects[id];
audio->_stream->rewind();
g_system->getMixer()->playStream(Audio::Mixer::kSFXSoundType, audio->_handle, audio->_stream, id, Audio::Mixer::kMaxChannelVolume, 0, DisposeAfterUse::NO);
Commit: b1fe7efa8991c29b685ec82cc4e6f465a1a5db34
https://github.com/scummvm/scummvm/commit/b1fe7efa8991c29b685ec82cc4e6f465a1a5db34
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup App class
Changed paths:
engines/crab/app.cpp
engines/crab/app.h
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 85137533761..4bcc87b36d7 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -33,99 +33,7 @@
namespace Crab {
-bool App::init() {
-
-#if 0
- // Load all SDL subsystems and the TrueType font subsystem
- if (SDL_Init(SDL_INIT_EVERYTHING) == -1) {
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to initialize SDL", "Please install libsdl2", NULL);
- return false;
- }
-
- if (TTF_Init() == -1) {
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to initialize sdl_ttf", "Please install libsdl2_ttf", NULL);
- return false;
- }
-
- int flags = IMG_Init(IMG_INIT_PNG);
- if (flags != IMG_INIT_PNG) {
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to initialize PNG support", "Please install libsdl2_image", NULL);
- return false;
- }
-#endif
-
- // Load paths for important files
- g_engine->_filePath->load("res/paths.xml");
-
- // Initialize Steam
- // SteamAPI_Init();
-#if 0
- // Load the settings corresponding to the latest version
- {
- const Common::String DEFAULT_FILENAME = "res/settings.xml";
-
- Common::String filename = g_engine->_filePath->appdata;
- filename += "settings.xml";
-
- using namespace boost::filesystem;
- if (!is_regular_file(filename)) {
- // The other file does not exist, just use the default file
- LoadSettings(DEFAULT_FILENAME);
- } else {
- // We are using the other file, check if it is up to date or not
- if (Version(DEFAULT_FILENAME) > Version(filename)) {
- // The game has been updated to a different control scheme, use the default file
- LoadSettings(DEFAULT_FILENAME);
- } else {
- // The version set by the player is fine, just use that
- LoadSettings(filename);
- }
- }
- }
-
- SDL_DisplayMode d;
- if (SDL_GetDesktopDisplayMode(0, &d) == 0) {
- // Store the default desktop values before starting our own screen
- g_engine->_screenSettings->desktop.w = d.w;
- g_engine->_screenSettings->desktop.h = d.h;
- }
-
- // Set up the screen - use windowed mode at start in order to prevent loss of texture on context switching
- gWindow = SDL_CreateWindow("Unrest", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
- g_engine->_screenSettings->cur.w, g_engine->_screenSettings->cur.h, SDL_WINDOW_SHOWN);
-
- if (gWindow == nullptr)
- return false;
-
- // Set the window icon
- SDL_Surface *icon = IMG_load(g_engine->_filePath->icon.c_str());
- SDL_SetWindowIcon(gWindow, icon);
- SDL_FreeSurface(icon);
-
- // Create the renderer
- gRenderer = SDL_CreateRenderer(gWindow, -1, SDL_RENDERER_PRESENTVSYNC);
-
- if (gRenderer == nullptr) {
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Unable to create renderer", ":(", NULL);
- return false;
- }
-
- // Disable the SDL stock cursor and screen-saver
- SDL_ShowCursor(SDL_DISABLE);
- SDL_DisableScreenSaver();
-
- // Initial check for controllers on the system
- g_engine->_inputManager->AddController();
-#endif
- // Initialize and load input
-
- loadSettings("res/settings.xml");
- g_engine->_screenSettings->_inGame = false;
- return true;
-}
-
void App::run() {
- init();
// State IDs
GameStateID currentStateId = GAMESTATE_NULL, nextStateId = GAMESTATE_TITLE;
bool shouldChangeState = true;
@@ -138,6 +46,11 @@ void App::run() {
_game = new Game();
+ g_engine->_filePath->load("res/paths.xml");
+
+ loadSettings("res/settings.xml");
+ g_engine->_screenSettings->_inGame = false;
+
// While the user hasn't quit - This is the main game loop
while (currentStateId != GAMESTATE_EXIT && !SHOULD_QUIT) {
// Start the frame timer
@@ -202,28 +115,6 @@ void App::run() {
// Do state InternalEvents
currentState->internalEvents(shouldChangeState, nextStateId);
-#if 0
- while (SDL_PollEvent(&Event)) {
- // Do state Event handling
- CurrentState->handleEvents(Event, ShouldChangeState, NextStateID);
-
- // If the user has closed the window or pressed ALT+F4
- if (Event.type == SDL_QUIT || (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_F4 && Event.key.keysym.mod & KMOD_ALT)) {
- // Save the program state to file
- CurrentState->AutoSave();
-
- // Quit the program
- ShouldChangeState = true;
- NextStateID = GAMESTATE_EXIT;
- } else if (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_RETURN && Event.key.keysym.mod & KMOD_ALT) {
- // Toggle full-screen if user presses ALT+ENTER
- g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
- g_engine->_screenSettings->SetFullscreen();
- } else if (Event.type == SDL_KEYUP && Event.key.keysym.scancode == SDL_SCANCODE_GRAVE && Event.key.keysym.mod & KMOD_CTRL)
- GameDebug = !GameDebug;
- g_engine->_inputManager->HandleController(Event);
- }
-#endif
while (g_system->getEventManager()->pollEvent(e)) {
switch (e.type) {
@@ -254,19 +145,6 @@ void App::run() {
// Do state Drawing
currentState->draw();
-#if 0
- if (GameDebug) {
- if (SDL_GetTicks() - lasts > 1000) {
- lasts = SDL_GetTicks();
- fpsval = fpscount;
- fpscount = 1;
- } else
- ++fpscount;
-
- if (CurrentStateID >= 0)
- g_engine->_textManager->draw(0, 0, NumberToString(fpsval), 0);
- }
-#endif
if (g_system->getMillis() - lasts > 1000) {
lasts = g_system->getMillis();
fpsval = fpscount;
@@ -276,20 +154,11 @@ void App::run() {
if (currentStateId >= 0)
g_engine->_textManager->draw(0, 0, numberToString(fpsval).c_str(), 0);
- //const Graphics::ManagedSurface *s = g_engine->_renderSurface;
- //g_system->copyRectToScreen(s->getPixels(), s->pitch, 0, 0, s->w, s->h);
- g_engine->_screen->update();
-#if 0
- // Update the screen
- SDL_RenderPresent(gRenderer);
-#endif
+ g_engine->_screen->update();
// Cap the frame rate
if (fps.ticks() < 1000u / g_engine->_screenSettings->_fps) {
-#if 0
- SDL_Delay((1000u / g_engine->_screenSettings->fps) - fps.Ticks());
-#endif
uint32 delay = (1000u / g_engine->_screenSettings->_fps) - fps.ticks();
//warning("Delay by %d ms", delay);
g_system->delayMillis(delay);
@@ -326,32 +195,6 @@ App::~App() {
g_engine->_inputManager->quit();
g_engine->_loadingScreen->quit();
g_engine->_mouse->quit();
-#if 0
- // SteamAPI_Shutdown();
-
- g_engine->_imageManager->Quit();
- g_engine->_musicManager->Quit();
- g_engine->_textManager->Quit();
- g_engine->_inputManager->Quit();
- g_engine->_loadingScreen->Quit();
-
- SDL_DestroyRenderer(gRenderer);
- SDL_DestroyWindow(gWindow);
-
- // Quit SDL_ttf
- TTF_Quit();
-
- // Quit the audio stuff
- Mix_CloseAudio();
- Mix_Quit();
-
- // Quit SDL_image
- IMG_Quit();
-
- // Quit SDL
- SDL_Quit();
-#endif
-
}
} // End of namespace Crab
diff --git a/engines/crab/app.h b/engines/crab/app.h
index 6a6f750d40b..3de07f4f869 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -61,7 +61,6 @@ public:
}
~App(void);
- bool init();
void run();
Game *getGame() const {
return _game;
Commit: 43fcd93bde264ccc73666b250e28c185c4d43898
https://github.com/scummvm/scummvm/commit/43fcd93bde264ccc73666b250e28c185c4d43898
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup Timer class
Changed paths:
engines/crab/timer.cpp
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index e92fb70f487..f849805bb60 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -58,9 +58,6 @@ void Timer::start() {
_paused = false;
// Get the current clock time
-#if 0
- start_ticks = SDL_GetTicks();
-#endif
_startTicks = g_system->getMillis();
}
@@ -81,9 +78,6 @@ uint32 Timer::ticks() {
return _pausedTicks;
} else {
// Return the current time minus the start time
-#if 0
- return SDL_GetTicks() - start_ticks;
-#endif
return g_system->getMillis() - _startTicks;
}
}
@@ -98,9 +92,6 @@ void Timer::pause() {
_paused = true;
// Calculate the paused ticks
-#if 0
- paused_ticks = SDL_GetTicks() - start_ticks;
-#endif
_pausedTicks = g_system->getMillis() - _startTicks;
}
}
@@ -112,9 +103,6 @@ void Timer::resume() {
_paused = false;
// Reset the starting ticks
-#if 0
- start_ticks = SDL_GetTicks() - paused_ticks;
-#endif
_pausedTicks = g_system->getMillis() - _startTicks;
// Reset the paused ticks
_pausedTicks = 0;
Commit: 93dc0cfc30cdcc112b33c61c05972b8eea002cdb
https://github.com/scummvm/scummvm/commit/93dc0cfc30cdcc112b33c61c05972b8eea002cdb
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove unneeded App constructor
Changed paths:
engines/crab/app.h
diff --git a/engines/crab/app.h b/engines/crab/app.h
index 3de07f4f869..f145392cd2d 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -48,17 +48,8 @@ namespace Crab {
class App {
private:
Game *_game;
-
void loadSettings(const Common::String &filename);
public:
- App(void) {
-#if 0
- // OS X .app files need to set the working directory
- char *working_directory = SDL_GetBasePath();
- chdir(working_directory);
- SDL_free(working_directory);
-#endif
- }
~App(void);
void run();
Commit: dcd2e28545cad4c7495a46da3666a060a87bb1de
https://github.com/scummvm/scummvm/commit/dcd2e28545cad4c7495a46da3666a060a87bb1de
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove stubbed out code where possible
Changed paths:
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/Line.cpp
engines/crab/ScreenSettings.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/event/gameeventmanager.h
engines/crab/image/ImageManager.cpp
engines/crab/input/cursor.cpp
engines/crab/input/fightinput.cpp
engines/crab/input/hotkey.h
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemSlot.cpp
engines/crab/item/ItemSlot.h
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/level/level_collide.cpp
engines/crab/loaders.h
engines/crab/mainmenu.h
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/CreditScreen.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapMarkerMenu.cpp
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonScreen.cpp
engines/crab/ui/PersonScreen.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SlideShow.h
engines/crab/ui/ToggleButton.cpp
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.h
engines/crab/ui/dialogbox.cpp
engines/crab/ui/dialogbox.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.cpp
engines/crab/ui/journal.h
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.h
engines/crab/ui/textarea.cpp
engines/crab/ui/textarea.h
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index 591b9a8c8ae..a867109b32c 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -58,11 +58,6 @@ FilePaths::FilePaths() : _common("res/levels/common.xml"),
_level.clear();
_loaded = false;
-#if 0
- char *path = SDL_GetPrefPath("Pyrodactyl", "Unrest");
- appdata = path;
- SDL_free(path);
-#endif
warning("FilePaths::FilePaths() setting appdata directory to game dir");
_appdata = "./";
}
@@ -143,14 +138,6 @@ void FilePaths::load(const Common::String &filename) {
Common::String custom_path;
if (loadStr(custom_path, "custom", savenode)) {
-#if 0
- using namespace boost::filesystem;
-
- path customdir(custom_path);
- if (exists(customdir) && is_directory(customdir)) {
- appdata = custom_path;
- }
-#endif
warning("In FilePaths::load(), customPath : %s", custom_path.c_str());
}
}
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 490896bfa8e..b47d9963424 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -123,12 +123,6 @@ public:
}
const char *Get(const int &num) {
-#if 0
- if (pool_i.count(num) == 0)
- pool_i[num] = NumberToString<int>(num);
-
- return pool_i[num].c_str();
-#endif
if (poolI.contains(num) == false)
poolI[num] = numberToString<int>(num);
@@ -150,19 +144,6 @@ public:
}
};
-// Our source of random numbers
-#if 0
-class RandomNumberGen {
- std::random_device rd;
- std::default_random_engine dre;
-
-public:
- RandomNumberGen() : rd(), dre(rd()) {}
-
- int Num() { return dre(); }
-};
-#endif
-
struct TempValue {
// Differences between normal mode and iron man mode
// save button - iron man saves in existing file
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
index 13a32151b98..957404b023d 100644
--- a/engines/crab/Line.cpp
+++ b/engines/crab/Line.cpp
@@ -39,11 +39,6 @@ namespace Crab {
void drawLine(const int &x1, const int &y1, const int &x2, const int &y2,
const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
g_engine->_screen->drawLine(x1, y1, x2, y2, g_engine->_format->ARGBToColor(a, r, g, b));
-
-#if 0
- SDL_SetRenderDrawColor(gRenderer, r, g, b, a);
- SDL_RenderDrawLine(gRenderer, x1, y1, x2, y2);
-#endif
}
} // End of namespace Crab
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index aa57dad5d9d..c687a0db558 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -38,14 +38,6 @@
namespace Crab {
-#if 0
-// Our rendering context
-extern SDL_Renderer *gRenderer;
-
-// Our window
-extern SDL_Window *gWindow;
-#endif
-
struct Dimension {
int w, h;
Dimension() {
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index e1f744baa8a..b8d38647279 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -397,72 +397,6 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
animate(info);
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle the movement in a level for the player only
-//------------------------------------------------------------------------
-void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const SDL_Event &Event) {
- int num = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_SPEED, num);
- ++num;
- float player_speed = static_cast<float>(num);
-
- // This is for Diablo style hold-mouse-button-in-direction-of-movement
- // This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
- if (!_aiData._dest._active && !g_engine->_mouse->_insideHud && !g_engine->_mouse->hover && g_engine->_mouse->Pressed()) {
- // To find where the click is w.r.t sprite, we need to see where it is being drawn
- int x = _pos.x - camera.x - _animSet.anchorX(_dir), y = _pos.y - camera.y - _animSet.anchorY(_dir);
-
- // Just use the bound rectangle dimensions
- Rect b = boundRect();
- int w = b.w, h = b.h;
-
- // X axis
- if (g_engine->_mouse->motion.x > x + w)
- xVel(player_speed * sc._walkVelMod.x);
- else if (g_engine->_mouse->motion.x < x)
- xVel(-player_speed * sc._walkVelMod.x);
- else
- xVel(0.0f);
-
- // Y axis
- if (g_engine->_mouse->motion.y > y + h)
- yVel(player_speed * sc._walkVelMod.y);
- else if (g_engine->_mouse->motion.y < y)
- yVel(-player_speed * sc._walkVelMod.y);
- else
- yVel(0.0f);
- } else // Keyboard movement
- {
- // Disable destination as soon as player presses a direction key
- // X axis
- if (g_engine->_inputManager->State(IG_LEFT)) {
- _aiData._dest._active = false;
- xVel(-player_speed * sc._walkVelMod.x);
- } else if (g_engine->_inputManager->State(IG_RIGHT)) {
- _aiData._dest._active = false;
- xVel(player_speed * sc._walkVelMod.x);
- } else if (!_aiData._dest._active)
- xVel(0.0f);
-
- // Y axis
- if (g_engine->_inputManager->State(IG_UP)) {
- _aiData._dest._active = false;
- yVel(-player_speed * sc._walkVelMod.y);
- } else if (g_engine->_inputManager->State(IG_DOWN)) {
- _aiData._dest._active = false;
- yVel(player_speed * sc._walkVelMod.y);
- } else if (!_aiData._dest._active)
- yVel(0.0f);
- }
-
- UpdateMove(input.handleEvents(Event));
-
- // This is to prevent one frame of drawing with incorrect parameters
- Animate(info);
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Set destination for sprite movement
//------------------------------------------------------------------------
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 73dd1aa3268..c36f8d28810 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -265,9 +265,6 @@ public:
// Used for sprite movement controlled by player input (usually the player sprite)
void handleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const Common::Event &Event);
-#if 0
- void handleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const SDL_Event &Event);
-#endif
// This is for sprites with valid object ids
void animate(pyrodactyl::event::Info &info);
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index f1c1fdc2cc9..069251a0343 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -100,10 +100,6 @@ public:
void handleEvents(Info &info, const Common::String &playerId, Common::Event &Event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
-#if 0
- void handleEvents(Info &info, const Common::String &player_id, SDL_Event &Event,
- pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
-#endif
void calcActiveSeq(Info &info, pyrodactyl::level::Level &level, const Rect &camera);
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 4c08eeb2cb8..8c2f75075b2 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -71,9 +71,6 @@ void ImageManager::loadMap(const Common::String &filename, const MapID &mapid) {
_map[mapid][key].load(path);
else
error("ImageManager::loadMap : Unable to load image id %u from %s!", key, path.c_str());
-#if 0
- fprintf(stderr, "Unable to load image id %u from %s! SDL Error: %s\n", key, path.c_str(), SDL_GetError());
-#endif
}
}
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 6c44fc2fb53..6b7275b7286 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -81,24 +81,6 @@ void Cursor::load(rapidxml::xml_node<char> *node) {
void Cursor::handleEvents(const Common::Event &event) {
g_engine->_mouse->_hover = false;
-#if 0
- if (event.type == SDL_MOUSEMOTION) {
- motion.x = Event.motion.x;
- motion.y = Event.motion.y;
-
- rel.x = Event.motion.xrel;
- rel.y = Event.motion.yrel;
- } else if (Event.type == SDL_MOUSEBUTTONDOWN) {
- pressed = true;
- button.x = Event.button.x;
- button.y = Event.button.y;
- } else if (Event.type == SDL_MOUSEBUTTONUP) {
- pressed = false;
- button.x = Event.button.x;
- button.y = Event.button.y;
- }
-#endif
-
if (event.type == Common::EVENT_MOUSEMOVE) {
_motion.x = event.mouse.x;
_motion.y = event.mouse.y;
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index 1bd21bb0596..e5f0e1d6afd 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -49,15 +49,4 @@ FightAnimationType FightInput::handleEvents(const Common::Event &event) {
return FA_IDLE;
}
-#if 0
-FightAnimationType FightInput::handleEvents(const SDL_Event &Event) {
- if (g_engine->_inputManager->State(IG_ATTACK))
- return FA_ATTACK;
- else if (g_engine->_inputManager->State(IG_BLOCK))
- return FA_BLOCK;
-
- return FA_IDLE;
-}
-#endif
-
} // End of namespace Crab
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 8cfc9addeb2..ae7cfe90ee8 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -67,9 +67,6 @@ public:
bool handleEvents(const Common::Event &Event);
-#if 0
- bool handleEvents(const SDL_Event &Event);
-#endif
};
} // End of namespace input
} // End of namespace pyrodactyl
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 469e4948162..b4c09825b6c 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -74,16 +74,6 @@ void ItemCollection::handleEvents(const Common::String &charId, const Common::Ev
_item[charId].handleEvents(event);
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle events
-//------------------------------------------------------------------------
-void ItemCollection::handleEvents(const Common::String &char_id, const SDL_Event &Event) {
- if (item.contains(char_id) > 0)
- item[char_id].handleEvents(Event);
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 396f6ef1877..9f08d11836e 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -73,9 +73,6 @@ public:
void load(rapidxml::xml_node<char> *node);
void handleEvents(const Common::String &charId, const Common::Event &event);
-#if 0
- void handleEvents(const Common::String &char_id, const SDL_Event &Event);
-#endif
void init(const Common::String &charId);
void draw(const Common::String &charId);
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 55a0ce2456b..200f9fb096b 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -81,20 +81,6 @@ void ItemMenu::handleEvents(const Common::Event &Event, const int &XOffset, cons
}
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
-//------------------------------------------------------------------------
-void ItemMenu::handleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
- int result = Menu<ItemSlot>::handleEvents(Event);
- if (result != -1) {
- select_index = result;
- for (unsigned int i = 0; i < element.size(); ++i)
- element[i].State(i == select_index);
- }
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Draw the slot backgrounds first, then the items
//------------------------------------------------------------------------
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 71aa08af978..5212c398e24 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -124,19 +124,6 @@ ButtonAction ItemSlot::handleEvents(const Common::Event &event, const int &xOffs
return ac;
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle user input
-//------------------------------------------------------------------------
-ButtonAction ItemSlot::handleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
- ButtonAction ac = StateButton::handleEvents(Event, XOffset, YOffset);
- if (ac == BUAC_LCLICK || ac == BUAC_RCLICK)
- unread = false;
-
- return ac;
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Exchange items with another slot
// this object is the current slot, parameter object is target slot
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index 78fc5f964a8..c00cf0f0e1b 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -83,9 +83,6 @@ public:
void draw();
pyrodactyl::ui::ButtonAction handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
-#if 0
- pyrodactyl::ui::ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
-#endif
bool canSwap(ItemSlot &target) {
return target._noType || _item._type == target._itemType;
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index dee7edd51d9..b997922189f 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -115,35 +115,6 @@ void Level::handleEvents(Info &info, const Common::Event &Event) {
_objects[_playerIndex].handleEvents(info, _camera, _scDefault, Event);
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle the level movement
-//------------------------------------------------------------------------
-void Level::handleEvents(Info &info, const SDL_Event &Event) {
- if (!g_engine->_mouse->_insideHud) {
- if (Event.type == SDL_MOUSEBUTTONDOWN) {
- // Only go to path if our mouse is a normal walking cursor
- if (!g_engine->_mouse->hover) {
- // The destination coordinate is set by adding camera position to click position
- Vector2i dest = g_engine->_mouse->button;
- dest.x += camera.x;
- dest.y += camera.y;
-
- Rect b = objects[player_index].BoundRect();
- b.w /= 2;
- b.h /= 2;
- b.x = dest.x - b.w / 2;
- b.y = dest.y - b.h / 2;
-
- objects[player_index].SetDestPathfinding(dest, !terrain.InsideNoWalk(dest));
- }
- }
- }
-
- objects[player_index].handleEvents(info, camera, sc_default, Event);
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Swap the player sprites
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index 28a13e70072..bcbb4f34045 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -202,17 +202,11 @@ public:
// See if a player clicked on the sprite in contact
bool containsClick(const Common::String &id, const Common::Event &event);
-#if 0
- bool ContainsClick(const Common::String &id, const SDL_Event &Event);
-#endif
// Get index of a sprite in the object array
pyrodactyl::anim::Sprite *getSprite(const Common::String &id);
void handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
-#if 0
- void handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
-#endif
LevelResult internalEvents(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
Common::Array<pyrodactyl::event::EventSeqInfo> &endSeq, bool eventInProgress);
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index b305e862d09..a23dc638d6e 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -78,43 +78,6 @@ bool Level::containsClick(const Common::String &id, const Common::Event &event)
return false;
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: See if player clicked on a sprite they are colliding with
-//------------------------------------------------------------------------
-bool Level::ContainsClick(const Common::String &id, const SDL_Event &Event) {
- // If mouse is moved and is hovering on the specified sprite (id), set hover = true
- if (Event.type == SDL_MOUSEMOTION) {
- for (auto &i : objects) {
- Rect r = i.posRect();
-
- if (r.Contains(g_engine->_mouse->motion.x + camera.x, g_engine->_mouse->motion.y + camera.y)) {
- // This is to show the sprite's name on top of their head
- i.hover = true;
-
- // This is to update the mouse cursor only if we're in talking range of a sprite
- if (i.ID() == id)
- g_engine->_mouse->hover = true;
- } else
- i.hover = false;
- }
-
- return false;
- } else if (g_engine->_mouse->Pressed()) {
- for (auto &i : objects) {
- if (i.ID() == id) {
- Rect r = i.posRect();
- if (r.Contains(g_engine->_mouse->button.x + camera.x, g_engine->_mouse->button.y + camera.y)) {
- g_engine->_mouse->hover = true;
- return true;
- }
- }
- }
- }
-
- return false;
-}
-#endif
//------------------------------------------------------------------------
// Purpose: Find if a layer is visible (used only for objects with layers associated with them)
//------------------------------------------------------------------------
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 38356b69ad9..1b229d3ef95 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -81,14 +81,6 @@ bool loadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node
return true;
}
-#if 0
-
-//Load Rectangle
-bool LoadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo = true,
- const Common::String &x_name = "x", const Common::String &y_name = "y", const Common::String &w_name = "w", const Common::String &h_name = "h");
-
-#endif
-
// Make linker happy by temporarily defining SDL_COLOR
struct SDL_Color {
uint32 r;
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index d5ef3b283e8..4d844696140 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -125,9 +125,6 @@ public:
~MainMenu() {}
void handleEvents(Common::Event &event, bool &shouldChangeState, GameStateID &newStateId);
-#if 0
- void handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID);
-#endif
void internalEvents(bool &shouldChangeState, GameStateID &newStateId);
void draw();
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index 950a1fbad4a..c5431c4aed2 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -52,15 +52,6 @@ bool ChapterIntro::handleEvents(Common::Event &event) {
return _dialog.handleEvents(event);
}
-#if 0
-bool ChapterIntro::handleEvents(SDL_Event &Event) {
- if (traits.handleEvents(Event))
- show_traits = true;
-
- return dialog.handleEvents(Event);
-}
-#endif
-
void ChapterIntro::draw(pyrodactyl::event::Info &info, Common::String &text,
pyrodactyl::anim::Sprite *curSp, const pyrodactyl::people::PersonState &state) {
_dialog.draw(false);
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index f0330175c2b..c9fa5120513 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -61,9 +61,6 @@ public:
void load(rapidxml::xml_node<char> *node);
bool handleEvents(Common::Event &event);
-#if 0
- bool handleEvents(SDL_Event &Event);
-#endif
void draw(pyrodactyl::event::Info &info, Common::String &text,
pyrodactyl::anim::Sprite *curSp, const pyrodactyl::people::PersonState &state);
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 375470dc5e0..7aee8d782ed 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -118,9 +118,7 @@ public:
void reset();
bool handleEvents(Common::Event &Event);
-#if 0
- bool handleEvents(SDL_Event &Event);
-#endif
+
void draw();
void setUI();
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index cbea9efe9b4..a5d64dce10d 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -212,20 +212,6 @@ public:
return false;
}
-#if 0
- bool handleEvents(const SDL_Event &Event) {
- int choice = menu.handleEvents(Event);
- if (choice >= 0) {
- menu.reset();
- selected = slot_info[menu.Index() + choice].path;
- reset();
- return true;
- }
-
- return false;
- }
-#endif
-
void draw() {
_bg.draw();
_menu.draw();
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 1438adf9f51..11cf2aebb6e 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -73,9 +73,6 @@ public:
void load(rapidxml::xml_node<char> *node);
int handleEvents(const Common::Event &event);
-#if 0
- int handleEvents(const SDL_Event &Event);
-#endif
void draw();
void setUI();
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 7daee56b26f..956819799ec 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -92,32 +92,6 @@ void GeneralSettingMenu::handleEvents(const Common::Event &event) {
g_engine->_screenSettings->_textSpeed = _textSpeed._element[result]._val;
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle user input
-//------------------------------------------------------------------------
-void GeneralSettingMenu::handleEvents(const SDL_Event &Event) {
- if (vol_music.handleEvents(Event))
- g_engine->_musicManager->VolMusic(vol_music.Value());
-
- if (vol_effects.handleEvents(Event))
- g_engine->_musicManager->VolEffects(vol_effects.Value());
-
- // No need to change screen here
- if (save_on_exit.handleEvents(Event))
- g_engine->_screenSettings->save_on_exit = !g_engine->_screenSettings->save_on_exit;
-
- if (mouse_trap.handleEvents(Event)) {
- g_engine->_screenSettings->mouse_trap = !g_engine->_screenSettings->mouse_trap;
- g_engine->_screenSettings->SetMouseTrap();
- }
-
- int result = text_speed.handleEvents(Event);
- if (result >= 0)
- g_engine->_screenSettings->text_speed = text_speed.element[result].val;
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Sync our buttons with screen settings
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 501f3f476d2..22cd743a71e 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -58,9 +58,6 @@ public:
void load(rapidxml::xml_node<char> *node);
void handleEvents(const Common::Event &event);
-#if 0
- void handleEvents(const SDL_Event &Event);
-#endif
void internalEvents();
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index 48bf6736f2d..c59d2c8377e 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -123,44 +123,6 @@ int GfxSettingMenu::handleEvents(const Common::Event &event) {
return _resolution.handleEvents(event);
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle input
-//------------------------------------------------------------------------
-int GfxSettingMenu::handleEvents(const SDL_Event &Event) {
- if (fullscreen.handleEvents(Event)) {
- // Setting video flags is necessary when toggling fullscreen
- g_engine->_screenSettings->fullscreen = !g_engine->_screenSettings->fullscreen;
- g_engine->_screenSettings->SetFullscreen();
- }
-
- // Vsync doesn't need to set the change value
- if (vsync.handleEvents(Event)) {
- g_engine->_screenSettings->vsync = !g_engine->_screenSettings->vsync;
- g_engine->_screenSettings->SetVsync();
- }
-
- // Quality and resolution can only be changed in the main menu
- if (!g_engine->_screenSettings->in_game) {
- if (quality.handleEvents(Event))
- g_engine->_screenSettings->quality = !g_engine->_screenSettings->quality;
- }
-
- // Window border doesn't matter if you are in fullscreen
- if (border.handleEvents(Event) && !g_engine->_screenSettings->fullscreen) {
- g_engine->_screenSettings->border = !g_engine->_screenSettings->border;
- g_engine->_screenSettings->SetWindowBorder();
- }
-
- if (brightness.handleEvents(Event)) {
- g_engine->_screenSettings->gamma = static_cast<float>(brightness.Value()) / 100.0f;
- g_engine->_screenSettings->SetGamma();
- }
-
- return resolution.handleEvents(Event);
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Keep button settings synced with our screen settings
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 737c06cee0c..03cb814fe9b 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -62,9 +62,7 @@ public:
void load(rapidxml::xml_node<char> *node);
int handleEvents(const Common::Event &event);
-#if 0
- int handleEvents(const SDL_Event &Event);
-#endif
+
void internalEvents();
void draw();
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 7ecaa7a8124..6b82ba43c19 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -107,16 +107,6 @@ void Inventory::handleEvents(const Common::String &string, const Common::Event &
_money.handleEvents(Event);
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle events
-//------------------------------------------------------------------------
-void Inventory::handleEvents(const Common::String &char_id, const SDL_Event &Event) {
- collection.handleEvents(char_id, Event);
- money.handleEvents(Event);
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Load and save items
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 47f87e73d7c..9c79e69ac6d 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -115,9 +115,6 @@ public:
_state = STATE_NORMAL;
}
-#if 0
- void SwapKey(const SDL_Scancode &find);
-#endif
bool disableHotkeys() {
return _state != STATE_NORMAL;
}
@@ -125,9 +122,7 @@ public:
void load(rapidxml::xml_node<char> *node);
void handleEvents(const Common::Event &event);
-#if 0
- void handleEvents(const SDL_Event &Event);
-#endif
+
void setCaption();
void draw();
diff --git a/engines/crab/ui/MapMarkerMenu.cpp b/engines/crab/ui/MapMarkerMenu.cpp
index 1b0337cd4cb..f77980e8c48 100644
--- a/engines/crab/ui/MapMarkerMenu.cpp
+++ b/engines/crab/ui/MapMarkerMenu.cpp
@@ -99,29 +99,6 @@ void MapMarkerMenu::handleEvents(const Element &pos, const Vector2i &playerPos,
}
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle Events
-//------------------------------------------------------------------------
-void MapMarkerMenu::handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event) {
- if (player_pos.x >= camera.x && player_pos.y >= camera.y)
- player.handleEvents(Event, pos.x + player_pos.x - camera.x + offset.player.x, pos.y + player_pos.y - camera.y + offset.player.y);
-
- int choice = menu.handleEvents(Event, pos.x - camera.x + offset.marker.x, pos.y - camera.y + offset.marker.y);
- if (choice != -1) {
- int c = 0;
- for (auto &i : menu.element) {
- if (c == choice) // For an already selected marker, clicking it toggles the selection state
- i.State(!i.State());
- else
- i.State(false);
-
- ++c;
- }
- }
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 6efe9d62a78..e36f74fcb47 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -93,9 +93,7 @@ public:
void draw(const Element &pos, const Vector2i &player_pos, const Rect &camera);
void handleEvents(const Element &pos, const Vector2i &playerPos, const Rect &camera, const Common::Event &event);
-#if 0
- void handleEvents(const Element &pos, const Vector2i &player_pos, const Rect &camera, const SDL_Event &Event);
-#endif
+
void internalEvents(const Element &pos, const Vector2i &playerPos, const Rect &camera, Rect bounds);
void setUI();
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 1fa83bb1523..28da8fece3b 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -87,18 +87,6 @@ bool ModMenu::handleEvents(const Common::Event &event) {
return false;
}
-#if 0
-bool ModMenu::handleEvents(const SDL_Event &Event) {
- int choice = menu.handleEvents(Event);
- if (choice >= 0) {
- g_engine->_filePath->mod_cur = slot_info[menu.Index() + choice].path;
- return true;
- }
-
- return false;
-}
-#endif
-
void ModMenu::draw() {
_bg.draw();
_menu.draw();
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index cc5c12a9e73..0e51e5cf4fb 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -46,9 +46,6 @@ public:
void load(const Common::String &filename);
bool handleEvents(const Common::Event &event);
-#if 0
- bool handleEvents(const SDL_Event &Event);
-#endif
void draw();
};
} // End of namespace ui
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 942a400a6bd..56290915d24 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -90,9 +90,6 @@ class OptionMenu {
// Function to draw the main menu (controls, settings, save, cancel)
bool handleTabs(Button &back, const Common::Event &event);
-#if 0
- bool HandleTabs(Button &back, const SDL_Event &Event);
-#endif
public:
bool _loaded;
@@ -112,9 +109,6 @@ public:
void load(const Common::String &filename);
void draw(Button &back);
bool handleEvents(Button &back, const Common::Event &event);
-#if 0
- bool handleEvents(Button &back, const SDL_Event &Event);
-#endif
void internalEvents();
void setUI();
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index eb674a3a969..25a03d61d8d 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -65,9 +65,6 @@ public:
void draw();
bool handleEvents(const Common::Event &Event);
-#if 0
- bool handleEvents(const SDL_Event &Event);
-#endif
void setUI();
};
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 954fcd7e102..ac6160b8817 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -245,30 +245,6 @@ public:
return _menu[_currentPage].handleEvents(Event);
}
-#if 0
- int handleEvents(const SDL_Event &Event) {
- using namespace pyrodactyl::input;
-
- if (current_page > 0 && prev.handleEvents(Event) == BUAC_LCLICK) {
- current_page--;
- UpdateInfo();
-
- if (current_page < 0)
- current_page = 0;
- }
-
- if (current_page < menu.size() - 1 && next.handleEvents(Event) == BUAC_LCLICK) {
- current_page++;
- UpdateInfo();
-
- if (current_page >= menu.size())
- current_page = menu.size() - 1;
- }
-
- return menu[current_page].handleEvents(Event);
- }
-#endif
-
void draw() {
_status.draw(_info);
_menu[_currentPage].draw();
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index caefa25ee25..260d04f1e7f 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -91,9 +91,6 @@ public:
void load(rapidxml::xml_node<char> *node);
PauseSignal handleEvents(const Common::Event &Event, Button &back);
-#if 0
- PauseSignal handleEvents(const SDL_Event &Event, Button &back);
-#endif
// Returns true if inside options menu, false otherwise
bool draw(Button &back);
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 72ff112136c..37d145ff523 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -126,26 +126,6 @@ bool PersonHandler::handleDlboxEvents(const Common::Event &event) {
return _dlbox.handleEvents(event);
}
-#if 0
-bool PersonHandler::HandleCommonEvents(const SDL_Event &Event) {
- opinion[OPI_LIKE].handleEvents(Event);
- opinion[OPI_RESPECT].handleEvents(Event);
- opinion[OPI_FEAR].handleEvents(Event);
-
- if (jb.handleEvents(Event) == BUAC_LCLICK) {
- // User wants to open their journal
- show_journal = true;
- return true;
- }
-
- return false;
-}
-
-bool PersonHandler::HandleDlboxEvents(const SDL_Event &Event) {
- return dlbox.handleEvents(Event);
-}
-#endif
-
void PersonHandler::internalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s) {
if (s != NULL)
s->dialogUpdateClip(state);
diff --git a/engines/crab/ui/PersonScreen.cpp b/engines/crab/ui/PersonScreen.cpp
index 1a1ec7969f9..1d2a7149a43 100644
--- a/engines/crab/ui/PersonScreen.cpp
+++ b/engines/crab/ui/PersonScreen.cpp
@@ -64,15 +64,6 @@ void PersonScreen::handleEvents(pyrodactyl::event::Info &info, const Common::Str
_menu.handleEvents(nullptr, event);
}
-#if 0
-void PersonScreen::handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event) {
- if (info.PersonValid(id))
- menu.handleEvents(&info.PersonGet(id), Event);
- else
- menu.handleEvents(nullptr, Event);
-}
-#endif
-
void PersonScreen::internalEvents() {
if (_curSp != nullptr)
_curSp->dialogUpdateClip(PST_NORMAL);
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index 73c3fb4132d..b5265447645 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -71,9 +71,6 @@ public:
void Cache(pyrodactyl::event::Info &info, const Common::String &id, pyrodactyl::level::Level &level);
void handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const Common::Event &event);
-#if 0
- void handleEvents(pyrodactyl::event::Info &info, const Common::String &id, const SDL_Event &Event);
-#endif
void internalEvents();
void draw(pyrodactyl::event::Info &info, const Common::String &id);
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 9e001d18a14..1f4e35a1c05 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -148,24 +148,6 @@ void QuestText::handleEvents(pyrodactyl::event::Quest &q, const Common::Event &e
}
}
-#if 0
-void QuestText::handleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event) {
- if (current_page > 0 && prev.handleEvents(Event) == BUAC_LCLICK) {
- current_page--;
-
- if (current_page < 0)
- current_page = 0;
- }
-
- if (current_page < total_page - 1 && next.handleEvents(Event) == BUAC_LCLICK) {
- current_page++;
-
- if (current_page >= total_page)
- current_page = total_page - 1;
- }
-}
-#endif
-
void QuestText::setUI() {
ParagraphData::setUI();
_img.setUI();
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index 7011690af7f..cf5c3dc414d 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -85,9 +85,7 @@ public:
}
void handleEvents(pyrodactyl::event::Quest &q, const Common::Event &event);
-#if 0
- void handleEvents(pyrodactyl::event::Quest &q, const SDL_Event &Event);
-#endif
+
void draw(pyrodactyl::event::Quest &q);
void setUI();
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index 81029183363..d801110fc72 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -78,21 +78,6 @@ public:
return result;
}
-#if 0
- int handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
- int result = Menu::handleEvents(Event, XOffset, YOffset);
-
- if (result >= 0) {
- select = result;
-
- for (int i = 0; i < element.size(); ++i)
- element[i].state = (i == result);
- }
-
- return result;
- }
-#endif
-
void setUI() {
Menu::setUI();
_desc.setUI();
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 68744c5e2d8..0f5465ac1e4 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -71,9 +71,6 @@ void ReplyButton::cache(const Common::String &val, const int &spacing, const int
// Find out about the font
int width = 0, height = 0;
-#if 0
- TTF_SizeText(g_engine->_textManager->GetFont(font), val, &width, &height);
-#endif
width = g_engine->_textManager->getFont(_font)->getStringWidth(val);
height = g_engine->_textManager->getFont(_font)->getFontHeight();
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 45e93de8709..fa6d9e21fbd 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -96,44 +96,6 @@ int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::Str
return -1;
}
-#if 0
-int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event) {
- // After that, check if the user has clicked on any reply option
- int choice = Menu<ReplyButton>::handleEvents(Event);
- if (choice >= 0 && choice < dat._reply.size()) {
- bool play_sound = false;
-
- // Loop through any opinion changes required
- for (auto &i : dat._reply[element[choice].index].change) {
- if (i.id == cur_id) {
- // This is a special case because we also need to update the opinion bars
- oh.OpinionChange(info, i.id, OPI_LIKE, i.val[OPI_LIKE]);
- oh.OpinionChange(info, i.id, OPI_RESPECT, i.val[OPI_RESPECT]);
- oh.OpinionChange(info, i.id, OPI_FEAR, i.val[OPI_FEAR]);
- play_sound = true;
- } else {
- info.OpinionChange(i.id, OPI_LIKE, i.val[OPI_LIKE]);
- info.OpinionChange(i.id, OPI_RESPECT, i.val[OPI_RESPECT]);
- info.OpinionChange(i.id, OPI_FEAR, i.val[OPI_FEAR]);
- play_sound = true;
- }
- }
-
- // Right now we play sound randomly
- if (play_sound) {
- if (gRandom.Num() % 2 == 1)
- info.sound.rep_dec = true;
- else
- info.sound.rep_inc = true;
- }
-
- return dat._reply[element[choice].index].nextid;
- }
-
- return -1;
-}
-#endif
-
void ReplyMenu::draw() {
_bg.draw();
_tone.draw(_hoverIndex);
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index a1f2432d08d..d4ca1853f92 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -125,37 +125,6 @@ int ResolutionMenu::handleEvents(const Common::Event &event) {
return 0;
}
-#if 0
-int ResolutionMenu::handleEvents(const SDL_Event &Event) {
- switch (state) {
- case STATE_NORMAL:
- if (change.handleEvents(Event) == BUAC_LCLICK)
- state = STATE_CHANGE;
- break;
- case STATE_CHANGE: {
- int choice = Menu::handleEvents(Event);
- if (choice >= 0) {
- g_engine->_screenSettings->cur = dim[choice];
- state = STATE_NORMAL;
- return 1;
- }
-
- if (custom.handleEvents(Event) == BUAC_LCLICK) {
- state = STATE_NORMAL;
- return 2;
- }
-
- if (cancel.handleEvents(Event) == BUAC_LCLICK)
- state = STATE_NORMAL;
- } break;
- default:
- break;
- }
-
- return 0;
-}
-#endif
-
void ResolutionMenu::setInfo() {
_info._text = _defInfo;
_info._text += numberToString(g_engine->_screenSettings->_cur.w);
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index e651376c66e..2ba1e8b009a 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -69,9 +69,7 @@ public:
void load(rapidxml::xml_node<char> *node);
bool handleEvents(const Common::Event &Event);
-#if 0
- bool handleEvents(const SDL_Event &Event);
-#endif
+
void draw();
void setUI();
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index f883deba171..1309ef1db44 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -77,9 +77,7 @@ public:
void load(rapidxml::xml_node<char> *node);
void handleEvents(const Common::Event &Event);
-#if 0
- void handleEvents(const SDL_Event &Event);
-#endif
+
void draw();
void setUI();
diff --git a/engines/crab/ui/ToggleButton.cpp b/engines/crab/ui/ToggleButton.cpp
index 251ee81727c..09a40ca29bc 100644
--- a/engines/crab/ui/ToggleButton.cpp
+++ b/engines/crab/ui/ToggleButton.cpp
@@ -63,17 +63,4 @@ ButtonAction ToggleButton::handleEvents(const Common::Event &event, const int &x
return action;
}
-#if 0
-ButtonAction ToggleButton::handleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
- ButtonAction action = Button::handleEvents(Event, XOffset, YOffset);
-
- if (action == BUAC_LCLICK)
- state = !state;
-
- return action;
-}
-#endif
-
-
-
} // End of namespace Crab
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index bc44bc5e255..a225dc6a8ff 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -62,9 +62,6 @@ public:
void load(rapidxml::xml_node<char> *node);
void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
-#if 0
- ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
-#endif
ButtonAction handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index d36abd88289..2e72e7db01f 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -100,24 +100,6 @@ void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const Common::Even
}
}
-#if 0
-void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event) {
- int choice = menu.handleEvents(Event);
- if (choice >= 0) {
- for (auto i = menu.element.begin(); i != menu.element.end(); ++i)
- i->State(false);
-
- menu.element[choice].State(true);
- select = choice;
-
- if (obj != nullptr) {
- if (select > -1 && select < obj->trait.size())
- obj->trait[select].unread = false;
- }
- }
-}
-#endif
-
void TraitMenu::cache(const pyrodactyl::people::Person &obj) {
auto e = _menu._element.begin();
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index 951baf43eb7..e836ab90eb9 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -80,9 +80,6 @@ public:
void draw(const pyrodactyl::people::Person *obj);
void handleEvents(pyrodactyl::people::Person *obj, const Common::Event &event);
-#if 0
- void handleEvents(pyrodactyl::people::Person *obj, const SDL_Event &Event);
-#endif
void cache(const pyrodactyl::people::Person &obj);
void setUI();
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index 835e522f727..13cec3c3426 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -132,9 +132,6 @@ public:
void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
ButtonAction handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
-#if 0
- ButtonAction handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
-#endif
// Special functions to only draw parts of a button (used in special situations like world map)
void imageCaptionOnlyDraw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
diff --git a/engines/crab/ui/dialogbox.cpp b/engines/crab/ui/dialogbox.cpp
index f348eae4d63..afe9a67721d 100644
--- a/engines/crab/ui/dialogbox.cpp
+++ b/engines/crab/ui/dialogbox.cpp
@@ -86,17 +86,6 @@ bool GameDialogBox::handleEvents(const Common::Event &event) {
return (_button.handleEvents(event) == BUAC_LCLICK);
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle input
-//------------------------------------------------------------------------
-bool GameDialogBox::handleEvents(const SDL_Event &Event) {
- return (button.handleEvents(Event) == BUAC_LCLICK);
-}
-#endif
-
-
-
void GameDialogBox::setUI() {
_pos.setUI();
_text.setUI(&_pos);
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index c2095f8c8bf..3db1404e82d 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -75,10 +75,6 @@ public:
bool handleEvents(const Common::Event &event);
-#if 0
- bool handleEvents(const SDL_Event &Event);
-#endif
-
void setUI();
};
} // End of namespace ui
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 3ff6e2a83b7..3773a02048f 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -138,25 +138,6 @@ HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const Common::Event &
return static_cast<HUDSignal>(choice);
}
-#if 0
-HUDSignal HUD::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
- g_engine->_mouse->_insideHud = bg.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y);
-
- int choice = menu.handleEvents(Event);
-
- if (choice == HS_JOURNAL)
- info.unread.journal = false;
- else if (choice == HS_INV)
- info.unread.inventory = false;
- else if (choice == HS_CHAR)
- info.unread.trait = false;
- else if (choice == HS_MAP)
- info.unread.map = false;
-
- return static_cast<HUDSignal>(choice);
-}
-#endif
-
void HUD::State(const int &val) {
int count = 0;
for (auto i = _menu._element.begin(); i != _menu._element.end(); ++i, ++count)
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 49bcdf3d339..9b55d50482a 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -105,9 +105,6 @@ public:
void load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn, pyrodactyl::level::PlayerDestMarker &pdm);
HUDSignal handleEvents(pyrodactyl::event::Info &info, const Common::Event &event);
-#if 0
- HUDSignal handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
-#endif
void draw(pyrodactyl::event::Info &info, const Common::String &id);
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 12fcf8ccf92..127b8eb8266 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -144,27 +144,6 @@ bool Journal::handleEvents(const Common::String &id, const Common::Event &event)
return false;
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle user input
-//------------------------------------------------------------------------
-bool Journal::handleEvents(const Common::String &id, const SDL_Event &Event) {
- int choice = category.handleEvents(Event);
- if (choice >= 0 && choice < category.element.size())
- Select(id, choice);
-
- // Check if select is valid
- if (select >= 0 && select < JE_TOTAL) {
- // Always find valid journal group first
- for (auto &jo : journal)
- if (jo.id == id)
- return jo.menu[select].handleEvents(bu_map, marker_title, Event);
- }
-
- return false;
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Add an entry to journal
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 284f7143d39..5a493d7956f 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -102,9 +102,6 @@ public:
// Return true if "go to map" is selected
bool handleEvents(const Common::String &id, const Common::Event &event);
-#if 0
- bool handleEvents(const Common::String &id, const SDL_Event &Event);
-#endif
void add(const Common::String &id, const Common::String &category, const Common::String &title, const Common::String &text);
void move(const Common::String &id, const Common::String &title, const bool &completed);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index c5790e6f026..5d0e7513e41 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -360,28 +360,6 @@ bool Map::handleEvents(pyrodactyl::event::Info &info, const Common::Event &event
return false;
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle Events
-//------------------------------------------------------------------------
-bool Map::handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event) {
- int choice = travel.handleEvents(Event, -1 * camera.x, -1 * camera.y);
- if (choice >= 0) {
- cur_loc = travel.element[choice].loc;
- pan = false;
- return true;
- }
-
- marker.handleEvents(pos, player_pos, camera, Event);
-
- Move(Event);
- if (bu_overlay.handleEvents(Event) == BUAC_LCLICK)
- overlay = bu_overlay.state;
-
- return false;
-}
-#endif
-
void Map::setImage(const unsigned int &val, const bool &force) {
if (force || (_cur != val && val < _map.size())) {
_cur = val;
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 75fe4106b4d..e356705e2f0 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -123,16 +123,10 @@ public:
void draw(pyrodactyl::event::Info &info);
bool handleEvents(pyrodactyl::event::Info &info, const Common::Event &event);
-#if 0
- bool handleEvents(pyrodactyl::event::Info &info, const SDL_Event &Event);
-#endif
void internalEvents(pyrodactyl::event::Info &info);
void center(const Vector2i &pos);
void move(const Common::Event &event);
-#if 0
- void Move(const SDL_Event &Event);
-#endif
void validate();
void revealAdd(const int &id, const Rect &area);
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 2c7144f7293..4738eaa11f9 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -171,50 +171,6 @@ protected:
return -1;
}
-#if 0
- //------------------------------------------------------------------------
- // Purpose: Handle keyboard input
- //------------------------------------------------------------------------
- int HandleKeyboard(const SDL_Event &Event) {
- using namespace pyrodactyl::input;
-
- if (!element.empty()) {
- if (path_type != PATH_HORIZONTAL) {
- if (g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_PRESSED) {
- Next();
- latest_input = KEYBOARD;
- } else if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_PRESSED) {
- Prev();
- latest_input = KEYBOARD;
- }
- }
-
- if (path_type != PATH_VERTICAL) {
- if (g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED) {
- Next();
- latest_input = KEYBOARD;
- } else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED) {
- Prev();
- latest_input = KEYBOARD;
- }
- }
-
- if (g_engine->_inputManager->Equals(IU_ACCEPT, Event) == SDL_PRESSED && hover_index != -1)
- return hover_index;
-
- // We pressed a key, which means we have to update the hovering status
- if (latest_input == KEYBOARD) {
- // Update hover status of keys according to the current index
- unsigned int i = 0;
- for (auto it = element.begin(); it != element.end(); ++it, ++i)
- it->hover_key = (i == hover_index);
- }
- }
-
- return -1;
- }
-#endif
-
public:
// The collection of buttons in the menu
Common::Array<T> _element;
@@ -311,63 +267,6 @@ public:
return -1;
}
- #if 0
- //------------------------------------------------------------------------
- // Purpose: Event Handling
- // The reason this function doesn't declare its own Event object is because
- // a menu might not be the only object in a game state
- //------------------------------------------------------------------------
- int handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0) {
- // The keyboard/joystick event handling bit
- if (use_keyboard) {
- int result = HandleKeyboard(Event);
-
- // We have accepted a menu option using the keyboard
- if (result != -1) {
- // Reset the menu state
- reset();
- return result;
- }
- }
-
- // Check if we have moved or clicked the mouse
- if (Event.type == SDL_MOUSEMOTION || Event.type == SDL_MOUSEBUTTONDOWN || Event.type == SDL_MOUSEBUTTONUP) {
- // Since the player is moving the mouse, we have to recalculate hover index at every opportunity
- hover_index = -1;
- latest_input = MOUSE;
- }
-
- // The mouse and hotkey event handling bit
- int i = 0;
- for (auto it = element.begin(); it != element.end(); ++it, ++i) {
- // We clicked on a button using the mouse
- if (it->handleEvents(Event, XOffset, YOffset) == BUAC_LCLICK) {
- // Reset the menu state
- reset();
- return i;
- }
-
- // We did not click a button, however we did hover over the button
- // However if we are use keyboard to browse through the menu, hovering is forgotten until we move the mouse again
- if (it->hover_mouse && latest_input == MOUSE) {
- hover_index = i;
-
- // The latest input is the mouse, which means we have to forget the keyboard hover states
- for (auto e = element.begin(); e != element.end(); ++e)
- e->hover_key = false;
- }
- }
-
- if (latest_input == KEYBOARD) {
- // The latest input is the keyboard, which means we have to forget the mouse hover states
- for (auto it = element.begin(); it != element.end(); ++it)
- it->hover_mouse = false;
- }
-
- return -1;
- }
- #endif
-
//------------------------------------------------------------------------
// Purpose: Draw the menu
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index be4290b69f5..0c671c63a13 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -182,41 +182,6 @@ bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const Co
return false;
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle user input
-//------------------------------------------------------------------------
-bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event) {
- int res = menu.handleEvents(Event);
- if (res != -1) {
- if (sel_bu >= 0 && sel_page >= 0)
- menu.Image(sel_bu, sel_page, img_n);
-
- sel_bu = res;
- sel_page = menu.CurrentPage();
- sel_quest = menu.Index() + sel_bu;
-
- quest[sel_quest].unread = false;
- text.reset();
-
- menu.Image(sel_bu, sel_page, img_s);
- }
-
- if (sel_quest >= 0 && sel_quest < quest.size()) {
- if (quest[sel_quest].marker)
- if (bu_map.handleEvents(Event) == BUAC_LCLICK) {
- // The title of the quest selected by the "show in map" button
- map_title = quest[sel_quest].title;
- return true;
- }
-
- text.handleEvents(quest[sel_quest], Event);
- }
-
- return false;
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Select an entry
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index b93ab3d89fe..678d5350f79 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -78,9 +78,6 @@ public:
void draw(Button &buMap);
bool handleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event);
-#if 0
- bool handleEvents(Button &bu_map, Common::String &map_title, const SDL_Event &Event);
-#endif
void useKeyboard(const bool &val) {
_menu.useKeyboard(val);
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 96601795e66..9f5a311faf4 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -70,10 +70,6 @@ public:
void load(rapidxml::xml_node<char> *node, const int &min, const int &max, const int &val);
bool handleEvents(const Common::Event &Event);
-#if 0
- // Return true if volume changed
- bool handleEvents(const SDL_Event &Event);
-#endif
void draw();
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index cfc9e79cad4..8cf2a6f5286 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -90,40 +90,6 @@ bool TextArea::handleEvents(const Common::Event &event, bool numbersOnly) {
return false;
}
-
-#if 0
-bool TextArea::handleEvents(const SDL_Event &Event, bool numbers_only) {
- // If a key was pressed
- if (Event.type == SDL_TEXTINPUT) {
- // If the string less than maximum size and does not contain invalid characters \ / : * ? " < > |
- if (text.length() < size && Event.kbd.ascii != '\\' && Event.kbd.ascii != '/' && Event.kbd.ascii != ':' && Event.kbd.ascii != '*' && Event.kbd.ascii != '?' && Event.kbd.ascii != '\"' && Event.kbd.ascii != '<' && Event.kbd.ascii != '>' && Event.kbd.ascii != '|') {
- // Should we only accept numbers?
- if (numbers_only && !isdigit(Event.kbd.ascii))
- return false;
-
- // Now play the text input sound
- g_engine->_musicManager->PlayEffect(se_entry, 0);
-
- // Append the character to string
- text += Event.text.text;
- }
- } else if (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_BACKSPACE && text.length() != 0) {
- // Now play the text erase sound
- g_engine->_musicManager->PlayEffect(se_erase, 0);
-
- // If backspace was pressed and the string isn't blank, remove a character from the end
- text.erase(text.length() - 1);
- } else if (g_engine->_inputManager->Equals(IU_ACCEPT, Event) == SDL_RELEASED && text.length() != 0) {
- // Now play the accept sound
- g_engine->_musicManager->PlayEffect(se_accept, 0);
-
- return true;
- }
-
- return false;
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Draw
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 23d8a3ca096..a93f013b682 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -69,9 +69,6 @@ public:
void load(rapidxml::xml_node<char> *node);
bool handleEvents(const Common::Event &event, bool numbersOnly = false);
-#if 0
- bool handleEvents(const SDL_Event &Event, bool numbers_only = false);
-#endif
void draw();
Commit: f2c8b2f953667de4f15a43b54b13a1173f440120
https://github.com/scummvm/scummvm/commit/f2c8b2f953667de4f15a43b54b13a1173f440120
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Fix code formatting and cleanup multiple classes
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/level/level.cpp
engines/crab/level/level.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/FileMenu.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/Inventory.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/PauseMenu.cpp
engines/crab/ui/PauseMenu.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/button.cpp
engines/crab/ui/questmenu.cpp
engines/crab/ui/questmenu.h
engines/crab/ui/slider.cpp
engines/crab/ui/slider.h
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index b8d38647279..d04c9020128 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -334,7 +334,7 @@ void Sprite::drawPopup(pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
//------------------------------------------------------------------------
// Purpose: Handle the movement in a level for the player only
//------------------------------------------------------------------------
-void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const Common::Event &Event) {
+void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &sc, const Common::Event &event) {
int num = 0;
info.statGet(_id, pyrodactyl::stat::STAT_SPEED, num);
@@ -391,7 +391,7 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
}
- updateMove(_input.handleEvents(Event));
+ updateMove(_input.handleEvents(event));
// This is to prevent one frame of drawing with incorrect parameters
animate(info);
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index c36f8d28810..23eca75035a 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -264,7 +264,7 @@ public:
void setDestPathfinding(const Vector2i &dest, bool reachable = true);
// Used for sprite movement controlled by player input (usually the player sprite)
- void handleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const Common::Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const Rect &camera, const pyrodactyl::ai::SpriteConstant &sc, const Common::Event &event);
// This is for sprites with valid object ids
void animate(pyrodactyl::event::Info &info);
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index c6a4f4b69d1..083a118d549 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -95,19 +95,19 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Manager::handleEvents(Info &info, const Common::String &playerId, Common::Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
+void Manager::handleEvents(Info &info, const Common::String &playerId, Common::Event &event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
if (_eventMap.contains(info.curLocID()) > 0 && _eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
switch (_curEvent->_type) {
case EVENT_DIALOG:
if (_oh._showJournal) {
- info._journal.handleEvents(playerId, Event);
+ info._journal.handleEvents(playerId, event);
- if (hud._back.handleEvents(Event) == BUAC_LCLICK || hud._pausekey.handleEvents(Event))
+ if (hud._back.handleEvents(event) == BUAC_LCLICK || hud._pausekey.handleEvents(event))
_oh._showJournal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (_oh.handleCommonEvents(Event)) {
+ if (_oh.handleCommonEvents(event)) {
if (info.personValid(_curEvent->_title)) {
Person &p = info.personGet(_curEvent->_title);
if (p._altJournalName)
@@ -117,7 +117,7 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
}
}
- if (_oh.handleDlboxEvents(Event)) {
+ if (_oh.handleDlboxEvents(event)) {
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
_oh._showJournal = false;
}
@@ -125,22 +125,22 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
break;
case EVENT_ANIM:
// Skip animation if key pressed or mouse pressed
- if (Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP)
+ if (event.type == Common::EVENT_LBUTTONUP || event.type == Common::EVENT_RBUTTONUP)
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
break;
case EVENT_REPLY:
if (_oh._showJournal) {
- info._journal.handleEvents(playerId, Event);
+ info._journal.handleEvents(playerId, event);
- if (hud._back.handleEvents(Event) == BUAC_LCLICK || hud._pausekey.handleEvents(Event))
+ if (hud._back.handleEvents(event) == BUAC_LCLICK || hud._pausekey.handleEvents(event))
_oh._showJournal = false;
} else {
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (_oh.handleCommonEvents(Event))
+ if (_oh.handleCommonEvents(event))
if (info.personValid(_curEvent->_title))
info._journal.open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
- int choice = _reply.handleEvents(info, g_engine->_eventStore->_con[_curEvent->_special], _curEvent->_title, _oh, Event);
+ int choice = _reply.handleEvents(info, g_engine->_eventStore->_con[_curEvent->_special], _curEvent->_title, _oh, event);
if (choice >= 0) {
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq, choice);
_oh._showJournal = false;
@@ -149,21 +149,21 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
break;
case EVENT_TEXT:
// If journal button is select from within an event, go to the entry corresponding to that person's name
- if (_oh.handleCommonEvents(Event))
+ if (_oh.handleCommonEvents(event))
if (info.personValid(_curEvent->_title))
info._journal.open(playerId, JE_PEOPLE, info.personGet(_curEvent->_title)._name);
- if (_textin.handleEvents(Event))
+ if (_textin.handleEvents(event))
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
break;
case EVENT_SPLASH:
if (_intro._showTraits) {
- _per.handleEvents(info, _curEvent->_title, Event);
+ _per.handleEvents(info, _curEvent->_title, event);
- if (hud._back.handleEvents(Event) == BUAC_LCLICK || hud._pausekey.handleEvents(Event))
+ if (hud._back.handleEvents(event) == BUAC_LCLICK || hud._pausekey.handleEvents(event))
_intro._showTraits = false;
} else {
- if (_intro.handleEvents(Event))
+ if (_intro.handleEvents(event))
_eventMap[info.curLocID()].nextEvent(_activeSeq, info, playerId, result, _endSeq);
if (_intro._showTraits)
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 069251a0343..72df6c60346 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -98,7 +98,7 @@ public:
// cur_per is also updated here
void internalEvents(Info &info, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
- void handleEvents(Info &info, const Common::String &playerId, Common::Event &Event,
+ void handleEvents(Info &info, const Common::String &playerId, Common::Event &event,
pyrodactyl::ui::HUD &hud, pyrodactyl::level::Level &level, Common::Array<EventResult> &result);
void calcActiveSeq(Info &info, pyrodactyl::level::Level &level, const Rect &camera);
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index 3f9f618fd2b..e2476eac4e6 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -58,7 +58,7 @@ bool HotKey::handleEvents(const SDL_Event &Event) {
}
#endif
-bool HotKey::handleEvents(const Common::Event &Event) {
+bool HotKey::handleEvents(const Common::Event &event) {
//warning("STUB: HotKey::handleEvents()");
if (_input > IT_NONE && _input < IT_TOTAL) {
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index ae7cfe90ee8..c458ea138e9 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -65,7 +65,7 @@ public:
void load(rapidxml::xml_node<char> *node);
- bool handleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &event);
};
} // End of namespace input
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 200f9fb096b..2401b907636 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -72,8 +72,8 @@ void ItemMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
//------------------------------------------------------------------------
// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
//------------------------------------------------------------------------
-void ItemMenu::handleEvents(const Common::Event &Event, const int &XOffset, const int &YOffset) {
- int result = Menu<ItemSlot>::handleEvents(Event);
+void ItemMenu::handleEvents(const Common::Event &event, const int &XOffset, const int &YOffset) {
+ int result = Menu<ItemSlot>::handleEvents(event);
if (result != -1) {
select_index = result;
for (unsigned int i = 0; i < _element.size(); ++i)
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index 13b565a6d5a..131736bb2a8 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -70,7 +70,7 @@ public:
void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
const unsigned int &cols, const bool &keyboard);
- void handleEvents(const Common::Event &Event, const int &XOffset = 0, const int &YOffset = 0);
+ void handleEvents(const Common::Event &event, const int &XOffset = 0, const int &YOffset = 0);
#if 0
void handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index b997922189f..e326e65c2d0 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -91,9 +91,9 @@ void Level::calcProperties(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
// Purpose: Handle the level movement
//------------------------------------------------------------------------
-void Level::handleEvents(Info &info, const Common::Event &Event) {
+void Level::handleEvents(Info &info, const Common::Event &event) {
if (!g_engine->_mouse->_insideHud) {
- if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
+ if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_RBUTTONDOWN) {
// Only go to path if our mouse is a normal walking cursor
if (!g_engine->_mouse->_hover) {
// The destination coordinate is set by adding camera position to click position
@@ -112,7 +112,7 @@ void Level::handleEvents(Info &info, const Common::Event &Event) {
}
}
- _objects[_playerIndex].handleEvents(info, _camera, _scDefault, Event);
+ _objects[_playerIndex].handleEvents(info, _camera, _scDefault, event);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index bcbb4f34045..c37cb966284 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -206,7 +206,7 @@ public:
// Get index of a sprite in the object array
pyrodactyl::anim::Sprite *getSprite(const Common::String &id);
- void handleEvents(pyrodactyl::event::Info &info, const Common::Event &Event);
+ void handleEvents(pyrodactyl::event::Info &info, const Common::Event &event);
LevelResult internalEvents(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
Common::Array<pyrodactyl::event::EventSeqInfo> &endSeq, bool eventInProgress);
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index 57a3f74461a..b4a4ccdc190 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -104,17 +104,17 @@ void CreditScreen::load(const Common::String &filename) {
}
}
-bool CreditScreen::handleEvents(Common::Event &Event) {
- if (_slow.handleEvents(Event) == BUAC_LCLICK)
+bool CreditScreen::handleEvents(Common::Event &event) {
+ if (_slow.handleEvents(event) == BUAC_LCLICK)
_speed._cur = _speed._slow;
- else if (_fast.handleEvents(Event) == BUAC_LCLICK)
+ else if (_fast.handleEvents(event) == BUAC_LCLICK)
_speed._cur = _speed._fast;
- else if (_pause.handleEvents(Event) == BUAC_LCLICK)
+ else if (_pause.handleEvents(event) == BUAC_LCLICK)
_speed._cur = 0.0f;
- else if (_reverse.handleEvents(Event) == BUAC_LCLICK)
+ else if (_reverse.handleEvents(event) == BUAC_LCLICK)
_speed._cur = _speed._reverse;
- return (_back.handleEvents(Event) == BUAC_LCLICK);
+ return (_back.handleEvents(event) == BUAC_LCLICK);
}
#if 0
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 7aee8d782ed..5a53f0a0f99 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -117,7 +117,7 @@ public:
void load(const Common::String &filename);
void reset();
- bool handleEvents(Common::Event &Event);
+ bool handleEvents(Common::Event &event);
void draw();
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index a5d64dce10d..23c67de969d 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -200,8 +200,8 @@ public:
scanDir();
}
- bool handleEvents(const Common::Event &Event) {
- int choice = _menu.handleEvents(Event);
+ bool handleEvents(const Common::Event &event) {
+ int choice = _menu.handleEvents(event);
if (choice >= 0) {
_menu.reset();
_selected = _slotInfo[_menu.index() + choice]._path;
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 6b82ba43c19..66132779bd3 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -102,9 +102,9 @@ void Inventory::draw(Person &obj, const int &moneyVal) {
//------------------------------------------------------------------------
// Purpose: Handle events
//------------------------------------------------------------------------
-void Inventory::handleEvents(const Common::String &string, const Common::Event &Event) {
- _collection.handleEvents(string, Event);
- _money.handleEvents(Event);
+void Inventory::handleEvents(const Common::String &string, const Common::Event &event) {
+ _collection.handleEvents(string, event);
+ _money.handleEvents(event);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index f65067f482a..4e649d3fe4f 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -75,9 +75,6 @@ public:
void draw(pyrodactyl::people::Person &obj, const int &moneyVal);
void handleEvents(const Common::String &string, const Common::Event &Event);
-#if 0
- void handleEvents(const Common::String &char_id, const SDL_Event &Event);
-#endif
void loadState(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 456ef0c0cf7..9f5dc8e9c75 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -64,12 +64,12 @@ void OptionSelect::draw() {
_next.draw();
}
-bool OptionSelect::handleEvents(const Common::Event &Event) {
+bool OptionSelect::handleEvents(const Common::Event &event) {
using namespace pyrodactyl::input;
if (_cur > 0) {
// Don't check for keyboard inputs for now
- if (_prev.handleEvents(Event) == BUAC_LCLICK) {
+ if (_prev.handleEvents(event) == BUAC_LCLICK) {
_cur--;
return true;
}
@@ -78,7 +78,7 @@ bool OptionSelect::handleEvents(const Common::Event &Event) {
if ((unsigned int)_cur < option._text.size() - 1) {
// Don't check for keyboard inputs for now
- if (_next.handleEvents(Event) == BUAC_LCLICK) {
+ if (_next.handleEvents(event) == BUAC_LCLICK) {
_cur++;
return true;
}
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index 25a03d61d8d..aa500592bcf 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -64,7 +64,7 @@ public:
void draw();
- bool handleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &event);
void setUI();
};
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index ac6160b8817..d3962a907b8 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -223,10 +223,10 @@ public:
updateInfo();
}
- int handleEvents(const Common::Event &Event) {
+ int handleEvents(const Common::Event &event) {
using namespace pyrodactyl::input;
- if (_currentPage > 0 && _prev.handleEvents(Event) == BUAC_LCLICK) {
+ if (_currentPage > 0 && _prev.handleEvents(event) == BUAC_LCLICK) {
_currentPage--;
updateInfo();
@@ -234,7 +234,7 @@ public:
_currentPage = 0;
}
- if (_currentPage < _menu.size() - 1 && _next.handleEvents(Event) == BUAC_LCLICK) {
+ if (_currentPage < _menu.size() - 1 && _next.handleEvents(event) == BUAC_LCLICK) {
_currentPage++;
updateInfo();
@@ -242,7 +242,7 @@ public:
_currentPage = _menu.size() - 1;
}
- return _menu[_currentPage].handleEvents(Event);
+ return _menu[_currentPage].handleEvents(event);
}
void draw() {
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index e742317fe30..e65ede78e50 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -59,12 +59,12 @@ bool PauseMenu::draw(Button &back) {
return false;
}
-PauseSignal PauseMenu::handleEvents(const Common::Event &Event, Button &back) {
+PauseSignal PauseMenu::handleEvents(const Common::Event &event, Button &back) {
switch (_state) {
case STATE_NORMAL:
- _choice = _menu.handleEvents(Event);
+ _choice = _menu.handleEvents(event);
if (_choice == -1) {
- if (back._hotkey.handleEvents(Event))
+ if (back._hotkey.handleEvents(event))
return PS_RESUME;
} else {
switch (_choice) {
@@ -100,7 +100,7 @@ PauseSignal PauseMenu::handleEvents(const Common::Event &Event, Button &back) {
}
break;
case STATE_OPTION:
- if (g_engine->_optionMenu->handleEvents(back, Event)) {
+ if (g_engine->_optionMenu->handleEvents(back, event)) {
g_engine->_optionMenu->reset();
_state = STATE_NORMAL;
}
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 260d04f1e7f..352ae169b9a 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -90,7 +90,7 @@ public:
void load(rapidxml::xml_node<char> *node);
- PauseSignal handleEvents(const Common::Event &Event, Button &back);
+ PauseSignal handleEvents(const Common::Event &event, Button &back);
// Returns true if inside options menu, false otherwise
bool draw(Button &back);
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index fa6d9e21fbd..1e69b4e524d 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -60,9 +60,9 @@ void ReplyMenu::load(const Common::String &filename) {
}
}
-int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::String &curId, PersonHandler &oh, const Common::Event &Event) {
+int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::String &curId, PersonHandler &oh, const Common::Event &event) {
// After that, check if the user has clicked on any reply option
- int choice = Menu<ReplyButton>::handleEvents(Event);
+ int choice = Menu<ReplyButton>::handleEvents(event);
if (choice >= 0 && (unsigned int)choice < dat._reply.size()) {
bool playSound = false;
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index 2825111755f..ed9e8ef4c0a 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -66,10 +66,6 @@ public:
int handleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
const Common::String &curId, PersonHandler &oh, const Common::Event &Event);
-#if 0
- int handleEvents(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat,
- const Common::String &cur_id, PersonHandler &oh, const SDL_Event &Event);
-#endif
void draw();
void cache(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat);
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 3c23a00d7f9..f1a95368f6f 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -73,9 +73,6 @@ public:
// Return 1 if one of resolution buttons is pressed, 2 if custom button is pressed, 0 otherwise
int handleEvents(const Common::Event &event);
-#if 0
- int handleEvents(const SDL_Event &Event);
-#endif
void setInfo();
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index b0fb70ea62f..9d5a843db1a 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -67,11 +67,11 @@ void GameSaveMenu::scanDir() {
_menu.assignPaths();
}
-bool GameSaveMenu::handleEvents(const Common::Event &Event) {
+bool GameSaveMenu::handleEvents(const Common::Event &event) {
int choice = -1;
switch (_state) {
case STATE_NORMAL:
- choice = _menu.handleEvents(Event);
+ choice = _menu.handleEvents(event);
if (choice >= 0) {
_taName.x = _menu.curX(choice) + tdB[DATA_SAVENAME].x;
_taName.y = _menu.curY(choice) + tdB[DATA_SAVENAME].y;
@@ -90,7 +90,7 @@ bool GameSaveMenu::handleEvents(const Common::Event &Event) {
if (g_engine->_inputManager->getKeyBindingMode() != input::KBM_UI)
g_engine->_inputManager->setKeyBindingMode(KBM_UI);
- if (_taName.handleEvents(Event)) {
+ if (_taName.handleEvents(event)) {
if (_index <= (int)_slotInfo.size() && _index != 0)
g_engine->getSaveFileManager()->removeSavefile(_slotInfo[_index]._path);
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 2ba1e8b009a..0eb32f69af0 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -68,7 +68,7 @@ public:
void load(rapidxml::xml_node<char> *node);
- bool handleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &event);
void draw();
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index b2310b282f6..85438a92917 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -77,17 +77,17 @@ void SlideShow::draw() {
_next.draw();
}
-void SlideShow::handleEvents(const Common::Event &Event) {
+void SlideShow::handleEvents(const Common::Event &event) {
using namespace pyrodactyl::input;
if (_index > 0)
- if (_prev.handleEvents(Event) == BUAC_LCLICK) {
+ if (_prev.handleEvents(event) == BUAC_LCLICK) {
_index--;
refresh();
}
if (_index < _path.size() - 1)
- if (_next.handleEvents(Event) == BUAC_LCLICK) {
+ if (_next.handleEvents(event) == BUAC_LCLICK) {
_index++;
refresh();
}
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 1309ef1db44..1f9beeeb6b2 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -76,7 +76,7 @@ public:
void load(rapidxml::xml_node<char> *node);
- void handleEvents(const Common::Event &Event);
+ void handleEvents(const Common::Event &event);
void draw();
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index a493e47b8f2..a1a20eb0713 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -145,7 +145,7 @@ void Button::hoverInfoOnlyDraw(const int &xOffset, const int &yOffset, Rect *cli
//------------------------------------------------------------------------
// Purpose: Handle input and stuff
//------------------------------------------------------------------------
-ButtonAction Button::handleEvents(const Common::Event &Event, const int &xOffset, const int &yOffset) {
+ButtonAction Button::handleEvents(const Common::Event &event, const int &xOffset, const int &yOffset) {
Rect dim = *this;
dim.x += xOffset;
dim.y += yOffset;
@@ -163,27 +163,27 @@ ButtonAction Button::handleEvents(const Common::Event &Event, const int &xOffset
_hoverMouse = false;
}
- if (Event.type == Common::EVENT_MOUSEMOVE) {
+ if (event.type == Common::EVENT_MOUSEMOVE) {
if (_canmove && _mousePressed) {
x += g_engine->_mouse->_rel.x;
y += g_engine->_mouse->_rel.y;
return BUAC_GRABBED;
}
- } else if (Event.type == Common::EVENT_LBUTTONDOWN || Event.type == Common::EVENT_RBUTTONDOWN) {
+ } else if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_RBUTTONDOWN) {
// The g_engine->_mouse button pressed, then released, comprises of a click action
if (dim.contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y))
_mousePressed = true;
- } else if ((Event.type == Common::EVENT_LBUTTONUP || Event.type == Common::EVENT_RBUTTONUP) && _mousePressed) {
+ } else if ((event.type == Common::EVENT_LBUTTONUP || event.type == Common::EVENT_RBUTTONUP) && _mousePressed) {
reset();
if (dim.contains(g_engine->_mouse->_button.x, g_engine->_mouse->_button.y)) {
_mousePressed = false;
- if (Event.type == Common::EVENT_LBUTTONUP) {
+ if (event.type == Common::EVENT_LBUTTONUP) {
g_engine->_musicManager->playEffect(_seClick, 0);
return BUAC_LCLICK;
- } else if (Event.type == Common::EVENT_RBUTTONUP)
+ } else if (event.type == Common::EVENT_RBUTTONUP)
return BUAC_RCLICK;
}
- } else if (_hotkey.handleEvents(Event)) {
+ } else if (_hotkey.handleEvents(event)) {
g_engine->_musicManager->playEffect(_seClick, 0);
return BUAC_LCLICK;
}
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 0c671c63a13..5e395430932 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -152,8 +152,8 @@ void QuestMenu::draw(Button &buMap) {
//------------------------------------------------------------------------
// Purpose: Handle user input
//------------------------------------------------------------------------
-bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event) {
- int res = _menu.handleEvents(Event);
+bool QuestMenu::handleEvents(Button &buMap, Common::String &mapTitle, const Common::Event &event) {
+ int res = _menu.handleEvents(event);
if (res != -1) {
if (_selBu >= 0 && _selPage >= 0)
_menu.image(_selBu, _selPage, _imgN);
@@ -170,13 +170,13 @@ bool QuestMenu::handleEvents(Button &bu_map, Common::String &map_title, const Co
if (_selQuest >= 0 && (unsigned int)_selQuest < _quest.size()) {
if (_quest[_selQuest]._marker)
- if (bu_map.handleEvents(Event) == BUAC_LCLICK) {
+ if (buMap.handleEvents(event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
- map_title = _quest[_selQuest]._title;
+ mapTitle = _quest[_selQuest]._title;
return true;
}
- _text.handleEvents(_quest[_selQuest], Event);
+ _text.handleEvents(_quest[_selQuest], event);
}
return false;
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 678d5350f79..8a55a92d93f 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -77,7 +77,7 @@ public:
void load(rapidxml::xml_node<char> *node);
void draw(Button &buMap);
- bool handleEvents(Button &bu_map, Common::String &map_title, const Common::Event &Event);
+ bool handleEvents(Button &buMap, Common::String &mapTitle, const Common::Event &event);
void useKeyboard(const bool &val) {
_menu.useKeyboard(val);
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index fd779c04b70..2ce57c84175 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -86,36 +86,6 @@ bool Slider::handleEvents(const Common::Event &Event) {
return false;
}
-#if 0
-bool Slider::handleEvents(const SDL_Event &Event) {
- // A person is moving the knob
- if (knob.handleEvents(Event) == BUAC_GRABBED) {
- int dx = g_engine->_mouse->motion.x - bar.x;
-
- if (dx < 0)
- dx = 0;
- else if (dx > (bar.w - knob.w))
- dx = (bar.w - knob.w);
-
- knob.x = bar.x + dx;
- knob.y = bar.y;
-
- value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
- return true;
- }
-
- // If a person clicks on the slider bar, the knob needs to travel there
- if (Event.type == SDL_MOUSEBUTTONDOWN && bar.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
- knob.x = g_engine->_mouse->button.x;
- knob.y = bar.y;
-
- value = min + (((max - min) * (knob.x - bar.x)) / (bar.w - knob.w));
- return true;
- }
-
- return false;
-}
-#endif
void Slider::draw() {
_bar.draw();
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 9f5a311faf4..20823e9eafc 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -69,7 +69,7 @@ public:
void load(rapidxml::xml_node<char> *node, const int &min, const int &max, const int &val);
- bool handleEvents(const Common::Event &Event);
+ bool handleEvents(const Common::Event &event);
void draw();
Commit: a091928251ce25d277f19449181ca7e1f64166a2
https://github.com/scummvm/scummvm/commit/a091928251ce25d277f19449181ca7e1f64166a2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix code formatting in ItemMenu class
Changed paths:
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index b4c09825b6c..e6b68fa088f 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -63,7 +63,7 @@ void ItemCollection::load(rapidxml::xml_node<char> *node) {
//------------------------------------------------------------------------
void ItemCollection::init(const Common::String &charId) {
if (_item.contains(charId) == 0)
- _item[charId].Init(_ref, _inc, _rows, _cols, _useKeyboard);
+ _item[charId].init(_ref, _inc, _rows, _cols, _useKeyboard);
}
//------------------------------------------------------------------------
@@ -87,7 +87,7 @@ void ItemCollection::draw(const Common::String &charId) {
//------------------------------------------------------------------------
void ItemCollection::del(const Common::String &charId, const Common::String &itemId) {
if (_item.contains(charId) > 0)
- _item[charId].Del(itemId);
+ _item[charId].del(itemId);
}
//------------------------------------------------------------------------
@@ -98,7 +98,7 @@ void ItemCollection::add(const Common::String &charId, Item &itemData) {
// Which is why we add a new inventory in case the character inventory does not exist yet
init(charId);
- _item[charId].Equip(itemData);
+ _item[charId].equip(itemData);
}
//------------------------------------------------------------------------
@@ -106,7 +106,7 @@ void ItemCollection::add(const Common::String &charId, Item &itemData) {
//------------------------------------------------------------------------
bool ItemCollection::has(const Common::String &charId, const Common::String &container, const Common::String &itemId) {
if (_item.contains(charId) > 0)
- return _item[charId].Has(container, itemId);
+ return _item[charId].has(container, itemId);
return false;
}
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 2401b907636..1bf7f3a4a33 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -39,7 +39,7 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load the layout and items
//------------------------------------------------------------------------
-void ItemMenu::Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows, const unsigned int &cols,
+void ItemMenu::init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows, const unsigned int &cols,
const bool &keyboard) {
unsigned int size = rows * cols;
for (unsigned int i = 0; i < size; ++i) {
@@ -72,21 +72,21 @@ void ItemMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
//------------------------------------------------------------------------
// Purpose: Handles drag n' drop - return type is Boolean because we only need to communicate stat changes
//------------------------------------------------------------------------
-void ItemMenu::handleEvents(const Common::Event &event, const int &XOffset, const int &YOffset) {
+void ItemMenu::handleEvents(const Common::Event &event, const int &xOffset, const int &yOffset) {
int result = Menu<ItemSlot>::handleEvents(event);
if (result != -1) {
- select_index = result;
+ _selectIndex = result;
for (unsigned int i = 0; i < _element.size(); ++i)
- _element[i].state(i == (unsigned int)select_index);
+ _element[i].state(i == (unsigned int)_selectIndex);
}
}
//------------------------------------------------------------------------
// Purpose: Draw the slot backgrounds first, then the items
//------------------------------------------------------------------------
-void ItemMenu::draw(ItemDesc &item_info) {
- if (select_index != -1)
- item_info.draw(_element[select_index]._item);
+void ItemMenu::draw(ItemDesc &itemInfo) {
+ if (_selectIndex != -1)
+ itemInfo.draw(_element[_selectIndex]._item);
for (auto i = _element.begin(); i != _element.end(); ++i)
i->draw();
@@ -95,7 +95,7 @@ void ItemMenu::draw(ItemDesc &item_info) {
//------------------------------------------------------------------------
// Purpose: Equip an item at the first available location (used in events)
//------------------------------------------------------------------------
-bool ItemMenu::Equip(Item &item) {
+bool ItemMenu::equip(Item &item) {
for (auto i = _element.begin(); i != _element.end(); ++i)
if (i->_category == SLOT_STORAGE && i->equip(item))
return true;
@@ -106,7 +106,7 @@ bool ItemMenu::Equip(Item &item) {
//------------------------------------------------------------------------
// Purpose: Remove all instances of an item
//------------------------------------------------------------------------
-bool ItemMenu::Del(const Common::String &id) {
+bool ItemMenu::del(const Common::String &id) {
bool result = false;
for (auto &i : _element)
@@ -124,7 +124,7 @@ bool ItemMenu::Del(const Common::String &id) {
//------------------------------------------------------------------------
// Purpose: Find out if we have an item with a name
//------------------------------------------------------------------------
-bool ItemMenu::Has(const Common::String &container, const Common::String &id) {
+bool ItemMenu::has(const Common::String &container, const Common::String &id) {
for (auto i = _element.begin(); i != _element.end(); ++i)
if (i->_item._id == id) {
if (container == "equip") {
@@ -143,23 +143,23 @@ bool ItemMenu::Has(const Common::String &container, const Common::String &id) {
//------------------------------------------------------------------------
// Purpose: Swap an item with another item menu
//------------------------------------------------------------------------
-bool ItemMenu::Swap(ItemMenu &target, int index) {
+bool ItemMenu::swap(ItemMenu &target, int index) {
// We need to scan the slots first for an empty slot to store the item.
// If no empty slot is found, then swap with a filled slot of same type
// If no slot of type is found, don't swap items at all
- int found_index = -1, cur_index = 0;
+ int foundIndex = -1, curIndex = 0;
- for (auto i = _element.begin(); i != _element.end(); ++i, ++cur_index)
+ for (auto i = _element.begin(); i != _element.end(); ++i, ++curIndex)
if (i->_itemType == target._element[index]._itemType) {
if (i->_empty) {
i->swap(target._element[index]);
return true;
} else
- found_index = cur_index;
+ foundIndex = curIndex;
}
- if (found_index != -1) {
- _element[found_index].swap(target._element[index]);
+ if (foundIndex != -1) {
+ _element[foundIndex].swap(target._element[index]);
return true;
}
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index 131736bb2a8..9df5803cbd6 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -46,40 +46,40 @@ namespace item {
// The menu is used to handle interactions like the player clicking on an item to equip it
class ItemMenu : public pyrodactyl::ui::Menu<ItemSlot> {
protected:
- int preview_index, select_index;
+ int _previewIndex, _selectIndex;
// Variable to determine if stats of object need updating
- bool update;
+ bool _update;
public:
// The preview for selected item and hovered item
// StatPreview select, hover;
ItemMenu() {
- preview_index = -1;
- select_index = -1;
- update = false;
+ _previewIndex = -1;
+ _selectIndex = -1;
+ _update = false;
}
~ItemMenu() {}
int hoverIndex() { return _hoverIndex; }
- void draw(pyrodactyl::ui::ItemDesc &item_info);
+ void draw(pyrodactyl::ui::ItemDesc &itemInfo);
/*pyrodactyl::people::Person &obj, pyrodactyl::stat::StatDrawHelper &helper*/
- void Init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
+ void init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
const unsigned int &cols, const bool &keyboard);
- void handleEvents(const Common::Event &event, const int &XOffset = 0, const int &YOffset = 0);
+ void handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
#if 0
void handleEvents(const SDL_Event &Event, const int &XOffset = 0, const int &YOffset = 0);
#endif
/* pyrodactyl::people::Person &obj,*/
- bool Swap(ItemMenu &target, int index);
- bool Equip(Item &item);
- bool Del(const Common::String &id);
- bool Has(const Common::String &container, const Common::String &id);
+ bool swap(ItemMenu &target, int index);
+ bool equip(Item &item);
+ bool del(const Common::String &id);
+ bool has(const Common::String &container, const Common::String &id);
// Used to calculate enabled slots
// void SetEnable();
Commit: 6928a4738abe48fbf62020cf849b823634763c46
https://github.com/scummvm/scummvm/commit/6928a4738abe48fbf62020cf849b823634763c46
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove duplicate license from console.cpp
Changed paths:
engines/crab/console.cpp
diff --git a/engines/crab/console.cpp b/engines/crab/console.cpp
index a1faf3da982..1f6f9175ad0 100644
--- a/engines/crab/console.cpp
+++ b/engines/crab/console.cpp
@@ -19,36 +19,6 @@
*
*/
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
#include "crab/console.h"
namespace Crab {
Commit: 03e5d5815ca1fe0b04f9f8ea30ecef9b7995af65
https://github.com/scummvm/scummvm/commit/03e5d5815ca1fe0b04f9f8ea30ecef9b7995af65
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Port rest of the MusicManager
Changed paths:
engines/crab/music/MusicManager.h
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index 58467b6cc0e..1f5144289ea 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -91,67 +91,31 @@ public:
void playEffect(const ChunkKey &id, const int &loops);
static void pause() {
- warning("STUB: MusicManager::pause()");
-
-#if 0
- Mix_PauseMusic();
-#endif
-
+ g_system->getMixer()->pauseAll(true);
}
static void resume() {
- warning("STUB: MusicManager::resume()");
-
-#if 0
- Mix_ResumeMusic();
-#endif
-
+ g_system->getMixer()->pauseAll(false);
}
static void stop() {
- warning("STUB: MusicManager::stop()");
-
-#if 0
- Mix_HaltMusic();
-#endif
-
+ g_system->getMixer()->stopAll();
}
static void volEffects(const int &volume) {
- warning("STUB: MusicManager::stop()");
-
-#if 0
- Mix_Volume(-1, volume);
-#endif
-
+ g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, volume);
}
static int volEffects() {
- warning("STUB: MusicManager::volEffects()");
- return 0;
-#if 0
- return Mix_Volume(0, -1);
-#endif
-
+ return g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kSFXSoundType);
}
static void volMusic(const int &volume) {
- warning("STUB: MusicManager::volMusic() %d", volume);
-
-#if 0
- Mix_VolumeMusic(volume);
-#endif
-
+ g_system->getMixer()->setVolumeForSoundType(Audio::Mixer::kMusicSoundType, volume);
}
static int volMusic() {
- warning("STUB: MusicManager::volMusic()");
- return 0;
-
-#if 0
- return Mix_VolumeMusic(-1);
-#endif
-
+ return g_system->getMixer()->getVolumeForSoundType(Audio::Mixer::kMusicSoundType);
}
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
Commit: f4f6a157a74bb10b8952d591cf3c2d37e191e51e
https://github.com/scummvm/scummvm/commit/f4f6a157a74bb10b8952d591cf3c2d37e191e51e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get sound and music volume from ConfMan
Changed paths:
engines/crab/music/MusicManager.cpp
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 923c68ad0c3..6fc260de5b7 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -102,13 +102,22 @@ void MusicManager::playEffect(const ChunkKey &id, const int &loops) {
bool MusicManager::load(rapidxml::xml_node<char> *node) {
_musicHandle = new Audio::SoundHandle();
- // Initialize music parameters
- int volumeMus = 100, volumeEff = 100;
+ bool mute = false;
+ if (ConfMan.hasKey("mute"))
+ mute = ConfMan.getBool("mute");
+
+ int volumeEff = mute ? 0 : ConfMan.getInt("sfx_volume");
+ int volumeMus = mute ? 0 : ConfMan.getInt("music_volume");
if (nodeValid("sound", node)) {
rapidxml::xml_node<char> *volnode = node->first_node("sound");
- loadNum(volumeMus, "music", volnode);
- loadNum(volumeEff, "effects", volnode);
+ /* Originally the game loads the music and sound effect at the default value of 100 from the settings file.
+ However, we get these values from the ConfMan, so skip reading these values from settings
+ */
+
+ //loadNum(_volumeMus, "music", volnode);
+ //loadNum(_volumeEff, "effects", volnode);
+
loadNum(_freq, "frequency", volnode);
loadNum(_channels, "channels", volnode);
loadNum(_chunksize, "chunk_size", volnode);
Commit: f4a1d6499c3e10e1a82593c624ff0051834a676f
https://github.com/scummvm/scummvm/commit/f4a1d6499c3e10e1a82593c624ff0051834a676f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get rid of inputVal class
Changed paths:
R engines/crab/input/inputval.cpp
R engines/crab/input/inputval.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/module.mk
engines/crab/ui/KeyBindMenu.cpp
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index d41b2798e56..59c13e53f0b 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -160,9 +160,9 @@ void InputManager::load(const Common::String &filename) {
if (nodeValid(node)) {
loadNum(_version, "version", node);
- int i = 0;
- for (auto n = node->first_node(); n != NULL && i < IT_TOTAL; n = n->next_sibling(), ++i)
- _iv[i].loadState(n);
+ // int i = 0;
+ // for (auto n = node->first_node(); n != NULL && i < IT_TOTAL; n = n->next_sibling(), ++i)
+ // _iv[i].loadState(n);
}
}
}
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 5232535f8ab..7b9f830864a 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -36,7 +36,7 @@
#include "backends/keymapper/standard-actions.h"
#include "crab/common_header.h"
-#include "crab/input/inputval.h"
+//#include "crab/input/inputval.h"
namespace Crab {
@@ -95,7 +95,7 @@ const int IU_START = IU_UP, IU_SIZE = IT_TOTAL - IU_START;
class InputManager {
// The backups used to restore in case of the user pressing cancel
- InputVal _backup[IT_TOTAL];
+ Common::String _backup[IT_TOTAL];
// Load key configuration from file
void load(const Common::String &filename);
@@ -147,7 +147,7 @@ public:
// Ex. UI and Fight can have buttons in common, but not two keys within UI
// Inputs used in the game
- InputVal _iv[IT_TOTAL];
+ Common::String _iv[IT_TOTAL];
bool _ivState[IT_TOTAL];
// Our controller object
diff --git a/engines/crab/input/inputval.cpp b/engines/crab/input/inputval.cpp
deleted file mode 100644
index 19a9b8f3f1a..00000000000
--- a/engines/crab/input/inputval.cpp
+++ /dev/null
@@ -1,121 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#include "crab/input/inputval.h"
-
-namespace Crab {
-
-using namespace pyrodactyl::input;
-
-InputVal::InputVal() {
- warning("STUB: InputVal::InputVal()");
-
-#if 0
- key = SDL_SCANCODE_UNKNOWN;
- alt = SDL_SCANCODE_UNKNOWN;
- c_bu = SDL_CONTROLLER_BUTTON_INVALID;
-#endif
-
-}
-
-//------------------------------------------------------------------------
-// Purpose: Load input values
-//------------------------------------------------------------------------
-void InputVal::loadState(rapidxml::xml_node<char> *node) {
- warning("STUB: InputVal::loadState()");
-
-#if 0
- loadStr(name, "name", node);
- loadEnum(key, "key", node);
- loadEnum(alt, "alt", node);
- loadEnum(c_bu, "bu", node);
-
- if (nodeValid("axis", node, false))
- c_ax.loadState(node->first_node("axis"));
-#endif
-}
-
-//------------------------------------------------------------------------
-// Purpose: Save them
-//------------------------------------------------------------------------
-void InputVal::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title) {
- warning("STUB: InputVal::saveState()");
-
-#if 0
- rapidxml::xml_node<char> *child;
- child = doc.allocate_node(rapidxml::node_element, title);
-
- child->append_attribute(doc.allocate_attribute("name", name.c_str()));
- child->append_attribute(doc.allocate_attribute("key", gStrPool.Get(key)));
- child->append_attribute(doc.allocate_attribute("alt", gStrPool.Get(alt)));
- child->append_attribute(doc.allocate_attribute("bu", gStrPool.Get(c_bu)));
-
- if (c_ax.id != SDL_CONTROLLER_AXIS_INVALID)
- c_ax.saveState(doc, child);
-
- root->append_node(child);
-#endif
-}
-
-#if 0
-//------------------------------------------------------------------------
-// Purpose: See if we have been using the analog sticks
-//------------------------------------------------------------------------
-const bool InputVal::Equals(const SDL_ControllerAxisEvent &Event) {
- if (c_ax.id == Event.axis) {
- if (!c_ax.toggle)
- c_ax.toggle = (c_ax.greater && Event.value > c_ax.val) || (!c_ax.greater && Event.value < c_ax.val);
- else {
- if (!((c_ax.greater && Event.value > c_ax.val) || (!c_ax.greater && Event.value < c_ax.val))) {
- c_ax.toggle = false;
- return true;
- };
- }
- }
-
- return false;
-}
-
-//------------------------------------------------------------------------
-// Purpose: See if we have been using the controller buttons sticks
-//------------------------------------------------------------------------
-const bool InputVal::Equals(const SDL_ControllerButtonEvent &Event) {
- return (c_bu == Event.button);
-}
-
-//------------------------------------------------------------------------
-// Purpose: See if we have been using the keyboard
-//------------------------------------------------------------------------
-const bool InputVal::Equals(const SDL_KeyboardEvent &Event) {
- return (key == Event.keysym.scancode || alt == Event.keysym.scancode);
-}
-#endif
-
-} // End of namespace Crab
diff --git a/engines/crab/input/inputval.h b/engines/crab/input/inputval.h
deleted file mode 100644
index fb1530a4373..00000000000
--- a/engines/crab/input/inputval.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#ifndef CRAB_INPUTVAL_H
-#define CRAB_INPUTVAL_H
-
-#include "crab/GameParam.h"
-#include "crab/XMLDoc.h"
-#include "crab/common_header.h"
-#include "crab/loaders.h"
-
-namespace Crab {
-
-namespace pyrodactyl {
-namespace input {
-class InputVal {
-public:
- // Name of the key (such as "punch", "up")
- Common::String name;
-
- // Keyboard keys
- //SDL_Scancode key, alt;
-
- // Controller button
- //SDL_GameControllerButton c_bu;
-
- // The controller axis
- struct AxisData {
- // The axis
- //SDL_GameControllerAxis id;
-
- // Value of controller axis - because controller axes have a range of values
- int val;
-
- // Do we want to do a "less than" or "greater than" comparison?
- bool greater;
-
- // For menus, we want to consider a "flick" of the analog stick - i.e. a back and forth movement
- // This means we toggle this flag once the stick hits maximum value, then check if the stick has
- // gone back to its previous value
- bool toggle;
-
- AxisData() {
- warning("STUB: AxisData::AxisDAta()");
-
-#if 0
- id = SDL_CONTROLLER_AXIS_INVALID;
- val = 0;
- toggle = false;
- greater = false;
-#endif
- }
-
- void loadState(rapidxml::xml_node<char> *node) {
- //loadEnum(id, "id", node);
- loadNum(val, "val", node);
- loadBool(greater, "greater", node);
- }
-
- void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- rapidxml::xml_node<char> *child;
- child = doc.allocate_node(rapidxml::node_element, "axis");
-
- //child->append_attribute(doc.allocate_attribute("id", gStrPool->Get(id)));
- child->append_attribute(doc.allocate_attribute("val", gStrPool->Get(val)));
-
- saveBool(greater, "greater", doc, child);
-
- root->append_node(child);
- }
- } c_ax;
-
- InputVal();
-
-#if 0
- const bool Equals(const SDL_KeyboardEvent &val);
- const bool Equals(const SDL_ControllerButtonEvent &Event);
- const bool Equals(const SDL_ControllerAxisEvent &Event);
-#endif
-
- void loadState(rapidxml::xml_node<char> *node);
- void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *title);
-};
-} // End of namespace input
-} // End of namespace pyrodactyl
-
-} // End of namespace Crab
-
-#endif // CRAB_INPUTVAL_H
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index efc6254cb2b..3d1196723db 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -43,7 +43,6 @@ MODULE_OBJS = \
input/fightinput.o \
input/hotkey.o \
input/input.o \
- input/inputval.o \
item/Item.o \
item/ItemCollection.o \
item/ItemMenu.o \
diff --git a/engines/crab/ui/KeyBindMenu.cpp b/engines/crab/ui/KeyBindMenu.cpp
index 6ef58defb11..682a5679226 100644
--- a/engines/crab/ui/KeyBindMenu.cpp
+++ b/engines/crab/ui/KeyBindMenu.cpp
@@ -119,7 +119,7 @@ void KeyBindMenu::drawDesc(const int &type) {
int xoffset = _inc.x * i + _divide.x * (i / _dim.x);
int yoffset = _inc.y * (i % _dim.x) + _divide.y * (i / _dim.x);
- _desc.draw(g_engine->_inputManager->_iv[i + start].name, xoffset, yoffset);
+ _desc.draw(g_engine->_inputManager->_iv[i + start], xoffset, yoffset);
}
}
Commit: e9fd5d913433095cfcbee5b5aac96c59c3877311
https://github.com/scummvm/scummvm/commit/e9fd5d913433095cfcbee5b5aac96c59c3877311
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Move gStrPool to Engine class
Changed paths:
engines/crab/GameParam.cpp
engines/crab/Rectangle.cpp
engines/crab/ScreenSettings.cpp
engines/crab/animation/sprite.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/item/Item.cpp
engines/crab/item/StatPreview.cpp
engines/crab/level/level_load.cpp
engines/crab/music/MusicManager.cpp
engines/crab/people/opinion.cpp
engines/crab/people/person.cpp
engines/crab/people/trait.cpp
engines/crab/stat/Stat.cpp
engines/crab/ui/MapData.cpp
engines/crab/ui/button.h
engines/crab/ui/map.cpp
engines/crab/vectors.h
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index a867109b32c..814b05f1ed5 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -34,12 +34,6 @@ namespace Crab {
// Are we in debug mode or not?
bool GameDebug = false;
-// A temporary list of strings we use when storing numbers in a file
-StringPool *gStrPool;
-
-// Generate random numbers using this
-//RandomNumberGen gRandom;
-
FilePaths::FilePaths() : _common("res/levels/common.xml"),
_modPath("mods/"),
_modExt(".unrmod"),
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index b62053908b6..9d545f3b733 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/crab.h"
#include "crab/Rectangle.h"
namespace Crab {
@@ -118,10 +119,10 @@ void Rect::draw(const int &xOffset, const int &yOffset, const uint8 &r, const ui
void Rect::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("x", gStrPool->Get(x)));
- child->append_attribute(doc.allocate_attribute("y", gStrPool->Get(y)));
- child->append_attribute(doc.allocate_attribute("w", gStrPool->Get(w)));
- child->append_attribute(doc.allocate_attribute("h", gStrPool->Get(h)));
+ child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get(x)));
+ child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get(y)));
+ child->append_attribute(doc.allocate_attribute("w", g_engine->_stringPool->Get(w)));
+ child->append_attribute(doc.allocate_attribute("h", g_engine->_stringPool->Get(h)));
root->append_node(child);
}
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index 1f92c4781ee..c1dfcb0ebe5 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/crab.h"
#include "crab/ScreenSettings.h"
namespace Crab {
@@ -144,15 +145,15 @@ void ScreenSettings::setMouseTrap() {
}
void ScreenSettings::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("version", gStrPool->Get(_version)));
+ root->append_attribute(doc.allocate_attribute("version", g_engine->_stringPool->Get(_version)));
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "screen");
- child->append_attribute(doc.allocate_attribute("w", gStrPool->Get(_cur.w)));
- child->append_attribute(doc.allocate_attribute("h", gStrPool->Get(_cur.h)));
- child->append_attribute(doc.allocate_attribute("fps", gStrPool->Get(_fps)));
+ child->append_attribute(doc.allocate_attribute("w", g_engine->_stringPool->Get(_cur.w)));
+ child->append_attribute(doc.allocate_attribute("h", g_engine->_stringPool->Get(_cur.h)));
+ child->append_attribute(doc.allocate_attribute("fps", g_engine->_stringPool->Get(_fps)));
- child->append_attribute(doc.allocate_attribute("gamma", gStrPool->FGet(_gamma)));
- child->append_attribute(doc.allocate_attribute("text_speed", gStrPool->FGet(_textSpeed)));
+ child->append_attribute(doc.allocate_attribute("gamma", g_engine->_stringPool->FGet(_gamma)));
+ child->append_attribute(doc.allocate_attribute("text_speed", g_engine->_stringPool->FGet(_textSpeed)));
saveBool(_vsync, "vsync", doc, child);
saveBool(_border, "border", doc, child);
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index d04c9020128..62c11d89433 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -665,8 +665,8 @@ void Sprite::internalEvents(Info &info, const Common::String &player_id, Common:
//------------------------------------------------------------------------
void Sprite::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("id", _id.c_str()));
- root->append_attribute(doc.allocate_attribute("x", gStrPool->Get(_pos.x)));
- root->append_attribute(doc.allocate_attribute("y", gStrPool->Get(_pos.y)));
+ root->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get(_pos.x)));
+ root->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get(_pos.y)));
}
//------------------------------------------------------------------------
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 5c6326e42c7..198f6d658cf 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -44,7 +44,7 @@ CrabEngine::~CrabEngine() {
delete _app;
delete _screenSettings;
- delete gStrPool;
+ delete _stringPool;
delete _tempData;
delete _filePath;
@@ -95,7 +95,7 @@ Common::Error CrabEngine::run() {
_filePath = new FilePaths();
_tempData = new TempValue();
- gStrPool = new StringPool();
+ _stringPool = new StringPool();
_screenSettings = new ScreenSettings();
CursorMan.showMouse(true);
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 41eb1a78d73..3881e0127f1 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -50,6 +50,8 @@ struct CrabGameDescription;
class LoadingScreen;
+class StringPool;
+
namespace pyrodactyl {
namespace event {
struct GameEventStore;
@@ -97,6 +99,7 @@ public:
FilePaths *_filePath = nullptr;
TempValue *_tempData = nullptr;
+ StringPool *_stringPool = nullptr;
ScreenSettings *_screenSettings = nullptr;
Common::FSNode _gameDataDir;
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 050dbb1b7e8..6f34ffcff3d 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -76,12 +76,12 @@ bool EventSeqGroup::activeSeq(unsigned int &activeSeq) {
void EventSeqGroup::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (auto i = _end.begin(); i != _end.end(); ++i) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "end");
- child->value(gStrPool->Get(*i));
+ child->value(g_engine->_stringPool->Get(*i));
root->append_node(child);
}
for (auto i = _seq.begin(); i != _seq.end(); ++i)
- i->_value.saveState(doc, root, gStrPool->Get(i->_key));
+ i->_value.saveState(doc, root, g_engine->_stringPool->Get(i->_key));
}
void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 008ff1bfc37..483d20528e3 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -116,12 +116,12 @@ void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
// Write current event id and name to node
seqnode->append_attribute(doc.allocate_attribute("name", name));
- seqnode->append_attribute(doc.allocate_attribute("current", gStrPool->Get(_cur)));
+ seqnode->append_attribute(doc.allocate_attribute("current", g_engine->_stringPool->Get(_cur)));
// Prepare strings of next events and write them
for (unsigned int i = 0; i < _next.size(); i++) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "next");
- child->value(gStrPool->Get(_next[i]));
+ child->value(g_engine->_stringPool->Get(_next[i]));
seqnode->append_node(child);
}
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 94e7d8160f9..67b02702f96 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -333,7 +333,7 @@ void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
for (auto v = _var.begin(); v != _var.end(); ++v) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
child->append_attribute(doc.allocate_attribute("id", v->first.c_str()));
- child->append_attribute(doc.allocate_attribute("val", gStrPool->Get(v->second)));
+ child->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(v->second)));
root->append_node(child);
}
@@ -350,7 +350,7 @@ void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
root->append_node(child_unr);
rapidxml::xml_node<char> *child_img = doc.allocate_node(rapidxml::node_element, "img");
- child_img->append_attribute(doc.allocate_attribute("index", gStrPool->Get(player_img)));
+ child_img->append_attribute(doc.allocate_attribute("index", g_engine->_stringPool->Get(player_img)));
root->append_node(child_img);
rapidxml::xml_node<char> *child_money = doc.allocate_node(rapidxml::node_element, "money");
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index baba411d9d1..c305a6a1d8e 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -75,7 +75,7 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
root->append_attribute(doc.allocate_attribute("id", _id.c_str()));
root->append_attribute(doc.allocate_attribute("name", _name.c_str()));
root->append_attribute(doc.allocate_attribute("type", _type.c_str()));
- root->append_attribute(doc.allocate_attribute("img", gStrPool->Get(_img)));
+ root->append_attribute(doc.allocate_attribute("img", g_engine->_stringPool->Get(_img)));
root->append_attribute(doc.allocate_attribute("desc", _desc.c_str()));
for (auto i = _bonus.begin(); i != _bonus.end(); ++i) {
@@ -99,7 +99,7 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
break;
}
- n->append_attribute(doc.allocate_attribute("val", gStrPool->Get(i->_val)));
+ n->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(i->_val)));
root->append_node(n);
}
}
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index bbb2d5d7483..0091f76a9a9 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -28,7 +28,7 @@
*
*/
-
+#include "crab/crab.h"
#include "crab/item/StatPreview.h"
namespace Crab {
@@ -58,7 +58,7 @@ void StatPreview::draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
int count = 0;
for (auto i = item._bonus.begin(); i != item._bonus.end(); ++i, ++count) {
stat.draw(helper.name(i->_type), _incS.x * count, _incS.y * count);
- unit.draw(gStrPool->Get(i->_val), _incU.x * count, _incU.y * count);
+ unit.draw(g_engine->_stringPool->Get(i->_val), _incU.x * count, _incU.y * count);
}
}
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index ebd2ea3822b..7d3fa310879 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -212,7 +212,7 @@ void Level::loadConst(const Common::String &filename) {
// Purpose: Save all sprite positions to save file
//------------------------------------------------------------------------
void Level::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("player_index", gStrPool->Get(_playerIndex)));
+ root->append_attribute(doc.allocate_attribute("player_index", g_engine->_stringPool->Get(_playerIndex)));
for (auto &i : _objects) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sprite");
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 6fc260de5b7..5f47bca7d44 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -157,11 +157,11 @@ void MusicManager::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<c
#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sound");
- child->append_attribute(doc.allocate_attribute("music", gStrPool->Get(Mix_VolumeMusic(-1))));
- child->append_attribute(doc.allocate_attribute("effects", gStrPool->Get(Mix_Volume(0, -1))));
- child->append_attribute(doc.allocate_attribute("frequency", gStrPool->Get(freq)));
- child->append_attribute(doc.allocate_attribute("channels", gStrPool->Get(channels)));
- child->append_attribute(doc.allocate_attribute("chunk_size", gStrPool->Get(chunksize)));
+ child->append_attribute(doc.allocate_attribute("music", g_engine->_stringPool->Get(Mix_VolumeMusic(-1))));
+ child->append_attribute(doc.allocate_attribute("effects", g_engine->_stringPool->Get(Mix_Volume(0, -1))));
+ child->append_attribute(doc.allocate_attribute("frequency", g_engine->_stringPool->Get(freq)));
+ child->append_attribute(doc.allocate_attribute("channels", g_engine->_stringPool->Get(channels)));
+ child->append_attribute(doc.allocate_attribute("chunk_size", g_engine->_stringPool->Get(chunksize)));
root->append_node(child);
#endif
}
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index 7f0555e0dea..89f3194ef42 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -28,7 +28,7 @@
*
*/
-
+#include "crab/crab.h"
#include "crab/people/opinion.h"
namespace Crab {
@@ -72,9 +72,9 @@ void Opinion::validate(const OpinionType &type) {
void Opinion::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "opinion");
- child->append_attribute(doc.allocate_attribute("like", gStrPool->Get(_val[OPI_LIKE])));
- child->append_attribute(doc.allocate_attribute("fear", gStrPool->Get(_val[OPI_FEAR])));
- child->append_attribute(doc.allocate_attribute("respect", gStrPool->Get(_val[OPI_RESPECT])));
+ child->append_attribute(doc.allocate_attribute("like", g_engine->_stringPool->Get(_val[OPI_LIKE])));
+ child->append_attribute(doc.allocate_attribute("fear", g_engine->_stringPool->Get(_val[OPI_FEAR])));
+ child->append_attribute(doc.allocate_attribute("respect", g_engine->_stringPool->Get(_val[OPI_RESPECT])));
root->append_node(child);
}
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 06ab56048d2..18ebb51504e 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/crab.h"
#include "crab/people/person.h"
namespace Crab {
@@ -108,7 +109,7 @@ void Person::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
child->append_attribute(doc.allocate_attribute("name", _name.c_str()));
unsigned int val = static_cast<unsigned int>(_state);
- child->append_attribute(doc.allocate_attribute("state", gStrPool->Get(val)));
+ child->append_attribute(doc.allocate_attribute("state", g_engine->_stringPool->Get(val)));
_opinion.saveState(doc, child);
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 7df24a03da7..27321126ccd 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/crab.h"
#include "crab/people/trait.h"
namespace Crab {
@@ -61,10 +62,10 @@ void Trait::clear() {
//------------------------------------------------------------------------
void Trait::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, rootname);
- child->append_attribute(doc.allocate_attribute("id", gStrPool->Get(_id)));
+ child->append_attribute(doc.allocate_attribute("id", g_engine->_stringPool->Get(_id)));
child->append_attribute(doc.allocate_attribute("name", _name.c_str()));
child->append_attribute(doc.allocate_attribute("desc", _desc.c_str()));
- child->append_attribute(doc.allocate_attribute("img", gStrPool->Get(_img)));
+ child->append_attribute(doc.allocate_attribute("img", g_engine->_stringPool->Get(_img)));
saveBool(_unread, "unread", doc, child);
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index bca5a075af7..a0182cddf70 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -28,7 +28,7 @@
*
*/
-
+#include "crab/crab.h"
#include "crab/stat/Stat.h"
namespace Crab {
@@ -104,10 +104,10 @@ void Stat::validate() {
void Stat::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(_cur)));
- child->append_attribute(doc.allocate_attribute("def", gStrPool->Get(_def)));
- child->append_attribute(doc.allocate_attribute("min", gStrPool->Get(_min)));
- child->append_attribute(doc.allocate_attribute("max", gStrPool->Get(_max)));
+ child->append_attribute(doc.allocate_attribute("cur", g_engine->_stringPool->Get(_cur)));
+ child->append_attribute(doc.allocate_attribute("def", g_engine->_stringPool->Get(_def)));
+ child->append_attribute(doc.allocate_attribute("min", g_engine->_stringPool->Get(_min)));
+ child->append_attribute(doc.allocate_attribute("max", g_engine->_stringPool->Get(_max)));
root->append_node(child);
}
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index 7b165ced176..cba8c1ff3fa 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/crab.h"
#include "crab/ui/MapData.h"
namespace Crab {
@@ -57,8 +58,8 @@ void MapData::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
for (auto d = _dest.begin(); d != _dest.end(); ++d) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "pos");
child->append_attribute(doc.allocate_attribute("name", d->_name.c_str()));
- child->append_attribute(doc.allocate_attribute("x", gStrPool->Get(d->_pos.x)));
- child->append_attribute(doc.allocate_attribute("y", gStrPool->Get(d->_pos.y)));
+ child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get(d->_pos.x)));
+ child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get(d->_pos.y)));
child_dest->append_node(child);
}
root->append_node(child_dest);
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index 13cec3c3426..f03ff5ad62e 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -77,9 +77,9 @@ struct ButtonImage {
}
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("img_b", gStrPool->Get(_normal)));
- root->append_attribute(doc.allocate_attribute("img_s", gStrPool->Get(_select)));
- root->append_attribute(doc.allocate_attribute("img_h", gStrPool->Get(_hover)));
+ root->append_attribute(doc.allocate_attribute("img_b", g_engine->_stringPool->Get(_normal)));
+ root->append_attribute(doc.allocate_attribute("img_s", g_engine->_stringPool->Get(_select)));
+ root->append_attribute(doc.allocate_attribute("img_h", g_engine->_stringPool->Get(_hover)));
}
};
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 5d0e7513e41..f2fc98076b5 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -449,7 +449,7 @@ void Map::destDel(const Common::String &name) {
void Map::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "map");
- child->append_attribute(doc.allocate_attribute("cur", gStrPool->Get(_cur)));
+ child->append_attribute(doc.allocate_attribute("cur", g_engine->_stringPool->Get(_cur)));
saveBool(_overlay, "overlay", doc, child);
for (auto r = _map.begin(); r != _map.end(); ++r) {
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index d2f3c29819f..755d0c28d7a 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -59,8 +59,8 @@ public:
warning("STUB: Vector2D::saveState()");
#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("x", gStrPool->Get((int)x)));
- child->append_attribute(doc.allocate_attribute("y", gStrPool->Get((int)y)));
+ child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get((int)x)));
+ child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get((int)y)));
root->append_node(child);
#endif
}
Commit: 8d272b45060c028743d0b99ae48bf31853112087
https://github.com/scummvm/scummvm/commit/8d272b45060c028743d0b99ae48bf31853112087
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub Sprite::attack()
Changed paths:
engines/crab/ai/spriteai.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 9ef7acab189..b75ec2e3d05 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -192,7 +192,7 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
++num;
float velocity = static_cast<float>(num);
- // MoveToLoc(aiData.dest, vel, sc);
+ // MoveToLoc(_aiData.dest, vel, sc);
moveToLocPathfinding(_aiData._dest, velocity, sc);
}
} break;
@@ -207,49 +207,47 @@ void Sprite::flee(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::level
//------------------------------------------------------------------------
// Purpose: AI routine for fighting the player
//------------------------------------------------------------------------
-void Sprite::attack(pyrodactyl::event::Info &info, Sprite &target_sp, const SpriteConstant &sc) {
- warning("STUB: Sprite::attack()");
-
-#if 0
- switch (aiData.fight._state) {
+void Sprite::attack(pyrodactyl::event::Info &info, Sprite &targetSp, const SpriteConstant &sc) {
+ switch (_aiData._fight._state) {
case FIGHTSTATE_GETNEXTMOVE: {
- aiData.fight._state = FIGHTSTATE_GETINRANGE;
- aiData.fight.delay.Start();
+ _aiData._fight._state = FIGHTSTATE_GETINRANGE;
+ _aiData._fight._delay.start();
- unsigned int size = aiData.fight.attack.size();
+ unsigned int size = _aiData._fight._attack.size();
if (size > 1)
- anim_set.fight.Next(aiData.fight.attack[gRandom.Num() % aiData.fight.attack.size()]);
+ _animSet._fight.next(_aiData._fight._attack[g_engine->getRandomNumber(_aiData._fight._attack.size())]);
else if (size <= 0)
- aiData.fight._state = FIGHTSTATE_CANTFIGHT;
+ _aiData._fight._state = FIGHTSTATE_CANTFIGHT;
else
- anim_set.fight.Next(aiData.fight.attack[0]);
- } break;
+ _animSet._fight.next(_aiData._fight._attack[0]);
+ }
+ break;
case FIGHTSTATE_GETINRANGE: {
// Set destination path to the player location
- Rect b = target_sp.BoundRect();
+ Rect b = targetSp.boundRect();
Vector2i dest(b.x + b.w / 2, b.y + b.h / 2);
- SetDestPathfinding(dest);
+ setDestPathfinding(dest);
- Rect p = BoundRect();
- pathing.SetPosition(Vector2f((float)(p.x + p.w / 2), (float)p.y + p.h / 2));
- pathing.Update(0);
+ Rect p = boundRect();
+ _pathing.setPosition(Vector2f((float)(p.x + p.w / 2), (float)p.y + p.h / 2));
+ _pathing.update(0);
FightMove f;
- if (anim_set.fight.NextMove(f) && FightCollide(target_sp.BoxV(), target_sp.BoundRect(), f.ai.range, sc)) {
- if (aiData.fight.delay.Ticks() > f.ai.delay)
- aiData.fight._state = FIGHTSTATE_EXECUTEMOVE;
- } else if (input.Idle())
- MoveToDestPathfinding(info, sc);
- } break;
+ if (_animSet._fight.nextMove(f) && fightCollide(targetSp.boxV(), targetSp.boundRect(), f._ai._range, sc)) {
+ if (_aiData._fight._delay.ticks() > f._ai._delay)
+ _aiData._fight._state = FIGHTSTATE_EXECUTEMOVE;
+ } else if (_input.idle())
+ moveToDestPathfinding(info, sc);
+ }
+ break;
case FIGHTSTATE_EXECUTEMOVE:
- UpdateMove(anim_set.fight.Next());
- aiData.fight._state = FIGHTSTATE_GETNEXTMOVE;
- aiData.fight.delay.Stop();
+ updateMove(_animSet._fight.next());
+ _aiData._fight._state = FIGHTSTATE_GETNEXTMOVE;
+ _aiData._fight._delay.stop();
break;
default:
break;
}
-#endif
}
void Sprite::flyAround(const Rect &camera, const SpriteConstant &sc) {
Commit: ef6e36d650ed5179c1b6a4ea220812848276d740
https://github.com/scummvm/scummvm/commit/ef6e36d650ed5179c1b6a4ea220812848276d740
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: contains() returns a bool and not an int
Changed paths:
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/item/ItemCollection.cpp
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 6f34ffcff3d..fffe7000cf6 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -45,7 +45,7 @@ void EventSeqGroup::addSeq(const unsigned int &id, Common::String &path) {
}
bool EventSeqGroup::eventInProgress(const unsigned int &id) {
- return _seq.contains(id) > 0 && _seq[id].eventInProgress();
+ return _seq.contains(id) && _seq[id].eventInProgress();
}
GameEvent *EventSeqGroup::curEvent(const unsigned int &id) {
@@ -91,7 +91,7 @@ void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set"))
if (n->first_attribute("name") != NULL) {
unsigned int id = stringToNumber<unsigned int>(n->first_attribute("name")->value());
- if (_seq.contains(id) > 0)
+ if (_seq.contains(id))
_seq[id].loadState(n);
}
}
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 67b02702f96..0e8dc5a7e73 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -98,12 +98,12 @@ void Info::loadPeople(const Common::String &filename) {
// Purpose: Get/Set information about object type
//------------------------------------------------------------------------
void Info::type(const Common::String &id, const PersonType &val) {
- if (_people.contains(id) > 0)
+ if (_people.contains(id))
_people[id]._type = val;
}
PersonType Info::type(const Common::String &id) {
- if (_people.contains(id) > 0)
+ if (_people.contains(id))
return _people[id]._type;
return PE_NEUTRAL;
@@ -113,12 +113,12 @@ PersonType Info::type(const Common::String &id) {
// Purpose: Get/Set information about object state
//------------------------------------------------------------------------
void Info::state(const Common::String &id, const PersonState &val) {
- if (_people.contains(id) > 0)
+ if (_people.contains(id))
_people[id]._state = val;
}
PersonState Info::state(const Common::String &id) {
- if (_people.contains(id) > 0)
+ if (_people.contains(id))
return _people[id]._state;
return PST_NORMAL;
@@ -128,7 +128,7 @@ PersonState Info::state(const Common::String &id) {
// Purpose: Get/Set information about variables
//------------------------------------------------------------------------
bool Info::varGet(const Common::String &name, int &val) {
- if (_var.contains(name) == 0)
+ if (!_var.contains(name))
return false;
else
val = _var[name];
@@ -148,28 +148,28 @@ void Info::varSet(const Common::String &name, const Common::String &val) {
}
void Info::varAdd(const Common::String &name, const int &val) {
- if (_var.contains(name) == 0)
+ if (!_var.contains(name))
varSet(name, 0);
_var[name] += val;
}
void Info::varSub(const Common::String &name, const int &val) {
- if (_var.contains(name) == 0)
+ if (!_var.contains(name))
varSet(name, 0);
_var[name] -= val;
}
void Info::varMul(const Common::String &name, const int &val) {
- if (_var.contains(name) == 0)
+ if (!_var.contains(name))
varSet(name, 0);
_var[name] *= val;
}
void Info::varDiv(const Common::String &name, const int &val) {
- if (_var.contains(name) == 0)
+ if (!_var.contains(name))
varSet(name, 0);
_var[name] /= val;
@@ -218,7 +218,7 @@ void Info::traitDel(const Common::String &perId, const int &traitId) {
// Purpose: Get/Set information about object opinion
//------------------------------------------------------------------------
bool Info::opinionGet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int &val) {
- if (_people.contains(name) == 0)
+ if (!_people.contains(name))
return false;
val = _people[name]._opinion._val[type];
@@ -226,12 +226,12 @@ bool Info::opinionGet(const Common::String &name, const pyrodactyl::people::Opin
}
void Info::opinionChange(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
- if (_people.contains(name) > 0)
+ if (_people.contains(name))
_people[name]._opinion.change(type, val);
}
void Info::opinionSet(const Common::String &name, const pyrodactyl::people::OpinionType &type, int val) {
- if (_people.contains(name) > 0)
+ if (_people.contains(name))
_people[name]._opinion.set(type, val);
}
@@ -239,7 +239,7 @@ void Info::opinionSet(const Common::String &name, const pyrodactyl::people::Opin
// Purpose: Get/Set information about object stats
//------------------------------------------------------------------------
bool Info::statGet(const Common::String &name, const pyrodactyl::stat::StatType &type, int &num) {
- if (_people.contains(name) == 0)
+ if (!_people.contains(name))
return false;
num = _people[name]._stat._val[type]._cur;
@@ -247,12 +247,12 @@ bool Info::statGet(const Common::String &name, const pyrodactyl::stat::StatType
}
void Info::statSet(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
- if (_people.contains(name) > 0)
+ if (_people.contains(name))
_people[name]._stat.set(type, num);
}
void Info::statChange(const Common::String &name, const pyrodactyl::stat::StatType &type, const int &num) {
- if (_people.contains(name) > 0)
+ if (_people.contains(name))
_people[name]._stat.change(type, num);
}
@@ -260,7 +260,7 @@ void Info::statChange(const Common::String &name, const pyrodactyl::stat::StatTy
// Purpose: Get person object
//------------------------------------------------------------------------
bool Info::personGet(const Common::String &id, pyrodactyl::people::Person &p) {
- if (_people.contains(id) == 0)
+ if (!_people.contains(id))
return false;
p = _people[id];
@@ -268,7 +268,7 @@ bool Info::personGet(const Common::String &id, pyrodactyl::people::Person &p) {
}
bool Info::personValid(const Common::String &id) {
- return _people.contains(id) > 0;
+ return _people.contains(id);
}
pyrodactyl::people::Person &Info::personGet(const Common::String &id) {
@@ -278,7 +278,7 @@ pyrodactyl::people::Person &Info::personGet(const Common::String &id) {
}
bool Info::collideWithTrigger(const Common::String &id, int rectIndex) {
- if (_people.contains(id) > 0) {
+ if (_people.contains(id)) {
for (auto i = _people[id]._trig.begin(); i != _people[id]._trig.end(); ++i)
if (*i == rectIndex)
return true;
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 083a118d549..991b0d4d61c 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -97,7 +97,7 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
//------------------------------------------------------------------------
void Manager::handleEvents(Info &info, const Common::String &playerId, Common::Event &event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
// If an event is already being performed
- if (_eventMap.contains(info.curLocID()) > 0 && _eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
+ if (_eventMap.contains(info.curLocID()) && _eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
switch (_curEvent->_type) {
case EVENT_DIALOG:
if (_oh._showJournal) {
@@ -270,7 +270,7 @@ void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Even
// Purpose: Internal Events
//------------------------------------------------------------------------
void Manager::internalEvents(Info &info, Level &level, Common::Array<EventResult> &result) {
- if (_eventMap.contains(info.curLocID()) > 0) {
+ if (_eventMap.contains(info.curLocID())) {
if (_eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
switch (_curEvent->_type) {
case EVENT_DIALOG:
@@ -316,7 +316,7 @@ void Manager::updateDialogBox(Info &info, pyrodactyl::level::Level &level) {
// Purpose: Draw
//------------------------------------------------------------------------
void Manager::draw(Info &info, HUD &hud, Level &level) {
- if (_eventMap.contains(info.curLocID()) > 0 && _eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
+ if (_eventMap.contains(info.curLocID()) && _eventMap[info.curLocID()].eventInProgress(_activeSeq)) {
switch (_curEvent->_type) {
case EVENT_ANIM:
g_engine->_eventStore->_anim[_curEvent->_special].draw();
@@ -392,7 +392,7 @@ void Manager::endSequence(const Common::String &curloc) {
for (auto i = _endSeq.begin(); i != _endSeq.end(); ++i)
if (i->_cur)
_eventMap[curloc].endSeq(_activeSeq);
- else if (_eventMap.contains(i->_loc) > 0)
+ else if (_eventMap.contains(i->_loc))
_eventMap[i->_loc].endSeq(stringToNumber<unsigned int>(i->_val));
_activeSeq = UINT_MAX;
@@ -425,7 +425,7 @@ void Manager::loadState(rapidxml::xml_node<char> *node) {
for (auto n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
if (n->first_attribute("name") != NULL) {
Common::String name = n->first_attribute("name")->value();
- if (_eventMap.contains(name) > 0)
+ if (_eventMap.contains(name))
_eventMap[name].loadState(n);
}
}
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index e6b68fa088f..3a766b63b71 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -62,7 +62,7 @@ void ItemCollection::load(rapidxml::xml_node<char> *node) {
// Purpose: Add a character's inventory if not added already
//------------------------------------------------------------------------
void ItemCollection::init(const Common::String &charId) {
- if (_item.contains(charId) == 0)
+ if (!_item.contains(charId))
_item[charId].init(_ref, _inc, _rows, _cols, _useKeyboard);
}
@@ -70,7 +70,7 @@ void ItemCollection::init(const Common::String &charId) {
// Purpose: Handle events
//------------------------------------------------------------------------
void ItemCollection::handleEvents(const Common::String &charId, const Common::Event &event) {
- if (_item.contains(charId) > 0)
+ if (_item.contains(charId))
_item[charId].handleEvents(event);
}
@@ -78,7 +78,7 @@ void ItemCollection::handleEvents(const Common::String &charId, const Common::Ev
// Purpose: Draw
//------------------------------------------------------------------------
void ItemCollection::draw(const Common::String &charId) {
- if (_item.contains(charId) > 0)
+ if (_item.contains(charId))
_item[charId].draw(_itemInfo);
}
@@ -86,7 +86,7 @@ void ItemCollection::draw(const Common::String &charId) {
// Purpose: Delete an item from a character's inventory
//------------------------------------------------------------------------
void ItemCollection::del(const Common::String &charId, const Common::String &itemId) {
- if (_item.contains(charId) > 0)
+ if (_item.contains(charId))
_item[charId].del(itemId);
}
@@ -105,7 +105,7 @@ void ItemCollection::add(const Common::String &charId, Item &itemData) {
// Purpose: Find if a character has an item
//------------------------------------------------------------------------
bool ItemCollection::has(const Common::String &charId, const Common::String &container, const Common::String &itemId) {
- if (_item.contains(charId) > 0)
+ if (_item.contains(charId))
return _item[charId].has(container, itemId);
return false;
Commit: d4e1991ecbdac3f4ee9b980bf543d51004a0c4f8
https://github.com/scummvm/scummvm/commit/d4e1991ecbdac3f4ee9b980bf543d51004a0c4f8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix bug due to which _startTicks was not set in resume()
Changed paths:
engines/crab/timer.cpp
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index f849805bb60..0a0bba35a60 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -103,7 +103,7 @@ void Timer::resume() {
_paused = false;
// Reset the starting ticks
- _pausedTicks = g_system->getMillis() - _startTicks;
+ _startTicks = g_system->getMillis() - _pausedTicks;
// Reset the paused ticks
_pausedTicks = 0;
}
Commit: fa086abcc4e417d34b4551c704d4778260285998
https://github.com/scummvm/scummvm/commit/fa086abcc4e417d34b4551c704d4778260285998
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix types of MusicKey and ChunkKey
Changed paths:
engines/crab/music/musicparam.h
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index 5f48bd5b4ef..3da20d46db6 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -41,11 +41,11 @@ namespace pyrodactyl {
namespace music {
// We use this object as key for music tracks
// Empty sounds are represented by -1
-typedef unsigned int MusicKey;
+typedef int MusicKey;
// We use this object as key for sound effects
// Empty sounds are represented by -1
-typedef unsigned int ChunkKey;
+typedef int ChunkKey;
struct MusicData {
// The id of this track
Commit: bd8824b0beb1dc25d026f3ece941dba9bf390091
https://github.com/scummvm/scummvm/commit/bd8824b0beb1dc25d026f3ece941dba9bf390091
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unneeded resource.h file
Changed paths:
R engines/crab/resource.h
diff --git a/engines/crab/resource.h b/engines/crab/resource.h
deleted file mode 100644
index aaf4dab4a0a..00000000000
Binary files a/engines/crab/resource.h and /dev/null differ
Commit: 27329370e9f6b2671e45c16b6b669c6720c8f008
https://github.com/scummvm/scummvm/commit/27329370e9f6b2671e45c16b6b669c6720c8f008
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub SlideShow::refresh()
Changed paths:
engines/crab/ui/SlideShow.cpp
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 85438a92917..a33b7bc1103 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -112,14 +112,10 @@ void SlideShow::handleEvents(const SDL_Event &Event) {
#endif
void SlideShow::refresh() {
- warning("SlideShow::refresh()");
+ _img.deleteImage();
-#if 0
- img.Delete();
-
- if (index >= 0 && index < path.size())
- img.load(path[index]);
-#endif
+ if (_index < _path.size())
+ _img.load(_path[_index]);
}
void SlideShow::setUI() {
Commit: fbeb586fda71e560bf6d1c641e8b1061ba65e76a
https://github.com/scummvm/scummvm/commit/fbeb586fda71e560bf6d1c641e8b1061ba65e76a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Simplify numberToString()
Changed paths:
engines/crab/numstr.h
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index c5eaa1e6d33..2032bdac6ac 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -36,31 +36,7 @@ namespace Crab {
template<typename T>
Common::String numberToString(T number) {
- Common::String res;
- const T num = number;
-
- if (number == 0) {
- return "0";
- }
-
- if (number < 0)
- number = -number;
-
- while (number > 0) {
- T d = number % 10;
- res += ('0' + d);
- number /= 10;
- }
-
- if (num < 0)
- res += "-";
-
- // reverse string
- Common::String revStr;
- for (int i = res.size() - 1; i >= 0; i--)
- revStr += res[i];
-
- return revStr;
+ return Common::String::format("%d", number);
}
template<typename T>
Commit: 42fcc6188854c155169d6f061d632092049eca3a
https://github.com/scummvm/scummvm/commit/42fcc6188854c155169d6f061d632092049eca3a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: _state should be signed
Changed paths:
engines/crab/input/cursor.h
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index f8ecb4b07ec..a1dc6cac82e 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -54,7 +54,7 @@ class Cursor {
// Mouse image changes slightly if left click button is pressed
bool _pressed;
- uint8 _state;
+ int8 _state;
public:
// Various coordinates
Commit: 0907c5cc1f768dee1f5fdb052a9e12389c7d9e6e
https://github.com/scummvm/scummvm/commit/0907c5cc1f768dee1f5fdb052a9e12389c7d9e6e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix signed/unsigned warning in journal.cpp
Changed paths:
engines/crab/ui/journal.cpp
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 127b8eb8266..a7fba57c0ab 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -217,7 +217,7 @@ void Journal::open(const Common::String &id, const JournalCategory &category, co
// Always find valid journal group first
for (auto &jo : _journal)
if (jo._id == id) {
- if (category >= 0 && category < _category._element.size()) {
+ if (category >= 0 && category < (int)_category._element.size()) {
// If category passes the valid check, select it
select(id, category);
Commit: 7297454e8f4460147e5452c8c51de22c8fd57d6a
https://github.com/scummvm/scummvm/commit/7297454e8f4460147e5452c8c51de22c8fd57d6a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub Info::saveState
Changed paths:
engines/crab/event/GameEventInfo.cpp
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 0e8dc5a7e73..4a86fcdeaae 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -327,39 +327,35 @@ Common::String Info::getName(const Common::String &id) {
// Purpose: Save and load object state
//------------------------------------------------------------------------
void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- warning("Info::saveState()");
-
-#if 0
for (auto v = _var.begin(); v != _var.end(); ++v) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
- child->append_attribute(doc.allocate_attribute("id", v->first.c_str()));
- child->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(v->second)));
+ child->append_attribute(doc.allocate_attribute("id", v->_key.c_str()));
+ child->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(v->_value)));
root->append_node(child);
}
for (auto p = _people.begin(); p != _people.end(); ++p)
- p->second.saveState(doc, root);
+ p->_value.saveState(doc, root);
- rapidxml::xml_node<char> *child_unr = doc.allocate_node(rapidxml::node_element, "unread");
+ rapidxml::xml_node<char> *childUnr = doc.allocate_node(rapidxml::node_element, "unread");
- saveBool(unread.inventory, "inventory", doc, child_unr);
- saveBool(unread.journal, "journal", doc, child_unr);
- saveBool(unread.trait, "trait", doc, child_unr);
- saveBool(unread.map, "map", doc, child_unr);
+ saveBool(_unread._inventory, "inventory", doc, childUnr);
+ saveBool(_unread._journal, "journal", doc, childUnr);
+ saveBool(_unread._trait, "trait", doc, childUnr);
+ saveBool(_unread._map, "map", doc, childUnr);
- root->append_node(child_unr);
+ root->append_node(childUnr);
rapidxml::xml_node<char> *child_img = doc.allocate_node(rapidxml::node_element, "img");
- child_img->append_attribute(doc.allocate_attribute("index", g_engine->_stringPool->Get(player_img)));
+ child_img->append_attribute(doc.allocate_attribute("index", g_engine->_stringPool->Get(_playerImg)));
root->append_node(child_img);
rapidxml::xml_node<char> *child_money = doc.allocate_node(rapidxml::node_element, "money");
- child_money->append_attribute(doc.allocate_attribute("var", money_var.c_str()));
+ child_money->append_attribute(doc.allocate_attribute("var", _moneyVar.c_str()));
root->append_node(child_money);
_journal.saveState(doc, root);
_inv.saveState(doc, root);
-#endif
}
void Info::loadState(rapidxml::xml_node<char> *node) {
Commit: 77e993681173e8d51a16c8e3be207aebc05cc0a4
https://github.com/scummvm/scummvm/commit/77e993681173e8d51a16c8e3be207aebc05cc0a4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Clear old journal entries on loadState()
Changed paths:
engines/crab/ui/journal.cpp
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index a7fba57c0ab..8eb1fef80aa 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -255,6 +255,8 @@ void Journal::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
}
void Journal::loadState(rapidxml::xml_node<char> *node) {
+ _journal.clear();
+
for (rapidxml::xml_node<char> *n = node->first_node("journal"); n != NULL; n = n->next_sibling("journal")) {
Common::String id;
loadStr(id, "id", n);
Commit: de0820c67232ab0248af09e49c92dc0008760b7b
https://github.com/scummvm/scummvm/commit/de0820c67232ab0248af09e49c92dc0008760b7b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use nullptr instead oF NULL
Changed paths:
engines/crab/GameParam.cpp
engines/crab/Line.h
engines/crab/LoadingScreen.cpp
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGrid.cpp
engines/crab/Polygon.cpp
engines/crab/TMX/TMXLayer.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/XMLDoc.cpp
engines/crab/XMLDoc.h
engines/crab/ai/movement.cpp
engines/crab/animation/PopUp.cpp
engines/crab/animation/animation.cpp
engines/crab/animation/animframe.cpp
engines/crab/animation/fightanim.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/app.cpp
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/conversationdata.cpp
engines/crab/event/eventstore.cpp
engines/crab/event/gameevent.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/event/quest.cpp
engines/crab/event/triggerset.cpp
engines/crab/filesystem.cpp
engines/crab/image/Image.cpp
engines/crab/image/Image.h
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
engines/crab/input/input.cpp
engines/crab/item/Item.cpp
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemSlot.cpp
engines/crab/level/LevelExit.cpp
engines/crab/level/MusicArea.cpp
engines/crab/level/Stairs.cpp
engines/crab/level/level_ai.cpp
engines/crab/level/level_load.cpp
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/mainmenu.cpp
engines/crab/music/MusicManager.cpp
engines/crab/people/person.cpp
engines/crab/stat/StatTemplate.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/color.cpp
engines/crab/ui/Caption.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/HoverInfo.h
engines/crab/ui/Inventory.cpp
engines/crab/ui/MapData.cpp
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/ParagraphData.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/ProgressBar.cpp
engines/crab/ui/ResolutionMenu.cpp
engines/crab/ui/SlideShow.cpp
engines/crab/ui/TextData.h
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitButton.h
engines/crab/ui/button.h
engines/crab/ui/element.cpp
engines/crab/ui/element.h
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index 814b05f1ed5..fe6d4bb16dd 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -62,7 +62,7 @@ void FilePaths::loadLevel(const Common::String &filename) {
if (lev_list.ready()) {
rapidxml::xml_node<char> *node = lev_list.doc()->first_node("world");
- for (rapidxml::xml_node<char> *n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
+ for (rapidxml::xml_node<char> *n = node->first_node("loc"); n != nullptr; n = n->next_sibling("loc")) {
LevelPath l;
l.load(n);
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index 2309fea8a2a..e644ad3c57d 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -41,7 +41,7 @@ namespace Crab {
template<typename T>
bool collideLine(const T &p0X, const T &p0Y, const T &p1X, const T &p1Y,
const T &p2X, const T &p2Y, const T &p3X, const T &p3Y,
- T *x = NULL, T *y = NULL) {
+ T *x = nullptr, T *y = nullptr) {
Vector2D<T> s1, s2;
s1.x = p1X - p0X;
s1.y = p1Y - p0Y;
@@ -57,9 +57,9 @@ bool collideLine(const T &p0X, const T &p0Y, const T &p1X, const T &p1Y,
if (s >= 0 && s <= 1 && t >= 0 && t <= 1) {
// Collision detected
- if (x != NULL)
+ if (x != nullptr)
*x = p0X + (t * s1.x);
- if (y != NULL)
+ if (y != nullptr)
*y = p0Y + (t * s1.y);
return true;
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 13f45e815ba..4d6bb9478b2 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -41,7 +41,7 @@ void LoadingScreen::load() {
if (nodeValid(node)) {
if (nodeValid("screens", node)) {
rapidxml::xml_node<char> *scrnode = node->first_node("screens");
- for (auto n = scrnode->first_node("screen"); n != NULL; n = n->next_sibling("screen"))
+ for (auto n = scrnode->first_node("screen"); n != nullptr; n = n->next_sibling("screen"))
_screen.push_back(n);
}
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index bf106f95794..bb04c66382f 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -34,7 +34,7 @@
namespace Crab {
PathfindingAgent::PathfindingAgent(void) : _nodeQueue(compareNodes) {
- _grid = NULL;
+ _grid = nullptr;
_destinationSet = false;
_destinationReachable = false;
@@ -72,7 +72,7 @@ void PathfindingAgent::setDestination(Vector2f d) {
}
void PathfindingAgent::setDestination(Vector2f d, bool r) {
- if (_grid == NULL)
+ if (_grid == nullptr)
return;
_destination = d;
@@ -244,20 +244,20 @@ void PathfindingAgent::reset() {
_solutionFound = false;
- _goalTile = NULL;
- _startTile = NULL;
+ _goalTile = nullptr;
+ _startTile = nullptr;
}
void PathfindingAgent::shutdown() {
reset();
- _grid = NULL;
+ _grid = nullptr;
}
Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getSolution(PathfindingGraphNode *destNode) const {
Common::Array<PathfindingGraphNode const *> temp;
- PlannerNode *current = NULL;
+ PlannerNode *current = nullptr;
if (_createdList.find(_goalTile) != _createdList.end()) {
current = _createdList.find(_goalTile)->second;
@@ -265,7 +265,7 @@ Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getSolution(
// If the dest node passed in is not null, that means we did not reach the goal but came close
// so we should start with that node instead when we are constructing our path
- else if (destNode != NULL) {
+ else if (destNode != nullptr) {
current = _createdList.find(destNode)->second;
}
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 118ebd9eb39..3e5d4d99be4 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -51,9 +51,9 @@ public:
PathfindingGraphNode *_location;
PlannerNode() {
- _location = NULL;
- _parent = NULL;
- _child = NULL;
+ _location = nullptr;
+ _parent = nullptr;
+ _child = nullptr;
_cost = 0;
_finalCost = 0;
_givenCost = 0;
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index bc70069a0ba..ff0dcd026bf 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -222,7 +222,7 @@ Common::Array<PathfindingGraphNode *> PathfindingGrid::cornerCheck(const Pathfin
for (auto iter : node1->_neighborNodes) {
for (auto iter2 : node2->_neighborNodes) {
if (iter == iter2 && iter->_movementCost < 0) {
- if (returnNodes.size() == 0 || (*(Common::find(returnNodes.begin(), returnNodes.end(), iter))) == NULL)
+ if (returnNodes.size() == 0 || (*(Common::find(returnNodes.begin(), returnNodes.end(), iter))) == nullptr)
returnNodes.push_back(iter);
}
}
@@ -237,7 +237,7 @@ PathfindingGraphNode *PathfindingGrid::getNearestOpenNode(Vector2f nodePos, Vect
if (startNode->getMovementCost() > 0) // If the clicked node is open, we're done!
return startNode;
- PathfindingGraphNode *returnNode = NULL;
+ PathfindingGraphNode *returnNode = nullptr;
float shortestDistance = 0.0f;
@@ -268,7 +268,7 @@ PathfindingGraphNode *PathfindingGrid::getNearestOpenNode(Vector2f nodePos, Vect
}
}
- if (returnNode != NULL) // If a node has been found, we are done. We don't want to continue iterating through neighbors since it would take us further from the clicked node.
+ if (returnNode != nullptr) // If a node has been found, we are done. We don't want to continue iterating through neighbors since it would take us further from the clicked node.
return returnNode;
checkNodes.pop_front();
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 32076ff326b..abcde9f6b51 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -69,7 +69,7 @@ void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
_point.clear();
rapidxml::xml_node<char> *polynode = node->first_node("polygon");
- if (polynode != NULL) {
+ if (polynode != nullptr) {
Common::String points, x, y;
loadStr(points, "points", polynode);
diff --git a/engines/crab/TMX/TMXLayer.cpp b/engines/crab/TMX/TMXLayer.cpp
index 9b046ec89d5..cbac1efb95b 100644
--- a/engines/crab/TMX/TMXLayer.cpp
+++ b/engines/crab/TMX/TMXLayer.cpp
@@ -47,7 +47,7 @@ bool MapLayer::load(const Common::String &path, rapidxml::xml_node<char> *node)
_type = LAYER_IMAGE;
rapidxml::xml_node<char> *imgnode = node->first_node("image");
- if (imgnode->first_attribute("source") != NULL)
+ if (imgnode->first_attribute("source") != nullptr)
_img.load((path + imgnode->first_attribute("source")->value()));
} else {
_type = LAYER_NORMAL;
@@ -55,7 +55,7 @@ bool MapLayer::load(const Common::String &path, rapidxml::xml_node<char> *node)
Common::Array<TileInfo> t;
//.tmx stores tiles row-first
- for (auto n = node->first_node("data")->first_node("tile"); n != NULL; n = n->next_sibling("tile")) {
+ for (auto n = node->first_node("data")->first_node("tile"); n != nullptr; n = n->next_sibling("tile")) {
t.push_back(n);
if (++i >= _w) {
@@ -71,7 +71,7 @@ bool MapLayer::load(const Common::String &path, rapidxml::xml_node<char> *node)
// The rate of scrolling of the layer, used for parallax scrolling
if (nodeValid("properties", node, false)) {
Common::String n, v;
- for (auto p = node->first_node("properties")->first_node("property"); p != NULL; p = p->next_sibling("property")) {
+ for (auto p = node->first_node("properties")->first_node("property"); p != nullptr; p = p->next_sibling("property")) {
if (loadStr(n, "name", p) && loadStr(v, "value", p)) {
if (n == "prop" && v == "true")
_type = LAYER_PROP;
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 93a8f38fff3..c20ad2b7245 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -107,7 +107,7 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
// We need to cycle through all tile and object layers in order to
// see the level at which the sprites will be drawn
- for (auto groupnode = node->first_node(); groupnode != NULL; groupnode = groupnode->next_sibling()) {
+ for (auto groupnode = node->first_node(); groupnode != nullptr; groupnode = groupnode->next_sibling()) {
// Store the name for easy comparison
Common::String name = groupnode->name();
@@ -131,22 +131,22 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
Common::String groupName;
loadStr(groupName, "name", groupnode);
if (groupName == "exit") {
- for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
+ for (auto n = groupnode->first_node("object"); n != nullptr; n = n->next_sibling("object")) {
pyrodactyl::level::Exit le(n);
_areaExit.push_back(le);
}
} else if (groupName == "walk") {
auto n = groupnode->first_node("object");
- if (n != NULL)
+ if (n != nullptr)
_areaWalk.load(n, true, "x", "y", "width", "height");
} else if (groupName == "no_walk") {
- for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
+ for (auto n = groupnode->first_node("object"); n != nullptr; n = n->next_sibling("object")) {
Shape s;
s.load(n);
_areaNowalk.push_back(s);
}
} else if (groupName == "trigger") {
- for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
+ for (auto n = groupnode->first_node("object"); n != nullptr; n = n->next_sibling("object")) {
Shape s;
s.load(n);
@@ -159,13 +159,13 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
_areaTrig[pos] = s;
}
} else if (groupName == "stairs") {
- for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
+ for (auto n = groupnode->first_node("object"); n != nullptr; n = n->next_sibling("object")) {
pyrodactyl::level::Stairs s;
s.load(n);
_areaStairs.push_back(s);
}
} else if (groupName == "music") {
- for (auto n = groupnode->first_node("object"); n != NULL; n = n->next_sibling("object")) {
+ for (auto n = groupnode->first_node("object"); n != nullptr; n = n->next_sibling("object")) {
pyrodactyl::level::MusicArea ma;
ma.load(n);
_areaMusic.push_back(ma);
@@ -187,13 +187,13 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
// void TMXMap::LoadPath(rapidxml::xml_node<char> *node)
//{
// int pos = 0;
-// for (auto n = node->first_node("object"); n != NULL; n = n->next_sibling("object"), ++pos)
+// for (auto n = node->first_node("object"); n != nullptr; n = n->next_sibling("object"), ++pos)
// {
// Vector2i start;
// start.load(n);
//
// rapidxml::xml_node<char> *linenode = n->first_node("polyline");
-// if (linenode != NULL)
+// if (linenode != nullptr)
// {
// Common::String points, x, y;
// loadStr(points, "points", linenode);
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 4b9a7049e53..fa077ad224e 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -74,7 +74,7 @@ void TileSetGroup::reset() {
void TileSetGroup::load(const Common::String &path, rapidxml::xml_node<char> *node) {
reset();
- for (auto n = node->first_node("tileset"); n != NULL; n = n->next_sibling("tileset")) {
+ for (auto n = node->first_node("tileset"); n != nullptr; n = n->next_sibling("tileset")) {
TileSet t;
t.load(path, n);
_tileset.push_back(t);
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index 73bc7a3e85d..a5ab03c618f 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -50,7 +50,7 @@ void XMLDoc::load(const Common::String &filename) {
}
const rapidxml::xml_document<> *XMLDoc::doc() const {
- if (_text != NULL)
+ if (_text != nullptr)
return &_doc;
else
return NULL;
diff --git a/engines/crab/XMLDoc.h b/engines/crab/XMLDoc.h
index d51ca6c7381..692bcfa1a8e 100644
--- a/engines/crab/XMLDoc.h
+++ b/engines/crab/XMLDoc.h
@@ -42,11 +42,11 @@ class XMLDoc {
public:
XMLDoc() {
- _text = NULL;
+ _text = nullptr;
}
XMLDoc(const Common::String &filename) {
- _text = NULL;
+ _text = nullptr;
load(filename);
}
@@ -65,7 +65,7 @@ public:
// Check if document is ready for parsing
bool ready() const {
- return _text != NULL;
+ return _text != nullptr;
}
const rapidxml::xml_document<> *doc() const;
diff --git a/engines/crab/ai/movement.cpp b/engines/crab/ai/movement.cpp
index 7e57ef99ca6..5defe07fa8d 100644
--- a/engines/crab/ai/movement.cpp
+++ b/engines/crab/ai/movement.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::ai;
void MovementSet::load(rapidxml::xml_node<char> *node) {
_enabled = true;
loadBool(_repeat, "repeat", node);
- for (auto n = node->first_node("walk"); n != NULL; n = n->next_sibling("walk"))
+ for (auto n = node->first_node("walk"); n != nullptr; n = n->next_sibling("walk"))
_path.push_back(n);
}
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index 7cd5e8fd029..c9811642da0 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -52,7 +52,7 @@ void PopUp::load(rapidxml::xml_node<char> *node) {
_visible.load(node);
_effect.clear();
- for (rapidxml::xml_node<char> *n = node->first_node("effect"); n != NULL; n = n->next_sibling("effect")) {
+ for (rapidxml::xml_node<char> *n = node->first_node("effect"); n != nullptr; n = n->next_sibling("effect")) {
Effect e;
e.load(n);
_effect.push_back(e);
@@ -61,7 +61,7 @@ void PopUp::load(rapidxml::xml_node<char> *node) {
void PopUpCollection::load(rapidxml::xml_node<char> *node) {
loadBool(_loop, "loop", node);
- for (auto n = node->first_node("dialog"); n != NULL; n = n->next_sibling("dialog"))
+ for (auto n = node->first_node("dialog"); n != nullptr; n = n->next_sibling("dialog"))
_element.push_back(n);
}
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index bd32a54fa16..d90d398f34e 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -37,7 +37,7 @@ using namespace pyrodactyl::anim;
Animation::Animation(rapidxml::xml_node<char> *node) {
loadNum(_length, "length", node);
- for (auto n = node->first_node("frame"); n != NULL; n = n->next_sibling("frame"))
+ for (auto n = node->first_node("frame"); n != nullptr; n = n->next_sibling("frame"))
_frame.push_back(n);
}
diff --git a/engines/crab/animation/animframe.cpp b/engines/crab/animation/animframe.cpp
index 1a2b7e06515..2e9ca8550b6 100644
--- a/engines/crab/animation/animframe.cpp
+++ b/engines/crab/animation/animframe.cpp
@@ -79,7 +79,7 @@ void AnimationFrames::load(rapidxml::xml_node<char> *node) {
if (nodeValid("frames", node)) {
_frame.clear();
rapidxml::xml_node<char> *framenode = node->first_node("frames");
- for (auto n = framenode->first_node("frame"); n != NULL; n = n->next_sibling("frame")) {
+ for (auto n = framenode->first_node("frame"); n != nullptr; n = n->next_sibling("frame")) {
AnimFrame af;
af.load(n, _boxV, _repeat, _anchor.x, _anchor.y);
_frame.push_back(af);
diff --git a/engines/crab/animation/fightanim.cpp b/engines/crab/animation/fightanim.cpp
index 9988362d79a..cc50e97b929 100644
--- a/engines/crab/animation/fightanim.cpp
+++ b/engines/crab/animation/fightanim.cpp
@@ -75,7 +75,7 @@ void FightAnimFrames::load(rapidxml::xml_node<char> *node) {
if (nodeValid("frames", node)) {
_frame.clear();
rapidxml::xml_node<char> *framenode = node->first_node("frames");
- for (auto n = framenode->first_node("frame"); n != NULL; n = n->next_sibling("frame")) {
+ for (auto n = framenode->first_node("frame"); n != nullptr; n = n->next_sibling("frame")) {
FightAnimFrame faf;
faf.load(n, _boxV, _repeat, _anchor.x, _anchor.y);
_frame.push_back(faf);
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 8449ed95a4f..3a628d6db59 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -53,7 +53,7 @@ FightMoves::FightMoves() {
// Purpose: Load from file
//------------------------------------------------------------------------
void FightMoves::load(rapidxml::xml_node<char> *node) {
- for (auto n = node->first_node("move"); n != NULL; n = n->next_sibling("move")) {
+ for (auto n = node->first_node("move"); n != nullptr; n = n->next_sibling("move")) {
FightMove fm;
fm.load(n);
_move.push_back(fm);
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 4bcc87b36d7..0883e1fedac 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -39,7 +39,7 @@ void App::run() {
bool shouldChangeState = true;
// Set the current game state object
- GameState *currentState = NULL;
+ GameState *currentState = nullptr;
Timer fps;
Common::Event e;
int fpscount = 0, fpsval = 1, lasts = 0;
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index fffe7000cf6..7511f6d7b0c 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -85,11 +85,11 @@ void EventSeqGroup::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<
}
void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
- for (rapidxml::xml_node<char> *i = node->first_node("end"); i != NULL; i = i->next_sibling("end"))
+ for (rapidxml::xml_node<char> *i = node->first_node("end"); i != nullptr; i = i->next_sibling("end"))
endSeq(stringToNumber<unsigned int>(i->value()));
- for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set"))
- if (n->first_attribute("name") != NULL) {
+ for (auto n = node->first_node("set"); n != nullptr; n = n->next_sibling("set"))
+ if (n->first_attribute("name") != nullptr) {
unsigned int id = stringToNumber<unsigned int>(n->first_attribute("name")->value());
if (_seq.contains(id))
_seq[id].loadState(n);
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 483d20528e3..a66b906c2b0 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -42,7 +42,7 @@ void EventSequence::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("events");
- for (auto n = node->first_node("event"); n != NULL; n = n->next_sibling("event")) {
+ for (auto n = node->first_node("event"); n != nullptr; n = n->next_sibling("event")) {
GameEvent e(n);
_events.push_back(e);
}
@@ -133,11 +133,11 @@ void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
//------------------------------------------------------------------------
void EventSequence::loadState(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *curid = node->first_attribute("current");
- if (curid != NULL)
+ if (curid != nullptr)
_cur = stringToNumber<unsigned int>(curid->value());
_next.clear();
- for (auto n = node->first_node("next"); n != NULL; n = n->next_sibling("next"))
+ for (auto n = node->first_node("next"); n != nullptr; n = n->next_sibling("next"))
_next.push_back(stringToNumber<unsigned int>(n->value()));
if (_next.empty())
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 4a86fcdeaae..a345de6e697 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -62,7 +62,7 @@ void Info::load(rapidxml::xml_node<char> *node) {
loadNum(OPINION_MIN, "op_min", cnode);
loadNum(OPINION_MAX, "op_max", cnode);
- for (auto n = cnode->first_node("group"); n != NULL; n = n->next_sibling("group"))
+ for (auto n = cnode->first_node("group"); n != nullptr; n = n->next_sibling("group"))
loadPeople(n->value());
}
}
@@ -85,7 +85,7 @@ void Info::loadPeople(const Common::String &filename) {
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("people");
if (nodeValid(node)) {
- for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
+ for (auto n = node->first_node(); n != nullptr; n = n->next_sibling()) {
Common::String str;
loadStr(str, "id", n);
_people[str].load(n, _stem);
@@ -359,10 +359,10 @@ void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
}
void Info::loadState(rapidxml::xml_node<char> *node) {
- for (rapidxml::xml_node<char> *v = node->first_node("var"); v != NULL; v = v->next_sibling("var"))
+ for (rapidxml::xml_node<char> *v = node->first_node("var"); v != nullptr; v = v->next_sibling("var"))
_var[v->first_attribute("id")->value()] = stringToNumber<int>(v->first_attribute("val")->value());
- for (rapidxml::xml_node<char> *p = node->first_node("object"); p != NULL; p = p->next_sibling("object")) {
+ for (rapidxml::xml_node<char> *p = node->first_node("object"); p != nullptr; p = p->next_sibling("object")) {
Common::String id;
loadStr(id, "id", p);
_people[id].loadState(p);
diff --git a/engines/crab/event/conversationdata.cpp b/engines/crab/event/conversationdata.cpp
index add2784bb28..cf4752803f5 100644
--- a/engines/crab/event/conversationdata.cpp
+++ b/engines/crab/event/conversationdata.cpp
@@ -43,12 +43,12 @@ void ReplyChoice::load(rapidxml::xml_node<char> *node) {
_unlock.load(node->first_node("unlock"));
if (nodeValid("change", node, false))
- for (auto n = node->first_node("change"); n != NULL; n = n->next_sibling("change"))
+ for (auto n = node->first_node("change"); n != nullptr; n = n->next_sibling("change"))
_change.push_back(n);
}
void ConversationData::load(rapidxml::xml_node<char> *node) {
- for (auto n = node->first_node("reply"); n != NULL; n = n->next_sibling("reply"))
+ for (auto n = node->first_node("reply"); n != nullptr; n = n->next_sibling("reply"))
_reply.push_back(n);
}
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index c4b7ebe70e0..38f62134a9c 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -57,13 +57,13 @@ void GameEventStore::load(const Common::String &filename) {
if (nodeValid("animations", node)) {
rapidxml::xml_node<char> *animnode = node->first_node("animations");
- for (auto n = animnode->first_node("anim"); n != NULL; n = n->next_sibling("anim"))
+ for (auto n = animnode->first_node("anim"); n != nullptr; n = n->next_sibling("anim"))
_anim.push_back(n);
}
if (nodeValid("tones", node)) {
rapidxml::xml_node<char> *tonenode = node->first_node("tones");
- for (auto n = tonenode->first_node("tone"); n != NULL; n = n->next_sibling("tone")) {
+ for (auto n = tonenode->first_node("tone"); n != nullptr; n = n->next_sibling("tone")) {
ToneData dat;
loadStr(dat._text, "text", n);
_tone.push_back(dat);
@@ -72,13 +72,13 @@ void GameEventStore::load(const Common::String &filename) {
if (nodeValid("images", node)) {
rapidxml::xml_node<char> *imgnode = node->first_node("images");
- for (auto n = imgnode->first_node("img"); n != NULL; n = n->next_sibling("img"))
+ for (auto n = imgnode->first_node("img"); n != nullptr; n = n->next_sibling("img"))
_img.push_back(n);
}
if (nodeValid("traits", node)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
- for (auto n = traitnode->first_node("trait"); n != NULL; n = n->next_sibling("trait"))
+ for (auto n = traitnode->first_node("trait"); n != nullptr; n = n->next_sibling("trait"))
_trait.push_back(n);
}
}
diff --git a/engines/crab/event/gameevent.cpp b/engines/crab/event/gameevent.cpp
index 99a6d89d17e..ca76d44d20f 100644
--- a/engines/crab/event/gameevent.cpp
+++ b/engines/crab/event/gameevent.cpp
@@ -76,12 +76,12 @@ void GameEvent::load(rapidxml::xml_node<char> *node) {
_trig.load(node);
_next.clear();
- for (rapidxml::xml_node<char> *i = node->first_node("next"); i != NULL; i = i->next_sibling("next"))
- if (i->first_attribute("id") != NULL)
+ for (rapidxml::xml_node<char> *i = node->first_node("next"); i != nullptr; i = i->next_sibling("next"))
+ if (i->first_attribute("id") != nullptr)
_next.push_back(stringToNumber<EventID>(i->first_attribute("id")->value()));
_effect.clear();
- for (rapidxml::xml_node<char> *it = node->first_node("effect"); it != NULL; it = it->next_sibling("effect")) {
+ for (rapidxml::xml_node<char> *it = node->first_node("effect"); it != nullptr; it = it->next_sibling("effect")) {
Effect e;
e.load(it);
_effect.push_back(e);
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 991b0d4d61c..27befcd049e 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -55,11 +55,11 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
XMLDoc conf(node->first_attribute("list")->value());
if (conf.ready()) {
rapidxml::xml_node<char> *lnode = conf.doc()->first_node("event_list");
- for (rapidxml::xml_node<char> *loc = lnode->first_node("loc"); loc != NULL; loc = loc->next_sibling("loc")) {
+ for (rapidxml::xml_node<char> *loc = lnode->first_node("loc"); loc != nullptr; loc = loc->next_sibling("loc")) {
Common::String locName;
loadStr(locName, "name", loc);
- for (auto n = loc->first_node("file"); n != NULL; n = n->next_sibling("file")) {
+ for (auto n = loc->first_node("file"); n != nullptr; n = n->next_sibling("file")) {
unsigned int id;
Common::String path;
loadNum(id, "name", n);
@@ -422,8 +422,8 @@ void Manager::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
// Purpose: Load the state of the object
//------------------------------------------------------------------------
void Manager::loadState(rapidxml::xml_node<char> *node) {
- for (auto n = node->first_node("loc"); n != NULL; n = n->next_sibling("loc")) {
- if (n->first_attribute("name") != NULL) {
+ for (auto n = node->first_node("loc"); n != nullptr; n = n->next_sibling("loc")) {
+ if (n->first_attribute("name") != nullptr) {
Common::String name = n->first_attribute("name")->value();
if (_eventMap.contains(name))
_eventMap[name].loadState(n);
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index 926ffa563c9..644313074cf 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -45,7 +45,7 @@ void Quest::loadState(rapidxml::xml_node<char> *node) {
loadBool(_unread, "unread", node);
loadBool(_marker, "marker", node);
- for (rapidxml::xml_node<char> *n = node->first_node("info"); n != NULL; n = n->next_sibling("info"))
+ for (rapidxml::xml_node<char> *n = node->first_node("info"); n != nullptr; n = n->next_sibling("info"))
_text.push_back(n->value());
}
diff --git a/engines/crab/event/triggerset.cpp b/engines/crab/event/triggerset.cpp
index d4ca418fb0b..b75b3cd7a51 100644
--- a/engines/crab/event/triggerset.cpp
+++ b/engines/crab/event/triggerset.cpp
@@ -36,7 +36,7 @@ namespace Crab {
using namespace pyrodactyl::event;
void TriggerSet::load(rapidxml::xml_node<char> *node) {
- for (rapidxml::xml_node<char> *n = node->first_node("trigger"); n != NULL; n = n->next_sibling("trigger")) {
+ for (rapidxml::xml_node<char> *n = node->first_node("trigger"); n != nullptr; n = n->next_sibling("trigger")) {
Trigger t(n);
_statement.push_back(t);
}
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index bbc17e90f56..6b72b9fec94 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -36,13 +36,13 @@ bool fileOpen(const Common::Path &path, char *&data) {
if (path.empty())
return false;
- if (data != NULL)
+ if (data != nullptr)
delete[] data;
Common::File file;
if (!file.open(path)) {
warning("Unable to open file %s", path.toString().c_str());
- data = NULL;
+ data = nullptr;
return false;
}
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 04faedce945..f59486edc4d 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -81,7 +81,7 @@ bool Image::load(const Common::String &path) {
}
bool Image::load(rapidxml::xml_node<char> *node, const char *name) {
- if (node->first_attribute(name) != NULL)
+ if (node->first_attribute(name) != nullptr)
return load(node->first_attribute(name)->value());
return false;
@@ -122,14 +122,14 @@ bool Image::load(const Image &image, Rect *clip, const TextureFlipType &flip) {
void Image::draw(const int &x, const int &y, Common::Rect *clip, const TextureFlipType &flip) {
Common::Rect srcRect;
- if (clip != NULL) {
+ if (clip != nullptr) {
srcRect = *clip;
} else {
srcRect = Common::Rect(x, y, _w + x, _h + y);
}
Common::Rect destRect(x, y, _w + x, _h + y);
- if (clip != NULL) {
+ if (clip != nullptr) {
destRect.right = clip->right;
destRect.bottom = clip->bottom;
}
@@ -187,7 +187,7 @@ Graphics::Surface* Image::rotate(const Graphics::ManagedSurface &src, ImageRotat
}
void Image::draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip, Graphics::ManagedSurface *surf) {
- if (surf == NULL)
+ if (surf == nullptr)
surf = g_engine->_screen;
Common::Rect srcRect(0, 0, _w, _h);
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 220b0fee99f..b77f1c08c8a 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -100,9 +100,9 @@ public:
// Draw the openGL texture
- void draw(const int &x, const int &y, Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
- void draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE, Graphics::ManagedSurface *surf = NULL);
- void fastDraw(const int &x, const int &y, Rect *clip = NULL);
+ void draw(const int &x, const int &y, Common::Rect *clip = nullptr, const TextureFlipType &flip = FLIP_NONE);
+ void draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE, Graphics::ManagedSurface *surf = nullptr);
+ void fastDraw(const int &x, const int &y, Rect *clip = nullptr);
// Delete the openGL texture
void deleteImage();
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 8c2f75075b2..27520788704 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -51,7 +51,7 @@ void ImageManager::loadMap(const Common::String &filename, const MapID &mapid) {
XMLDoc imageList(filename);
if (imageList.ready()) {
rapidxml::xml_node<char> *node = imageList.doc()->first_node("res");
- for (auto n = node->first_node("image"); n != NULL; n = n->next_sibling("image")) {
+ for (auto n = node->first_node("image"); n != nullptr; n = n->next_sibling("image")) {
ImageKey key;
if (loadImgKey(key, "name", n)) {
// Load different images depending on image quality setting
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index e9fdb48694f..a1fb31b4f29 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -104,7 +104,7 @@ public:
bool validTexture(const ImageKey &id);
void draw(const int &x, const int &y, const ImageKey &id,
- Common::Rect *clip = NULL, const TextureFlipType &flip = FLIP_NONE);
+ Common::Rect *clip = nullptr, const TextureFlipType &flip = FLIP_NONE);
void draw(const int &x, const int &y, const ImageKey &id,
Rect *clip, const TextureFlipType &flip = FLIP_NONE);
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 59c13e53f0b..11ab7f11d24 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -161,7 +161,7 @@ void InputManager::load(const Common::String &filename) {
loadNum(_version, "version", node);
// int i = 0;
- // for (auto n = node->first_node(); n != NULL && i < IT_TOTAL; n = n->next_sibling(), ++i)
+ // for (auto n = node->first_node(); n != nullptr && i < IT_TOTAL; n = n->next_sibling(), ++i)
// _iv[i].loadState(n);
}
}
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index c305a6a1d8e..60af37c9bce 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -50,7 +50,7 @@ void Item::load(rapidxml::xml_node<char> *node) {
loadImgKey(_img, "img", node);
_bonus.clear();
- for (auto n = node->first_node("bonus"); n != NULL; n = n->next_sibling("bonus")) {
+ for (auto n = node->first_node("bonus"); n != nullptr; n = n->next_sibling("bonus")) {
Bonus b;
b.load(n);
_bonus.push_back(b);
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 3a766b63b71..6c25840eddd 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -115,7 +115,7 @@ bool ItemCollection::has(const Common::String &charId, const Common::String &con
// Purpose: Load items from save file
//------------------------------------------------------------------------
void ItemCollection::loadState(rapidxml::xml_node<char> *node) {
- for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
+ for (auto n = node->first_node(); n != nullptr; n = n->next_sibling()) {
// Add all characters in the save file, whether we have them in the inventory or not
init(n->name());
_item[n->name()].loadState(n);
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 1bf7f3a4a33..9ac6e41d1f9 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -57,7 +57,7 @@ void ItemMenu::init(const ItemSlot &ref, const Vector2i &inc, const unsigned int
//------------------------------------------------------------------------
void ItemMenu::loadState(rapidxml::xml_node<char> *node) {
unsigned int count = 0;
- for (auto n = node->first_node(); n != NULL && count < _element.size(); n = n->next_sibling(), ++count)
+ for (auto n = node->first_node(); n != nullptr && count < _element.size(); n = n->next_sibling(), ++count)
_element[count].loadState(n);
}
diff --git a/engines/crab/item/ItemSlot.cpp b/engines/crab/item/ItemSlot.cpp
index 5212c398e24..6c956bb4408 100644
--- a/engines/crab/item/ItemSlot.cpp
+++ b/engines/crab/item/ItemSlot.cpp
@@ -45,7 +45,7 @@ using namespace pyrodactyl::people;
void ItemSlot::load(rapidxml::xml_node<char> *node) {
StateButton::load(node);
- if (node->first_attribute("slot") == NULL)
+ if (node->first_attribute("slot") == nullptr)
_noType = true;
else {
loadStr(_itemType, "slot", node);
diff --git a/engines/crab/level/LevelExit.cpp b/engines/crab/level/LevelExit.cpp
index bfb31017948..a65aa7a3e45 100644
--- a/engines/crab/level/LevelExit.cpp
+++ b/engines/crab/level/LevelExit.cpp
@@ -40,7 +40,7 @@ void Exit::load(rapidxml::xml_node<char> *node) {
if (nodeValid("properties", node)) {
rapidxml::xml_node<char> *propertynode = node->first_node("properties");
- for (auto n = propertynode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
+ for (auto n = propertynode->first_node("property"); n != nullptr; n = n->next_sibling("property")) {
Common::String nodeName;
loadStr(nodeName, "name", n);
if (nodeName == "entry_x") {
diff --git a/engines/crab/level/MusicArea.cpp b/engines/crab/level/MusicArea.cpp
index 63cbcfc4914..2445cf4c762 100644
--- a/engines/crab/level/MusicArea.cpp
+++ b/engines/crab/level/MusicArea.cpp
@@ -39,7 +39,7 @@ void MusicArea::load(rapidxml::xml_node<char> *node, const bool &echo) {
if (nodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
- for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
+ for (auto n = pnode->first_node("property"); n != nullptr; n = n->next_sibling("property")) {
Common::String name;
if (loadStr(name, "name", n, echo)) {
if (name == "music")
diff --git a/engines/crab/level/Stairs.cpp b/engines/crab/level/Stairs.cpp
index 59f4ed6c512..678cd8da27d 100644
--- a/engines/crab/level/Stairs.cpp
+++ b/engines/crab/level/Stairs.cpp
@@ -39,7 +39,7 @@ void Stairs::load(rapidxml::xml_node<char> *node, const bool &echo) {
if (nodeValid("properties", node, echo)) {
auto pnode = node->first_node("properties");
- for (auto n = pnode->first_node("property"); n != NULL; n = n->next_sibling("property")) {
+ for (auto n = pnode->first_node("property"); n != nullptr; n = n->next_sibling("property")) {
Common::String name;
if (loadStr(name, "name", n, echo)) {
if (name == "x")
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index fed1ffbec89..7e2d4f9f40e 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -91,7 +91,7 @@ void Level::think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event
// Only bother if the sprite is visible
if (i->visible()) {
// TODO: Find a place where this should be initialized... (SZ)
- if (i->_pathing._grid == NULL)
+ if (i->_pathing._grid == nullptr)
i->_pathing.initialize(&_pathfindingGrid);
// If a sprite is dead, nothing else matters
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 7d3fa310879..624ee84d239 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -98,7 +98,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
if (nodeValid("sprites", node)) {
rapidxml::xml_node<char> *spritenode = node->first_node("sprites");
int count = 0;
- for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling(), ++count) {
+ for (auto n = spritenode->first_node(); n != nullptr; n = n->next_sibling(), ++count) {
Sprite s;
s.load(n, _animSet);
@@ -117,7 +117,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
if (nodeValid("background", node)) {
rapidxml::xml_node<char> *spritenode = node->first_node("background");
- for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling()) {
+ for (auto n = spritenode->first_node(); n != nullptr; n = n->next_sibling()) {
Sprite s;
s.load(n, _animSet);
_background.push_back(s);
@@ -128,7 +128,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
if (nodeValid("fly", node)) {
rapidxml::xml_node<char> *spritenode = node->first_node("fly");
- for (auto n = spritenode->first_node(); n != NULL; n = n->next_sibling()) {
+ for (auto n = spritenode->first_node(); n != nullptr; n = n->next_sibling()) {
Sprite s;
s.load(n, _animSet);
@@ -142,7 +142,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
if (nodeValid("movement", node)) {
rapidxml::xml_node<char> *movnode = node->first_node("movement");
- for (auto n = movnode->first_node("set"); n != NULL; n = n->next_sibling("set"))
+ for (auto n = movnode->first_node("set"); n != nullptr; n = n->next_sibling("set"))
_moveSet.push_back(n);
}
@@ -178,7 +178,7 @@ void Level::loadMoves(const Common::String &filename) {
XMLDoc movList(filename);
if (movList.ready()) {
rapidxml::xml_node<char> *node = movList.doc()->first_node("movelist");
- for (auto n = node->first_node("set"); n != NULL; n = n->next_sibling("set")) {
+ for (auto n = node->first_node("set"); n != nullptr; n = n->next_sibling("set")) {
unsigned int pos = _animSet.size();
loadNum(pos, "id", n);
@@ -228,7 +228,7 @@ void Level::loadState(rapidxml::xml_node<char> *node) {
loadNum(_playerIndex, "player_index", node);
auto i = _objects.begin();
- for (auto *n = node->first_node("sprite"); n != NULL && i != _objects.end(); n = n->next_sibling("sprite"), ++i)
+ for (auto *n = node->first_node("sprite"); n != nullptr && i != _objects.end(); n = n->next_sibling("sprite"), ++i)
i->loadState(n);
}
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 589ca4e28eb..92215365953 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -33,7 +33,7 @@
namespace Crab {
bool nodeValid(rapidxml::xml_node<char> *node, const bool &echo) {
- if (node == NULL) {
+ if (node == nullptr) {
/*if (echo)
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", "node not found", NULL);*/
@@ -44,14 +44,14 @@ bool nodeValid(rapidxml::xml_node<char> *node, const bool &echo) {
}
bool nodeValid(const Common::String &name, rapidxml::xml_node<char> *parentNode, const bool &echo) {
- if (parentNode == NULL) {
+ if (parentNode == nullptr) {
/*if (echo)
{
Common::String error_msg = "parent node of " + name + " not found \n";
SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
}*/
return false;
- } else if (parentNode->first_node(name.c_str()) == NULL) {
+ } else if (parentNode->first_node(name.c_str()) == nullptr) {
/*if (echo)
{
Common::String error_msg = "child node " + name + " of parent node " + parent_node->name() + " not found \n";
@@ -64,7 +64,7 @@ bool nodeValid(const Common::String &name, rapidxml::xml_node<char> *parentNode,
}
bool loadStr(Common::String &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo) {
- if (node->first_attribute(name.c_str()) != NULL)
+ if (node->first_attribute(name.c_str()) != nullptr)
val = node->first_attribute(name.c_str())->value();
else {
/*if (echo)
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 1b229d3ef95..5d521737695 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -50,7 +50,7 @@ bool loadStr(Common::String &val, const Common::String &name, rapidxml::xml_node
// Used for loading numerical types
template<typename T>
bool loadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
- if (node->first_attribute(name.c_str()) != NULL)
+ if (node->first_attribute(name.c_str()) != nullptr)
val = stringToNumber<T>(node->first_attribute(name.c_str())->value());
else {
/*if (echo)
@@ -67,7 +67,7 @@ bool loadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node,
// Used for loading enumerator types that are integers
template<typename T>
bool loadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node, const bool &echo = true) {
- if (node->first_attribute(name.c_str()) != NULL)
+ if (node->first_attribute(name.c_str()) != nullptr)
val = static_cast<T>(stringToNumber<int>(node->first_attribute(name.c_str())->value()));
else {
/*if (echo)
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index b0457785195..8b61e6d2d93 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -87,7 +87,7 @@ MainMenu::MainMenu() {
if (nodeValid("lights", snode)) {
rapidxml::xml_node<char> *lnode = snode->first_node("lights");
- for (rapidxml::xml_node<char> *n = lnode->first_node("img"); n != NULL; n = n->next_sibling("img"))
+ for (rapidxml::xml_node<char> *n = lnode->first_node("img"); n != nullptr; n = n->next_sibling("img"))
_lights.push_back(n);
}
}
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 5f47bca7d44..f98c18f0673 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -64,9 +64,9 @@ void MusicManager::playMusic(const MusicKey &id) {
XMLDoc trackList(g_engine->_filePath->_soundMusic);
if (trackList.ready()) {
rapidxml::xml_node<char> *node = trackList.doc()->first_node("music");
- for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
+ for (auto n = node->first_node(); n != nullptr; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *att = n->first_attribute("id");
- if (att != NULL && id == stringToNumber<MusicKey>(att->value())) {
+ if (att != nullptr && id == stringToNumber<MusicKey>(att->value())) {
if (g_system->getMixer()->isSoundHandleActive(*_musicHandle))
g_system->getMixer()->stopHandle(*_musicHandle);
_bg.reset();
@@ -76,7 +76,7 @@ void MusicManager::playMusic(const MusicKey &id) {
}
}
- if (_bg._track != NULL)
+ if (_bg._track != nullptr)
g_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, _musicHandle, _bg._track, (int)_bg._id);
}
}
@@ -136,9 +136,9 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
loadNum(_repInc, "rep_inc", tnode);
loadNum(_repDec, "rep_dec", tnode);
- for (auto n = tnode->first_node(); n != NULL; n = n->next_sibling()) {
+ for (auto n = tnode->first_node(); n != nullptr; n = n->next_sibling()) {
rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
- if (id != NULL && path != NULL) {
+ if (id != nullptr && path != nullptr) {
EffectAudio *audio = new EffectAudio();
audio->_file.open(path->value());
audio->_handle = new Audio::SoundHandle();
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 18ebb51504e..6bc5aff3a1b 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -52,21 +52,21 @@ void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
if (nodeValid("opinion", node))
_opinion.load(node->first_node("opinion"));
- if (node->first_attribute("type") != NULL) {
+ if (node->first_attribute("type") != nullptr) {
Common::String t;
loadStr(t, "type", node);
_type = stringToPersonType(t);
} else
_type = PE_NEUTRAL;
- if (node->first_attribute("state") != NULL) {
+ if (node->first_attribute("state") != nullptr) {
Common::String s;
loadStr(s, "state", node);
_state = stringToPersonState(s);
} else
_state = PST_NORMAL;
- if (node->first_attribute("journal_name") != NULL) {
+ if (node->first_attribute("journal_name") != nullptr) {
loadStr(_journalName, "journal_name", node);
_altJournalName = true;
} else
@@ -74,7 +74,7 @@ void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
if (nodeValid("stats", node)) {
rapidxml::xml_node<char> *statnode = node->first_node("stats");
- if (statnode->first_attribute("template") == NULL) {
+ if (statnode->first_attribute("template") == nullptr) {
_stat.load(statnode);
} else {
int index = 0;
@@ -87,7 +87,7 @@ void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
if (nodeValid("traits", node, false)) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
- for (auto n = traitnode->first_node("trait"); n != NULL; n = n->next_sibling("trait"))
+ for (auto n = traitnode->first_node("trait"); n != nullptr; n = n->next_sibling("trait"))
_trait.push_back(n);
}
}
@@ -145,7 +145,7 @@ void Person::loadState(rapidxml::xml_node<char> *node) {
rapidxml::xml_node<char> *traitnode = node->first_node("traits");
_trait.clear();
- for (auto n = traitnode->first_node("trait"); n != NULL; n = n->next_sibling("trait"))
+ for (auto n = traitnode->first_node("trait"); n != nullptr; n = n->next_sibling("trait"))
_trait.push_back(n);
}
}
diff --git a/engines/crab/stat/StatTemplate.cpp b/engines/crab/stat/StatTemplate.cpp
index af99f56b0ca..f00ffd6f86b 100644
--- a/engines/crab/stat/StatTemplate.cpp
+++ b/engines/crab/stat/StatTemplate.cpp
@@ -40,7 +40,7 @@ void StatTemplates::load(const Common::String &filename) {
XMLDoc conf(filename);
if (conf.ready()) {
rapidxml::xml_node<char> *node = conf.doc()->first_node("templates");
- for (auto n = node->first_node("stats"); n != NULL; n = n->next_sibling("stats"))
+ for (auto n = node->first_node("stats"); n != nullptr; n = n->next_sibling("stats"))
_collection.push_back(n);
}
}
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 54e43a22323..e7613139d29 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -55,13 +55,13 @@ void TextManager::init() {
if (nodeValid(node->first_node("padding")))
_padBg.load(node->first_node("padding"));
- for (auto n = node->first_node("font"); n != NULL; n = n->next_sibling("font")) {
+ for (auto n = node->first_node("font"); n != nullptr; n = n->next_sibling("font")) {
rapidxml::xml_attribute<char> *id, *path, *size;
id = n->first_attribute("id");
path = n->first_attribute("path");
size = n->first_attribute("size");
- if (id != NULL && path != NULL && size != NULL) {
+ if (id != nullptr && path != nullptr && size != nullptr) {
unsigned int pos = stringToNumber<unsigned int>(id->value());
if (_font.size() <= pos)
_font.resize(pos + 1);
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index c59b9f247c0..d8ef53fff93 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -39,7 +39,7 @@ void ColorPool::load(const Common::String &filename) {
XMLDoc colList(filename);
if (colList.ready()) {
rapidxml::xml_node<char> *node = colList.doc()->first_node("colors");
- for (rapidxml::xml_node<char> *n = node->first_node("color"); n != NULL; n = n->next_sibling("color")) {
+ for (rapidxml::xml_node<char> *n = node->first_node("color"); n != nullptr; n = n->next_sibling("color")) {
SDL_Color c;
loadColor(c, n);
_pool.push_back(c);
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index 480550cf12d..52b2b9ddec8 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -54,7 +54,7 @@ public:
void init(const Caption &c, const int &xOffset = 0, const int &yOffset = 0);
- void load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
+ void load(rapidxml::xml_node<char> *node, Rect *parent = nullptr);
void draw(bool selected, const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index b4a4ccdc190..c62168aca62 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -94,7 +94,7 @@ void CreditScreen::load(const Common::String &filename) {
if (nodeValid("text", node)) {
rapidxml::xml_node<char> *tnode = node->first_node("text");
- for (rapidxml::xml_node<char> *n = tnode->first_node(); n != NULL; n = n->next_sibling()) {
+ for (rapidxml::xml_node<char> *n = tnode->first_node(); n != nullptr; n = n->next_sibling()) {
CreditText t;
t._text = n->value();
t._heading = (n->name()[0] == 'h');
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index cb044003e91..b89b748aefe 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -45,7 +45,7 @@ void GameOverMenu::load(rapidxml::xml_node<char> *node) {
rapidxml::xml_node<char> *tinode = node->first_node("title");
_title.load(tinode);
- for (auto n = tinode->first_node("quote"); n != NULL; n = n->next_sibling("quote")) {
+ for (auto n = tinode->first_node("quote"); n != nullptr; n = n->next_sibling("quote")) {
Common::String str;
loadStr(str, "text", n);
_quote.push_back(str);
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index 11f6c3f445c..d60f1f02291 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -39,7 +39,7 @@ void HealthIndicator::load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
loadXY(_x, _y, node);
- for (auto n = node->first_node("img"); n != NULL; n = n->next_sibling("img")) {
+ for (auto n = node->first_node("img"); n != nullptr; n = n->next_sibling("img")) {
HealthImage hi;
loadImgKey(hi._normal, "normal", n);
loadImgKey(hi._glow, "glow", n);
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index 9294ead7d31..ab210748636 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -52,7 +52,7 @@ public:
void init(const HoverInfo &h, const int &xOffset = 0, const int &yOffset = 0);
- void load(rapidxml::xml_node<char> *node, Rect *parent = NULL);
+ void load(rapidxml::xml_node<char> *node, Rect *parent = nullptr);
void draw(const int &xOffset = 0, const int &yOffset = 0);
};
} // End of namespace ui
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index 66132779bd3..a8ab656579c 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -64,7 +64,7 @@ void Inventory::loadItem(const Common::String &charId, const Common::String &id)
XMLDoc itemList(_itemfile);
if (itemList.ready()) {
rapidxml::xml_node<char> *node = itemList.doc()->first_node("items");
- for (auto n = node->first_node("item"); n != NULL; n = n->next_sibling("item")) {
+ for (auto n = node->first_node("item"); n != nullptr; n = n->next_sibling("item")) {
Common::String str = n->first_attribute("id")->value();
if (id == str) {
i.load(n);
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index cba8c1ff3fa..e1cde563656 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -69,7 +69,7 @@ void MapData::loadState(rapidxml::xml_node<char> *node) {
_reveal.clear();
if (nodeValid("clip", node)) {
rapidxml::xml_node<char> *clipnode = node->first_node("clip");
- for (rapidxml::xml_node<char> *n = clipnode->first_node("rect"); n != NULL; n = n->next_sibling("rect")) {
+ for (rapidxml::xml_node<char> *n = clipnode->first_node("rect"); n != nullptr; n = n->next_sibling("rect")) {
Rect r;
r.load(n);
_reveal.push_back(r);
@@ -79,7 +79,7 @@ void MapData::loadState(rapidxml::xml_node<char> *node) {
_dest.clear();
if (nodeValid("dest", node)) {
rapidxml::xml_node<char> *destnode = node->first_node("dest");
- for (rapidxml::xml_node<char> *n = destnode->first_node("pos"); n != NULL; n = n->next_sibling("pos")) {
+ for (rapidxml::xml_node<char> *n = destnode->first_node("pos"); n != nullptr; n = n->next_sibling("pos")) {
MarkerData md;
loadStr(md._name, "name", n);
md._pos.load(n);
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index 9f5dc8e9c75..ea00069703b 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -44,7 +44,7 @@ void OptionSelect::load(rapidxml::xml_node<char> *node) {
_cur = 0;
option._text.clear();
- for (auto n = node->first_node("option"); n != NULL; n = n->next_sibling("option")) {
+ for (auto n = node->first_node("option"); n != nullptr; n = n->next_sibling("option")) {
Common::String s;
loadStr(s, "name", n);
option._text.push_back(s);
diff --git a/engines/crab/ui/ParagraphData.h b/engines/crab/ui/ParagraphData.h
index 20eb82ca376..0abe9fb694b 100644
--- a/engines/crab/ui/ParagraphData.h
+++ b/engines/crab/ui/ParagraphData.h
@@ -45,7 +45,7 @@ public:
ParagraphData() : _line(1, 1) {}
~ParagraphData() {}
- bool load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
+ bool load(rapidxml::xml_node<char> *node, Rect *parent = nullptr, const bool &echo = true);
void draw(const Common::String &val, const int &xOffset = 0, const int &yOffset = 0);
};
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index 37d145ff523..cd0232d7065 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -74,7 +74,7 @@ void PersonHandler::draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameE
// Draw the dialog box background
_dlbox.draw(player);
- if (s != NULL) {
+ if (s != nullptr) {
Rect r = s->dialogClip(event->_state);
int x = _img.x, y = _img.y;
@@ -127,7 +127,7 @@ bool PersonHandler::handleDlboxEvents(const Common::Event &event) {
}
void PersonHandler::internalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s) {
- if (s != NULL)
+ if (s != nullptr)
s->dialogUpdateClip(state);
}
diff --git a/engines/crab/ui/ProgressBar.cpp b/engines/crab/ui/ProgressBar.cpp
index f84659bf96b..80074f1a1cd 100644
--- a/engines/crab/ui/ProgressBar.cpp
+++ b/engines/crab/ui/ProgressBar.cpp
@@ -48,7 +48,7 @@ void ProgressBar::load(rapidxml::xml_node<char> *node) {
if (nodeValid("desc", node)) {
rapidxml::xml_node<char> *descnode = node->first_node("desc");
- for (rapidxml::xml_node<char> *n = descnode->first_node("above"); n != NULL; n = n->next_sibling("above"))
+ for (rapidxml::xml_node<char> *n = descnode->first_node("above"); n != nullptr; n = n->next_sibling("above"))
_ct.push_back(n);
}
}
diff --git a/engines/crab/ui/ResolutionMenu.cpp b/engines/crab/ui/ResolutionMenu.cpp
index d4ca1853f92..901bbf44e05 100644
--- a/engines/crab/ui/ResolutionMenu.cpp
+++ b/engines/crab/ui/ResolutionMenu.cpp
@@ -56,7 +56,7 @@ void ResolutionMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("options", node)) {
int countSlot = 0;
rapidxml::xml_node<char> *resnode = node->first_node("options");
- for (auto n = resnode->first_node("res"); n != NULL; n = n->next_sibling("res"), countSlot++) {
+ for (auto n = resnode->first_node("res"); n != nullptr; n = n->next_sibling("res"), countSlot++) {
Dimension d;
loadNum(d.w, "x", n);
loadNum(d.h, "y", n);
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index a33b7bc1103..0f18b71094f 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -54,7 +54,7 @@ void SlideShow::load(rapidxml::xml_node<char> *node) {
}
_path.clear();
- for (auto n = node->first_node("slide"); n != NULL; n = n->next_sibling("slide")) {
+ for (auto n = node->first_node("slide"); n != nullptr; n = n->next_sibling("slide")) {
Common::String p;
loadStr(p, "path", n);
_path.push_back(p);
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index de0795f4a2a..be131365aca 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -54,7 +54,7 @@ public:
}
~TextData(void) {}
- bool load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
+ bool load(rapidxml::xml_node<char> *node, Rect *parent = nullptr, const bool &echo = true);
// Plain drawing
void draw(const Common::String &val, const int &xOffset = 0, const int &yOffset = 0);
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index a225dc6a8ff..b7a38be269a 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -60,7 +60,7 @@ public:
~ToggleButton() {}
void load(rapidxml::xml_node<char> *node);
- void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
+ void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = nullptr);
ButtonAction handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
};
diff --git a/engines/crab/ui/TraitButton.h b/engines/crab/ui/TraitButton.h
index d32d9fee180..89d3a6aa5f2 100644
--- a/engines/crab/ui/TraitButton.h
+++ b/engines/crab/ui/TraitButton.h
@@ -56,7 +56,7 @@ public:
void init(const TraitButton &ref, const int &xOffset = 0, const int &yOffset = 0);
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
+ void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = nullptr);
void cache(const pyrodactyl::people::Trait &trait);
void empty();
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index f03ff5ad62e..708f9658d32 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -112,7 +112,7 @@ public:
~Button() {}
void reset();
- void setUI(Rect *parent = NULL);
+ void setUI(Rect *parent = nullptr);
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
void init(const Button &ref, const int &xOffset = 0, const int &yOffset = 0);
@@ -129,13 +129,13 @@ public:
return _img;
}
- void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
+ void draw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = nullptr);
ButtonAction handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
// Special functions to only draw parts of a button (used in special situations like world map)
- void imageCaptionOnlyDraw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
- void hoverInfoOnlyDraw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = NULL);
+ void imageCaptionOnlyDraw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = nullptr);
+ void hoverInfoOnlyDraw(const int &xOffset = 0, const int &yOffset = 0, Rect *clip = nullptr);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 6f0c38b341b..7c9ebe4a625 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -61,12 +61,12 @@ void Element::basicload(rapidxml::xml_node<char> *node, const bool &echo) {
void Element::load(rapidxml::xml_node<char> *node, ImageKey img, const bool &echo) {
basicload(node, echo);
- if (node->first_attribute("w") == NULL)
+ if (node->first_attribute("w") == nullptr)
w = g_engine->_imageManager->getTexture(img).w();
else
loadNum(w, "w", node);
- if (node->first_attribute("h") == NULL)
+ if (node->first_attribute("h") == nullptr)
h = g_engine->_imageManager->getTexture(img).h();
else
loadNum(h, "h", node);
@@ -82,7 +82,7 @@ void Element::load(rapidxml::xml_node<char> *node, Rect *parent, const bool &ech
}
void Element::setUI(Rect *parent) {
- if (parent == NULL) {
+ if (parent == nullptr) {
switch (_align.x) {
case ALIGN_CENTER:
x = g_engine->_screenSettings->_cur.w / 2 - w / 2 + _raw.x;
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index f54fef38cd2..0ea9ade4c89 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -74,9 +74,9 @@ public:
void load(rapidxml::xml_node<char> *node, ImageKey img, const bool &echo = true);
// The parent is the object inside which the element exists
- void load(rapidxml::xml_node<char> *node, Rect *parent = NULL, const bool &echo = true);
+ void load(rapidxml::xml_node<char> *node, Rect *parent = nullptr, const bool &echo = true);
- void setUI(Rect *parent = NULL);
+ void setUI(Rect *parent = nullptr);
};
} // End of namespace ui
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 8eb1fef80aa..7f0c7e2a433 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -257,7 +257,7 @@ void Journal::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
void Journal::loadState(rapidxml::xml_node<char> *node) {
_journal.clear();
- for (rapidxml::xml_node<char> *n = node->first_node("journal"); n != NULL; n = n->next_sibling("journal")) {
+ for (rapidxml::xml_node<char> *n = node->first_node("journal"); n != nullptr; n = n->next_sibling("journal")) {
Common::String id;
loadStr(id, "id", n);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index f2fc98076b5..69eb6d1ea14 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -49,7 +49,7 @@ void Map::load(const Common::String &filename, pyrodactyl::event::Info &info) {
rapidxml::xml_node<char> *imgnode = node->first_node("img");
loadNum(_speed, "speed", imgnode);
- for (auto n = imgnode->first_node("map"); n != NULL; n = n->next_sibling("map"))
+ for (auto n = imgnode->first_node("map"); n != nullptr; n = n->next_sibling("map"))
_map.push_back(n);
}
@@ -470,7 +470,7 @@ void Map::loadState(rapidxml::xml_node<char> *node) {
loadNum(val, "cur", mapnode);
auto r = _map.begin();
- for (rapidxml::xml_node<char> *n = mapnode->first_node("data"); n != NULL && r != _map.end(); n = n->next_sibling("data"), ++r)
+ for (rapidxml::xml_node<char> *n = mapnode->first_node("data"); n != nullptr && r != _map.end(); n = n->next_sibling("data"), ++r)
r->loadState(n);
setImage(val, true);
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 4738eaa11f9..3c0d698d05f 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -200,7 +200,7 @@ public:
//------------------------------------------------------------------------
void load(rapidxml::xml_node<char> *node) {
if (nodeValid(node)) {
- for (auto n = node->first_node(); n != NULL; n = n->next_sibling()) {
+ for (auto n = node->first_node(); n != nullptr; n = n->next_sibling()) {
T b;
b.load(n);
_element.push_back(b);
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 5e395430932..ae9dea651a7 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -226,7 +226,7 @@ void QuestMenu::loadState(rapidxml::xml_node<char> *node) {
loadBool(_unread, "unread", node);
_quest.clear();
- for (auto n = node->first_node("quest"); n != NULL; n = n->next_sibling("quest")) {
+ for (auto n = node->first_node("quest"); n != nullptr; n = n->next_sibling("quest")) {
Quest q;
q.loadState(n);
_quest.push_back(q);
Commit: 225cff85fa3a7f82deaeededf4d371c0789e6d0b
https://github.com/scummvm/scummvm/commit/225cff85fa3a7f82deaeededf4d371c0789e6d0b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup hotkey.cpp
Changed paths:
engines/crab/input/hotkey.cpp
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index e2476eac4e6..e0da60b59da 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -41,26 +41,7 @@ void HotKey::load(rapidxml::xml_node<char> *node) {
_name = g_engine->_inputManager->getAssociatedKey(_input);
}
-#if 0
-bool HotKey::handleEvents(const SDL_Event &Event) {
- if (input > IT_NONE && input < IT_TOTAL) {
- int result = g_engine->_inputManager->Equals(input, Event);
-
- if (result == SDL_PRESSED)
- keydown = true;
- else if ((keydown && result == SDL_RELEASED) || result == ANALOG_PRESSED) {
- keydown = false;
- return true;
- }
- }
-
- return false;
-}
-#endif
-
bool HotKey::handleEvents(const Common::Event &event) {
- //warning("STUB: HotKey::handleEvents()");
-
if (_input > IT_NONE && _input < IT_TOTAL) {
return g_engine->_inputManager->state(_input);
}
@@ -70,13 +51,6 @@ bool HotKey::handleEvents(const Common::Event &event) {
const char *HotKey::name() {
return _name.c_str();
-
-#if 0
- if (input > IT_NONE && input < IT_TOTAL)
- return SDL_GetScancodeName(g_engine->_inputManager->iv[input].key);
-#endif
-
- return "";
}
} // End of namespace Crab
Commit: 2d4b439f593fd084be07d20ba417da3fa9b4a7bc
https://github.com/scummvm/scummvm/commit/2d4b439f593fd084be07d20ba417da3fa9b4a7bc
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove unneeded warning
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 0883e1fedac..a63931c4dbd 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -160,7 +160,6 @@ void App::run() {
// Cap the frame rate
if (fps.ticks() < 1000u / g_engine->_screenSettings->_fps) {
uint32 delay = (1000u / g_engine->_screenSettings->_fps) - fps.ticks();
- //warning("Delay by %d ms", delay);
g_system->delayMillis(delay);
}
}
Commit: 453f79271b22025045be93de065050e4b7fa8816
https://github.com/scummvm/scummvm/commit/453f79271b22025045be93de065050e4b7fa8816
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup TextManager
Changed paths:
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index e7613139d29..ebdbe5cdc28 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -65,10 +65,6 @@ void TextManager::init() {
unsigned int pos = stringToNumber<unsigned int>(id->value());
if (_font.size() <= pos)
_font.resize(pos + 1);
-#if 0
- font[pos] = TTF_OpenFont(path->value(), StringToNumber<int>(size->value()));
- TTF_SetFontHinting(font[pos], TTF_HINTING_LIGHT);
-#endif
Common::File file;
fileOpen(path->value(), &file);
_font[pos] = Graphics::loadTTFFont(file, stringToNumber<int>(size->value()));
@@ -110,15 +106,6 @@ int TextManager::findFreeSlot() {
//------------------------------------------------------------------------
// Purpose: Render the SDL surface for text
//------------------------------------------------------------------------
-#if 0
-SDL_Surface *TextManager::RenderTextBlended(const FontKey &font, const Common::String &text, const int &color) {
- if (text.empty())
- return TTF_RenderText_Blended(GetFont(font), " ", colpool.Get(color));
-
- return TTF_RenderText_Blended(GetFont(font), text.c_str(), colpool.Get(color));
-}
-#endif
-
Graphics::ManagedSurface *TextManager::renderTextBlended(const FontKey &fKey, const Common::String &text, const int &color) {
SDL_Color sdlcolor = _colpool.get(color);
uint32 col = g_engine->_format->ARGBToColor(255, sdlcolor.r, sdlcolor.g, sdlcolor.b);
@@ -145,16 +132,11 @@ Graphics::ManagedSurface *TextManager::renderTextBlended(const FontKey &fKey, co
//------------------------------------------------------------------------
void TextManager::draw(const int &x, const int &y, const Common::String &text, const int &color,
const FontKey &fontk, const Align &align, const bool &background) {
- //warning("STUB: TextManager::draw()");
-
if (text == " ") return;
int pos = search(text, color, fontk);
if (pos == -1) {
pos = findFreeSlot();
-#if 0
- SDL_Surface *surf = RenderTextBlended(font, text, color);
-#endif
Graphics::ManagedSurface *surf = renderTextBlended(fontk, text, color);
_cache[pos]._img.deleteImage();
_cache[pos]._empty = false;
@@ -166,9 +148,6 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
_cache[pos]._img.load(surf);
delete surf;
-#if 0
- SDL_FreeSurface(surf);
-#endif
}
if (background) {
@@ -180,37 +159,26 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
surf.create(_rect.w, _rect.h, *g_engine->_format);
surf.fillRect(Common::Rect(_rect.w, _rect.h), col);
-#if 0
- SDL_SetRenderDrawBlendMode(gRenderer, SDL_BLENDMODE_BLEND);
- SDL_SetRenderDrawColor(gRenderer, 0, 0, 0, 128);
-#endif
-
if (align == ALIGN_LEFT) {
_rect.x = x - _padBg.x;
_rect.y = y - _padBg.y;
+
g_engine->_screen->blitFrom(surf, Common::Point(_rect.x, _rect.y));
-#if 0
- SDL_RenderFillRect(gRenderer, &rect);
-#endif
_cache[pos]._img.draw(x, y);
} else if (align == ALIGN_CENTER) {
_rect.x = x - _cache[pos]._img.w() / 2 - _padBg.x;
_rect.y = y - _cache[pos]._img.h() / 2 - _padBg.y;
+
g_engine->_screen->blitFrom(surf, Common::Point(_rect.x, _rect.y));
-#if 0
- SDL_RenderFillRect(gRenderer, &rect);
-#endif
_cache[pos]._img.draw(x - _cache[pos]._img.w() / 2, y - _cache[pos]._img.h() / 2);
} else {
_rect.x = x - _cache[pos]._img.w() - _padBg.x;
_rect.y = y - _padBg.y;
+
g_engine->_screen->blitFrom(surf, Common::Point(_rect.x, _rect.y));
-#if 0
- SDL_RenderFillRect(gRenderer, &rect);
-#endif
_cache[pos]._img.draw(x - _cache[pos]._img.w(), y);
}
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index f57077477b9..d767abf05e1 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -112,9 +112,6 @@ public:
}
Graphics::ManagedSurface *renderTextBlended(const FontKey &font, const Common::String &text, const int &color);
-#if 0
- SDL_Surface *RenderTextBlended(const FontKey &font, const Common::String &text, const int &color);
-#endif
void draw(const int &x, const int &y, const Common::String &text, const int &color,
const FontKey &font = 0, const Align &align = ALIGN_LEFT, const bool &background = false);
Commit: dab387b1f348feeb7915d90ae0fd88a09a0726f4
https://github.com/scummvm/scummvm/commit/dab387b1f348feeb7915d90ae0fd88a09a0726f4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Move warning to debug in Image.cpp
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index f59486edc4d..2bc5eb70776 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -73,7 +73,7 @@ bool Image::load(const Common::String &path) {
file.close();
- warning("Image::load() Image Texture(%s): w: %d h: %d", path.c_str(), _w, _h);
+ debugC(kDebugFilePath, "Image::load() Image Texture(%s): w: %d h: %d", path.c_str(), _w, _h);
}
Commit: 8d586b7c580d92bf0580679e27476c15b6769447
https://github.com/scummvm/scummvm/commit/8d586b7c580d92bf0580679e27476c15b6769447
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Move warning about cur height and weight to debug
Changed paths:
engines/crab/splash.cpp
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index f161d9c46a8..2e572263525 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -87,7 +87,7 @@ void Splash::draw() {
// Purpose: Reset UI position
//------------------------------------------------------------------------
void Splash::setUI() {
- warning("ScreenSettings cur w : %d h : %d", g_engine->_screenSettings->_cur.w, g_engine->_screenSettings->_cur.h);
+ debugC(kDebugGraphics, "ScreenSettings cur w : %d h : %d", g_engine->_screenSettings->_cur.w, g_engine->_screenSettings->_cur.h);
_x = (g_engine->_screenSettings->_cur.w - _background.w()) / 2;
_y = (g_engine->_screenSettings->_cur.h - _background.h()) / 2;
}
Commit: 8ce8efa546514bb027d9d034b0c5b6e2d31c0b48
https://github.com/scummvm/scummvm/commit/8ce8efa546514bb027d9d034b0c5b6e2d31c0b48
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup filesystem.[cpp, h]
Changed paths:
engines/crab/filesystem.cpp
engines/crab/filesystem.h
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index 6b72b9fec94..5ff2dadefff 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -73,11 +73,4 @@ bool fileOpen(const Common::Path &path, Common::File *file) {
return true;
}
-#if 0
-bool PathCompare(const path &p1, const path &p2)
-{
- return last_write_time(p1) > last_write_time(p2);
-}
-#endif
-
} // End of namespace Crab
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index 5aace0e55dc..13fe9e3190e 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -33,11 +33,10 @@
#include "crab/common_header.h"
namespace Crab {
+
bool fileOpen(const Common::Path &path, char *&data);
bool fileOpen(const Common::Path &path, Common::File *file);
-#if 0
- bool PathCompare(const boost::filesystem::path &p1, const boost::filesystem::path &p2);
-#endif
+
} // End of namespace Crab
#endif // CRAB_FILESYSTEM_H
Commit: b80501fbc090dd572a3d8f8b43d6293532e81191
https://github.com/scummvm/scummvm/commit/b80501fbc090dd572a3d8f8b43d6293532e81191
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Move a TMX related warning to debug
Changed paths:
engines/crab/TMX/TMXTileSet.cpp
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index fa077ad224e..bddd241c404 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -55,7 +55,7 @@ void TileSet::load(const Common::String &path, rapidxml::xml_node<char> *node) {
_img.load(_loc);
_totalRows = _img.h() / _tileH;
_totalCols = _img.w() / _tileW;
- warning("Total rows : %d Total cols: %d gid: %d", _totalRows, _totalCols, _firstGid);
+ debugC(kDebugGraphics, "Total rows : %d Total cols: %d gid: %d", _totalRows, _totalCols, _firstGid);
}
}
Commit: f45082bf0c512391b2a5d7aad0430345c12668e7
https://github.com/scummvm/scummvm/commit/f45082bf0c512391b2a5d7aad0430345c12668e7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove uneeded url.cpp/url.h
Changed paths:
R engines/crab/url.cpp
R engines/crab/url.h
engines/crab/mainmenu.cpp
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 8b61e6d2d93..0609ccaf11e 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -29,7 +29,6 @@
*/
#include "crab/mainmenu.h"
-#include "crab/url.h"
namespace Crab {
diff --git a/engines/crab/url.cpp b/engines/crab/url.cpp
deleted file mode 100644
index d6017347dd9..00000000000
--- a/engines/crab/url.cpp
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#include "crab/url.h"
-
-namespace Crab {
-
-void OpenURL(const Common::String &url_str) {
- warning("STUB: OpenUrl()");
-}
-
-} // End of namespace Crab
diff --git a/engines/crab/url.h b/engines/crab/url.h
deleted file mode 100644
index 2d8dea8ba97..00000000000
--- a/engines/crab/url.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#ifndef CRAB_URL_H
-#define CRAB_URL_H
-
-#include "crab/common_header.h"
-
-namespace Crab {
-
-void OpenURL(const Common::String &url_str);
-
-} // End of namespace Crab
-
-#endif // CRAB_URL_H
Commit: 4f87989f29aad3274c44a11553e603dcd930d3b5
https://github.com/scummvm/scummvm/commit/4f87989f29aad3274c44a11553e603dcd930d3b5
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unneeded warnings and leave a comment
Changed paths:
engines/crab/input/input.cpp
engines/crab/music/MusicManager.cpp
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 11ab7f11d24..1b6acbb3a6f 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -245,12 +245,12 @@ Common::String InputManager::getAssociatedKey(const InputType &type) {
return _keyDescs[type];
}
+
//------------------------------------------------------------------------
// Purpose: Save to file
+// Function is not needed as of now, keeping it incase its needed in future.
//------------------------------------------------------------------------
void InputManager::save() {
- warning("STUB: InputManager::Save()");
-
#if 0
rapidxml::xml_document<char> doc;
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index f98c18f0673..efcdecaa68a 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -152,9 +152,8 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
return true;
}
+// Function is not needed as of now, keeping it incase its needed in future.
void MusicManager::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- warning("STUB: MusicManager::saveState()");
-
#if 0
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sound");
child->append_attribute(doc.allocate_attribute("music", g_engine->_stringPool->Get(Mix_VolumeMusic(-1))));
Commit: 608b0fcf1ba9c7a14826029d506d4c32f849f5bc
https://github.com/scummvm/scummvm/commit/608b0fcf1ba9c7a14826029d506d4c32f849f5bc
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Add some whitespaces in Image.cpp
Changed paths:
engines/crab/image/Image.cpp
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 2bc5eb70776..1dce286a986 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -44,16 +44,21 @@ bool Image::load(Graphics::Surface *surface) {
_texture->create(surface->w, surface->h, surface->format);
_texture->copyFrom(*surface);
+
_w = surface->w;
_h = surface->h;
+
return true;
}
bool Image::load(Graphics::ManagedSurface *surface) {
deleteImage();
+
_texture = new Graphics::ManagedSurface(*surface);
+
_w = surface->w;
_h = surface->h;
+
return true;
}
@@ -74,7 +79,6 @@ bool Image::load(const Common::String &path) {
file.close();
debugC(kDebugFilePath, "Image::load() Image Texture(%s): w: %d h: %d", path.c_str(), _w, _h);
-
}
return _texture != nullptr;
Commit: 4e6a602af9823e4c41523dbe0574ad11a75fe769
https://github.com/scummvm/scummvm/commit/4e6a602af9823e4c41523dbe0574ad11a75fe769
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Stop music before freeing
Changed paths:
engines/crab/music/MusicManager.h
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index 1f5144289ea..26020071071 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -124,6 +124,8 @@ public:
void freeChunk();
void quit() {
+ g_system->getMixer()->stopAll();
+
freeMusic();
freeChunk();
}
Commit: 83e77c269c2703deec6092ebd8d3b9fc87874d16
https://github.com/scummvm/scummvm/commit/83e77c269c2703deec6092ebd8d3b9fc87874d16
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Handle AutoShow layer correctly
Changed paths:
engines/crab/TMX/TMXTileSet.cpp
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index bddd241c404..da392c6a71c 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -100,7 +100,7 @@ void TileSet::preDraw(const Vector2i &pos, const TileInfo &tile, Graphics::Manag
}
void TileSetGroup::preDraw(MapLayer &layer, const Vector2i &tileSize, Graphics::ManagedSurface *surf) {
- if (layer._type == LAYER_IMAGE)
+ if (layer._type == LAYER_IMAGE || layer._type == LAYER_AUTOSHOW)
return;
_start.x = 0;
@@ -155,13 +155,25 @@ void TileSetGroup::forceDraw(MapLayer &layer, const Rect &camera, const Vector2i
_start.x = playerPos.y / tileSize.y;
_start.y = playerPos.x / tileSize.x;
- if(_start.x < 0 || _start.y < 0)
+ if (_start.x < 0 || _start.y < 0)
return;
// The row and column we end drawing at
_finish.x = (playerPos.y + playerPos.h) / tileSize.y + 1;
_finish.y = (playerPos.x + playerPos.w) / tileSize.x + 1;
+ if (layer._type == LAYER_AUTOSHOW) {
+ if (layer._collide)
+ return;
+
+ _start.x = camera.y / tileSize.y;
+ _start.y = camera.x / tileSize.x;
+
+ //The row and column we end drawing at
+ _finish.x = (camera.y + camera.h) / tileSize.y + 1;
+ _finish.y = (camera.x + camera.w) / tileSize.x + 1;
+ }
+
if (_finish.x > (int)layer._tile.size())
_finish.x = layer._tile.size();
if (_finish.y > (int)layer._tile[0].size())
Commit: c97593c76d1240df1cb89f82bc5727574e0a1e3f
https://github.com/scummvm/scummvm/commit/c97593c76d1240df1cb89f82bc5727574e0a1e3f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Create thumbnails correctly
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/game.cpp
engines/crab/metaengine.cpp
engines/crab/metaengine.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 198f6d658cf..b7b7a214775 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -62,6 +62,7 @@ CrabEngine::~CrabEngine() {
delete _textManager;
delete _imageManager;
+ delete _thumbnail;
delete _screen;
delete _format;
}
@@ -78,6 +79,7 @@ Common::Error CrabEngine::run() {
_format = new Graphics::PixelFormat(4, 8, 8, 8, 8, 0, 8, 16, 24);
initGraphics(1280, 720, _format);
_screen = new Graphics::Screen(1280, 720, *_format);
+ _thumbnail = new Graphics::ManagedSurface(1280, 720, *_format);
_imageManager = new pyrodactyl::image::ImageManager();
_textManager = new pyrodactyl::text::TextManager();
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 3881e0127f1..e9004b09cb5 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -102,6 +102,9 @@ public:
StringPool *_stringPool = nullptr;
ScreenSettings *_screenSettings = nullptr;
+ // Keeps a copy of latest screen for thumbnail
+ Graphics::ManagedSurface *_thumbnail;
+
Common::FSNode _gameDataDir;
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 430d5d34b15..12de5d57b2b 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -190,6 +190,7 @@ void Game::handleEvents(Common::Event &event, bool &shouldChangeState, GameState
toggleState(STATE_MAP);
break;
case HS_PAUSE:
+ g_engine->_thumbnail->copyFrom(g_engine->_screen->rawSurface());
toggleState(STATE_PAUSE);
break;
case HS_CHAR:
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index 8ceec4a9762..a3f8694142b 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -29,6 +29,8 @@
#include "backends/keymapper/keymapper.h"
#include "backends/keymapper/standard-actions.h"
+#include "graphics/scaler.h"
+
namespace Crab {
static const ADExtraGuiOptionsMap optionsList[] = {
@@ -80,6 +82,11 @@ int CrabMetaEngine::getMaximumSaveSlot() const {
return 999;
}
+void CrabMetaEngine::getSavegameThumbnail(Graphics::Surface &thumb) {
+ Graphics::ManagedSurface *surf = Crab::g_engine->_thumbnail;
+ createThumbnail(&thumb, surf);
+}
+
#if PLUGIN_ENABLED_DYNAMIC(CRAB)
REGISTER_PLUGIN_DYNAMIC(CRAB, PLUGIN_TYPE_ENGINE, CrabMetaEngine);
#else
diff --git a/engines/crab/metaengine.h b/engines/crab/metaengine.h
index 7e78149ce39..12d33d913a9 100644
--- a/engines/crab/metaengine.h
+++ b/engines/crab/metaengine.h
@@ -43,6 +43,8 @@ public:
const ADExtraGuiOptionsMap *getAdvancedExtraGuiOptions() const override;
virtual int getMaximumSaveSlot() const override;
+
+ virtual void getSavegameThumbnail(Graphics::Surface &thumb) override;
};
#endif // CRAB_METAENGINE_H
Commit: 2b8d0366b67fb3d789e71a2ab43deefa762c0736
https://github.com/scummvm/scummvm/commit/2b8d0366b67fb3d789e71a2ab43deefa762c0736
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unneeded warning
Changed paths:
engines/crab/game.cpp
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 12de5d57b2b..6b094713050 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -674,9 +674,6 @@ void Game::loadState(Common::SeekableReadStream *stream) {
uint8 *dataC = new uint8[end + 1];
dataC[end] = '\0';
memcpy(dataC, data.c_str(), end);
-
- warning("Output: %s", dataC);
-
XMLDoc conf(dataC);
if (conf.ready()) {
Commit: e1ed69a296fe939bfc3674a4903ccf46394cd08e
https://github.com/scummvm/scummvm/commit/e1ed69a296fe939bfc3674a4903ccf46394cd08e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove old code in LoadingScreen.cpp
Changed paths:
engines/crab/LoadingScreen.cpp
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 4d6bb9478b2..23f72ab7b2d 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -62,10 +62,8 @@ void LoadingScreen::draw() {
// Draw the loading text
_text.draw((g_engine->_screenSettings->_cur.w - _text.w()) / 2, (g_engine->_screenSettings->_cur.h - _text.h()) / 2);
- g_engine->_screen->update();
-
// Update the screen
- //SDL_RenderPresent(gRenderer);
+ g_engine->_screen->update();
}
void LoadingScreen::dim() {
Commit: 222d37cb53113720731efe5c0bdf890b796430df
https://github.com/scummvm/scummvm/commit/222d37cb53113720731efe5c0bdf890b796430df
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add warning that LoadingScreen::dim() is stubbed
Changed paths:
engines/crab/LoadingScreen.cpp
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 23f72ab7b2d..6049320696e 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -67,6 +67,8 @@ void LoadingScreen::draw() {
}
void LoadingScreen::dim() {
+ warning("STUB: LoadingScreen::dim()");
+
#if 0
// This is used when starting or loading a game from the main menu in order to dim the screen
// until an actual loading screen is drawn
Commit: cec7b34522edc312cb84755ce40e3fe63c94ed93
https://github.com/scummvm/scummvm/commit/cec7b34522edc312cb84755ce40e3fe63c94ed93
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add input.cpp to POTFILES
Changed paths:
engines/crab/POTFILES
diff --git a/engines/crab/POTFILES b/engines/crab/POTFILES
index c1eee4543d3..790b6767224 100644
--- a/engines/crab/POTFILES
+++ b/engines/crab/POTFILES
@@ -1 +1,2 @@
engines/crab/metaengine.cpp
+engines/crab/input/input.cpp
\ No newline at end of file
Commit: 7f43dd243565d3ab5ca21cff71aff7339601fc4e
https://github.com/scummvm/scummvm/commit/7f43dd243565d3ab5ca21cff71aff7339601fc4e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: collide() does not modify class
Changed paths:
engines/crab/Polygon.cpp
engines/crab/Polygon.h
engines/crab/Rectangle.cpp
engines/crab/Rectangle.h
engines/crab/Shape.cpp
engines/crab/Shape.h
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index abcde9f6b51..08fc32ada29 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -153,7 +153,7 @@ void Polygon2D::project(const Vector2f &axis, float &min, float &max) const {
}
}
-PolygonCollisionResult Polygon2D::collide(const Rect &rect) {
+PolygonCollisionResult Polygon2D::collide(const Rect &rect) const {
Polygon2D polyB;
Vector2f p;
p.x = rect.x;
@@ -173,7 +173,7 @@ PolygonCollisionResult Polygon2D::collide(const Rect &rect) {
return collide(polyB);
}
-PolygonCollisionResult Polygon2D::collide(const Polygon2D &polyB) {
+PolygonCollisionResult Polygon2D::collide(const Polygon2D &polyB) const {
PolygonCollisionResult result;
result._intersect = true;
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index 00216dc14f4..0a7f98fc443 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -84,10 +84,10 @@ public:
// Check if Polygon2D A is going to collide with Polygon2D B for the given velocity
// PolyA is this polygon
- PolygonCollisionResult collide(const Polygon2D &polyB);
+ PolygonCollisionResult collide(const Polygon2D &polyB) const;
// Code for collision with a rectangle
- PolygonCollisionResult collide(const Rect &rect);
+ PolygonCollisionResult collide(const Rect &rect) const;
// Find if a point is inside this polygon
bool contains(const float &x, const float &y);
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 9d545f3b733..31ebf883a12 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -38,7 +38,7 @@ bool Rect::load(rapidxml::xml_node<char> *node, const bool &echo, const Common::
return loadNum(x, x_name, node, echo) && loadNum(y, y_name, node, echo) && loadNum(w, w_name, node, echo) && loadNum(h, h_name, node, echo);
}
-bool Rect::collide(Rect box) {
+bool Rect::collide(Rect box) const {
if (box.x + box.w < x)
return false; // just checking if their
if (box.x > x + w)
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index 13f025da0a3..0cda97f35bc 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -58,7 +58,7 @@ struct Rect {
const Common::String &y_name = "y", const Common::String &w_name = "w", const Common::String &h_name = "h");
// Is this rectangle colliding with another rectangle?
- bool collide(Rect box);
+ bool collide(Rect box) const;
// Extend this rectangle to fully contain another rectangle
void extend(Rect box);
diff --git a/engines/crab/Shape.cpp b/engines/crab/Shape.cpp
index 6a052e30dd1..ce32323c232 100644
--- a/engines/crab/Shape.cpp
+++ b/engines/crab/Shape.cpp
@@ -45,7 +45,7 @@ void Shape::load(rapidxml::xml_node<char> *node, const bool &echo) {
}
}
-CollisionData Shape::collide(Rect box) {
+CollisionData Shape::collide(Rect box) const {
CollisionData res;
res._intersect = _rect.collide(box);
diff --git a/engines/crab/Shape.h b/engines/crab/Shape.h
index 658178b3e8d..7bb5f3efd96 100644
--- a/engines/crab/Shape.h
+++ b/engines/crab/Shape.h
@@ -78,7 +78,7 @@ public:
~Shape() {}
void load(rapidxml::xml_node<char> *node, const bool &echo = true);
- CollisionData collide(Rect box);
+ CollisionData collide(Rect box) const;
bool contains(const Vector2i &pos);
Commit: 8adef975d820edea95115abe7cbb1b2518cefc66
https://github.com/scummvm/scummvm/commit/8adef975d820edea95115abe7cbb1b2518cefc66
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add const-correctness to various methods in TMXMap
Changed paths:
engines/crab/PathfindingGrid.cpp
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index ff0dcd026bf..0024fed9ead 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -121,7 +121,7 @@ void PathfindingGrid::setupNodes(TMX::TMXMap map) {
pos.y += _cellSize.y;
- Common::Array<Shape> noWalk = map.areaNoWalk();
+ const Common::Array<Shape> &noWalk = map.areaNoWalk();
// Check if the square should count as blocked
for (auto i = noWalk.begin(); i != noWalk.end(); ++i) {
@@ -133,7 +133,7 @@ void PathfindingGrid::setupNodes(TMX::TMXMap map) {
// Check for stairs if the cell isn't blocked
if (_nodes[x][y]._movementCost >= 0.0f) {
- Common::Array<pyrodactyl::level::Stairs> stairs = map.areaStairs();
+ const Common::Array<pyrodactyl::level::Stairs> &stairs = map.areaStairs();
for (auto i = stairs.begin(); i != stairs.end(); ++i) {
if (i->collide(_nodes[x][y]._collisionRect)._intersect) {
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index c20ad2b7245..63947859878 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -333,7 +333,7 @@ bool TMXMap::insideNoWalk(const Vector2i &pos) {
return false;
}
-bool TMXMap::insideWalk(const Rect boundingBox) {
+bool TMXMap::insideWalk(const Rect &boundingBox) {
if (_areaWalk.contains(boundingBox))
return true;
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 0afb657512a..b1ad3d98b50 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -110,7 +110,7 @@ public:
void drawDebug(const Rect &camera);
- bool insideWalk(const Rect boundingBox);
+ bool insideWalk(const Rect &boundingBox);
bool insideWalk(const Vector2i &pos);
bool insideNoWalk(const Vector2i &pos);
@@ -131,15 +131,15 @@ public:
return _h;
}
- Rect areaWalk() {
+ const Rect &areaWalk() {
return _areaWalk;
}
- Common::Array<Shape> areaNoWalk() {
+ const Common::Array<Shape> &areaNoWalk() {
return _areaNowalk;
}
- Common::Array<pyrodactyl::level::Stairs> areaStairs() {
+ const Common::Array<pyrodactyl::level::Stairs> &areaStairs() {
return _areaStairs;
}
};
Commit: b1e1c2847ae9899130c9e346420961145ff84e0d
https://github.com/scummvm/scummvm/commit/b1e1c2847ae9899130c9e346420961145ff84e0d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Fix code formatting in TMXMap.cpp
Changed paths:
engines/crab/TMX/TMXMap.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 63947859878..27468fac7f1 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -111,8 +111,7 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
// Store the name for easy comparison
Common::String name = groupnode->name();
- if (name == "layer" || name == "imagelayer") // Is this a tile or an image layer
- {
+ if (name == "layer" || name == "imagelayer") { // Is this a tile or an image layer
MapLayer l;
l.load(path, groupnode);
l._pos.x *= _tileSize.x;
@@ -126,8 +125,7 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
_layer.push_back(l);
layerCount++;
- } else if (name == "objectgroup") // Is this an object layer
- {
+ } else if (name == "objectgroup") { // Is this an object layer
Common::String groupName;
loadStr(groupName, "name", groupnode);
if (groupName == "exit") {
Commit: 951237e4e9a63f958bc65f5b026b05c861922a9d
https://github.com/scummvm/scummvm/commit/951237e4e9a63f958bc65f5b026b05c861922a9d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Append end of namespace message in GameParam.h
Changed paths:
engines/crab/GameParam.h
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index b47d9963424..7c9e714bb5c 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -175,6 +175,6 @@ extern StringPool *gStrPool;
// Generate random numbers using this
//extern RandomNumberGen gRandom;
-}
+} // End of namespace Crab
#endif // CRAB_GAMEPARAM_H
Commit: b71c4901a7b74e261f0d0f36edf49b7183e17c6e
https://github.com/scummvm/scummvm/commit/b71c4901a7b74e261f0d0f36edf49b7183e17c6e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove code leftovers in GameParam.h
Changed paths:
engines/crab/GameParam.h
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 7c9e714bb5c..c18d1571daa 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -169,12 +169,6 @@ struct TempValue {
// Whether to draw debug outlines on polygons
extern bool GameDebug;
-// Strings are stored here to avoid duplicates and invalid values when writing to XML
-extern StringPool *gStrPool;
-
-// Generate random numbers using this
-//extern RandomNumberGen gRandom;
-
} // End of namespace Crab
#endif // CRAB_GAMEPARAM_H
Commit: 73bb1b5845f6f2dd36c8a056ea6c67b260f8a042
https://github.com/scummvm/scummvm/commit/73bb1b5845f6f2dd36c8a056ea6c67b260f8a042
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove wrapper around Graphics::Screen::drawLine()
Changed paths:
R engines/crab/Line.cpp
engines/crab/Line.h
engines/crab/Polygon.cpp
engines/crab/Rectangle.cpp
engines/crab/module.mk
diff --git a/engines/crab/Line.cpp b/engines/crab/Line.cpp
deleted file mode 100644
index 957404b023d..00000000000
--- a/engines/crab/Line.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#include "crab/crab.h"
-#include "crab/Line.h"
-
-namespace Crab {
-
-//------------------------------------------------------------------------
-// Purpose: Draw a line from start to end
-//------------------------------------------------------------------------
-void drawLine(const int &x1, const int &y1, const int &x2, const int &y2,
- const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
- g_engine->_screen->drawLine(x1, y1, x2, y2, g_engine->_format->ARGBToColor(a, r, g, b));
-}
-
-} // End of namespace Crab
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index e644ad3c57d..e7613b57dc9 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -69,10 +69,6 @@ bool collideLine(const T &p0X, const T &p0Y, const T &p1X, const T &p1Y,
return false; // No collision
}
-// Draw a line OpenGL style
-void drawLine(const int &x1, const int &y1, const int &x2, const int &y2,
- const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a);
-
} // End of namespace Crab
#endif // CRAB_LINE_H
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 08fc32ada29..697ef3e62bf 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/crab.h"
#include "crab/Polygon.h"
namespace Crab {
@@ -266,7 +267,7 @@ void Polygon2D::draw(const int &xOffset, const int &yOffset, const uint8 &r, con
else
p2 = _point[i + 1];
- drawLine(p1.x + xOffset, p1.y + yOffset, p2.x + xOffset, p2.y + yOffset, r, g, b, a);
+ g_engine->_screen->drawLine(p1.x + xOffset, p1.y + yOffset, p2.x + xOffset, p2.y + yOffset, g_engine->_format->ARGBToColor(a, r, g, b));
}
}
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 31ebf883a12..80ff543c373 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -111,10 +111,10 @@ void Rect::flip(const TextureFlipType &flip, const Vector2i &axis) {
void Rect::draw(const int &xOffset, const int &yOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
int X = x + xOffset, Y = y + yOffset;
- drawLine(X, Y, X + w, Y, r, g, b, a);
- drawLine(X, Y, X, Y + h, r, g, b, a);
- drawLine(X + w, Y, X + w, Y + h, r, g, b, a);
- drawLine(X, Y + h, X + w, Y + h, r, g, b, a);
+ g_engine->_screen->drawLine(X, Y, X + w, Y, g_engine->_format->ARGBToColor(a, r, g, b));
+ g_engine->_screen->drawLine(X, Y, X, Y + h, g_engine->_format->ARGBToColor(a, r, g, b));
+ g_engine->_screen->drawLine(X + w, Y, X + w, Y + h, g_engine->_format->ARGBToColor(a, r, g, b));
+ g_engine->_screen->drawLine(X, Y + h, X + w, Y + h, g_engine->_format->ARGBToColor(a, r, g, b));
}
void Rect::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 3d1196723db..fd35af4cd85 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -123,7 +123,6 @@ MODULE_OBJS = \
app.o \
splash.o \
LoadingScreen.o \
- Line.o \
mainmenu.o \
PathfindingAgent.o \
PathfindingGraphNode.o \
Commit: bff540360821896c9d9c7bdc650bf6a4ccaac54a
https://github.com/scummvm/scummvm/commit/bff540360821896c9d9c7bdc650bf6a4ccaac54a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Allow dawing debugLines via debug console
Changed paths:
engines/crab/console.cpp
engines/crab/console.h
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/level/level_draw.cpp
diff --git a/engines/crab/console.cpp b/engines/crab/console.cpp
index 1f6f9175ad0..db082a74d51 100644
--- a/engines/crab/console.cpp
+++ b/engines/crab/console.cpp
@@ -19,19 +19,31 @@
*
*/
+#include "crab/crab.h"
#include "crab/console.h"
namespace Crab {
Console::Console() : GUI::Debugger() {
- registerCmd("test", WRAP_METHOD(Console, Cmd_test));
+ registerCmd("draw", WRAP_METHOD(Console, cmdDraw));
}
Console::~Console() {
}
-bool Console::Cmd_test(int argc, const char **argv) {
- debugPrintf("Test\n");
+bool Console::cmdDraw(int argc, const char **argv) {
+ if (argc > 1) {
+ for (int i = 1; i < argc; i++) {
+ if (!scumm_stricmp(argv[i], "OFF"))
+ g_engine->_debugDraw = 0;
+ else if (!scumm_stricmp(argv[i], "TMX"))
+ g_engine->_debugDraw |= DRAW_TMX;
+ else if (!scumm_stricmp(argv[i], "PROPS"))
+ g_engine->_debugDraw |= DRAW_PROP_BOUNDS;
+ else if (!scumm_stricmp(argv[i], "ALL"))
+ g_engine->_debugDraw = DRAW_TMX | DRAW_PROP_BOUNDS;
+ }
+ }
return true;
}
diff --git a/engines/crab/console.h b/engines/crab/console.h
index b14a259cf6f..11992f6e625 100644
--- a/engines/crab/console.h
+++ b/engines/crab/console.h
@@ -28,7 +28,7 @@ namespace Crab {
class Console : public GUI::Debugger {
private:
- bool Cmd_test(int argc, const char **argv);
+ bool cmdDraw(int argc, const char **argv);
public:
Console();
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index b7b7a214775..5a612d17aed 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -100,6 +100,8 @@ Common::Error CrabEngine::run() {
_stringPool = new StringPool();
_screenSettings = new ScreenSettings();
+ _debugDraw = 0;
+
CursorMan.showMouse(true);
_mouse->reset();
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index e9004b09cb5..4c48488009a 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -69,6 +69,11 @@ class SaveFileData;
} // End of namespace pyrodactyl
+enum DebugDraw {
+ DRAW_TMX = 1 << 0,
+ DRAW_PROP_BOUNDS = 1 << 1
+};
+
class CrabEngine : public Engine {
private:
const ADGameDescription *_gameDescription;
@@ -105,6 +110,9 @@ public:
// Keeps a copy of latest screen for thumbnail
Graphics::ManagedSurface *_thumbnail;
+ // What components to draw lines for (if any)
+ uint32 _debugDraw;
+
Common::FSNode _gameDataDir;
CrabEngine(OSystem *syst, const ADGameDescription *gameDesc);
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index c878a215017..6e101421f6a 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -131,7 +131,7 @@ void Level::draw(pyrodactyl::event::Info &info) {
}
}
- if (GameDebug)
+ if (g_engine->_debugDraw & DRAW_TMX)
_terrain.drawDebug(_camera);
}
@@ -159,7 +159,10 @@ void Level::drawObjects(pyrodactyl::event::Info &info) {
auto obj = b->second;
if (a->_pos.y + a->_pos.h < obj->y() + obj->h()) {
for (auto &i : a->_boundRect) {
- i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
+ // draw prop bounds if requested
+ if (g_engine->_debugDraw & DRAW_PROP_BOUNDS)
+ i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
+
if (i.collide(_objects[_playerIndex].posRect())) {
g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, _objects[_playerIndex].posRect());
}
@@ -185,7 +188,10 @@ void Level::drawObjects(pyrodactyl::event::Info &info) {
} else if (b == _objSeq.end()) {
for (; a != _terrain._prop.end(); ++a) {
for (auto &i : a->_boundRect) {
- i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
+ // draw prop bounds if requested
+ if (g_engine->_debugDraw & DRAW_PROP_BOUNDS)
+ i.draw(-_camera.x, -_camera.y, 128, 128, 0, 255);
+
if (i.collide(_objects[_playerIndex].posRect())) {
g_engine->_imageManager->_tileset.forceDraw(*a, _camera, _terrain._tileSize, _objects[_playerIndex].posRect());
}
Commit: 0c65d4b9cd2eee755391a79e27ed92d8a91eede7
https://github.com/scummvm/scummvm/commit/0c65d4b9cd2eee755391a79e27ed92d8a91eede7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup TMXMap::drawDebug()
Changed paths:
engines/crab/TMX/TMXMap.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 27468fac7f1..4a92fb7b6f5 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -266,49 +266,20 @@ void TMXMap::drawDebug(const Rect &camera) {
for (auto i = _areaStairs.begin(); i != _areaStairs.end(); ++i) {
i->draw(-camera.x, -camera.y, 0, 254, 0, 254);
- //g_engine->_textManager->draw(i->rect.x - camera.x + 100, i->rect.y - camera.y, NumberToString(i->modifier.x), 0);
- //g_engine->_textManager->draw(i->rect.x - camera.x + 200, i->rect.y - camera.y, NumberToString(i->modifier.y), 0);
}
// Draw the pathfinding grid (SZ)
- /*for(int x = 0; x < grid->GetDimensions().x; ++x)
- {
- for(int y = 0; y < grid->GetDimensions().y; ++y)
- {
- if(grid->GetNodeAtCoords(x, y)->GetMovementCost() < 0.0f)
- grid->GetNodeAtCoords(x, y)->GetRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
- else
- grid->GetNodeAtCoords(x, y)->GetRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
+ for(int x = 0; x < _grid->getDimensions().x; ++x) {
+ for(int y = 0; y < _grid->getDimensions().y; ++y) {
+ if(_grid->getNodeAtCoords(x, y)->getMovementCost() < 0.0f)
+ _grid->getNodeAtCoords(x, y)->getRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
+ }
}
- }*/
for (auto i = _layer.begin(); i != _layer.end(); ++i)
i->_pos.draw(-camera.x, -camera.y, 254, 216, 0);
_areaWalk.draw(-camera.x, -camera.y, 254, 254, 254, 254);
- // g_engine->_textManager->draw(0, 200, NumberToString(sprite_layer), 0);
-
- // Use this if you want to draw poly lines in debug
- /*bool start = true;
- Vector2i prev;
- for (auto i = path.begin(); i != path.end(); ++i)
- {
- for (auto j = i->begin(); j != i->end(); ++j)
- {
- if (start)
- {
- prev = *j;
- start = false;
- }
-
- DrawLine(prev.x - camera.x, prev.y - camera.y, j->x - camera.x, j->y - camera.y, 0, 0, 0, 254);
-
- g_engine->_textManager->draw(j->x - camera.x + 100, j->y - camera.y, NumberToString(j->x), 0);
- g_engine->_textManager->draw(j->x - camera.x + 200, j->y - camera.y, NumberToString(j->y), 0);
-
- prev = *j;
- }
- }*/
}
//------------------------------------------------------------------------
Commit: d06d7b7b5db65e664d1815faf660c6579a4f991a
https://github.com/scummvm/scummvm/commit/d06d7b7b5db65e664d1815faf660c6579a4f991a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unneeded overload of Image::load()
Changed paths:
engines/crab/image/Image.cpp
engines/crab/image/Image.h
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 1dce286a986..bd893bbe54c 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -91,35 +91,6 @@ bool Image::load(rapidxml::xml_node<char> *node, const char *name) {
return false;
}
-bool Image::load(const Image &image, Rect *clip, const TextureFlipType &flip) {
- deleteImage();
-
- Common::Rect srcRect(0, 0, _w, _h);
-
- if (clip)
- srcRect = Common::Rect(clip->x, clip->y, clip->x + clip->w, clip->y + clip->h);
-
- _texture = new Graphics::ManagedSurface();
- _texture->copyFrom(image._texture->getSubArea(srcRect));
-
- switch (flip) {
- case FLIP_NONE:
- break;
-
- case FLIP_X:
- _texture->surfacePtr()->flipHorizontal(Common::Rect(_texture->w, _texture->h));
- break;
-
- default:
- warning("Flipped texture: %d", flip);
- }
-
- _w = _texture->w;
- _h = _texture->h;
-
- return true;
-}
-
//------------------------------------------------------------------------
// Purpose: Draw a texture to the screen without cropping
//------------------------------------------------------------------------
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index b77f1c08c8a..aecdba9a8b3 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -96,7 +96,6 @@ public:
bool load(rapidxml::xml_node<char> *node, const char *name);
bool load(Graphics::Surface *surface);
bool load(Graphics::ManagedSurface *surface);
- bool load(const Image &image, Rect *clip, const TextureFlipType &flip);
// Draw the openGL texture
Commit: 34b2565b0fa11eddefd1e527302ce77cd5333c7a
https://github.com/scummvm/scummvm/commit/34b2565b0fa11eddefd1e527302ce77cd5333c7a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Update comments in ImageManager
Changed paths:
engines/crab/image/Image.h
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index aecdba9a8b3..bec16e41bf2 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -98,12 +98,12 @@ public:
bool load(Graphics::ManagedSurface *surface);
- // Draw the openGL texture
+ // Draw the texture
void draw(const int &x, const int &y, Common::Rect *clip = nullptr, const TextureFlipType &flip = FLIP_NONE);
void draw(const int &x, const int &y, Rect *clip, const TextureFlipType &flip = FLIP_NONE, Graphics::ManagedSurface *surf = nullptr);
void fastDraw(const int &x, const int &y, Rect *clip = nullptr);
- // Delete the openGL texture
+ // Delete the texture
void deleteImage();
int w() {
Commit: 62e5879f22db21b0efc81f41e08f4fc729dab2f2
https://github.com/scummvm/scummvm/commit/62e5879f22db21b0efc81f41e08f4fc729dab2f2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make Vectors class follow code formatting conventions
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGrid.cpp
engines/crab/Polygon.cpp
engines/crab/ai/spriteai.cpp
engines/crab/vectors.h
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index bb04c66382f..92aef645b22 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -90,8 +90,8 @@ void PathfindingAgent::setDestination(Vector2f d, bool r) {
PlannerNode *startingNode = new PlannerNode();
startingNode->setLocation(_startTile);
- startingNode->setHCost((_position - _destination).Magnitude());
- startingNode->setFinalCost((_position - _destination).Magnitude());
+ startingNode->setHCost((_position - _destination).magnitude());
+ startingNode->setFinalCost((_position - _destination).magnitude());
startingNode->setGivenCost(0.0);
_nodeQueue.push(startingNode);
@@ -112,7 +112,7 @@ void PathfindingAgent::update(long timeslice) {
if (_solutionFound) {
if (_vSolution.size() > 0) {
- float distSqr = (_position - _vSolution.back()->getPosition()).MagSqr();
+ float distSqr = (_position - _vSolution.back()->getPosition()).magSqr();
if (distSqr < _nodeBufferDistance) // Have to find the right deadzone buffer
{
_vSolution.pop_back();
@@ -310,13 +310,13 @@ Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSol
double PathfindingAgent::distSquared(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB) {
Vector2f vecTo = tileA->getPosition() - tileB->getPosition();
- return vecTo.MagSqr();
+ return vecTo.magSqr();
}
double PathfindingAgent::distExact(PathfindingGraphNode *tileA, PathfindingGraphNode *tileB) {
Vector2f vecTo = tileA->getPosition() - tileB->getPosition();
- return vecTo.Magnitude();
+ return vecTo.magnitude();
}
// This keeps the PriorityQueue organized based on the cost of the paths.
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 69e3328a1b0..29e75c39bb1 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -69,7 +69,7 @@ void PathfindingGraphNode::addNeighbor(PathfindingGraphNode *node, bool ignoreDi
} else {
Vector2f distVec = node->_position - this->_position;
- _neighborCosts.push_back(distVec.Magnitude() * node->_movementCost);
+ _neighborCosts.push_back(distVec.magnitude() * node->_movementCost);
}
}
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 0024fed9ead..d800527e92b 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -250,7 +250,7 @@ PathfindingGraphNode *PathfindingGrid::getNearestOpenNode(Vector2f nodePos, Vect
// Iterate through the nodes, check if they are open then check their distance from the compare point.
while (!checkNodes.empty()) {
if (checkNodes.front()->getMovementCost() > 0) {
- float distance = (comparePos - checkNodes.front()->getPosition()).MagSqr();
+ float distance = (comparePos - checkNodes.front()->getPosition()).magSqr();
if (shortestDistance == 0.0f || distance) // If this is the new shortest distance, this becomes the new return.
{
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 697ef3e62bf..adb3290abd5 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -140,12 +140,12 @@ void Polygon2D::offset(const float &x, const float &y) {
void Polygon2D::project(const Vector2f &axis, float &min, float &max) const {
// To project a point on an axis use the dot product
- float d = axis.DotProduct(_point[0]);
+ float d = axis.dotProduct(_point[0]);
min = d;
max = d;
for (auto i = _point.begin(); i != _point.end(); ++i) {
- d = i->DotProduct(axis);
+ d = i->dotProduct(axis);
if (d < min)
min = d;
@@ -195,7 +195,7 @@ PolygonCollisionResult Polygon2D::collide(const Polygon2D &polyB) const {
// Find the axis perpendicular to the current edge
Vector2f axis(-e.y, e.x);
- axis.Normalize();
+ axis.normalize();
// Find the projection of the Polygon2D on the current axis
float minA = 0;
@@ -228,7 +228,7 @@ PolygonCollisionResult Polygon2D::collide(const Polygon2D &polyB) const {
d.x = ca.x - cb.x;
d.y = ca.y - cb.y;
- if (d.DotProduct(translationAxis) < 0) {
+ if (d.dotProduct(translationAxis) < 0) {
translationAxis.x = -translationAxis.x;
translationAxis.y = -translationAxis.y;
}
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index b75ec2e3d05..96c9d3c6340 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -130,8 +130,8 @@ bool Sprite::moveToLocPathfinding(Vector2i &dest, const float &velocity, const S
// Project how far we will travel next frame.
Vector2f velVec = Vector2f(sc._walkVelMod.x * velocity * deltaTime, sc._walkVelMod.y * velocity * deltaTime);
- if (vecTo.Magnitude() > velVec.Magnitude()) {
- vecTo.Normalize();
+ if (vecTo.magnitude() > velVec.magnitude()) {
+ vecTo.normalize();
xVel(vecTo.x * sc._walkVelMod.x * velocity);
yVel(vecTo.y * sc._walkVelMod.y * velocity);
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index 755d0c28d7a..7e32f15a547 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -65,15 +65,23 @@ public:
#endif
}
- double Magnitude() { return sqrt(x * x + y * y); }
- double MagSqr() { return (x * x + y * y); } // Added to avoid unnecessary sqrt calls (SZ)
- void Normalize() {
- double m = Magnitude();
+ double magnitude() {
+ return sqrt(x * x + y * y);
+ }
+
+ double magSqr() { // Added to avoid unnecessary sqrt calls (SZ)
+ return (x * x + y * y);
+ }
+
+ void normalize() {
+ double m = magnitude();
x = x / m;
y = y / m;
}
- float DotProduct(const Vector2D<T> &v) const { return x * v.x + y * v.y; }
+ float dotProduct(const Vector2D<T> &v) const {
+ return x * v.x + y * v.y;
+ }
// operators
void operator+=(const Vector2D &v) {
@@ -102,15 +110,23 @@ class Vector3D {
public:
T x, y, z;
- Vector3D(T X = 0, T Y = 0, T Z = 0) { Set(X, Y, Z); }
- Vector3D(rapidxml::xml_node<char> *node) { load(node); }
+ Vector3D(T X = 0, T Y = 0, T Z = 0) {
+ set(X, Y, Z);
+ }
+
+ Vector3D(rapidxml::xml_node<char> *node) {
+ load(node);
+ }
- void Set(T X = 0, T Y = 0, T Z = 0) {
+ void set(T X = 0, T Y = 0, T Z = 0) {
x = X;
y = Y;
z = Z;
}
- bool load(rapidxml::xml_node<char> *node) { return loadXYZ<T>(x, y, z, node); }
+
+ bool load(rapidxml::xml_node<char> *node) {
+ return loadXYZ<T>(x, y, z, node);
+ }
// operators
void operator+=(const Vector3D &v) {
Commit: f0c816a3fb4d8fd24d9a75126e2d3fc66c28fd6f
https://github.com/scummvm/scummvm/commit/f0c816a3fb4d8fd24d9a75126e2d3fc66c28fd6f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Append of namespace message at the end of GameParam.cpp
Changed paths:
engines/crab/GameParam.cpp
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index fe6d4bb16dd..dde329056d5 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -141,4 +141,4 @@ void FilePaths::load(const Common::String &filename) {
}
}
-}
+} // End of namespace Crab
Commit: 2e955b366a6b3796ed0c3699aacc32819f81974c
https://github.com/scummvm/scummvm/commit/2e955b366a6b3796ed0c3699aacc32819f81974c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Fix code formatting in PathfindingAgent.cpp
Changed paths:
engines/crab/PathfindingAgent.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 92aef645b22..be7bb5ac2dd 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -113,8 +113,7 @@ void PathfindingAgent::update(long timeslice) {
if (_solutionFound) {
if (_vSolution.size() > 0) {
float distSqr = (_position - _vSolution.back()->getPosition()).magSqr();
- if (distSqr < _nodeBufferDistance) // Have to find the right deadzone buffer
- {
+ if (distSqr < _nodeBufferDistance) { // Have to find the right deadzone buffer
_vSolution.pop_back();
}
}
@@ -141,9 +140,7 @@ void PathfindingAgent::update(long timeslice) {
PlannerNode *current = _nodeQueue.front();
_nodeQueue.pop();
- if (current->getLocation() == _goalTile)
- //|| //We're done.
- {
+ if (current->getLocation() == _goalTile) { // We're done.
// m_vSolution = getSolution();
_vSolution = getPrunedSolution(NULL);
_solutionFound = true;
Commit: 6db58b9ff8cc74ee90ba97c6cb36b0d9d19f21ab
https://github.com/scummvm/scummvm/commit/6db58b9ff8cc74ee90ba97c6cb36b0d9d19f21ab
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Fix code formatting in PathfindingGrid.cpp
Changed paths:
engines/crab/PathfindingGrid.cpp
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index d800527e92b..f80b3d78576 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -252,8 +252,7 @@ PathfindingGraphNode *PathfindingGrid::getNearestOpenNode(Vector2f nodePos, Vect
if (checkNodes.front()->getMovementCost() > 0) {
float distance = (comparePos - checkNodes.front()->getPosition()).magSqr();
- if (shortestDistance == 0.0f || distance) // If this is the new shortest distance, this becomes the new return.
- {
+ if (shortestDistance == 0.0f || distance) { // If this is the new shortest distance, this becomes the new return.
shortestDistance = distance;
returnNode = checkNodes.front();
Commit: d7ac8b61852fb4cab6354276562c14aa4c47a1ff
https://github.com/scummvm/scummvm/commit/d7ac8b61852fb4cab6354276562c14aa4c47a1ff
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace unsigned int with uint
Changed paths:
engines/crab/LoadingScreen.h
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGrid.cpp
engines/crab/Polygon.cpp
engines/crab/ScreenSettings.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TileInfo.h
engines/crab/ai/moveeffect.h
engines/crab/ai/movement.h
engines/crab/ai/spriteai.cpp
engines/crab/ai/spriteai.h
engines/crab/animation/PopUp.cpp
engines/crab/animation/animframe.h
engines/crab/animation/fightanim.h
engines/crab/animation/fightmoves.cpp
engines/crab/animation/fightmoves.h
engines/crab/animation/fm_ai_data.h
engines/crab/animation/sprite.cpp
engines/crab/animation/sprite.h
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSeqGroup.h
engines/crab/event/EventSequence.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/conversationdata.h
engines/crab/event/eventstore.cpp
engines/crab/event/eventstore.h
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.cpp
engines/crab/event/gameeventmanager.h
engines/crab/image/ImageManager.h
engines/crab/input/fightinput.h
engines/crab/input/input.cpp
engines/crab/input/input.h
engines/crab/item/Item.h
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.cpp
engines/crab/item/ItemMenu.h
engines/crab/level/level.h
engines/crab/level/level_ai.cpp
engines/crab/level/level_collide.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/mainmenu.cpp
engines/crab/people/person.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.cpp
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.h
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/QuestText.cpp
engines/crab/ui/QuestText.h
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/SaveGameMenu.cpp
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SlideShow.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/TraitMenu.h
engines/crab/ui/emotion.cpp
engines/crab/ui/emotion.h
engines/crab/ui/hud.cpp
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/ui/map.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
engines/crab/ui/textarea.h
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 39bebfc9515..12104f78480 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -60,7 +60,7 @@ class LoadingScreen {
Common::Array<Screen> _screen;
// The current loading screen
- unsigned int _cur;
+ uint _cur;
// The text image (says loading)
pyrodactyl::image::Image _text;
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index be7bb5ac2dd..e926378f684 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -286,9 +286,9 @@ Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getPrunedSol
Common::Array<PathfindingGraphNode const *> returnVec = temp;
// Any node that is not adjacent to an obstacle or an obstacle corner can be removed.
- for (int i = 0; (unsigned int)i < temp.size(); ++i) {
+ for (int i = 0; (uint)i < temp.size(); ++i) {
if (!temp[i]->adjacentToObstacle()) {
- if (i > 0 && (unsigned int)i < temp.size() - 1) {
+ if (i > 0 && (uint)i < temp.size() - 1) {
// This check to see if the node is a "corner" to an obstacle that should not be pruned
// to prevent hanging on corners.
Common::Array<PathfindingGraphNode *> corners = _grid->cornerCheck(temp[i - 1], temp[i + 1]);
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 29e75c39bb1..0fa1acec37a 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -55,7 +55,7 @@ void PathfindingGraphNode::addNeighbor(PathfindingGraphNode *node, bool ignoreDi
return;
// Make sure that the node is not already a neighbor (SZ)
- for (unsigned int i = 0; i < _neighborNodes.size(); ++i) {
+ for (uint i = 0; i < _neighborNodes.size(); ++i) {
if (_neighborNodes[i]->_id == node->_id) {
return;
}
@@ -83,7 +83,7 @@ bool PathfindingGraphNode::adjacentToObstacle() const {
}
bool PathfindingGraphNode::adjacentToNode(PathfindingGraphNode *otherNode) {
- for (unsigned int i = 0; i < _neighborNodes.size(); ++i) {
+ for (uint i = 0; i < _neighborNodes.size(); ++i) {
if (_neighborNodes[i] == otherNode)
return true;
}
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index f80b3d78576..9c43a5c4ccc 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -258,7 +258,7 @@ PathfindingGraphNode *PathfindingGrid::getNearestOpenNode(Vector2f nodePos, Vect
returnNode = checkNodes.front();
}
} else {
- for (unsigned int i = 0; i < checkNodes.front()->_neighborNodes.size(); ++i) {
+ for (uint i = 0; i < checkNodes.front()->_neighborNodes.size(); ++i) {
// If the neighbor hasn't been checked yet, add it to the list to check.
if (Common::find(allUsedNodes.begin(), allUsedNodes.end(), checkNodes.front()->_neighborNodes[i]) == allUsedNodes.end()) {
allUsedNodes.push_back(checkNodes.front()->_neighborNodes[i]);
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index adb3290abd5..f73380b2460 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -103,7 +103,7 @@ void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
void Polygon2D::setEdge() {
_edge.clear();
Vector2f p1, p2, res;
- for (unsigned int i = 0; i < _point.size(); i++) {
+ for (uint i = 0; i < _point.size(); i++) {
p1 = _point[i];
if (i + 1 >= _point.size())
p2 = _point[0];
@@ -118,7 +118,7 @@ void Polygon2D::setEdge() {
Vector2f Polygon2D::center() const {
Vector2f total;
- for (unsigned int i = 0; i < _point.size(); i++) {
+ for (uint i = 0; i < _point.size(); i++) {
total.x += _point[i].x;
total.y += _point[i].y;
}
@@ -249,7 +249,7 @@ PolygonCollisionResult Polygon2D::collide(const Polygon2D &polyB) const {
bool Polygon2D::contains(const float &x, const float &y) {
bool result = false;
- for (unsigned int i = 0, j = _point.size() - 1; i < _point.size(); j = i++) {
+ for (uint i = 0, j = _point.size() - 1; i < _point.size(); j = i++) {
if (((_point[i].y > y) != (_point[j].y > y)) &&
(x < (_point[j].x - _point[i].x) * (y - _point[i].y) / (_point[j].y - _point[i].y) + _point[i].x))
result = !result;
@@ -260,7 +260,7 @@ bool Polygon2D::contains(const float &x, const float &y) {
void Polygon2D::draw(const int &xOffset, const int &yOffset, const uint8 &r, const uint8 &g, const uint8 &b, const uint8 &a) {
Vector2f p1, p2;
- for (unsigned int i = 0; i < _point.size(); i++) {
+ for (uint i = 0; i < _point.size(); i++) {
p1 = _point[i];
if (i + 1 >= _point.size())
p2 = _point[0];
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index c687a0db558..5592b240510 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -117,7 +117,7 @@ public:
bool _changeInterface;
// The version of the settings
- unsigned int _version;
+ uint _version;
ScreenSettings() {
_inGame = false;
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 4a92fb7b6f5..72f1fd9af68 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -103,7 +103,7 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
// Reset the layer at which sprites are drawn
_spriteLayer = 0;
- unsigned int layerCount = 0;
+ uint layerCount = 0;
// We need to cycle through all tile and object layers in order to
// see the level at which the sprites will be drawn
@@ -148,7 +148,7 @@ void TMXMap::load(const Common::String &path, Common::String filename) {
Shape s;
s.load(n);
- unsigned int pos = _areaTrig.size();
+ uint pos = _areaTrig.size();
loadNum(pos, "name", n);
if (_areaTrig.size() <= pos)
@@ -317,7 +317,7 @@ bool TMXMap::insideWalk(const Vector2i &pos) {
}
bool TMXMap::collideWithTrigger(const Rect rect, int index) {
- if (_areaTrig.size() > (unsigned int)index)
+ if (_areaTrig.size() > (uint)index)
return _areaTrig[index].collide(rect)._intersect;
return false;
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index b1ad3d98b50..54354c874b0 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -75,7 +75,7 @@ public:
Common::Array<pyrodactyl::level::Exit> _areaExit;
// The layer on top of which objects walk
- unsigned int _spriteLayer;
+ uint _spriteLayer;
// Dimensions of the level in terms of tiles
int _tileRows, _tileCols;
diff --git a/engines/crab/TMX/TileInfo.h b/engines/crab/TMX/TileInfo.h
index 5ebfa8e91e4..90d865fabbf 100644
--- a/engines/crab/TMX/TileInfo.h
+++ b/engines/crab/TMX/TileInfo.h
@@ -37,7 +37,7 @@
namespace Crab {
namespace TMX {
-typedef unsigned int GidFormat;
+typedef uint GidFormat;
// Bits on the far end of the 32-bit global tile ID are used for tile flags
const static GidFormat FlippedHorizontallyFlag = 0x80000000;
diff --git a/engines/crab/ai/moveeffect.h b/engines/crab/ai/moveeffect.h
index a98ca438f12..de7a846a4f9 100644
--- a/engines/crab/ai/moveeffect.h
+++ b/engines/crab/ai/moveeffect.h
@@ -56,7 +56,7 @@ struct FightMoveEffect {
int _death;
// The stun time for the enemy if this move hits a sprite
- unsigned int _stun;
+ uint _stun;
// The base damage of the move if it hits a sprite
int _dmg;
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index d838449468e..de4f0980442 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -61,7 +61,7 @@ struct MovementSet {
bool _repeat;
// The current path node we are traveling to
- unsigned int _cur;
+ uint _cur;
// The time the sprite has spent waiting is calculated here
Timer _timer;
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 96c9d3c6340..641a1816840 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -213,7 +213,7 @@ void Sprite::attack(pyrodactyl::event::Info &info, Sprite &targetSp, const Sprit
_aiData._fight._state = FIGHTSTATE_GETINRANGE;
_aiData._fight._delay.start();
- unsigned int size = _aiData._fight._attack.size();
+ uint size = _aiData._fight._attack.size();
if (size > 1)
_animSet._fight.next(_aiData._fight._attack[g_engine->getRandomNumber(_aiData._fight._attack.size())]);
else if (size <= 0)
diff --git a/engines/crab/ai/spriteai.h b/engines/crab/ai/spriteai.h
index 7123ab625a4..a1df5046c87 100644
--- a/engines/crab/ai/spriteai.h
+++ b/engines/crab/ai/spriteai.h
@@ -68,7 +68,7 @@ struct SpriteAIData {
Timer _delay;
// The list of moves that can be performed while attacking
- Common::Array<unsigned int> _attack;
+ Common::Array<uint> _attack;
FightData() {
_state = FIGHTSTATE_GETNEXTMOVE;
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index c9811642da0..d02bd559dc7 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -93,9 +93,9 @@ bool PopUp::internalEvents(pyrodactyl::event::Info &info, const Common::String &
void PopUpCollection::internalEvents(pyrodactyl::event::Info &info, const Common::String &playerId,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq) {
- if (_cur >= 0 && (unsigned int)_cur < _element.size()) {
+ if (_cur >= 0 && (uint)_cur < _element.size()) {
if (_element[_cur].internalEvents(info, playerId, result, endSeq)) {
- if (_element[_cur]._next <= 0 || (unsigned int)_element[_cur]._next >= _element.size()) {
+ if (_element[_cur]._next <= 0 || (uint)_element[_cur]._next >= _element.size()) {
// This means that this popup is the "end" node, we must loop back to start or end this
if (_loop) {
_cur = 0;
@@ -125,7 +125,7 @@ void PopUp::draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop,
}
void PopUpCollection::draw(const int &x, const int &y, pyrodactyl::ui::ParagraphData &pop, const Rect &camera) {
- if (_cur >= 0 && (unsigned int)_cur < _element.size())
+ if (_cur >= 0 && (uint)_cur < _element.size())
_element[_cur].draw(x, y, pop, camera);
}
diff --git a/engines/crab/animation/animframe.h b/engines/crab/animation/animframe.h
index 6be0b030695..cec3b68fdba 100644
--- a/engines/crab/animation/animframe.h
+++ b/engines/crab/animation/animframe.h
@@ -71,7 +71,7 @@ public:
Common::Array<AnimFrame> _frame;
// The currentClip
- unsigned int _currentClip;
+ uint _currentClip;
// Should we flip the images in the frame rectangle?
TextureFlipType _flip;
diff --git a/engines/crab/animation/fightanim.h b/engines/crab/animation/fightanim.h
index de719a2b341..b10a777140c 100644
--- a/engines/crab/animation/fightanim.h
+++ b/engines/crab/animation/fightanim.h
@@ -53,7 +53,7 @@ struct FightAnimFrame : public AnimFrame {
Vector2i _delta;
// The sprite state for the duration of the frame
- unsigned int _state;
+ uint _state;
// Can we cancel/branch to another move from this frame?
bool _branch;
@@ -78,7 +78,7 @@ public:
Common::Array<FightAnimFrame> _frame;
// The currentClip
- unsigned int _currentClip;
+ uint _currentClip;
// Should we flip the images in the frame rectangle?
TextureFlipType _flip;
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index 3a628d6db59..d8336240038 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -64,7 +64,7 @@ void FightMoves::load(rapidxml::xml_node<char> *node) {
// Purpose: Return current or next move
//------------------------------------------------------------------------
bool FightMoves::curMove(FightMove &fm) {
- if (_cur >= 0 && (unsigned int)_cur < _move.size()) {
+ if (_cur >= 0 && (uint)_cur < _move.size()) {
fm = _move[_cur];
return true;
}
@@ -73,7 +73,7 @@ bool FightMoves::curMove(FightMove &fm) {
}
bool FightMoves::nextMove(FightMove &fm) {
- if (_next >= 0 && (unsigned int)_next < _move.size()) {
+ if (_next >= 0 && (uint)_next < _move.size()) {
fm = _move[_next];
return true;
}
@@ -86,7 +86,7 @@ bool FightMoves::nextMove(FightMove &fm) {
//------------------------------------------------------------------------
bool FightMoves::curFrame(FightAnimFrame &faf, const Direction &d) {
// Check validity of current move
- if (_cur >= 0 && (unsigned int)_cur < _move.size()) {
+ if (_cur >= 0 && (uint)_cur < _move.size()) {
// Check validity of current frame
if (_frameCur < _frameTotal && _frameCur < _move[_cur]._frames[d]._frame.size()) {
faf = _move[_cur]._frames[d]._frame[_frameCur];
@@ -102,7 +102,7 @@ bool FightMoves::curFrame(FightAnimFrame &faf, const Direction &d) {
//------------------------------------------------------------------------
FrameUpdateResult FightMoves::updateFrame(const Direction &d) {
// Check validity of current move
- if (_cur >= 0 && (unsigned int)_cur < _move.size()) {
+ if (_cur >= 0 && (uint)_cur < _move.size()) {
// Check validity of current frame
if (_frameCur < _frameTotal && _frameCur < _move[_cur]._frames[d]._frame.size()) {
// Has the current frame finished playing?
@@ -124,10 +124,10 @@ FrameUpdateResult FightMoves::updateFrame(const Direction &d) {
//------------------------------------------------------------------------
// Purpose: Find a move corresponding to the input and sprite state
//------------------------------------------------------------------------
-unsigned int FightMoves::findMove(const pyrodactyl::input::FightAnimationType &type, const int &state) {
- unsigned int pos = 0;
+uint FightMoves::findMove(const pyrodactyl::input::FightAnimationType &type, const int &state) {
+ uint pos = 0;
for (auto i = _move.begin(); i != _move.end(); ++i, ++pos)
- if (i->_input._type == type && i->_input._state == (unsigned int)state)
+ if (i->_input._type == type && i->_input._state == (uint)state)
return pos;
pos = 0;
@@ -141,9 +141,9 @@ unsigned int FightMoves::findMove(const pyrodactyl::input::FightAnimationType &t
//------------------------------------------------------------------------
// Purpose: Function for AI
//------------------------------------------------------------------------
-void FightMoves::listAttackMoves(Common::Array<unsigned int> &list) {
+void FightMoves::listAttackMoves(Common::Array<uint> &list) {
list.clear();
- unsigned int pos = 0;
+ uint pos = 0;
for (auto i = _move.begin(); i != _move.end(); ++i, ++pos)
if (i->_ai._type == MOVE_ATTACK)
list.push_back(pos);
@@ -152,11 +152,11 @@ void FightMoves::listAttackMoves(Common::Array<unsigned int> &list) {
//------------------------------------------------------------------------
// Purpose: Force update to a new move
//------------------------------------------------------------------------
-bool FightMoves::forceUpdate(const unsigned int &index, pyrodactyl::input::FightInput &input, const Direction &d) {
+bool FightMoves::forceUpdate(const uint &index, pyrodactyl::input::FightInput &input, const Direction &d) {
_frameCur = 0;
_cur = index;
- if ((unsigned int)_cur < _move.size()) {
+ if ((uint)_cur < _move.size()) {
if (_move[_cur]._unlock.result()) {
_frameTotal = _move[_cur]._frames[d]._frame.size();
if (_frameTotal > 0) {
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index 938fbbf26f2..7bc151e6de8 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -47,7 +47,7 @@ enum FrameUpdateResult {
};
// This state value indicates that the move should execute regardless of actual sprite state
-const unsigned int SPRITE_STATE_OVERRIDE = std::numeric_limits<unsigned int>::max();
+const uint SPRITE_STATE_OVERRIDE = std::numeric_limits<uint>::max();
class FightMoves {
// The fighting moves of a sprite
@@ -66,7 +66,7 @@ class FightMoves {
bool _start;
// The current frame and total frames
- unsigned int _frameCur, _frameTotal;
+ uint _frameCur, _frameTotal;
public:
FightMoves();
@@ -85,17 +85,17 @@ public:
FrameUpdateResult updateFrame(const Direction &d);
bool curFrame(FightAnimFrame &faf, const Direction &d);
- unsigned int findMove(const pyrodactyl::input::FightAnimationType &type, const int &state);
+ uint findMove(const pyrodactyl::input::FightAnimationType &type, const int &state);
- void listAttackMoves(Common::Array<unsigned int> &list);
+ void listAttackMoves(Common::Array<uint> &list);
- bool forceUpdate(const unsigned int &index, pyrodactyl::input::FightInput &input, const Direction &d);
+ bool forceUpdate(const uint &index, pyrodactyl::input::FightInput &input, const Direction &d);
bool lastFrame() {
return _frameCur >= _frameTotal;
}
- void frameIndex(unsigned int val) {
+ void frameIndex(uint val) {
_frameCur = val;
}
@@ -104,7 +104,7 @@ public:
}
bool validMove() {
- return _cur >= 0 && (unsigned int)_cur < _move.size();
+ return _cur >= 0 && (uint)_cur < _move.size();
}
bool empty() {
diff --git a/engines/crab/animation/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
index 299408e74d0..43e0a43986c 100644
--- a/engines/crab/animation/fm_ai_data.h
+++ b/engines/crab/animation/fm_ai_data.h
@@ -52,7 +52,7 @@ struct FightMoveAIData {
Range _range;
// The AI delays executing the move by this long
- unsigned int _delay;
+ uint _delay;
FightMoveAIData() {
_type = MOVE_NONE;
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 62c11d89433..8b40d27bd71 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -77,7 +77,7 @@ void Sprite::load(rapidxml::xml_node<char> *node, Common::Array<Common::String>
_imgSize.x = dat.w();
_imgSize.y = dat.h();
- unsigned int index = 0;
+ uint index = 0;
loadNum(index, "moveset", node);
if (index < animations.size())
@@ -518,19 +518,19 @@ void Sprite::updateMove(const FightAnimationType &combo) {
}
void Sprite::forceUpdateMove(const FightAnimationType &combo) {
- unsigned int index = _animSet._fight.findMove(combo, _input._state);
+ uint index = _animSet._fight.findMove(combo, _input._state);
forceUpdateMove(index);
}
//------------------------------------------------------------------------
// Purpose: Update the move info of the AI or player sprite
//------------------------------------------------------------------------
-void Sprite::updateMove(const unsigned int &index) {
+void Sprite::updateMove(const uint &index) {
if (_input.idle())
forceUpdateMove(index);
}
-void Sprite::forceUpdateMove(const unsigned int &index) {
+void Sprite::forceUpdateMove(const uint &index) {
if (_animSet._fight.forceUpdate(index, _input, _dir)) {
// This sets the sprite input to the current move input
_animSet._fight.curCombo(_input);
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 23eca75035a..c1ceb477334 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -257,8 +257,8 @@ public:
void updateMove(const pyrodactyl::input::FightAnimationType &combo);
void forceUpdateMove(const pyrodactyl::input::FightAnimationType &combo);
- void updateMove(const unsigned int &index);
- void forceUpdateMove(const unsigned int &index);
+ void updateMove(const uint &index);
+ void forceUpdateMove(const uint &index);
// Set sprite destination
void setDestPathfinding(const Vector2i &dest, bool reachable = true);
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 7511f6d7b0c..05c94cf7d52 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -35,24 +35,24 @@ namespace Crab {
using namespace pyrodactyl::event;
-void EventSeqGroup::endSeq(const unsigned int &id) {
+void EventSeqGroup::endSeq(const uint &id) {
_seq.erase(id);
_end.push_back(id);
}
-void EventSeqGroup::addSeq(const unsigned int &id, Common::String &path) {
+void EventSeqGroup::addSeq(const uint &id, Common::String &path) {
_seq[id].load(path);
}
-bool EventSeqGroup::eventInProgress(const unsigned int &id) {
+bool EventSeqGroup::eventInProgress(const uint &id) {
return _seq.contains(id) && _seq[id].eventInProgress();
}
-GameEvent *EventSeqGroup::curEvent(const unsigned int &id) {
+GameEvent *EventSeqGroup::curEvent(const uint &id) {
return _seq[id].currentEvent();
}
-void EventSeqGroup::nextEvent(const unsigned int &id, Info &info, const Common::String &playerId,
+void EventSeqGroup::nextEvent(const uint &id, Info &info, const Common::String &playerId,
Common::Array<EventResult> &result, Common::Array<EventSeqInfo> &endSeq, const int choice) {
return _seq[id].nextEvent(info, playerId, result, endSeq, choice);
}
@@ -62,7 +62,7 @@ void EventSeqGroup::internalEvents(Info &info) {
it->_value.internalEvents(info);
}
-bool EventSeqGroup::activeSeq(unsigned int &activeSeq) {
+bool EventSeqGroup::activeSeq(uint &activeSeq) {
for (auto i = _seq.begin(); i != _seq.end(); ++i)
if (i->_value.eventInProgress()) {
activeSeq = i->_key;
@@ -86,11 +86,11 @@ void EventSeqGroup::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<
void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
for (rapidxml::xml_node<char> *i = node->first_node("end"); i != nullptr; i = i->next_sibling("end"))
- endSeq(stringToNumber<unsigned int>(i->value()));
+ endSeq(stringToNumber<uint>(i->value()));
for (auto n = node->first_node("set"); n != nullptr; n = n->next_sibling("set"))
if (n->first_attribute("name") != nullptr) {
- unsigned int id = stringToNumber<unsigned int>(n->first_attribute("name")->value());
+ uint id = stringToNumber<uint>(n->first_attribute("name")->value());
if (_seq.contains(id))
_seq[id].loadState(n);
}
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index 4c792b55552..d16e37aa23f 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -39,25 +39,25 @@ namespace Crab {
namespace pyrodactyl {
namespace event {
class EventSeqGroup {
- typedef Common::HashMap<unsigned int, EventSequence> SeqMap;
+ typedef Common::HashMap<uint, EventSequence> SeqMap;
// The event sequences in this group
SeqMap _seq;
// The sequences that have ended in this group
- Common::Array<unsigned int> _end;
+ Common::Array<uint> _end;
public:
EventSeqGroup(void) {}
~EventSeqGroup(void) {}
- void addSeq(const unsigned int &id, Common::String &path);
- void endSeq(const unsigned int &id);
- bool eventInProgress(const unsigned int &id);
- bool activeSeq(unsigned int &activeSeq);
+ void addSeq(const uint &id, Common::String &path);
+ void endSeq(const uint &id);
+ bool eventInProgress(const uint &id);
+ bool activeSeq(uint &activeSeq);
- GameEvent *curEvent(const unsigned int &id);
- void nextEvent(const unsigned int &id, Info &info, const Common::String &playerId, Common::Array<EventResult> &result,
+ GameEvent *curEvent(const uint &id);
+ void nextEvent(const uint &id, Info &info, const Common::String &playerId, Common::Array<EventResult> &result,
Common::Array<EventSeqInfo> &endSeq, const int choice = -1);
void internalEvents(Info &info);
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index a66b906c2b0..6b2e5dc4d08 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -119,7 +119,7 @@ void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
seqnode->append_attribute(doc.allocate_attribute("current", g_engine->_stringPool->Get(_cur)));
// Prepare strings of next events and write them
- for (unsigned int i = 0; i < _next.size(); i++) {
+ for (uint i = 0; i < _next.size(); i++) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "next");
child->value(g_engine->_stringPool->Get(_next[i]));
seqnode->append_node(child);
@@ -134,11 +134,11 @@ void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
void EventSequence::loadState(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *curid = node->first_attribute("current");
if (curid != nullptr)
- _cur = stringToNumber<unsigned int>(curid->value());
+ _cur = stringToNumber<uint>(curid->value());
_next.clear();
for (auto n = node->first_node("next"); n != nullptr; n = n->next_sibling("next"))
- _next.push_back(stringToNumber<unsigned int>(n->value()));
+ _next.push_back(stringToNumber<uint>(n->value()));
if (_next.empty())
_next.push_back(0);
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index e203473e31f..cbb6bacd093 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -48,12 +48,12 @@ class EventSequence {
bool _eventInProgress;
// The event currently in execution - updated only when all trigger conditions are met in InternalEvents
- unsigned int _cur;
+ uint _cur;
// The events that can happen next - these are updated when the cur event is over
// This means cur and next operate in an alternating way
// scan next until find event, make it cur, end cur and update next, repeat
- Common::Array<unsigned int> _next;
+ Common::Array<uint> _next;
public:
EventSequence() {
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index a345de6e697..ef8211e7b94 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -184,7 +184,7 @@ void Info::varDel(const Common::String &name) {
//------------------------------------------------------------------------
void Info::traitAdd(const Common::String &perId, const int &traitId) {
if (personValid(perId)) { // Valid person id
- if (traitId >= 0 && (unsigned int)traitId < g_engine->_eventStore->_trait.size()) { // Valid trait id
+ if (traitId >= 0 && (uint)traitId < g_engine->_eventStore->_trait.size()) { // Valid trait id
// Check for duplicate traits, DONT award anything if duplicate found
Person *p = &personGet(perId);
@@ -201,7 +201,7 @@ void Info::traitAdd(const Common::String &perId, const int &traitId) {
void Info::traitDel(const Common::String &perId, const int &traitId) {
if (personValid(perId)) { // Valid person id
- if (traitId > 0 && (unsigned int)traitId < g_engine->_eventStore->_trait.size()) { // Valid trait id
+ if (traitId > 0 && (uint)traitId < g_engine->_eventStore->_trait.size()) { // Valid trait id
Person *p = &personGet(perId);
for (auto j = p->_trait.begin(); j != p->_trait.end(); ++j) {
@@ -292,11 +292,11 @@ bool Info::collideWithTrigger(const Common::String &id, int rectIndex) {
//------------------------------------------------------------------------
void Info::insertName(Common::String &msg) {
// We scan the dialog for #id values, which we convert to actual NPC names
- for (unsigned int i = 0; i < msg.size(); ++i) {
+ for (uint i = 0; i < msg.size(); ++i) {
// The # symbol indicates that the next string until an end character needs to be replaced by the name
if (msg[i] == '#') {
// The position we want to start from, and the length of the substring
- unsigned int start = i, end = i + 1, len = 0;
+ uint start = i, end = i + 1, len = 0;
// First make sure # wasn't the end of the string
for (; end < msg.size(); ++end, ++len)
diff --git a/engines/crab/event/conversationdata.h b/engines/crab/event/conversationdata.h
index 24a1ea35a0a..ec21444e2d2 100644
--- a/engines/crab/event/conversationdata.h
+++ b/engines/crab/event/conversationdata.h
@@ -44,10 +44,10 @@ struct ReplyChoice {
Common::String _text;
// The tone of the response
- unsigned int _tone;
+ uint _tone;
// The next event id
- unsigned int _nextid;
+ uint _nextid;
// The conditions to unlock this choice
TriggerSet _unlock;
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 38f62134a9c..043bd574db3 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -34,7 +34,7 @@ namespace Crab {
using namespace pyrodactyl::event;
-void GameEventStore::addConv(rapidxml::xml_node<char> *node, unsigned int &index) {
+void GameEventStore::addConv(rapidxml::xml_node<char> *node, uint &index) {
ConversationData c;
if (nodeValid("talk", node))
c.load(node->first_node("talk"));
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index d835de99427..151c761fdfb 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -80,7 +80,7 @@ struct GameEventStore {
void load(const Common::String &filename);
- void addConv(rapidxml::xml_node<char> *node, unsigned int &index);
+ void addConv(rapidxml::xml_node<char> *node, uint &index);
void setAchievement(const int &id);
};
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index 3db5c8d8042..4177960c6ec 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -41,8 +41,8 @@
namespace Crab {
-// An unsigned integer is our event id format
-typedef unsigned int EventID;
+// An uinteger is our event id format
+typedef uint EventID;
// Just map loading function to number load
#define LoadEventID loadNum
@@ -73,7 +73,7 @@ struct GameEvent {
// Event type and related data index
EventType _type;
- unsigned int _special;
+ uint _special;
// The variables changed/added in the event
Common::Array<Effect> _effect;
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 27befcd049e..08fecebdecd 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -60,7 +60,7 @@ void Manager::load(rapidxml::xml_node<char> *node, ParagraphData &popup) {
loadStr(locName, "name", loc);
for (auto n = loc->first_node("file"); n != nullptr; n = n->next_sibling("file")) {
- unsigned int id;
+ uint id;
Common::String path;
loadNum(id, "name", n);
loadStr(path, "path", n);
@@ -393,7 +393,7 @@ void Manager::endSequence(const Common::String &curloc) {
if (i->_cur)
_eventMap[curloc].endSeq(_activeSeq);
else if (_eventMap.contains(i->_loc))
- _eventMap[i->_loc].endSeq(stringToNumber<unsigned int>(i->_val));
+ _eventMap[i->_loc].endSeq(stringToNumber<uint>(i->_val));
_activeSeq = UINT_MAX;
_endSeq.clear();
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 72df6c60346..653a09f13dd 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -52,7 +52,7 @@ protected:
Common::HashMap<Common::String, EventSeqGroup> _eventMap;
// The currently happening or active sequence
- unsigned int _activeSeq;
+ uint _activeSeq;
// THIS IS NOT THE DEFINITIVE LIST OF ENDED SEQUENCES
// JUST A TEMPORARY LIST OF EVENT SEQUENCES TO PASS AROUND
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index a1fb31b4f29..e3e346c9061 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -46,9 +46,9 @@
namespace Crab {
// We use this object as the key for all image assets
-typedef unsigned int ImageKey;
+typedef uint ImageKey;
-// Since we use unsigned int as a key for images, our loadImgKey function is loadNum
+// Since we use uint as a key for images, our loadImgKey function is loadNum
#define loadImgKey loadNum
namespace pyrodactyl {
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 2dc5da331f8..0e121c746ba 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -62,7 +62,7 @@ struct FightInput {
FightAnimationType _type;
// The sprite state, used to have different moves trigger from the same move
- unsigned int _state;
+ uint _state;
FightInput() {
reset();
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 1b6acbb3a6f..15c16a5ad60 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -207,17 +207,17 @@ void InputManager::restoreBackup() {
}
void InputManager::populateKeyTable() {
- for (unsigned int type = IG_START; type < IT_TOTAL; type++) {
+ for (uint type = IG_START; type < IT_TOTAL; type++) {
_keyDescs[type] = '\0';
}
setKeyBindingMode(KBM_GAME);
- for (unsigned int i = IG_START; i < IG_SIZE + IG_START; i++) {
+ for (uint i = IG_START; i < IG_SIZE + IG_START; i++) {
getAssociatedKey((InputType)i);
}
setKeyBindingMode(KBM_UI);
- for (unsigned int i = IU_START; i < IU_SIZE + IU_START; i++) {
+ for (uint i = IU_START; i < IU_SIZE + IU_START; i++) {
getAssociatedKey((InputType)i);
}
}
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 7b9f830864a..de850a60eba 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -101,7 +101,7 @@ class InputManager {
void load(const Common::String &filename);
// The current version of the input scheme
- unsigned int _version;
+ uint _version;
// The current mode of keymap applied
KeyBindingMode _keyMode;
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index e005365687f..1fd91d5501c 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -54,7 +54,7 @@ struct Item {
Common::Array<pyrodactyl::stat::Bonus> _bonus;
// The price
- unsigned int _value;
+ uint _value;
Item() {
clear();
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index 9f08d11836e..fd153a78593 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -53,7 +53,7 @@ class ItemCollection {
Vector2i _inc;
// The dimensions of the menu
- unsigned int _rows, _cols;
+ uint _rows, _cols;
// Draw item description when user clicks an item to select it
pyrodactyl::ui::ItemDesc _itemInfo;
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index 9ac6e41d1f9..ab09aae98b3 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -39,10 +39,10 @@ using namespace pyrodactyl::people;
//------------------------------------------------------------------------
// Purpose: Load the layout and items
//------------------------------------------------------------------------
-void ItemMenu::init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows, const unsigned int &cols,
+void ItemMenu::init(const ItemSlot &ref, const Vector2i &inc, const uint &rows, const uint &cols,
const bool &keyboard) {
- unsigned int size = rows * cols;
- for (unsigned int i = 0; i < size; ++i) {
+ uint size = rows * cols;
+ for (uint i = 0; i < size; ++i) {
ItemSlot b;
b.init(ref, inc.x * (i % cols), inc.y * (i / cols));
_element.push_back(b);
@@ -56,7 +56,7 @@ void ItemMenu::init(const ItemSlot &ref, const Vector2i &inc, const unsigned int
// Purpose: Load items from file
//------------------------------------------------------------------------
void ItemMenu::loadState(rapidxml::xml_node<char> *node) {
- unsigned int count = 0;
+ uint count = 0;
for (auto n = node->first_node(); n != nullptr && count < _element.size(); n = n->next_sibling(), ++count)
_element[count].loadState(n);
}
@@ -76,8 +76,8 @@ void ItemMenu::handleEvents(const Common::Event &event, const int &xOffset, cons
int result = Menu<ItemSlot>::handleEvents(event);
if (result != -1) {
_selectIndex = result;
- for (unsigned int i = 0; i < _element.size(); ++i)
- _element[i].state(i == (unsigned int)_selectIndex);
+ for (uint i = 0; i < _element.size(); ++i)
+ _element[i].state(i == (uint)_selectIndex);
}
}
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index 9df5803cbd6..dfb9fd4483f 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -67,8 +67,8 @@ public:
void draw(pyrodactyl::ui::ItemDesc &itemInfo);
/*pyrodactyl::people::Person &obj, pyrodactyl::stat::StatDrawHelper &helper*/
- void init(const ItemSlot &ref, const Vector2i &inc, const unsigned int &rows,
- const unsigned int &cols, const bool &keyboard);
+ void init(const ItemSlot &ref, const Vector2i &inc, const uint &rows,
+ const uint &cols, const bool &keyboard);
void handleEvents(const Common::Event &event, const int &xOffset = 0, const int &yOffset = 0);
#if 0
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index c37cb966284..be3bb39b5e9 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -60,7 +60,7 @@ class Level {
Rect _camera;
// The player sprite location in the object list
- unsigned int _playerIndex;
+ uint _playerIndex;
// The order in which to draw the sprites
Common::MultiMap<int, pyrodactyl::anim::Sprite *> _objSeq;
diff --git a/engines/crab/level/level_ai.cpp b/engines/crab/level/level_ai.cpp
index 7e2d4f9f40e..98a371f2afc 100644
--- a/engines/crab/level/level_ai.cpp
+++ b/engines/crab/level/level_ai.cpp
@@ -86,7 +86,7 @@ LevelResult Level::internalEvents(Info &info, Common::Array<EventResult> &result
//------------------------------------------------------------------------
void Level::think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event::EventResult> &result,
Common::Array<pyrodactyl::event::EventSeqInfo> &endSeq, Common::String &id) {
- unsigned int index = 0;
+ uint index = 0;
for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index) {
// Only bother if the sprite is visible
if (i->visible()) {
@@ -170,7 +170,7 @@ void Level::think(pyrodactyl::event::Info &info, Common::Array<pyrodactyl::event
// Purpose: Once a player provokes any sprite, call this function
//------------------------------------------------------------------------
void Level::battleAlert(pyrodactyl::event::Info &info) {
- unsigned int index = 0;
+ uint index = 0;
for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index) {
if (index != _playerIndex && i->visible() && info.state(i->id()) != PST_KO) {
switch (info.type(i->id())) {
@@ -208,7 +208,7 @@ void Level::moveObject(pyrodactyl::event::Info &info, pyrodactyl::anim::Sprite &
// Purpose: If any other object is trying to kill you, you are in combat
//------------------------------------------------------------------------
bool Level::playerInCombat(pyrodactyl::event::Info &info) {
- unsigned int index = 0;
+ uint index = 0;
for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index)
if (index != _playerIndex && info.state(i->id()) == PST_FIGHT && i->visible())
return true;
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index a23dc638d6e..bd41a13f5b3 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -85,7 +85,7 @@ bool Level::layerVisible(pyrodactyl::anim::Sprite *obj) {
if (obj->_layer < 0)
return true;
- if ((unsigned int)obj->_layer < _terrain._layer.size())
+ if ((uint)obj->_layer < _terrain._layer.size())
return _terrain._layer[obj->_layer]._collide;
return false;
@@ -109,7 +109,7 @@ bool Level::collidingWithObject(pyrodactyl::event::Info &info, Common::String &i
// Clip and Bounding rectangle of player
Rect pPos = _objects[_playerIndex].posRect(), pBound = _objects[_playerIndex].boundRect();
- unsigned int index = 0;
+ uint index = 0;
for (auto i = _objects.begin(); i != _objects.end(); ++i, ++index) {
if (i->visible() && _playerIndex != index && info.state(i->id()) == PST_NORMAL) {
// Clip and bounding rectangles for the NPC sprite
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 6e101421f6a..5ef5b14b0ba 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -43,7 +43,7 @@ using namespace pyrodactyl::input;
// Purpose: Pre render the terrain layer
void Level::preDraw() {
Graphics::ManagedSurface *surf = new Graphics::ManagedSurface(_terrain.w(), _terrain.h(), *g_engine->_format);
- unsigned int layerCount = 0u;
+ uint layerCount = 0u;
for (auto l = _terrain._layer.begin(); l != _terrain._layer.end(); ++l, ++layerCount) {
g_engine->_imageManager->_tileset.preDraw(*l, _terrain._tileSize, surf);
@@ -70,7 +70,7 @@ void Level::draw(pyrodactyl::event::Info &info) {
// Background sprites are assumed to be sorted by their layer count
auto b = _background.begin();
- unsigned int layerCount = 0u;
+ uint layerCount = 0u;
// Draw the terrain layer
g_engine->_imageManager->_tileset.draw(_terrain._layer[0], _camera, _terrain._tileSize, _objects[_playerIndex].posRect(), _img);
@@ -82,9 +82,9 @@ void Level::draw(pyrodactyl::event::Info &info) {
// Draw the background sprites
for (; b != _background.end(); ++b) {
- if ((unsigned int)b->_layer > layerCount) // We don't have any sprites to draw at this layer
+ if ((uint)b->_layer > layerCount) // We don't have any sprites to draw at this layer
break;
- else if ((unsigned int)b->_layer == layerCount && b->visible())
+ else if ((uint)b->_layer == layerCount && b->visible())
b->draw(info, _camera);
}
@@ -98,9 +98,9 @@ void Level::draw(pyrodactyl::event::Info &info) {
// Draw the background sprites
for (; b != _background.end(); ++b) {
- if ((unsigned int)b->_layer > layerCount) // We don't have any sprites to draw at this layer
+ if ((uint)b->_layer > layerCount) // We don't have any sprites to draw at this layer
break;
- else if ((unsigned int)b->_layer >= layerCount && b->visible())
+ else if ((uint)b->_layer >= layerCount && b->visible())
b->draw(info, _camera);
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 624ee84d239..830965fda9e 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -179,7 +179,7 @@ void Level::loadMoves(const Common::String &filename) {
if (movList.ready()) {
rapidxml::xml_node<char> *node = movList.doc()->first_node("movelist");
for (auto n = node->first_node("set"); n != nullptr; n = n->next_sibling("set")) {
- unsigned int pos = _animSet.size();
+ uint pos = _animSet.size();
loadNum(pos, "id", n);
if (pos >= _animSet.size())
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 92215365953..8304ec9dbb9 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -197,8 +197,8 @@ bool loadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node,
return false;
}
-unsigned int version(const Common::String &filename) {
- unsigned int version = 0;
+uint version(const Common::String &filename) {
+ uint version = 0;
XMLDoc doc(filename);
if (doc.ready()) {
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 5d521737695..11d618e0825 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -129,7 +129,7 @@ bool loadDirection(Direction &dir, rapidxml::xml_node<char> *node, const bool &e
bool loadTextureFlipType(TextureFlipType &flip, rapidxml::xml_node<char> *node, const bool &echo = true);
// Check the version of a file
-unsigned int version(const Common::String &filename);
+uint version(const Common::String &filename);
} // End of namespace Crab
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 0609ccaf11e..deca9d331e3 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -159,8 +159,8 @@ void MainMenu::handleEvents(Common::Event &event, bool &shouldChangeState, GameS
if (_state != STATE_CREDITS) {
int choice = _meMain.handleEvents(event);
if (choice >= 0) {
- for (unsigned i = 0; i < _meMain._element.size(); ++i)
- _meMain._element[i].state(i == (unsigned int)choice);
+ for (uint i = 0; i < _meMain._element.size(); ++i)
+ _meMain._element[i].state(i == (uint)choice);
switch (choice) {
case 0:
@@ -294,7 +294,7 @@ void MainMenu::handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameState
if (state != STATE_CREDITS) {
int choice = me_main.handleEvents(Event);
if (choice >= 0) {
- for (unsigned i = 0; i < me_main.element.size(); ++i)
+ for (uint i = 0; i < me_main.element.size(); ++i)
me_main.element[i].State(i == choice);
switch (choice) {
@@ -454,7 +454,7 @@ void MainMenu::changeState(MenuState ms, const bool &start) {
// We are entering the normal state, i.e outside all menus - reset color of menu items
if (_state == STATE_NORMAL) {
- for (unsigned i = 0; i < _meMain._element.size(); ++i)
+ for (uint i = 0; i < _meMain._element.size(); ++i)
_meMain._element[i].state(false);
}
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 6bc5aff3a1b..b5c6a4696e6 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -79,7 +79,7 @@ void Person::load(rapidxml::xml_node<char> *node, const pyrodactyl::stat::StatTe
} else {
int index = 0;
loadNum(index, "template", statnode);
- if (index >= 0 && (unsigned int)index < stem._collection.size())
+ if (index >= 0 && (uint)index < stem._collection.size())
for (int i = 0; i < STAT_TOTAL; i++)
_stat._val[i] = stem._collection[index]._val[i];
}
@@ -108,7 +108,7 @@ void Person::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
child->append_attribute(doc.allocate_attribute("id", _id.c_str()));
child->append_attribute(doc.allocate_attribute("name", _name.c_str()));
- unsigned int val = static_cast<unsigned int>(_state);
+ uint val = static_cast<uint>(_state);
child->append_attribute(doc.allocate_attribute("state", g_engine->_stringPool->Get(val)));
_opinion.saveState(doc, child);
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index ebdbe5cdc28..6fc46827d1f 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -62,7 +62,7 @@ void TextManager::init() {
size = n->first_attribute("size");
if (id != nullptr && path != nullptr && size != nullptr) {
- unsigned int pos = stringToNumber<unsigned int>(id->value());
+ uint pos = stringToNumber<uint>(id->value());
if (_font.size() <= pos)
_font.resize(pos + 1);
Common::File file;
@@ -195,9 +195,9 @@ void TextManager::draw(const int &x, const int &y, const Common::String &text, c
}
void TextManager::draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &fKey, const Align &align,
- const unsigned int &lineWidth, const unsigned int &lineHeight, const bool &background) {
- for (unsigned int startPos = 0, len = text.size(); startPos < len; y += lineHeight) {
- unsigned int endPos = startPos + 1;
+ const uint &lineWidth, const uint &lineHeight, const bool &background) {
+ for (uint startPos = 0, len = text.size(); startPos < len; y += lineHeight) {
+ uint endPos = startPos + 1;
int lastInterrupt = -1;
Common::String word;
@@ -215,13 +215,13 @@ void TextManager::draw(const int &x, int y, const Common::String &text, const in
if (lastInterrupt >= 0) // wrap a word around
{
- for (unsigned int i = 0; i < lastInterrupt - startPos; i++)
+ for (uint i = 0; i < lastInterrupt - startPos; i++)
word += text[startPos + i];
startPos = lastInterrupt + 1;
} else // word bigger than line, just thunk
{
- for (unsigned int i = 0; i < endPos - startPos; i++)
+ for (uint i = 0; i < endPos - startPos; i++)
word += text[startPos + i];
startPos += lineWidth;
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index d767abf05e1..efff46d9a69 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -40,9 +40,9 @@
namespace Crab {
// We use this object as the key for all fonts
-typedef unsigned int FontKey;
+typedef uint FontKey;
-// Since we use unsigned int as a key for images, our loadImgKey function is loadNum
+// Since we use uint as a key for images, our loadImgKey function is loadNum
#define LoadFontKey loadNum
namespace pyrodactyl {
@@ -117,7 +117,7 @@ public:
const FontKey &font = 0, const Align &align = ALIGN_LEFT, const bool &background = false);
void draw(const int &x, int y, const Common::String &text, const int &color, const FontKey &font, const Align &align,
- const unsigned int &lineWidth, const unsigned int &lineHeight, const bool &background = false);
+ const uint &lineWidth, const uint &lineHeight, const bool &background = false);
};
} // End of namespace text
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index d8ef53fff93..3e7aeeb35de 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -48,7 +48,7 @@ void ColorPool::load(const Common::String &filename) {
}
SDL_Color &ColorPool::get(const int &num) {
- if (_pool.size() <= static_cast<unsigned int>(num))
+ if (_pool.size() <= static_cast<uint>(num))
return _invalid;
return _pool[num];
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 23c67de969d..1446af5e9eb 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -126,7 +126,7 @@ public:
_slotInfo.clear();
_menu.clear();
- unsigned int countSlot = 0, countMenu = 0;
+ uint countSlot = 0, countMenu = 0;
for (const Common::String& save : saves) {
_slotInfo.push_back(FileType(save));
_menu.add(countSlot, countMenu);
@@ -149,7 +149,7 @@ public:
std::sort(file_in_dir.begin(), file_in_dir.end(), PathCompare);
// First, we must load all the files with the same extension as our save file
- unsigned int count_slot = 0, count_menu = 0;
+ uint count_slot = 0, count_menu = 0;
for (auto i = file_in_dir.begin(); i != file_in_dir.end(); ++i)
if (is_regular_file(*i) && i->extension().string() == extension) {
slot_info.push_back(FileType(*i));
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 11cf2aebb6e..03f7a0ef3c9 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -48,7 +48,7 @@ class GameOverMenu {
Common::Array<Common::String> _quote;
// The current picked quote
- unsigned int _cur;
+ uint _cur;
// How to draw the quote
TextData _title;
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index de765536a1b..14472a23b6e 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -99,7 +99,7 @@ void OptionMenu::reset() {
_keybind.reset();
_state = STATE_GENERAL;
- for (unsigned i = 0; i < _menu._element.size(); ++i)
+ for (uint i = 0; i < _menu._element.size(); ++i)
_menu._element[i].state(i == STATE_GENERAL);
}
@@ -318,7 +318,7 @@ bool OptionMenu::HandleTabs(Button &back, const SDL_Event &Event) {
int choice = menu.handleEvents(Event);
if (choice >= 0) {
if (choice < 4)
- for (unsigned i = 0; i < menu.element.size(); ++i)
+ for (uint i = 0; i < menu.element.size(); ++i)
menu.element[i].State(i == choice);
switch (choice) {
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index ea00069703b..bd2044af596 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -60,7 +60,7 @@ void OptionSelect::draw() {
if (_cur > 0)
_prev.draw();
- if ((unsigned int)_cur < option._text.size() - 1)
+ if ((uint)_cur < option._text.size() - 1)
_next.draw();
}
@@ -75,7 +75,7 @@ bool OptionSelect::handleEvents(const Common::Event &event) {
}
}
- if ((unsigned int)_cur < option._text.size() - 1) {
+ if ((uint)_cur < option._text.size() - 1) {
// Don't check for keyboard inputs for now
if (_next.handleEvents(event) == BUAC_LCLICK) {
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index aa500592bcf..f6852335317 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -45,7 +45,7 @@ class OptionSelect {
TextData _data;
void draw(const int &index) {
- if (index >= 0 && (unsigned int)index < _text.size())
+ if (index >= 0 && (uint)index < _text.size())
_data.draw(_text[index]);
}
} option;
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index d3962a907b8..22cb239b659 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -49,7 +49,7 @@ class PageMenu {
Common::Array<Menu<T>> _menu;
// Keep track of which page we are at, and how many elements we keep in a page
- unsigned int _currentPage, _elementsPerPage, _rows, _cols;
+ uint _currentPage, _elementsPerPage, _rows, _cols;
// The image used for the elements
Button _ref;
@@ -83,22 +83,22 @@ public:
}
// Get the elements per page
- unsigned int elementsPerPage() {
+ uint elementsPerPage() {
return _elementsPerPage;
}
// This is added to the result from handleEvents to calculate the exact position
- unsigned int index() {
+ uint index() {
return _currentPage * _elementsPerPage;
}
// The end position of the elements
- unsigned int indexPlusOne() {
+ uint indexPlusOne() {
return (_currentPage + 1) * _elementsPerPage;
}
// Get the current page of the menu
- unsigned int currentPage() {
+ uint currentPage() {
return _currentPage;
}
@@ -193,7 +193,7 @@ public:
}
}
- void add(unsigned int &slot, unsigned int &page) {
+ void add(uint &slot, uint &page) {
if (slot >= _elementsPerPage) {
++page;
slot = 0;
@@ -211,13 +211,13 @@ public:
}
void add() {
- unsigned int page = _menu.size() - 1;
- unsigned int slot = _menu[page]._element.size();
+ uint page = _menu.size() - 1;
+ uint slot = _menu[page]._element.size();
add(slot, page);
}
void erase() {
- unsigned int page = _menu.size() - 1;
+ uint page = _menu.size() - 1;
_menu[page]._element.pop_back();
assignPaths();
updateInfo();
diff --git a/engines/crab/ui/QuestText.cpp b/engines/crab/ui/QuestText.cpp
index 1f4e35a1c05..83ddfcd5ac7 100644
--- a/engines/crab/ui/QuestText.cpp
+++ b/engines/crab/ui/QuestText.cpp
@@ -72,10 +72,10 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
_stop = q._text.size();
// Keep count of lines and pages - remember a single entry can take more than one line
- unsigned int pageCount = 0, pageStart = 0;
+ uint pageCount = 0, pageStart = 0;
// Start from line 0, page 0 and scan the list of entries
- for (unsigned int i = 0, lineCount = 0; i < q._text.size(); ++i) {
+ for (uint i = 0, lineCount = 0; i < q._text.size(); ++i) {
// Increment the number of lines by one text entry
lineCount += (q._text[i].size() / _line.x) + 1;
@@ -121,7 +121,7 @@ void QuestText::draw(pyrodactyl::event::Quest &q) {
// Count the number of lines, because a single entry can take more than one line
int count = 0;
- for (unsigned int i = _start; i < (unsigned int)_stop; ++i) {
+ for (uint i = _start; i < (uint)_stop; ++i) {
_img.draw(_inc.x * count, _inc.y * count);
// Draw first entry in selected color, and older quest entries in standard color
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index cf5c3dc414d..e0e2cfc6913 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -53,10 +53,10 @@ protected:
ImageData _img;
// The lines per page, we split the quest text into multiple pages if we have to draw more than that
- unsigned int _linesPerPage;
+ uint _linesPerPage;
// Keep track of which page we are at, and total pages
- unsigned int _currentPage, _totalPage;
+ uint _currentPage, _totalPage;
// The quest entries we start and stop the drawing at
int _start, _stop;
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index 29c0baa5c83..16dc4e4f632 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -44,7 +44,7 @@ class ReplyButton : public Button {
int _colB, _colS, _colH;
FontKey _font;
Align _replyAlign;
- Vector2D<unsigned int> _lineSize;
+ Vector2D<uint> _lineSize;
// Reply options get moved around a lot, this remembers their actual position
Rect _orig;
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index 1e69b4e524d..a1541a4606e 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -63,7 +63,7 @@ void ReplyMenu::load(const Common::String &filename) {
int ReplyMenu::handleEvents(Info &info, ConversationData &dat, const Common::String &curId, PersonHandler &oh, const Common::Event &event) {
// After that, check if the user has clicked on any reply option
int choice = Menu<ReplyButton>::handleEvents(event);
- if (choice >= 0 && (unsigned int)choice < dat._reply.size()) {
+ if (choice >= 0 && (uint)choice < dat._reply.size()) {
bool playSound = false;
// Loop through any opinion changes required
@@ -107,7 +107,7 @@ void ReplyMenu::draw() {
void ReplyMenu::cache(pyrodactyl::event::Info &info, pyrodactyl::event::ConversationData &dat) {
// Some replies are locked, which means the other replies move up and take their place -
// which is why we need two count variables
- unsigned int replyCount = 0, elementCount = 0;
+ uint replyCount = 0, elementCount = 0;
for (auto i = dat._reply.begin(); i != dat._reply.end() && replyCount < dat._reply.size(); ++i, ++replyCount) {
if (i->_unlock.evaluate(info)) {
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 9d5a843db1a..35b4b6eb811 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -42,7 +42,7 @@ void GameSaveMenu::load(rapidxml::xml_node<char> *node) {
FileMenu<SaveFileData>::load(node);
}
-void GameSaveMenu::addButton(const Common::String &p, unsigned int &slotIndex, unsigned int &menuIndex) {
+void GameSaveMenu::addButton(const Common::String &p, uint &slotIndex, uint &menuIndex) {
_slotInfo.push_back(SaveFileData(p));
_menu.add(slotIndex, menuIndex);
}
@@ -55,7 +55,7 @@ void GameSaveMenu::scanDir() {
_slotInfo.clear();
_menu.clear();
- unsigned int countSlot = 0, countMenu = 0;
+ uint countSlot = 0, countMenu = 0;
// For the save menu, the first slot is a "blank" slot - to create a new save file
addButton("CRAB_New Save" + g_engine->_filePath->_saveExt, countMenu, countSlot);
@@ -119,7 +119,7 @@ void GameSaveMenu::draw() {
float base_x = _menu.baseX(count), base_y = _menu.baseY(count);
tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
- if (i == (unsigned int)_index && _state == STATE_NAME)
+ if (i == (uint)_index && _state == STATE_NAME)
_taName.draw();
else
tdB[DATA_SAVENAME].draw(_slotInfo[i]._name, base_x, base_y);
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index 0eb32f69af0..df4a24972d0 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -51,7 +51,7 @@ class GameSaveMenu : public FileMenu<SaveFileData> {
// The index of the selected button
int _index;
- void addButton(const Common::String &p, unsigned int &slotIndex, unsigned int &menuIndex);
+ void addButton(const Common::String &p, uint &slotIndex, uint &menuIndex);
public:
GameSaveMenu() {
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index 1f9beeeb6b2..cfd8f79b2df 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -48,7 +48,7 @@ class SlideShow {
pyrodactyl::image::Image _img;
// The index of our current image
- unsigned int _index;
+ uint _index;
// The position at which map image has to be drawn
Element _pos;
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 2e72e7db01f..056da8e1bb8 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -52,7 +52,7 @@ void TraitMenu::load(rapidxml::xml_node<char> *node) {
if (nodeValid("desc", node))
_desc.load(node->first_node("desc"));
- for (unsigned int i = 0; i < _size; ++i) {
+ for (uint i = 0; i < _size; ++i) {
TraitButton b;
b.init(_ref, _inc.x * (i % _cols), _inc.y * (i / _cols));
_menu._element.push_back(b);
@@ -77,7 +77,7 @@ void TraitMenu::draw(const pyrodactyl::people::Person *obj) {
for (; i != _menu._element.end(); ++i)
i->draw();
- if (_select > -1 && (unsigned int)_select < obj->_trait.size())
+ if (_select > -1 && (uint)_select < obj->_trait.size())
_desc.draw(obj->_trait[_select]._desc);
} else
for (auto &i : _menu._element)
@@ -94,7 +94,7 @@ void TraitMenu::handleEvents(pyrodactyl::people::Person *obj, const Common::Even
_select = choice;
if (obj != nullptr) {
- if (_select > -1 && (unsigned int)_select < obj->_trait.size())
+ if (_select > -1 && (uint)_select < obj->_trait.size())
obj->_trait[_select]._unread = false;
}
}
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index e836ab90eb9..812c054b5aa 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -58,7 +58,7 @@ class TraitMenu {
int _select;
// The size and dimensions of the menu
- unsigned int _size, _rows, _cols;
+ uint _size, _rows, _cols;
public:
TraitMenu() {
diff --git a/engines/crab/ui/emotion.cpp b/engines/crab/ui/emotion.cpp
index 1c6debe37f9..58aabe5bffb 100644
--- a/engines/crab/ui/emotion.cpp
+++ b/engines/crab/ui/emotion.cpp
@@ -41,7 +41,7 @@ void EmotionIndicator::load(rapidxml::xml_node<char> *node) {
}
void EmotionIndicator::draw(const int &select) {
- if (select >= 0 && (unsigned int)select < _value.size())
+ if (select >= 0 && (uint)select < _value.size())
if (_value[select] < g_engine->_eventStore->_tone.size()) {
_text.draw(g_engine->_eventStore->_tone[_value[select]]._text);
}
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index f163c81c6c3..76fc524309e 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -45,7 +45,7 @@ struct EmotionIndicator {
TextData _text;
// This array is used to store the corresponding tone values to a reply
- Common::Array<unsigned int> _value;
+ Common::Array<uint> _value;
EmotionIndicator() {}
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 3773a02048f..a929df5a367 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -145,7 +145,7 @@ void HUD::State(const int &val) {
}
void HUD::setTooltip() {
- unsigned int count = 0;
+ uint count = 0;
for (auto i = _menu._element.begin(); i != _menu._element.end() && count < _tooltip.size(); ++i, ++count)
i->_tooltip._text = _tooltip[count] + " (" + i->_hotkey.name() + ")";
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index 7f0c7e2a433..d89138b9196 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -89,7 +89,7 @@ void Journal::init(const Common::String &id) {
// Purpose: Select a category
//------------------------------------------------------------------------
void Journal::select(const Common::String &id, const int &choice) {
- for (unsigned int i = 0; i < _category._element.size(); ++i)
+ for (uint i = 0; i < _category._element.size(); ++i)
_category._element[i].state(false);
_category._element[choice].state(true);
@@ -130,7 +130,7 @@ void Journal::draw(const Common::String &id) {
//------------------------------------------------------------------------
bool Journal::handleEvents(const Common::String &id, const Common::Event &event) {
int choice = _category.handleEvents(event);
- if (choice >= 0 && (unsigned int)choice < _category._element.size())
+ if (choice >= 0 && (uint)choice < _category._element.size())
select(id, choice);
// Check if select is valid
@@ -196,7 +196,7 @@ void Journal::move(const Common::String &id, const Common::String &title, const
for (auto &jo : _journal)
if (jo._id == id) {
// Find the quest chain in the source menu
- unsigned int index = 0;
+ uint index = 0;
for (auto i = jo._menu[source]._quest.begin(); i != jo._menu[source]._quest.end(); ++i, ++index)
if (i->_title == title)
break;
@@ -224,7 +224,7 @@ void Journal::open(const Common::String &id, const JournalCategory &category, co
// Perform validity check on select, just in case
if (_select > 0 && _select < JE_TOTAL) {
// Search for the title with same name
- for (unsigned int num = 0; num < jo._menu[_select]._quest.size(); ++num)
+ for (uint num = 0; num < jo._menu[_select]._quest.size(); ++num)
if (jo._menu[_select]._quest[num]._title == title) {
// Found it, switch to this
jo._menu[_select].select(num);
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 69eb6d1ea14..8f7bc3861a1 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -360,7 +360,7 @@ bool Map::handleEvents(pyrodactyl::event::Info &info, const Common::Event &event
return false;
}
-void Map::setImage(const unsigned int &val, const bool &force) {
+void Map::setImage(const uint &val, const bool &force) {
if (force || (_cur != val && val < _map.size())) {
_cur = val;
@@ -402,7 +402,7 @@ void Map::update(pyrodactyl::event::Info &info) {
// Purpose: Add a rectangle to the revealed world map data
//------------------------------------------------------------------------
void Map::revealAdd(const int &id, const Rect &area) {
- if ((unsigned int)id < _map.size()) {
+ if ((uint)id < _map.size()) {
for (auto i = _map[id]._reveal.begin(); i != _map[id]._reveal.end(); ++i)
if (*i == area)
return;
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index e356705e2f0..631580f0b9e 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -51,7 +51,7 @@ class Map {
Common::Array<MapData> _map;
// Index of the currently visible map
- unsigned int _cur;
+ uint _cur;
// The currently loaded map background image
pyrodactyl::image::Image _imgBg, _imgOverlay;
@@ -135,7 +135,7 @@ public:
void selectDest(const Common::String &name);
void update(pyrodactyl::event::Info &info);
- void setImage(const unsigned int &val, const bool &force = false);
+ void setImage(const uint &val, const bool &force = false);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
void loadState(rapidxml::xml_node<char> *node);
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 3c0d698d05f..bc5e20f4a96 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -52,7 +52,7 @@ protected:
int _hoverIndex;
// The order in which a keyboard or gamepad traverses the menu
- Common::Array<unsigned int> _path;
+ Common::Array<uint> _path;
// Are keyboard buttons enabled?
bool _useKeyboard;
@@ -75,18 +75,18 @@ protected:
//------------------------------------------------------------------------
void next() {
if (_hoverIndex == -1) {
- for (unsigned int pos = 0; pos < _path.size(); pos++)
+ for (uint pos = 0; pos < _path.size(); pos++)
if (_element[_path[pos]]._visible == true) {
_hoverIndex = _path[pos];
break;
}
} else {
- unsigned int curpos = 0;
+ uint curpos = 0;
for (; curpos < _path.size(); curpos++)
if ((int)_path[curpos] == _hoverIndex)
break;
- for (unsigned int nextloc = (curpos + 1) % _element.size(); nextloc != curpos; nextloc = (nextloc + 1) % _element.size())
+ for (uint nextloc = (curpos + 1) % _element.size(); nextloc != curpos; nextloc = (nextloc + 1) % _element.size())
if (_element[nextloc]._visible == true) {
_hoverIndex = _path[nextloc];
break;
@@ -99,13 +99,13 @@ protected:
//------------------------------------------------------------------------
void prev() {
if (_hoverIndex == -1) {
- for (unsigned int pos = 0; pos < _path.size(); pos++)
+ for (uint pos = 0; pos < _path.size(); pos++)
if (_element[_path[pos]]._visible == true) {
_hoverIndex = _path[pos];
break;
}
} else {
- unsigned int curpos = 0;
+ uint curpos = 0;
for (; curpos < _path.size(); curpos++)
if ((int)_path[curpos] == _hoverIndex)
break;
@@ -303,7 +303,7 @@ public:
if (!_element.empty()) {
_path.push_back(0);
- for (unsigned int i = 1; i < _element.size(); i++) {
+ for (uint i = 1; i < _element.size(); i++) {
_path.push_back(i);
int prevX = _element[i - 1].x;
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index ae9dea651a7..7c52553bddb 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -130,7 +130,7 @@ void QuestMenu::draw(Button &buMap) {
auto base_x = _menu.baseX(count), base_y = _menu.baseY(count);
// Only draw in _s color if we are on the same button and page
- if ((unsigned int)_selBu == count && (unsigned int)_selPage == _menu.currentPage())
+ if ((uint)_selBu == count && (uint)_selPage == _menu.currentPage())
g_engine->_textManager->draw(base_x + _offTitle.x, base_y + _offTitle.y, _quest[i]._title, _colS, _font, _align);
else
g_engine->_textManager->draw(base_x + _offTitle.x, base_y + _offTitle.y, _quest[i]._title, _colN, _font, _align);
@@ -141,7 +141,7 @@ void QuestMenu::draw(Button &buMap) {
}
}
- if (_selQuest >= 0 && (unsigned int)_selQuest < _quest.size()) {
+ if (_selQuest >= 0 && (uint)_selQuest < _quest.size()) {
_text.draw(_quest[_selQuest]);
if (_quest[_selQuest]._marker)
@@ -168,7 +168,7 @@ bool QuestMenu::handleEvents(Button &buMap, Common::String &mapTitle, const Comm
_menu.image(_selBu, _selPage, _imgS);
}
- if (_selQuest >= 0 && (unsigned int)_selQuest < _quest.size()) {
+ if (_selQuest >= 0 && (uint)_selQuest < _quest.size()) {
if (_quest[_selQuest]._marker)
if (buMap.handleEvents(event) == BUAC_LCLICK) {
// The title of the quest selected by the "show in map" button
@@ -186,7 +186,7 @@ bool QuestMenu::handleEvents(Button &buMap, Common::String &mapTitle, const Comm
// Purpose: Select an entry
//------------------------------------------------------------------------
void QuestMenu::select(const int &questIndex) {
- if (questIndex >= 0 && (unsigned int)questIndex < _quest.size()) {
+ if (questIndex >= 0 && (uint)questIndex < _quest.size()) {
if (_selBu >= 0 && _selPage >= 0)
_menu.image(_selBu, _selPage, _imgN);
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index a93f013b682..6fbcf350e3d 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -47,7 +47,7 @@ namespace pyrodactyl {
namespace ui {
class TextArea : public TextData {
// The maximum number of characters allowed
- unsigned int _size;
+ uint _size;
// The name of the text area is stored here
HoverInfo _title;
Commit: d1a43f0ec08d4247000a3bdfa75f477161370e74
https://github.com/scummvm/scummvm/commit/d1a43f0ec08d4247000a3bdfa75f477161370e74
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not mix long and uint32
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index e926378f684..c7da55c0711 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -103,10 +103,10 @@ void PathfindingAgent::setDestination(Vector2f d, bool r) {
_destinationReachable = r;
}
-void PathfindingAgent::update(long timeslice) {
+void PathfindingAgent::update(uint32 timeslice) {
- long prevTime = g_system->getMillis();
- long time = timeslice;
+ uint32 prevTime = g_system->getMillis();
+ uint32 time = timeslice;
double dTempCost;
@@ -215,7 +215,7 @@ void PathfindingAgent::update(long timeslice) {
prevTime = g_system->getMillis();
}
- } while (!isDone() && (time >= 0 || timeslice == 0));
+ } while (!isDone() && ((int32)time >= 0 || timeslice == 0));
_noSolution = true; // You can't get there from here (SZ)
}
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 3e5d4d99be4..ed15380eebd 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -190,7 +190,7 @@ public:
//! \brief Performs the main part of the algorithm until the specified time has elapsed or
//! no nodes are left open.
- void update(long timeslice);
+ void update(uint32 timeslice);
//! \brief Returns <code>true</code> if and only if no nodes are left open.
//!
Commit: 2a7cff595f9d5bb273b8d88da73003a9e035bd46
https://github.com/scummvm/scummvm/commit/2a7cff595f9d5bb273b8d88da73003a9e035bd46
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add a newline in POTFILES
Changed paths:
engines/crab/POTFILES
diff --git a/engines/crab/POTFILES b/engines/crab/POTFILES
index 790b6767224..124710cd87e 100644
--- a/engines/crab/POTFILES
+++ b/engines/crab/POTFILES
@@ -1,2 +1,2 @@
engines/crab/metaengine.cpp
-engines/crab/input/input.cpp
\ No newline at end of file
+engines/crab/input/input.cpp
Commit: 8465061b20a69c159793a583419e8008df5de4d0
https://github.com/scummvm/scummvm/commit/8465061b20a69c159793a583419e8008df5de4d0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Fix code formatting in PathfindingAgent.cpp
Changed paths:
engines/crab/PathfindingAgent.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index c7da55c0711..ba40bcf72a4 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -186,10 +186,7 @@ void PathfindingAgent::update(uint32 timeslice) {
_nodeQueue.push(currentIter->second);
}
- }
-
- // Otherwise...
- else {
+ } else { // Otherwise...
PlannerNode *successor = new PlannerNode();
successor->setLocation((*i));
@@ -206,8 +203,6 @@ void PathfindingAgent::update(uint32 timeslice) {
}
}
}
- // }
- //}
// Update the time
if (timeslice != 0) {
Commit: 33e1a6eae79986aab0df68985cca2b876dbb9422
https://github.com/scummvm/scummvm/commit/33e1a6eae79986aab0df68985cca2b876dbb9422
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand for loop in PathfindingAgent.cpp
Changed paths:
engines/crab/PathfindingAgent.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index ba40bcf72a4..f621f84158d 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -223,12 +223,8 @@ bool PathfindingAgent::isDone() const {
// Clear everything.
void PathfindingAgent::reset() {
- Common::StableMap<PathfindingGraphNode *, PlannerNode *>::iterator iter;
- if (!_createdList.empty()) {
- for (iter = _createdList.begin(); iter != _createdList.end(); ++iter) {
- delete (*iter).second;
- }
- }
+ for (auto &iter : _createdList)
+ delete iter.second;
_nodeQueue.clear();
_createdList.clear();
@@ -317,7 +313,7 @@ bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB) {
}
bool PathfindingAgent::adjacentToGoal(PathfindingGraphNode *node) {
- for (auto iter : node->_neighborNodes) {
+ for (const auto &iter : node->_neighborNodes) {
if (iter == _goalTile) {
return true;
}
Commit: 7d19280051f6da69271f8156387e0236da3012ee
https://github.com/scummvm/scummvm/commit/7d19280051f6da69271f8156387e0236da3012ee
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove dead code in PathfindingAgent.cpp
Changed paths:
engines/crab/PathfindingAgent.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index f621f84158d..4ff7419529a 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -151,19 +151,9 @@ void PathfindingAgent::update(uint32 timeslice) {
return;
}
- // PathfindingGraphNode* _checkTile;
-
- // Find the successors
- // for(int x = -1; x < 2; ++x)
- //{
- // for(int y = -1; y < 2; ++y)
- // {
Common::Array<PathfindingGraphNode *>::iterator i;
for (i = current->_location->_neighborNodes.begin(); i != current->_location->_neighborNodes.end(); ++i) {
- // Get the new tile to check
- //_checkTile = m_pTileMap->getTile(current->GetLocation()->getRow() + x, current->GetLocation()->getColumn() + y);
-
if ((*i)->getMovementCost() > 0) {
// Compute the temp given cost
dTempCost = current->getGivenCost() + ((*i)->getMovementCost() * distExact((*i), current->getLocation()));
Commit: d4f5ef4e28490b5219ca1f6f5234a642e93d1992
https://github.com/scummvm/scummvm/commit/d4f5ef4e28490b5219ca1f6f5234a642e93d1992
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make comparision functions static
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/TMX/TMXMap.cpp
engines/crab/level/level_load.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 4ff7419529a..93bb7f8b511 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -33,6 +33,11 @@
namespace Crab {
+// This keeps the PriorityQueue organized based on the cost of the paths.
+static bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB) {
+ return nodeA->getFinalCost() > nodeB->getFinalCost();
+}
+
PathfindingAgent::PathfindingAgent(void) : _nodeQueue(compareNodes) {
_grid = nullptr;
@@ -297,11 +302,6 @@ double PathfindingAgent::distExact(PathfindingGraphNode *tileA, PathfindingGraph
return vecTo.magnitude();
}
-// This keeps the PriorityQueue organized based on the cost of the paths.
-bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB) {
- return nodeA->getFinalCost() > nodeB->getFinalCost();
-}
-
bool PathfindingAgent::adjacentToGoal(PathfindingGraphNode *node) {
for (const auto &iter : node->_neighborNodes) {
if (iter == _goalTile) {
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index ed15380eebd..717c5204edc 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -214,8 +214,6 @@ public:
bool adjacentToGoal(PathfindingGraphNode *node);
};
-bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB);
-
} // End of namespace Crab
#endif // CRAB_PATHFINDINGAGENT_H
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 72f1fd9af68..03f8bfa2108 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -37,7 +37,7 @@ namespace Crab {
using namespace TMX;
using namespace pyrodactyl::image;
-bool propCompare(const MapLayer &l1, const MapLayer &l2) {
+static bool propCompare(const MapLayer &l1, const MapLayer &l2) {
return l1._pos.y + l1._pos.h < l2._pos.y + l2._pos.h;
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 830965fda9e..1fe3a0cd889 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -43,7 +43,7 @@ using namespace pyrodactyl::input;
//------------------------------------------------------------------------
// Purpose: Used to sort background sprites
//------------------------------------------------------------------------
-bool CompSpriteLayer(const Sprite &a, const Sprite &b) {
+static bool compSpriteLayer(const Sprite &a, const Sprite &b) {
return (a._layer < b._layer);
}
@@ -123,7 +123,7 @@ void Level::load(const Common::String &filename, pyrodactyl::event::Info &info,
_background.push_back(s);
}
- Common::sort(_background.begin(), _background.end(), CompSpriteLayer);
+ Common::sort(_background.begin(), _background.end(), compSpriteLayer);
}
if (nodeValid("fly", node)) {
Commit: e04ac9197dd4d987a4d2460e1be8fc0f5802d131
https://github.com/scummvm/scummvm/commit/e04ac9197dd4d987a4d2460e1be8fc0f5802d131
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Move from C style func(void) sytem to func() syntax
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGraphNode.h
engines/crab/PathfindingGrid.cpp
engines/crab/PathfindingGrid.h
engines/crab/app.h
engines/crab/event/EventSeqGroup.h
engines/crab/stat/StatTemplate.h
engines/crab/text/TextManager.h
engines/crab/ui/Caption.h
engines/crab/ui/GameOverMenu.h
engines/crab/ui/HoverInfo.h
engines/crab/ui/OptionMenu.h
engines/crab/ui/PauseMenu.h
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/TextData.h
engines/crab/ui/textarea.h
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 93bb7f8b511..bc2ec8c6e25 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -38,7 +38,7 @@ static bool compareNodes(PlannerNode const *nodeA, PlannerNode const *nodeB) {
return nodeA->getFinalCost() > nodeB->getFinalCost();
}
-PathfindingAgent::PathfindingAgent(void) : _nodeQueue(compareNodes) {
+PathfindingAgent::PathfindingAgent() : _nodeQueue(compareNodes) {
_grid = nullptr;
_destinationSet = false;
@@ -51,7 +51,7 @@ PathfindingAgent::PathfindingAgent(void) : _nodeQueue(compareNodes) {
_clickedTile = nullptr;
}
-PathfindingAgent::~PathfindingAgent(void) {
+PathfindingAgent::~PathfindingAgent() {
}
void PathfindingAgent::initialize(PathfindingGrid *g) {
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 717c5204edc..37079a36ac2 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -60,27 +60,27 @@ public:
}
~PlannerNode() {}
- PathfindingGraphNode *getLocation(void) {
+ PathfindingGraphNode *getLocation() {
return _location;
}
- PlannerNode *getParent(void) {
+ PlannerNode *getParent() {
return _parent;
}
- PlannerNode *getChild(void) {
+ PlannerNode *getChild() {
return _child;
}
- double getHCost(void) const {
+ double getHCost() const {
return _cost;
}
- double getFinalCost(void) const {
+ double getFinalCost() const {
return _finalCost;
}
- double getGivenCost(void) const {
+ double getGivenCost() const {
return _givenCost;
}
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 0fa1acec37a..7d129432c99 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -32,7 +32,7 @@
namespace Crab {
-PathfindingGraphNode::PathfindingGraphNode(void) {
+PathfindingGraphNode::PathfindingGraphNode() {
_id = -1;
_movementCost = -1.0f;
}
@@ -42,7 +42,7 @@ PathfindingGraphNode::PathfindingGraphNode(Vector2f pos, int i) : _position(pos)
_movementCost = -1.0f;
}
-PathfindingGraphNode::~PathfindingGraphNode(void) {
+PathfindingGraphNode::~PathfindingGraphNode() {
}
void PathfindingGraphNode::addNeighbor(PathfindingGraphNode *node) {
diff --git a/engines/crab/PathfindingGraphNode.h b/engines/crab/PathfindingGraphNode.h
index 0a1068b82b7..92a5beaa7c8 100644
--- a/engines/crab/PathfindingGraphNode.h
+++ b/engines/crab/PathfindingGraphNode.h
@@ -54,10 +54,10 @@ public:
Common::Array<float> _neighborCosts; // The movement cost for the neighbor nodes (distance to the node X the nodes movement cost)
// This is stored to prevent having to recalculate each frame.
- PathfindingGraphNode(void);
+ PathfindingGraphNode();
PathfindingGraphNode(Vector2f pos, int i);
- ~PathfindingGraphNode(void);
+ ~PathfindingGraphNode();
float getMovementCost() {
return _movementCost;
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 9c43a5c4ccc..843d6ba5e20 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -35,7 +35,7 @@ namespace Crab {
using namespace TMX;
-PathfindingGrid::PathfindingGrid(void) {
+PathfindingGrid::PathfindingGrid() {
_blockedCost = BLOCKED;
_openCost = OPEN;
_stairsCost = STAIRS;
@@ -48,7 +48,7 @@ PathfindingGrid::PathfindingGrid(void) {
_cellSize.y = 0.0;
}
-PathfindingGrid::~PathfindingGrid(void) {
+PathfindingGrid::~PathfindingGrid() {
reset();
}
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 64af8bbb430..56805fd6db1 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -64,8 +64,8 @@ public:
int _openCost;
int _stairsCost;
- PathfindingGrid(void);
- ~PathfindingGrid(void);
+ PathfindingGrid();
+ ~PathfindingGrid();
void reset();
diff --git a/engines/crab/app.h b/engines/crab/app.h
index f145392cd2d..6b2dc6ce930 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -50,7 +50,7 @@ private:
Game *_game;
void loadSettings(const Common::String &filename);
public:
- ~App(void);
+ ~App();
void run();
Game *getGame() const {
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index d16e37aa23f..628cd6058ed 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -48,8 +48,8 @@ class EventSeqGroup {
Common::Array<uint> _end;
public:
- EventSeqGroup(void) {}
- ~EventSeqGroup(void) {}
+ EventSeqGroup() {}
+ ~EventSeqGroup() {}
void addSeq(const uint &id, Common::String &path);
void endSeq(const uint &id);
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index 55b652e9402..c13aded4486 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -42,8 +42,8 @@ struct StatTemplates {
Common::Array<StatGroup> _collection;
public:
- StatTemplates(void) {}
- ~StatTemplates(void) {}
+ StatTemplates() {}
+ ~StatTemplates() {}
void load(const Common::String &filename);
};
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index efff46d9a69..2db4b076a59 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -96,12 +96,12 @@ class TextManager {
int findFreeSlot();
public:
- TextManager(void) {
+ TextManager() {
_oldest = 0;
_cacheSize = 30;
}
- ~TextManager(void) {}
+ ~TextManager() {}
void init();
void quit();
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index 52b2b9ddec8..9cae53e0376 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -46,11 +46,11 @@ public:
Common::String _text;
- Caption(void) {
+ Caption() {
_colS = 0;
_enabled = false;
}
- ~Caption(void) {}
+ ~Caption() {}
void init(const Caption &c, const int &xOffset = 0, const int &yOffset = 0);
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 03f7a0ef3c9..dd450c9846e 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -57,11 +57,11 @@ class GameOverMenu {
ButtonMenu _menu;
public:
- GameOverMenu(void) {
+ GameOverMenu() {
_cur = 0;
}
- ~GameOverMenu(void) {}
+ ~GameOverMenu() {}
void reset() {
warning("STUB: GameOverMenu::reset()");
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index ab210748636..4ad89c93af7 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -44,11 +44,11 @@ public:
bool _enabled;
Common::String _text;
- HoverInfo(void) {
+ HoverInfo() {
_enabled = false;
}
- ~HoverInfo(void) {}
+ ~HoverInfo() {}
void init(const HoverInfo &h, const int &xOffset = 0, const int &yOffset = 0);
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 56290915d24..a4d6c3b6d95 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -94,12 +94,12 @@ class OptionMenu {
public:
bool _loaded;
- OptionMenu(void) {
+ OptionMenu() {
_loaded = false;
_state = STATE_GENERAL;
_menu.useKeyboard(true);
}
- ~OptionMenu(void) {}
+ ~OptionMenu() {}
void reset();
bool disableHotkeys() {
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 352ae169b9a..ccd67ee754d 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -76,12 +76,12 @@ class PauseMenu {
int _choice;
public:
- PauseMenu(void) {
+ PauseMenu() {
_state = STATE_NORMAL;
_choice = -1;
}
- ~PauseMenu(void) {}
+ ~PauseMenu() {}
void updateMode(const bool &ironman) {
_menu._element[PS_SAVE - 1]._visible = !ironman;
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index f1a95368f6f..7accada41de 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -62,11 +62,11 @@ class ResolutionMenu : public ButtonMenu {
int _columns;
public:
- ResolutionMenu(void) {
+ ResolutionMenu() {
_state = STATE_NORMAL;
_columns = 1;
}
- ~ResolutionMenu(void) {}
+ ~ResolutionMenu() {}
void load(rapidxml::xml_node<char> *node);
void draw();
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index be131365aca..7f96d378864 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -46,13 +46,13 @@ public:
Align _align;
bool _background;
- TextData(void) {
+ TextData() {
_col = 0;
_font = 0;
_align = ALIGN_LEFT;
_background = false;
}
- ~TextData(void) {}
+ ~TextData() {}
bool load(rapidxml::xml_node<char> *node, Rect *parent = nullptr, const bool &echo = true);
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 6fbcf350e3d..48b591de246 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -58,13 +58,13 @@ class TextArea : public TextData {
public:
Common::String _text;
- TextArea(void) : _text("") {
+ TextArea() : _text("") {
_size = 20;
_seEntry = -1;
_seErase = -1;
_seAccept = -1;
}
- ~TextArea(void) {}
+ ~TextArea() {}
void load(rapidxml::xml_node<char> *node);
Commit: ac2ec635a2b0df4ad69d65e3e702fe7cb32ea0af
https://github.com/scummvm/scummvm/commit/ac2ec635a2b0df4ad69d65e3e702fe7cb32ea0af
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in animation component
Changed paths:
engines/crab/animation/animation.cpp
engines/crab/animation/fightmoves.cpp
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/animation.cpp b/engines/crab/animation/animation.cpp
index d90d398f34e..570b544e50b 100644
--- a/engines/crab/animation/animation.cpp
+++ b/engines/crab/animation/animation.cpp
@@ -43,14 +43,14 @@ Animation::Animation(rapidxml::xml_node<char> *node) {
void Animation::draw() {
uint32 timestamp = _timer.ticks();
- for (auto i = _frame.begin(); i != _frame.end(); ++i)
- i->draw(timestamp);
+ for (auto &frame : _frame)
+ frame.draw(timestamp);
}
bool Animation::internalEvents(DrawType &gameDraw) {
uint32 timestamp = _timer.ticks();
- for (auto i = _frame.begin(); i != _frame.end(); ++i) {
- DrawType result = i->internalEvents(timestamp);
+ for (auto &frame : _frame) {
+ DrawType result = frame.internalEvents(timestamp);
// if (result != DRAW_SAME)
gameDraw = result;
}
@@ -59,8 +59,8 @@ bool Animation::internalEvents(DrawType &gameDraw) {
}
void Animation::reset() {
- for (auto i = _frame.begin(); i != _frame.end(); ++i)
- i->reset();
+ for (auto &frame : _frame)
+ frame.reset();
}
} // End of namespace Crab
diff --git a/engines/crab/animation/fightmoves.cpp b/engines/crab/animation/fightmoves.cpp
index d8336240038..0a4c25723d9 100644
--- a/engines/crab/animation/fightmoves.cpp
+++ b/engines/crab/animation/fightmoves.cpp
@@ -181,8 +181,8 @@ bool FightMoves::forceUpdate(const uint &index, pyrodactyl::input::FightInput &i
// Purpose: Set unlock status
//------------------------------------------------------------------------
void FightMoves::evaluate(pyrodactyl::event::Info &info) {
- for (auto i = _move.begin(); i != _move.end(); ++i)
- i->_unlock.evaluate(info);
+ for (auto &i : _move)
+ i._unlock.evaluate(info);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 8b40d27bd71..dd9379b961e 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -124,23 +124,23 @@ void Sprite::move(const SpriteConstant &sc) {
//------------------------------------------------------------------------
void Sprite::resolveCollide() {
// NOTE: we don't check i->intersect here because we do that in the level functions
- for (auto i = _collideData.begin(); i != _collideData.end(); ++i) {
+ for (const auto &i : _collideData) {
Rect bounds = boundRect();
- if (i->_type == SHAPE_POLYGON) {
- _pos.x -= i->_data.x;
- _pos.y -= i->_data.y;
+ if (i._type == SHAPE_POLYGON) {
+ _pos.x -= i._data.x;
+ _pos.y -= i._data.y;
} else {
- Direction d = bounds.resolveY(i->_data);
+ Direction d = bounds.resolveY(i._data);
if (d == DIRECTION_UP)
- _pos.y -= i->_data.y + i->_data.h - _animSet._bounds.y + _animSet.anchorY(_dir) + 1;
+ _pos.y -= i._data.y + i._data.h - _animSet._bounds.y + _animSet.anchorY(_dir) + 1;
else if (d == DIRECTION_DOWN)
- _pos.y -= i->_data.y - bounds.h - _animSet._bounds.y + _animSet.anchorY(_dir) - 1;
+ _pos.y -= i._data.y - bounds.h - _animSet._bounds.y + _animSet.anchorY(_dir) - 1;
- d = bounds.resolveX(i->_data);
+ d = bounds.resolveX(i._data);
if (d == DIRECTION_LEFT)
- _pos.x -= i->_data.x + i->_data.w - _animSet._bounds.x + _animSet.anchorX(_dir) + 1;
+ _pos.x -= i._data.x + i._data.w - _animSet._bounds.x + _animSet.anchorX(_dir) + 1;
else if (d == DIRECTION_RIGHT)
- _pos.x -= i->_data.x - bounds.w - _animSet._bounds.x + _animSet.anchorX(_dir) - 1;
+ _pos.x -= i._data.x - bounds.w - _animSet._bounds.x + _animSet.anchorX(_dir) - 1;
}
}
@@ -290,31 +290,32 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
g_engine->_textManager->draw(x + 120.0f, y - 60.0f, NumberToString(_aiData.dest.y), 0);*/
- if (_pathing._vSolution.size() > 0) {
- for (auto iter = _pathing._vSolution.begin(); iter != _pathing._vSolution.end(); ++iter) {
- bool nextToWall = false;
- for (auto neighbor = (*iter)->_neighborNodes.begin(); neighbor != (*iter)->_neighborNodes.end(); ++neighbor) {
- if ((*neighbor)->getMovementCost() < 0 || (*neighbor)->getMovementCost() > 1) {
- nextToWall = true;
- break;
- }
- }
- if (nextToWall)
- (*iter)->getRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
- else
- (*iter)->getRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
+ for (const auto &iter : _pathing._vSolution) {
+ bool nextToWall = false;
+ for (const auto &neighbor : iter->_neighborNodes) {
+ if (neighbor->getMovementCost() < 0 || neighbor->getMovementCost() > 1) {
+ nextToWall = true;
+ break;
+ }
}
- _pathing._goalTile->getRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
- _pathing._startTile->getRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
+ if (nextToWall)
+ iter->getRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
+ else
+ iter->getRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
+ }
+
+ _pathing._goalTile->getRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
+ _pathing._startTile->getRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
- // Draw adjacencies to the goal tile.
- /* for(auto neighbor = _pathing.m_pGoalTile->neighborNodes.begin(); neighbor != _pathing.m_pGoalTile->neighborNodes.end(); ++neighbor)
- {
+ // Draw adjacencies to the goal tile.
+ /*
+ for(auto neighbor = _pathing.m_pGoalTile->neighborNodes.begin(); neighbor != _pathing.m_pGoalTile->neighborNodes.end(); ++neighbor) {
(*neighbor)->GetRect().draw(-camera.x, -camera.y, 200, 0, 0, 254);
- }*/
- }
+ }
+ */
+
Rect destinationRect = Rect((int)_pathing._destination.x - 5,
(int)_pathing._destination.y - 5,
10,
Commit: d9228252c272622ed91fa438d7a4f58ab44145f3
https://github.com/scummvm/scummvm/commit/d9228252c272622ed91fa438d7a4f58ab44145f3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in event component
Changed paths:
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/gameeventmanager.cpp
engines/crab/event/quest.cpp
engines/crab/event/triggerset.cpp
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index 05c94cf7d52..ec65456b0a9 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -58,30 +58,31 @@ void EventSeqGroup::nextEvent(const uint &id, Info &info, const Common::String &
}
void EventSeqGroup::internalEvents(Info &info) {
- for (auto it = _seq.begin(); it != _seq.end(); ++it)
- it->_value.internalEvents(info);
+ for (auto &it : _seq)
+ it._value.internalEvents(info);
}
bool EventSeqGroup::activeSeq(uint &activeSeq) {
- for (auto i = _seq.begin(); i != _seq.end(); ++i)
- if (i->_value.eventInProgress()) {
- activeSeq = i->_key;
+ for (auto &i : _seq) {
+ if (i._value.eventInProgress()) {
+ activeSeq = i._key;
return true;
}
+ }
activeSeq = UINT_MAX;
return false;
}
void EventSeqGroup::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto i = _end.begin(); i != _end.end(); ++i) {
+ for (const auto &i : _end) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "end");
- child->value(g_engine->_stringPool->Get(*i));
+ child->value(g_engine->_stringPool->Get(i));
root->append_node(child);
}
- for (auto i = _seq.begin(); i != _seq.end(); ++i)
- i->_value.saveState(doc, root, g_engine->_stringPool->Get(i->_key));
+ for (auto &i : _seq)
+ i._value.saveState(doc, root, g_engine->_stringPool->Get(i._key));
}
void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 6b2e5dc4d08..ab28a152936 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -53,14 +53,15 @@ void EventSequence::load(const Common::String &filename) {
// Purpose: Check for events happening
//------------------------------------------------------------------------
void EventSequence::internalEvents(pyrodactyl::event::Info &info) {
- for (auto nxe = _next.begin(); nxe != _next.end(); ++nxe)
- if (*nxe < _events.size()) {
- if (_events[*nxe]._trig.evaluate(info)) {
+ for (const auto &nxe : _next) {
+ if (nxe < _events.size()) {
+ if (_events[nxe]._trig.evaluate(info)) {
_eventInProgress = true;
- _cur = *nxe;
+ _cur = nxe;
break;
}
}
+ }
}
//------------------------------------------------------------------------
@@ -72,8 +73,8 @@ void EventSequence::nextEvent(pyrodactyl::event::Info &info, const Common::Strin
_eventInProgress = false;
// Execute all effects associated with the event
- for (auto i = _events[_cur]._effect.begin(); i != _events[_cur]._effect.end(); ++i)
- if (i->execute(info, player_id, result, end_seq))
+ for (auto &i : _events[_cur]._effect)
+ if (i.execute(info, player_id, result, end_seq))
sync = true;
// Play a notification sound
@@ -103,8 +104,8 @@ void EventSequence::nextEvent(pyrodactyl::event::Info &info, const Common::Strin
if (NextEventChoice != -1)
_next.push_back(NextEventChoice);
else {
- for (auto i = _events[_cur]._next.begin(); i != _events[_cur]._next.end(); ++i)
- _next.push_back(*i);
+ for (const auto &i : _events[_cur]._next)
+ _next.push_back(i);
}
}
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index ef8211e7b94..6ace1750a9f 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -188,8 +188,8 @@ void Info::traitAdd(const Common::String &perId, const int &traitId) {
// Check for duplicate traits, DONT award anything if duplicate found
Person *p = &personGet(perId);
- for (auto i = p->_trait.begin(); i != p->_trait.end(); ++i)
- if (i->_id == traitId)
+ for (const auto &i : p->_trait)
+ if (i._id == traitId)
return;
p->_trait.push_back(g_engine->_eventStore->_trait[traitId]);
@@ -279,8 +279,8 @@ pyrodactyl::people::Person &Info::personGet(const Common::String &id) {
bool Info::collideWithTrigger(const Common::String &id, int rectIndex) {
if (_people.contains(id)) {
- for (auto i = _people[id]._trig.begin(); i != _people[id]._trig.end(); ++i)
- if (*i == rectIndex)
+ for (const auto &i : _people[id]._trig)
+ if (i == rectIndex)
return true;
}
@@ -327,15 +327,15 @@ Common::String Info::getName(const Common::String &id) {
// Purpose: Save and load object state
//------------------------------------------------------------------------
void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto v = _var.begin(); v != _var.end(); ++v) {
+ for (const auto &v : _var) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
- child->append_attribute(doc.allocate_attribute("id", v->_key.c_str()));
- child->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(v->_value)));
+ child->append_attribute(doc.allocate_attribute("id", v._key.c_str()));
+ child->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(v._value)));
root->append_node(child);
}
- for (auto p = _people.begin(); p != _people.end(); ++p)
- p->_value.saveState(doc, root);
+ for (auto &p : _people)
+ p._value.saveState(doc, root);
rapidxml::xml_node<char> *childUnr = doc.allocate_node(rapidxml::node_element, "unread");
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 08fecebdecd..817215489e8 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -388,16 +388,17 @@ void Manager::calcActiveSeq(Info &info, pyrodactyl::level::Level &level, const R
// Purpose: Get/set info
//------------------------------------------------------------------------
void Manager::endSequence(const Common::String &curloc) {
- if (_endSeq.empty() == false) {
- for (auto i = _endSeq.begin(); i != _endSeq.end(); ++i)
- if (i->_cur)
- _eventMap[curloc].endSeq(_activeSeq);
- else if (_eventMap.contains(i->_loc))
- _eventMap[i->_loc].endSeq(stringToNumber<uint>(i->_val));
+ if (_endSeq.empty())
+ return;
- _activeSeq = UINT_MAX;
- _endSeq.clear();
- }
+ for (const auto &i : _endSeq)
+ if (i._cur)
+ _eventMap[curloc].endSeq(_activeSeq);
+ else if (_eventMap.contains(i._loc))
+ _eventMap[i._loc].endSeq(stringToNumber<uint>(i._val));
+
+ _activeSeq = UINT_MAX;
+ _endSeq.clear();
}
bool Manager::eventInProgress() {
@@ -410,10 +411,10 @@ bool Manager::eventInProgress() {
// Purpose: Save the state of the object
//------------------------------------------------------------------------
void Manager::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto i = _eventMap.begin(); i != _eventMap.end(); ++i) {
+ for (auto &i : _eventMap) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "loc");
- child->append_attribute(doc.allocate_attribute("name", i->_key.c_str()));
- i->_value.saveState(doc, child);
+ child->append_attribute(doc.allocate_attribute("name", i._key.c_str()));
+ i._value.saveState(doc, child);
root->append_node(child);
}
}
diff --git a/engines/crab/event/quest.cpp b/engines/crab/event/quest.cpp
index 644313074cf..2b8a409991d 100644
--- a/engines/crab/event/quest.cpp
+++ b/engines/crab/event/quest.cpp
@@ -56,9 +56,9 @@ void Quest::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *r
saveBool(_unread, "unread", doc, child);
saveBool(_marker, "marker", doc, child);
- for (auto i = _text.begin(); i != _text.end(); ++i) {
+ for (const auto &i : _text) {
rapidxml::xml_node<char> *grandchild = doc.allocate_node(rapidxml::node_element, "info");
- grandchild->value(i->c_str());
+ grandchild->value(i.c_str());
child->append_node(grandchild);
}
diff --git a/engines/crab/event/triggerset.cpp b/engines/crab/event/triggerset.cpp
index b75b3cd7a51..1dc22674620 100644
--- a/engines/crab/event/triggerset.cpp
+++ b/engines/crab/event/triggerset.cpp
@@ -54,18 +54,18 @@ bool TriggerSet::evaluate(pyrodactyl::event::Info &info) {
_result = true;
bool curResult = false;
- for (auto i = _statement.begin(); i != _statement.end(); ++i) {
- if (i->_negate)
- curResult = !i->evaluate(info);
+ for (auto &i : _statement) {
+ if (i._negate)
+ curResult = !i.evaluate(info);
else
- curResult = i->evaluate(info);
+ curResult = i.evaluate(info);
if (nextOp == OP_AND)
_result = curResult && _result;
else
_result = curResult || _result;
- nextOp = i->_rel;
+ nextOp = i._rel;
}
} else
_result = true;
Commit: 49d31ba53e64ff12f9996ca368eb0c92e8040129
https://github.com/scummvm/scummvm/commit/49d31ba53e64ff12f9996ca368eb0c92e8040129
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in image component
Changed paths:
engines/crab/image/ImageManager.cpp
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 27520788704..7a194c881cc 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -44,8 +44,8 @@ using namespace pyrodactyl::image;
// Purpose: Load assets here.
//------------------------------------------------------------------------
void ImageManager::loadMap(const Common::String &filename, const MapID &mapid) {
- for (auto it = _map[mapid].begin(); it != _map[mapid].end(); ++it)
- it->_value.deleteImage();
+ for (auto &it : _map[mapid])
+ it._value.deleteImage();
_map[mapid].clear();
XMLDoc imageList(filename);
@@ -181,8 +181,8 @@ void ImageManager::blackScreen() {
//------------------------------------------------------------------------
void ImageManager::quit() {
for (int i = 0; i < MAP_TOTAL; i++) {
- for (auto it = _map[i].begin(); it != _map[i].end(); ++it)
- it->_value.deleteImage();
+ for (auto &it : _map[i])
+ it._value.deleteImage();
_map[i].clear();
}
Commit: 58e07a575ae40b25411b818953a8d50c7140a313
https://github.com/scummvm/scummvm/commit/58e07a575ae40b25411b818953a8d50c7140a313
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in item component
Changed paths:
engines/crab/item/Item.cpp
engines/crab/item/ItemCollection.cpp
engines/crab/item/ItemMenu.cpp
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 60af37c9bce..9c522c9daf6 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -78,9 +78,9 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
root->append_attribute(doc.allocate_attribute("img", g_engine->_stringPool->Get(_img)));
root->append_attribute(doc.allocate_attribute("desc", _desc.c_str()));
- for (auto i = _bonus.begin(); i != _bonus.end(); ++i) {
+ for (const auto &i : _bonus) {
auto n = doc.allocate_node(rapidxml::node_element, "bonus");
- switch (i->_type) {
+ switch (i._type) {
case STAT_HEALTH:
n->append_attribute(doc.allocate_attribute("type", STATNAME_HEALTH));
break;
@@ -99,7 +99,7 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
break;
}
- n->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(i->_val)));
+ n->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(i._val)));
root->append_node(n);
}
}
@@ -108,11 +108,11 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
// Purpose: Calculate effect of item on stats
//------------------------------------------------------------------------
void Item::statChange(pyrodactyl::people::Person &obj, bool increase) {
- for (auto i = _bonus.begin(); i != _bonus.end(); ++i)
+ for (const auto &i : _bonus)
if (increase)
- obj._stat.change(i->_type, i->_val);
+ obj._stat.change(i._type, i._val);
else
- obj._stat.change(i->_type, -i->_val);
+ obj._stat.change(i._type, -i._val);
}
void Item::draw(const int &x, const int &y) {
diff --git a/engines/crab/item/ItemCollection.cpp b/engines/crab/item/ItemCollection.cpp
index 6c25840eddd..d420baab35e 100644
--- a/engines/crab/item/ItemCollection.cpp
+++ b/engines/crab/item/ItemCollection.cpp
@@ -126,9 +126,9 @@ void ItemCollection::loadState(rapidxml::xml_node<char> *node) {
// Purpose: Write items to save file
//------------------------------------------------------------------------
void ItemCollection::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto i = _item.begin(); i != _item.end(); ++i) {
- rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, i->_key.c_str());
- i->_value.saveState(doc, child);
+ for (auto &i : _item) {
+ rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, i._key.c_str());
+ i._value.saveState(doc, child);
root->append_node(child);
}
}
@@ -139,8 +139,8 @@ void ItemCollection::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node
void ItemCollection::setUI() {
_itemInfo.setUI();
- for (auto i = _item.begin(); i != _item.end(); ++i)
- i->_value.setUI();
+ for (auto &i : _item)
+ i._value.setUI();
}
} // End of namespace Crab
diff --git a/engines/crab/item/ItemMenu.cpp b/engines/crab/item/ItemMenu.cpp
index ab09aae98b3..07362db6e1d 100644
--- a/engines/crab/item/ItemMenu.cpp
+++ b/engines/crab/item/ItemMenu.cpp
@@ -65,8 +65,8 @@ void ItemMenu::loadState(rapidxml::xml_node<char> *node) {
// Purpose: Save to file
//------------------------------------------------------------------------
void ItemMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- for (auto i = _element.begin(); i != _element.end(); ++i)
- i->saveState(doc, root);
+ for (auto &i : _element)
+ i.saveState(doc, root);
}
//------------------------------------------------------------------------
@@ -88,16 +88,16 @@ void ItemMenu::draw(ItemDesc &itemInfo) {
if (_selectIndex != -1)
itemInfo.draw(_element[_selectIndex]._item);
- for (auto i = _element.begin(); i != _element.end(); ++i)
- i->draw();
+ for (auto &i : _element)
+ i.draw();
}
//------------------------------------------------------------------------
// Purpose: Equip an item at the first available location (used in events)
//------------------------------------------------------------------------
bool ItemMenu::equip(Item &item) {
- for (auto i = _element.begin(); i != _element.end(); ++i)
- if (i->_category == SLOT_STORAGE && i->equip(item))
+ for (auto &i : _element)
+ if (i._category == SLOT_STORAGE && i.equip(item))
return true;
return false;
@@ -125,13 +125,13 @@ bool ItemMenu::del(const Common::String &id) {
// Purpose: Find out if we have an item with a name
//------------------------------------------------------------------------
bool ItemMenu::has(const Common::String &container, const Common::String &id) {
- for (auto i = _element.begin(); i != _element.end(); ++i)
- if (i->_item._id == id) {
+ for (const auto &i : _element)
+ if (i._item._id == id) {
if (container == "equip") {
- if (i->_category == SLOT_EQUIP)
+ if (i._category == SLOT_EQUIP)
return true;
} else if (container == "storage") {
- if (i->_category == SLOT_STORAGE)
+ if (i._category == SLOT_STORAGE)
return true;
} else
return true;
Commit: 57baa32881eb17323a09c375bbcc063f215f7b32
https://github.com/scummvm/scummvm/commit/57baa32881eb17323a09c375bbcc063f215f7b32
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in level component
Changed paths:
engines/crab/level/level.cpp
engines/crab/level/level_collide.cpp
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index e326e65c2d0..dab8401a6ae 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -84,8 +84,8 @@ pyrodactyl::anim::Sprite *Level::getSprite(const Common::String &id) {
// Purpose: Figure visibility and let the AI see what moves are allowed
//------------------------------------------------------------------------
void Level::calcProperties(pyrodactyl::event::Info &info) {
- for (auto i = _objects.begin(); i != _objects.end(); ++i)
- i->calcProperties(info);
+ for (auto &i : _objects)
+ i.calcProperties(info);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index bd41a13f5b3..908bd0f22f2 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -96,9 +96,9 @@ bool Level::layerVisible(pyrodactyl::anim::Sprite *obj) {
// Common::String &id is set to the id of colliding object
//------------------------------------------------------------------------
void Level::calcTrigCollide(pyrodactyl::event::Info &info) {
- for (auto i = _objects.begin(); i != _objects.end(); ++i)
- if (info.personValid(i->id()))
- _terrain.collideWithTrigger(i->boundRect(), info.personGet(i->id())._trig);
+ for (auto &i : _objects)
+ if (info.personValid(i.id()))
+ _terrain.collideWithTrigger(i.boundRect(), info.personGet(i.id())._trig);
}
//------------------------------------------------------------------------
Commit: e3c9a23e72d58160082c6bdc19b8e1e19b6c4b71
https://github.com/scummvm/scummvm/commit/e3c9a23e72d58160082c6bdc19b8e1e19b6c4b71
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in music component
Changed paths:
engines/crab/music/MusicManager.cpp
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index efcdecaa68a..10e12e4a326 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -46,11 +46,11 @@ void MusicManager::freeMusic() {
}
void MusicManager::freeChunk() {
- for (auto i = _effects.begin(); i != _effects.end(); ++i) {
- i->_value->_file.close();
- delete i->_value->_handle;
- delete i->_value->_stream;
- delete i->_value;
+ for (auto &i : _effects) {
+ i._value->_file.close();
+ delete i._value->_handle;
+ delete i._value->_stream;
+ delete i._value;
}
_effects.clear();
Commit: 43b417e4003407159d525a3b32a79956d082ca91
https://github.com/scummvm/scummvm/commit/43b417e4003407159d525a3b32a79956d082ca91
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in text component
Changed paths:
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 6fc46827d1f..705a978262b 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -235,13 +235,13 @@ void TextManager::draw(const int &x, int y, const Common::String &text, const in
// Purpose: Quit
//------------------------------------------------------------------------
void TextManager::quit() {
- for (auto i = _font.begin(); i != _font.end(); ++i)
- delete *i;
+ for (auto &i : _font)
+ delete i;
- for (auto i = _cache.begin(); i != _cache.end(); ++i) {
- if (i->_empty == false) {
- i->_img.deleteImage();
- i->_empty = true;
+ for (auto &i : _cache) {
+ if (i._empty == false) {
+ i._img.deleteImage();
+ i._empty = true;
}
}
}
Commit: 13e7fbb180c2be69a1e1a080bb3d8faf1445aa86
https://github.com/scummvm/scummvm/commit/13e7fbb180c2be69a1e1a080bb3d8faf1445aa86
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in TMX component
Changed paths:
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXTileSet.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 03f8bfa2108..1572131f4cf 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -249,23 +249,23 @@ void TMXMap::reset() {
void TMXMap::drawDebug(const Rect &camera) {
using namespace pyrodactyl::text;
- for (auto i = _areaTrig.begin(); i != _areaTrig.end(); ++i)
- i->draw(-camera.x, -camera.y, 0, 0, 254, 254);
+ for (auto &i : _areaTrig)
+ i.draw(-camera.x, -camera.y, 0, 0, 254, 254);
- for (auto i = _areaExit.begin(); i != _areaExit.end(); ++i)
- i->_dim.draw(-camera.x, -camera.y, 0, 254, 254, 254);
+ for (auto &i : _areaExit)
+ i._dim.draw(-camera.x, -camera.y, 0, 254, 254, 254);
- for (auto i = _prop.begin(); i != _prop.end(); ++i)
- i->_pos.draw(-camera.x, -camera.y, 254, 0, 254, 254);
+ for (auto &i : _prop)
+ i._pos.draw(-camera.x, -camera.y, 254, 0, 254, 254);
- for (auto i = _areaNowalk.begin(); i != _areaNowalk.end(); ++i)
- i->draw(-camera.x, -camera.y, 254, 0, 0, 254);
+ for (auto &i : _areaNowalk)
+ i.draw(-camera.x, -camera.y, 254, 0, 0, 254);
- for (auto i = _areaMusic.begin(); i != _areaMusic.end(); ++i)
- i->draw(-camera.x, -camera.y, 254, 254, 0, 254);
+ for (auto &i : _areaMusic)
+ i.draw(-camera.x, -camera.y, 254, 254, 0, 254);
- for (auto i = _areaStairs.begin(); i != _areaStairs.end(); ++i) {
- i->draw(-camera.x, -camera.y, 0, 254, 0, 254);
+ for (auto &i : _areaStairs) {
+ i.draw(-camera.x, -camera.y, 0, 254, 0, 254);
}
// Draw the pathfinding grid (SZ)
@@ -276,8 +276,8 @@ void TMXMap::drawDebug(const Rect &camera) {
}
}
- for (auto i = _layer.begin(); i != _layer.end(); ++i)
- i->_pos.draw(-camera.x, -camera.y, 254, 216, 0);
+ for (auto i : _layer)
+ i._pos.draw(-camera.x, -camera.y, 254, 216, 0);
_areaWalk.draw(-camera.x, -camera.y, 254, 254, 254, 254);
}
@@ -287,16 +287,16 @@ void TMXMap::drawDebug(const Rect &camera) {
//------------------------------------------------------------------------
void TMXMap::collideWithNoWalk(const Rect boundingBox, Common::List<CollisionData> &colliders) {
CollisionData res;
- for (auto i = _areaNowalk.begin(); i != _areaNowalk.end(); ++i) {
- res = i->collide(boundingBox);
+ for (auto &i : _areaNowalk) {
+ res = i.collide(boundingBox);
if (res._intersect)
colliders.push_back(res);
}
}
bool TMXMap::insideNoWalk(const Vector2i &pos) {
- for (auto i = _areaNowalk.begin(); i != _areaNowalk.end(); ++i)
- if (i->contains(pos))
+ for (auto &i : _areaNowalk)
+ if (i.contains(pos))
return true;
return false;
@@ -333,11 +333,11 @@ void TMXMap::collideWithTrigger(const Rect rect, Common::Array<int> &collisionTa
}
bool TMXMap::collideWithExit(const Rect rect, LevelResult &res) {
- for (auto i = _areaExit.begin(); i != _areaExit.end(); ++i)
- if (i->_dim.collide(rect)._intersect) {
- res._val = i->_name;
- res._x = i->_entry.x;
- res._y = i->_entry.y;
+ for (const auto &i : _areaExit)
+ if (i._dim.collide(rect)._intersect) {
+ res._val = i._name;
+ res._x = i._entry.x;
+ res._y = i._entry.y;
return true;
}
@@ -345,9 +345,9 @@ bool TMXMap::collideWithExit(const Rect rect, LevelResult &res) {
}
bool TMXMap::collideWithStairs(const Rect rect, Vector2f &velMod) {
- for (auto i = _areaStairs.begin(); i != _areaStairs.end(); ++i) {
- if (i->collide(rect)._intersect) {
- velMod = i->_modifier;
+ for (const auto &i : _areaStairs) {
+ if (i.collide(rect)._intersect) {
+ velMod = i._modifier;
return true;
}
}
@@ -359,11 +359,11 @@ bool TMXMap::collideWithStairs(const Rect rect, Vector2f &velMod) {
}
bool TMXMap::collideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &music) {
- for (auto i = _areaMusic.begin(); i != _areaMusic.end(); ++i) {
- if (i->collide(rect)._intersect) {
- music._id = i->_id;
- music._track = i->_track;
- music._loops = i->_loops;
+ for (const auto &i : _areaMusic) {
+ if (i.collide(rect)._intersect) {
+ music._id = i._id;
+ music._track = i._track;
+ music._loops = i._loops;
return true;
}
}
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index da392c6a71c..4d7d45eea05 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -66,8 +66,8 @@ void TileSet::load(const Common::String &path, rapidxml::xml_node<char> *node) {
}
void TileSetGroup::reset() {
- for (auto i = _tileset.begin(); i != _tileset.end(); ++i)
- i->_img.deleteImage();
+ for (auto &i : _tileset)
+ i._img.deleteImage();
_tileset.clear();
}
Commit: d10054457542e7b47542c4133b3ca41f72b04643
https://github.com/scummvm/scummvm/commit/d10054457542e7b47542c4133b3ca41f72b04643
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in UI component
Changed paths:
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/HealthIndicator.cpp
engines/crab/ui/MapData.cpp
engines/crab/ui/PageMenu.h
engines/crab/ui/TraitMenu.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
engines/crab/ui/menu.h
engines/crab/ui/questmenu.cpp
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index c62168aca62..fb395aa765a 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -153,15 +153,15 @@ void CreditScreen::draw() {
_cur.y = _start.y;
- for (auto i = _list.begin(); i != _list.end(); ++i) {
+ for (const auto &i : _list) {
_cur.y += _paragraph._inc;
- if (i->_heading) {
+ if (i._heading) {
_cur.y += _heading._inc;
if (_cur.y > -30 && _cur.y < g_engine->_screenSettings->_cur.h + 40) // Only draw text if it is actually visible on screen
- g_engine->_textManager->draw(_cur.x, _cur.y, i->_text, _heading._color, _heading._font, _heading._align);
+ g_engine->_textManager->draw(_cur.x, _cur.y, i._text, _heading._color, _heading._font, _heading._align);
} else if (_cur.y > -30 && _cur.y < g_engine->_screenSettings->_cur.h + 40)
- g_engine->_textManager->draw(_cur.x, _cur.y, i->_text, _paragraph._color, _paragraph._font, _paragraph._align);
+ g_engine->_textManager->draw(_cur.x, _cur.y, i._text, _paragraph._color, _paragraph._font, _paragraph._align);
// If our cur value has reached below the screen, simply exit the loop as we won't draw anything else
if (_cur.y > g_engine->_screenSettings->_cur.h + 40)
diff --git a/engines/crab/ui/HealthIndicator.cpp b/engines/crab/ui/HealthIndicator.cpp
index d60f1f02291..2cc83accfc2 100644
--- a/engines/crab/ui/HealthIndicator.cpp
+++ b/engines/crab/ui/HealthIndicator.cpp
@@ -51,12 +51,12 @@ void HealthIndicator::load(rapidxml::xml_node<char> *node) {
}
void HealthIndicator::draw(int num) {
- for (auto i = _img.begin(); i != _img.end(); ++i)
- if (num == i->_val) {
+ for (auto i : _img)
+ if (num == i._val) {
using namespace pyrodactyl::image;
- g_engine->_imageManager->draw(_x, _y, i->_normal);
- g_engine->_imageManager->getTexture(i->_glow).alpha(_alpha);
- g_engine->_imageManager->draw(_x, _y, i->_glow);
+ g_engine->_imageManager->draw(_x, _y, i._normal);
+ g_engine->_imageManager->getTexture(i._glow).alpha(_alpha);
+ g_engine->_imageManager->draw(_x, _y, i._glow);
if (_inc) {
_alpha += 2;
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index e1cde563656..de0bb9d3d7b 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -50,16 +50,16 @@ void MapData::destAdd(const Common::String &name, const int &x, const int &y) {
void MapData::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child_clip = doc.allocate_node(rapidxml::node_element, "clip");
- for (auto c = _reveal.begin(); c != _reveal.end(); ++c)
- c->saveState(doc, child_clip, "rect");
+ for (auto &c : _reveal)
+ c.saveState(doc, child_clip, "rect");
root->append_node(child_clip);
rapidxml::xml_node<char> *child_dest = doc.allocate_node(rapidxml::node_element, "dest");
- for (auto d = _dest.begin(); d != _dest.end(); ++d) {
+ for (auto &d : _dest) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "pos");
- child->append_attribute(doc.allocate_attribute("name", d->_name.c_str()));
- child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get(d->_pos.x)));
- child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get(d->_pos.y)));
+ child->append_attribute(doc.allocate_attribute("name", d._name.c_str()));
+ child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get(d._pos.x)));
+ child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get(d._pos.y)));
child_dest->append_node(child);
}
root->append_node(child_dest);
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 22cb239b659..51301ceb157 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -72,8 +72,8 @@ public:
~PageMenu() {}
void reset() {
- for (auto m = _menu.begin(); m != _menu.end(); ++m)
- m->reset();
+ for (auto &m : _menu)
+ m.reset();
}
void clear() {
@@ -137,13 +137,13 @@ public:
}
void assignPaths() {
- for (auto m = _menu.begin(); m != _menu.end(); ++m)
- m->assignPaths();
+ for (auto &m : _menu)
+ m.assignPaths();
}
void useKeyboard(const bool &val) {
- for (auto m = _menu.begin(); m != _menu.end(); ++m)
- m->useKeyboard(val);
+ for (auto &m : _menu)
+ m.useKeyboard(val);
}
void setUI() {
@@ -152,8 +152,8 @@ public:
_ref.setUI();
_status.setUI();
- for (auto m = _menu.begin(); m != _menu.end(); ++m)
- m->setUI();
+ for (auto &m : _menu)
+ m.setUI();
}
void updateInfo() {
diff --git a/engines/crab/ui/TraitMenu.cpp b/engines/crab/ui/TraitMenu.cpp
index 056da8e1bb8..67facbc4672 100644
--- a/engines/crab/ui/TraitMenu.cpp
+++ b/engines/crab/ui/TraitMenu.cpp
@@ -111,8 +111,8 @@ void TraitMenu::cache(const pyrodactyl::people::Person &obj) {
}
void TraitMenu::clear() {
- for (auto e = _menu._element.begin(); e != _menu._element.end(); ++e)
- e->empty();
+ for (auto &e : _menu._element)
+ e.empty();
}
void TraitMenu::setUI() {
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index a929df5a367..0f77966ab66 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -75,8 +75,8 @@ void HUD::load(const Common::String &filename, pyrodactyl::level::TalkNotify &tn
}
// Create a copy of all the tooltips
- for (auto i = _menu._element.begin(); i != _menu._element.end(); ++i)
- _tooltip.push_back(i->_tooltip._text);
+ for (const auto &i : _menu._element)
+ _tooltip.push_back(i._tooltip._text);
setTooltip();
}
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 8f7bc3861a1..0b34647c3ae 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -403,8 +403,8 @@ void Map::update(pyrodactyl::event::Info &info) {
//------------------------------------------------------------------------
void Map::revealAdd(const int &id, const Rect &area) {
if ((uint)id < _map.size()) {
- for (auto i = _map[id]._reveal.begin(); i != _map[id]._reveal.end(); ++i)
- if (*i == area)
+ for (auto &i : _map[id]._reveal)
+ if (i == area)
return;
_map[id]._reveal.push_back(area);
@@ -416,10 +416,10 @@ void Map::revealAdd(const int &id, const Rect &area) {
//------------------------------------------------------------------------
void Map::destAdd(const Common::String &name, const int &x, const int &y) {
if (_cur < _map.size()) {
- for (auto i = _map[_cur]._dest.begin(); i != _map[_cur]._dest.end(); ++i) {
- if (i->_name == name) {
- i->_pos.x = x;
- i->_pos.y = y;
+ for (auto &i : _map[_cur]._dest) {
+ if (i._name == name) {
+ i._pos.x = x;
+ i._pos.y = y;
return;
}
}
@@ -452,9 +452,9 @@ void Map::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *roo
child->append_attribute(doc.allocate_attribute("cur", g_engine->_stringPool->Get(_cur)));
saveBool(_overlay, "overlay", doc, child);
- for (auto r = _map.begin(); r != _map.end(); ++r) {
+ for (auto &r : _map) {
rapidxml::xml_node<char> *child_data = doc.allocate_node(rapidxml::node_element, "data");
- r->saveState(doc, child_data);
+ r.saveState(doc, child_data);
child->append_node(child_data);
}
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index bc5e20f4a96..9da2e727401 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -186,13 +186,13 @@ public:
void reset() {
_latestInput = MOUSE;
_hoverIndex = -1;
- for (auto b = _element.begin(); b != _element.end(); ++b)
- b->reset();
+ for (auto &b : _element)
+ b.reset();
}
void setUI() {
- for (auto i = _element.begin(); i != _element.end(); ++i)
- i->setUI();
+ for (auto &i : _element)
+ i.setUI();
}
//------------------------------------------------------------------------
@@ -254,15 +254,15 @@ public:
_hoverIndex = i;
// The latest input is the mouse, which means we have to forget the keyboard hover states
- for (auto e = _element.begin(); e != _element.end(); ++e)
- e->_hoverKey = false;
+ for (auto &e : _element)
+ e._hoverKey = false;
}
}
if (_latestInput == KEYBOARD) {
// The latest input is the keyboard, which means we have to forget the mouse hover states
- for (auto it = _element.begin(); it != _element.end(); ++it)
- it->_hoverMouse = false;
+ for (auto &it : _element)
+ it._hoverMouse = false;
}
return -1;
}
@@ -271,8 +271,8 @@ public:
// Purpose: Draw the menu
//------------------------------------------------------------------------
void draw(const int &XOffset = 0, const int &YOffset = 0) {
- for (auto it = _element.begin(); it != _element.end(); ++it)
- it->draw(XOffset, YOffset);
+ for (auto &it : _element)
+ it.draw(XOffset, YOffset);
}
//------------------------------------------------------------------------
diff --git a/engines/crab/ui/questmenu.cpp b/engines/crab/ui/questmenu.cpp
index 7c52553bddb..6085ef7da55 100644
--- a/engines/crab/ui/questmenu.cpp
+++ b/engines/crab/ui/questmenu.cpp
@@ -84,11 +84,10 @@ void QuestMenu::load(rapidxml::xml_node<char> *node) {
// Purpose: Add an entry to the menu
//------------------------------------------------------------------------
void QuestMenu::add(const Common::String &title, const Common::String &txt) {
- for (auto i = _quest.begin(); i != _quest.end(); ++i)
- if (i->_title == title) // We already have the quest entry
- {
- i->_text.insert_at(0, txt); // Just add the new string to the start of the quest messages and return
- i->_unread = true;
+ for (auto &i : _quest)
+ if (i._title == title) { // We already have the quest entry
+ i._text.insert_at(0, txt); // Just add the new string to the start of the quest messages and return
+ i._unread = true;
return;
}
@@ -115,9 +114,9 @@ void QuestMenu::erase(const int &index) {
// Purpose: Indicate that this quest has an associated map marker in world map
//------------------------------------------------------------------------
void QuestMenu::marker(const Common::String &title, const bool &val) {
- for (auto i = _quest.begin(); i != _quest.end(); ++i)
- if (i->_title == title)
- i->_marker = val;
+ for (auto &i : _quest)
+ if (i._title == title)
+ i._marker = val;
}
//------------------------------------------------------------------------
// Purpose: Draw
@@ -213,8 +212,8 @@ void QuestMenu::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char
saveBool(_unread, "unread", doc, child);
- for (auto q = _quest.begin(); q != _quest.end(); ++q)
- q->saveState(doc, child);
+ for (auto &q: _quest)
+ q.saveState(doc, child);
root->append_node(child);
}
Commit: d9272dd290c2cf9593ddcb805b96263617451b16
https://github.com/scummvm/scummvm/commit/d9272dd290c2cf9593ddcb805b96263617451b16
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use shorthand range based for loop in rest of the files
Changed paths:
engines/crab/LoadingScreen.cpp
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGraphNode.cpp
engines/crab/PathfindingGrid.cpp
engines/crab/Polygon.cpp
engines/crab/game.cpp
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 6049320696e..2e392e2e7a9 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -84,8 +84,8 @@ void LoadingScreen::dim() {
void LoadingScreen::quit() {
_text.deleteImage();
- for (auto i = _screen.begin(); i != _screen.end(); ++i)
- i->clear();
+ for (auto &i : _screen)
+ i.clear();
}
} // End of namespace Crab
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index bc2ec8c6e25..555d56fc2a2 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -156,15 +156,13 @@ void PathfindingAgent::update(uint32 timeslice) {
return;
}
- Common::Array<PathfindingGraphNode *>::iterator i;
-
- for (i = current->_location->_neighborNodes.begin(); i != current->_location->_neighborNodes.end(); ++i) {
- if ((*i)->getMovementCost() > 0) {
+ for (auto &i : current->_location->_neighborNodes) {
+ if (i->getMovementCost() > 0) {
// Compute the temp given cost
- dTempCost = current->getGivenCost() + ((*i)->getMovementCost() * distExact((*i), current->getLocation()));
+ dTempCost = current->getGivenCost() + i->getMovementCost() * distExact(i, current->getLocation());
// If it's a duplicate...
- currentIter = _createdList.find((*i));
+ currentIter = _createdList.find(i);
if (currentIter != _createdList.end()) {
if (dTempCost < currentIter->second->getGivenCost()) {
// If the current planner node has already been added, but the current path is cheaper,
@@ -183,17 +181,17 @@ void PathfindingAgent::update(uint32 timeslice) {
}
} else { // Otherwise...
PlannerNode *successor = new PlannerNode();
- successor->setLocation((*i));
+ successor->setLocation(i);
// Set the new heuristic (distance from node to the goal)
- successor->setHCost(distExact((*i), _goalTile));
+ successor->setHCost(distExact(i, _goalTile));
successor->setGivenCost(dTempCost);
// Final cost is the distance to goal (scaled by 10%) plus the distance of the path.
successor->setFinalCost(successor->getHCost() * 1.1 + successor->getGivenCost());
successor->setParent(current);
- _createdList[(*i)] = (successor);
+ _createdList[i] = (successor);
_nodeQueue.push(successor); // When the node is pushed onto the PriorityQueue it ends up beings sorted cheapest -> most expensive
}
}
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 7d129432c99..80ff0d850f8 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -74,8 +74,8 @@ void PathfindingGraphNode::addNeighbor(PathfindingGraphNode *node, bool ignoreDi
}
bool PathfindingGraphNode::adjacentToObstacle() const {
- for (auto iter = _neighborNodes.begin(); iter != _neighborNodes.end(); ++iter) {
- if ((*iter)->getMovementCost() < 0)
+ for (const auto &iter : _neighborNodes) {
+ if (iter->getMovementCost() < 0)
return true;
}
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 843d6ba5e20..780612fe6bd 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -124,8 +124,8 @@ void PathfindingGrid::setupNodes(TMX::TMXMap map) {
const Common::Array<Shape> &noWalk = map.areaNoWalk();
// Check if the square should count as blocked
- for (auto i = noWalk.begin(); i != noWalk.end(); ++i) {
- if (i->collide(_nodes[x][y]._collisionRect)._intersect) {
+ for (const auto &i : noWalk) {
+ if (i.collide(_nodes[x][y]._collisionRect)._intersect) {
_nodes[x][y]._movementCost = (float)_blockedCost;
break;
}
@@ -135,8 +135,8 @@ void PathfindingGrid::setupNodes(TMX::TMXMap map) {
if (_nodes[x][y]._movementCost >= 0.0f) {
const Common::Array<pyrodactyl::level::Stairs> &stairs = map.areaStairs();
- for (auto i = stairs.begin(); i != stairs.end(); ++i) {
- if (i->collide(_nodes[x][y]._collisionRect)._intersect) {
+ for (const auto &i : stairs) {
+ if (i.collide(_nodes[x][y]._collisionRect)._intersect) {
_nodes[x][y]._movementCost = (float)_stairsCost;
break;
}
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index f73380b2460..84e9818873b 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -75,18 +75,18 @@ void Polygon2D::load(rapidxml::xml_node<char> *node, Rect &bounds) {
loadStr(points, "points", polynode);
bool comma = false;
- for (auto i = points.begin(); i != points.end(); ++i) {
- if (*i == ',')
+ for (const auto &i : points) {
+ if (i == ',')
comma = true;
- else if (*i == ' ') {
+ else if (i == ' ') {
addPoint(ref, x, y, min, max);
comma = false;
x.clear();
y.clear();
} else if (comma)
- y += *i;
+ y += i;
else
- x += *i;
+ x += i;
}
addPoint(ref, x, y, min, max);
@@ -132,9 +132,9 @@ Vector2f Polygon2D::center() const {
}
void Polygon2D::offset(const float &x, const float &y) {
- for (auto i = _point.begin(); i != _point.end(); ++i) {
- i->x += x;
- i->y += y;
+ for (auto &i : _point) {
+ i.x += x;
+ i.y += y;
}
}
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 6b094713050..cf9efa35568 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -569,23 +569,23 @@ void Game::draw() {
bool Game::applyResult() {
using namespace pyrodactyl::event;
- for (auto i = _eventRes.begin(); i != _eventRes.end(); ++i) {
- switch (i->_type) {
+ for (const auto &i : _eventRes) {
+ switch (i._type) {
case ER_MAP:
- if (i->_val == "img")
- _map.setImage(i->_y);
- else if (i->_val == "pos") {
- _map._playerPos.x = i->_x;
- _map._playerPos.y = i->_y;
+ if (i._val == "img")
+ _map.setImage(i._y);
+ else if (i._val == "pos") {
+ _map._playerPos.x = i._x;
+ _map._playerPos.y = i._y;
}
break;
case ER_DEST:
- if (i->_x < 0 || i->_y < 0) {
- _info._journal.marker(_level.playerId(), i->_val, false);
- _map.destDel(i->_val);
+ if (i._x < 0 || i._y < 0) {
+ _info._journal.marker(_level.playerId(), i._val, false);
+ _map.destDel(i._val);
} else {
- _map.destAdd(i->_val, i->_x, i->_y);
- _info._journal.marker(_level.playerId(), i->_val, true);
+ _map.destAdd(i._val, i._x, i._y);
+ _info._journal.marker(_level.playerId(), i._val, true);
_info._unread._map = true;
}
break;
@@ -593,22 +593,22 @@ bool Game::applyResult() {
playerImg();
break;
case ER_TRAIT:
- if (i->_x == 42)
- _info.traitDel(i->_val, i->_y);
+ if (i._x == 42)
+ _info.traitDel(i._val, i._y);
else
- _info.traitAdd(i->_val, i->_y);
+ _info.traitAdd(i._val, i._y);
break;
case ER_LEVEL:
- if (i->_val == "Map")
+ if (i._val == "Map")
toggleState(STATE_MAP);
else
- loadLevel(i->_val, i->_x, i->_y);
+ loadLevel(i._val, i._x, i._y);
break;
case ER_MOVE:
for (auto &o : _level._objects) {
- if (i->_val == o.id()) {
- o.x(i->_x);
- o.y(i->_y);
+ if (i._val == o.id()) {
+ o.x(i._x);
+ o.y(i._y);
break;
}
}
@@ -618,7 +618,7 @@ bool Game::applyResult() {
_level.playerStop();
// Then swap to the new id
- _level.playerId(i->_val, i->_x, i->_y);
+ _level.playerId(i._val, i._x, i._y);
// Stop the new player sprite's movement as well
_level.playerStop();
@@ -631,7 +631,7 @@ bool Game::applyResult() {
_map.update(_info);
break;
case ER_QUIT:
- g_engine->_tempData->_credits = (i->_val == "credits");
+ g_engine->_tempData->_credits = (i._val == "credits");
return true;
default:
break;
Commit: c48e1588af70b967625c09efa1ab9ae1ebd52b79
https://github.com/scummvm/scummvm/commit/c48e1588af70b967625c09efa1ab9ae1ebd52b79
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename variable to timeLeft in PathfindingAgent.cpp
Changed paths:
engines/crab/PathfindingAgent.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 555d56fc2a2..91557e40259 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -111,7 +111,7 @@ void PathfindingAgent::setDestination(Vector2f d, bool r) {
void PathfindingAgent::update(uint32 timeslice) {
uint32 prevTime = g_system->getMillis();
- uint32 time = timeslice;
+ uint32 timeLeft = timeslice;
double dTempCost;
@@ -199,11 +199,11 @@ void PathfindingAgent::update(uint32 timeslice) {
// Update the time
if (timeslice != 0) {
- time -= (g_system->getMillis() - prevTime);
+ timeLeft -= (g_system->getMillis() - prevTime);
prevTime = g_system->getMillis();
}
- } while (!isDone() && ((int32)time >= 0 || timeslice == 0));
+ } while (!isDone() && ((int32)timeLeft >= 0 || timeslice == 0));
_noSolution = true; // You can't get there from here (SZ)
}
Commit: 3f2eb15a8f5936ae8dacbedb02db2b6a079f754e
https://github.com/scummvm/scummvm/commit/3f2eb15a8f5936ae8dacbedb02db2b6a079f754e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Code cleanup and fix formatting
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGraphNode.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 91557e40259..85a8875c087 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -242,11 +242,9 @@ Common::Array<PathfindingGraphNode const *> const PathfindingAgent::getSolution(
if (_createdList.find(_goalTile) != _createdList.end()) {
current = _createdList.find(_goalTile)->second;
- }
-
- // If the dest node passed in is not null, that means we did not reach the goal but came close
- // so we should start with that node instead when we are constructing our path
- else if (destNode != nullptr) {
+ } else if (destNode != nullptr) {
+ // If the dest node passed in is not null, that means we did not reach the goal but came close
+ // so we should start with that node instead when we are constructing our path
current = _createdList.find(destNode)->second;
}
diff --git a/engines/crab/PathfindingGraphNode.cpp b/engines/crab/PathfindingGraphNode.cpp
index 80ff0d850f8..fa2dbf5d023 100644
--- a/engines/crab/PathfindingGraphNode.cpp
+++ b/engines/crab/PathfindingGraphNode.cpp
@@ -91,10 +91,4 @@ bool PathfindingGraphNode::adjacentToNode(PathfindingGraphNode *otherNode) {
return false;
}
-//
-// const Common::Array< PathfindingGraphNode*>& PathfindingGraphNode::GetNeighbors() const
-//{
-// return neighborNodes;
-//}
-
} // End of namespace Crab
Commit: 610e3dd7b6a5f4f4cff8e589545f2a2a398ccff6
https://github.com/scummvm/scummvm/commit/610e3dd7b6a5f4f4cff8e589545f2a2a398ccff6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Code cleanup and fix formatting in TMXMap.cpp
Changed paths:
engines/crab/TMX/TMXMap.cpp
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 1572131f4cf..30825f91dee 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -269,9 +269,9 @@ void TMXMap::drawDebug(const Rect &camera) {
}
// Draw the pathfinding grid (SZ)
- for(int x = 0; x < _grid->getDimensions().x; ++x) {
- for(int y = 0; y < _grid->getDimensions().y; ++y) {
- if(_grid->getNodeAtCoords(x, y)->getMovementCost() < 0.0f)
+ for (int x = 0; x < _grid->getDimensions().x; ++x) {
+ for (int y = 0; y < _grid->getDimensions().y; ++y) {
+ if (_grid->getNodeAtCoords(x, y)->getMovementCost() < 0.0f)
_grid->getNodeAtCoords(x, y)->getRect().draw(-camera.x, -camera.y, 0, 0, 0, 254);
}
}
@@ -371,8 +371,4 @@ bool TMXMap::collideWithMusic(const Rect rect, pyrodactyl::level::MusicInfo &mus
return false;
}
-//------------------------------------------------------------------------
-// Purpose: Path finding functions
-//------------------------------------------------------------------------
-
} // End of namespace Crab
Commit: e3920899b116e7f52ecc64b6d2a6641ac49da55a
https://github.com/scummvm/scummvm/commit/e3920899b116e7f52ecc64b6d2a6641ac49da55a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Start cleaning up headers
Changed paths:
engines/crab/GameClock.h
engines/crab/GameParam.h
engines/crab/LevelResult.h
engines/crab/Line.h
engines/crab/LoadingScreen.h
engines/crab/PathfindingAgent.h
engines/crab/PathfindingGrid.h
engines/crab/Polygon.h
engines/crab/PriorityQueue.h
engines/crab/Rectangle.h
engines/crab/ScreenSettings.h
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.h
engines/crab/TMX/TileInfo.h
engines/crab/XMLDoc.cpp
engines/crab/XMLDoc.h
engines/crab/ai/SpriteConstant.h
engines/crab/ai/moveeffect.h
engines/crab/ai/movement.h
engines/crab/ai/spriteai.h
engines/crab/animation/AnimationEffect.h
engines/crab/animation/AnimationFrame.h
engines/crab/animation/PopUp.h
engines/crab/animation/animation.h
engines/crab/animation/animframe.h
engines/crab/animation/animset.h
engines/crab/animation/fightanim.h
engines/crab/animation/fightmove.h
engines/crab/animation/fightmoves.h
engines/crab/animation/fm_ai_data.h
engines/crab/animation/imageeffect.h
engines/crab/animation/range.h
engines/crab/animation/shadow.h
engines/crab/animation/sprite.h
engines/crab/animation/walkframes.h
engines/crab/app.h
engines/crab/backInserter.h
engines/crab/collision.h
engines/crab/crab.h
engines/crab/event/EventSeqGroup.h
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.h
engines/crab/event/changeval.h
engines/crab/event/conversationdata.h
engines/crab/event/effect.h
engines/crab/event/eventstore.h
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.h
engines/crab/event/quest.h
engines/crab/event/trigger.h
engines/crab/event/triggerset.h
engines/crab/filesystem.h
engines/crab/game.cpp
engines/crab/game.h
engines/crab/gamestate_container.h
engines/crab/gamestates.h
engines/crab/image/Image.cpp
engines/crab/image/Image.h
engines/crab/image/ImageManager.h
engines/crab/input/cursor.cpp
engines/crab/input/cursor.h
engines/crab/input/fightinput.h
engines/crab/input/hotkey.h
engines/crab/input/input.h
engines/crab/item/Item.h
engines/crab/item/ItemCollection.h
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.h
engines/crab/item/StatPreview.h
engines/crab/level/LevelExit.h
engines/crab/level/MusicArea.h
engines/crab/level/Stairs.h
engines/crab/level/level.h
engines/crab/level/level_objects.h
engines/crab/level/talknotify.h
engines/crab/levelpaths.h
engines/crab/loaders.h
engines/crab/mainmenu.h
engines/crab/music/MusicManager.h
engines/crab/music/musicparam.h
engines/crab/numstr.h
engines/crab/people/opinion.h
engines/crab/people/person.h
engines/crab/people/personbase.h
engines/crab/people/trait.h
engines/crab/splash.h
engines/crab/stat/Stat.h
engines/crab/stat/StatDrawHelper.h
engines/crab/stat/StatTemplate.h
engines/crab/stat/bonus.h
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.h
engines/crab/timer.h
engines/crab/ui/AlphaImage.h
engines/crab/ui/Caption.h
engines/crab/ui/ClipButton.h
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.h
engines/crab/ui/FileData.cpp
engines/crab/ui/FileData.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GameOverMenu.h
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/HealthIndicator.h
engines/crab/ui/HoverInfo.h
engines/crab/ui/ImageData.h
engines/crab/ui/Inventory.h
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapData.h
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.h
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.h
engines/crab/ui/PageMenu.h
engines/crab/ui/ParagraphData.h
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.h
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.h
engines/crab/ui/ReplyButton.cpp
engines/crab/ui/ReplyButton.h
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SaveGameMenu.h
engines/crab/ui/SectionHeader.h
engines/crab/ui/SlideShow.h
engines/crab/ui/StateButton.h
engines/crab/ui/TextData.h
engines/crab/ui/ToggleButton.h
engines/crab/ui/TraitButton.h
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.h
engines/crab/ui/dialogbox.h
engines/crab/ui/element.h
engines/crab/ui/emotion.h
engines/crab/ui/hud.h
engines/crab/ui/journal.h
engines/crab/ui/map.h
engines/crab/ui/mapbutton.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.h
engines/crab/ui/slider.h
engines/crab/ui/textarea.h
engines/crab/vectors.h
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 6f9e430a270..270a8075faf 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -31,7 +31,6 @@
#ifndef CRAB_GAMECLOCK_H
#define CRAB_GAMECLOCK_H
-#include "crab/common_header.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index c18d1571daa..57b8f99418a 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -31,8 +31,10 @@
#ifndef CRAB_GAMEPARAM_H
#define CRAB_GAMEPARAM_H
+#include "common/str.h"
+#include "common/hashmap.h"
+#include "common/rect.h"
#include "crab/XMLDoc.h"
-#include "crab/common_header.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index 50c2aadbbac..70de20bbad0 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -30,7 +30,6 @@
#ifndef CRAB_LEVELRESULT_H
#define CRAB_LEVELRESULT_H
-#include "crab/common_header.h"
#include "crab/image/ImageManager.h"
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index e7613b57dc9..46c0bc79a57 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -32,7 +32,6 @@
#define CRAB_LINE_H
#include "crab/ScreenSettings.h"
-#include "crab/common_header.h"
#include "crab/vectors.h"
namespace Crab {
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 12104f78480..228063434a6 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -32,7 +32,6 @@
#define CRAB_LOADINGSCREEN_H
#include "crab/image/Image.h"
-#include "crab/common_header.h"
#include "crab/timer.h"
#include "crab/vectors.h"
diff --git a/engines/crab/PathfindingAgent.h b/engines/crab/PathfindingAgent.h
index 37079a36ac2..f95f4b48ad0 100644
--- a/engines/crab/PathfindingAgent.h
+++ b/engines/crab/PathfindingAgent.h
@@ -31,6 +31,7 @@
#ifndef CRAB_PATHFINDINGAGENT_H
#define CRAB_PATHFINDINGAGENT_H
+#include "common/stablemap.h"
#include "crab/PathfindingGrid.h"
#include "crab/PriorityQueue.h"
#include "crab/vectors.h"
diff --git a/engines/crab/PathfindingGrid.h b/engines/crab/PathfindingGrid.h
index 56805fd6db1..e0e6369bc35 100644
--- a/engines/crab/PathfindingGrid.h
+++ b/engines/crab/PathfindingGrid.h
@@ -32,7 +32,6 @@
#define CRAB_PATHFINDINGGRID_H
#include "crab/PathfindingGraphNode.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/Polygon.h b/engines/crab/Polygon.h
index 0a7f98fc443..a9052308367 100644
--- a/engines/crab/Polygon.h
+++ b/engines/crab/Polygon.h
@@ -32,7 +32,6 @@
#define CRAB_POLYGON_H
#include "crab/Rectangle.h"
-#include "crab/common_header.h"
#include "crab/vectors.h"
namespace Crab {
diff --git a/engines/crab/PriorityQueue.h b/engines/crab/PriorityQueue.h
index c38429dd3a7..063f10498fa 100644
--- a/engines/crab/PriorityQueue.h
+++ b/engines/crab/PriorityQueue.h
@@ -31,7 +31,6 @@
#ifndef CRAB_PRIORITYQUEUE_H
#define CRAB_PRIORITYQUEUE_H
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/Rectangle.h b/engines/crab/Rectangle.h
index 0cda97f35bc..86b2cf85c1c 100644
--- a/engines/crab/Rectangle.h
+++ b/engines/crab/Rectangle.h
@@ -32,7 +32,6 @@
#define CRAB_RECTANGLE_H
#include "crab/Line.h"
-#include "crab/common_header.h"
#include "crab/vectors.h"
namespace Crab {
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index 5592b240510..684bedee423 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -32,7 +32,6 @@
#define CRAB_SCREENSETTINGS_H
#include "crab/GameParam.h"
-#include "crab/common_header.h"
#include "crab/loaders.h"
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index 31ff760b4cf..483eb702fb1 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -34,7 +34,6 @@
#include "crab/image/Image.h"
#include "crab/Rectangle.h"
#include "crab/TMX/TileInfo.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index 54354c874b0..e39d5d949f7 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -39,7 +39,6 @@
#include "crab/Shape.h"
#include "crab/level/Stairs.h"
#include "crab/TMX/TMXTileSet.h"
-#include "crab/common_header.h"
#include "crab/ai/spriteai.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXTileSet.h b/engines/crab/TMX/TMXTileSet.h
index 48fa7b15a59..83511cfb6ed 100644
--- a/engines/crab/TMX/TMXTileSet.h
+++ b/engines/crab/TMX/TMXTileSet.h
@@ -33,7 +33,6 @@
#include "crab/image/Image.h"
#include "crab/TMX/TMXLayer.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/TMX/TileInfo.h b/engines/crab/TMX/TileInfo.h
index 90d865fabbf..5da33df957a 100644
--- a/engines/crab/TMX/TileInfo.h
+++ b/engines/crab/TMX/TileInfo.h
@@ -30,7 +30,6 @@
#ifndef CRAB_TILEINFO_H
#define CRAB_TILEINFO_H
-#include "crab/common_header.h"
#include "crab/loaders.h"
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index a5ab03c618f..4f16291e9ba 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -29,7 +29,6 @@
*/
#include "crab/XMLDoc.h"
-#include "crab/common_header.h"
namespace rapidxml {
void parse_error_handler(char const* what, void* where) {
diff --git a/engines/crab/XMLDoc.h b/engines/crab/XMLDoc.h
index 692bcfa1a8e..8a349d12f02 100644
--- a/engines/crab/XMLDoc.h
+++ b/engines/crab/XMLDoc.h
@@ -31,8 +31,8 @@
#ifndef CRAB_XMLDOC_H
#define CRAB_XMLDOC_H
-#include "crab/common_header.h"
#include "crab/filesystem.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/ai/SpriteConstant.h b/engines/crab/ai/SpriteConstant.h
index 12db230d7ca..41df7788be4 100644
--- a/engines/crab/ai/SpriteConstant.h
+++ b/engines/crab/ai/SpriteConstant.h
@@ -31,7 +31,6 @@
#ifndef CRAB_SPRITECONSTANT_H
#define CRAB_SPRITECONSTANT_H
-#include "crab/common_header.h"
#include "crab/vectors.h"
namespace Crab {
diff --git a/engines/crab/ai/moveeffect.h b/engines/crab/ai/moveeffect.h
index de7a846a4f9..89a9a0cc392 100644
--- a/engines/crab/ai/moveeffect.h
+++ b/engines/crab/ai/moveeffect.h
@@ -31,7 +31,6 @@
#ifndef CRAB_MOVEEFFECT_H
#define CRAB_MOVEEFFECT_H
-#include "crab/common_header.h"
#include "crab/animation/imageeffect.h"
#include "crab/music/musicparam.h"
diff --git a/engines/crab/ai/movement.h b/engines/crab/ai/movement.h
index de4f0980442..0ae977f5882 100644
--- a/engines/crab/ai/movement.h
+++ b/engines/crab/ai/movement.h
@@ -32,7 +32,6 @@
#define CRAB_MOVEMENT_H
#include "crab/Rectangle.h"
-#include "crab/common_header.h"
#include "crab/timer.h"
#include "crab/vectors.h"
diff --git a/engines/crab/ai/spriteai.h b/engines/crab/ai/spriteai.h
index a1df5046c87..7e1975e0026 100644
--- a/engines/crab/ai/spriteai.h
+++ b/engines/crab/ai/spriteai.h
@@ -31,7 +31,6 @@
#ifndef CRAB_SPRITEAI_H
#define CRAB_SPRITEAI_H
-#include "crab/common_header.h"
#include "crab/ai/movement.h"
#include "crab/PathfindingAgent.h"
diff --git a/engines/crab/animation/AnimationEffect.h b/engines/crab/animation/AnimationEffect.h
index 561b847963a..d88918173c9 100644
--- a/engines/crab/animation/AnimationEffect.h
+++ b/engines/crab/animation/AnimationEffect.h
@@ -31,7 +31,6 @@
#ifndef CRAB_ANIMATIONEFFECT_H
#define CRAB_ANIMATIONEFFECT_H
-#include "crab/common_header.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/animation/AnimationFrame.h b/engines/crab/animation/AnimationFrame.h
index ffe6e8ad99c..115a3c78450 100644
--- a/engines/crab/animation/AnimationFrame.h
+++ b/engines/crab/animation/AnimationFrame.h
@@ -35,7 +35,6 @@
#include "crab/ui/HoverInfo.h"
#include "crab/image/ImageManager.h"
#include "crab/text/TextManager.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index 7edb7433496..701b9799caa 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -34,7 +34,6 @@
#include "crab/event/GameEventInfo.h"
#include "crab/ui/ParagraphData.h"
#include "crab/text/TextManager.h"
-#include "crab/common_header.h"
#include "crab/event/effect.h"
#include "crab/event/triggerset.h"
#include "crab/timer.h"
diff --git a/engines/crab/animation/animation.h b/engines/crab/animation/animation.h
index 69c562f0a86..ff9bb95f269 100644
--- a/engines/crab/animation/animation.h
+++ b/engines/crab/animation/animation.h
@@ -33,7 +33,6 @@
#include "crab/animation/AnimationEffect.h"
#include "crab/animation/AnimationFrame.h"
-#include "crab/common_header.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/animation/animframe.h b/engines/crab/animation/animframe.h
index cec3b68fdba..7accb7a03ea 100644
--- a/engines/crab/animation/animframe.h
+++ b/engines/crab/animation/animframe.h
@@ -32,7 +32,6 @@
#define CRAB_ANIMFRAME_H
#include "crab/Rectangle.h"
-#include "crab/common_header.h"
#include "crab/animation/shadow.h"
#include "crab/vectors.h"
diff --git a/engines/crab/animation/animset.h b/engines/crab/animation/animset.h
index d12d181f795..083e923d9d0 100644
--- a/engines/crab/animation/animset.h
+++ b/engines/crab/animation/animset.h
@@ -31,7 +31,6 @@
#ifndef CRAB_ANIMSET_H
#define CRAB_ANIMSET_H
-#include "crab/common_header.h"
#include "crab/animation/fightmoves.h"
#include "crab/animation/shadow.h"
#include "crab/animation/walkframes.h"
diff --git a/engines/crab/animation/fightanim.h b/engines/crab/animation/fightanim.h
index b10a777140c..7621dd74dd0 100644
--- a/engines/crab/animation/fightanim.h
+++ b/engines/crab/animation/fightanim.h
@@ -32,7 +32,6 @@
#define CRAB_FIGHTANIM_H
#include "crab/music/MusicManager.h"
-#include "crab/common_header.h"
#include "crab/input/fightinput.h"
#include "crab/animation/fm_ai_data.h"
#include "crab/ai/moveeffect.h"
diff --git a/engines/crab/animation/fightmove.h b/engines/crab/animation/fightmove.h
index 4a503cc33c3..e8898ab8361 100644
--- a/engines/crab/animation/fightmove.h
+++ b/engines/crab/animation/fightmove.h
@@ -31,7 +31,6 @@
#ifndef CRAB_FIGHTMOVE_H
#define CRAB_FIGHTMOVE_H
-#include "crab/common_header.h"
#include "crab/animation/fightanim.h"
namespace Crab {
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index 7bc151e6de8..864306783e4 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -32,7 +32,6 @@
#define CRAB_FIGHTMOVES_H
#include "crab/music/MusicManager.h"
-#include "crab/common_header.h"
#include "crab/animation/fightmove.h"
#include "crab/timer.h"
diff --git a/engines/crab/animation/fm_ai_data.h b/engines/crab/animation/fm_ai_data.h
index 43e0a43986c..8c7b1ab047a 100644
--- a/engines/crab/animation/fm_ai_data.h
+++ b/engines/crab/animation/fm_ai_data.h
@@ -31,7 +31,6 @@
#ifndef CRAB_FM_AI_DATA_H
#define CRAB_FM_AI_DATA_H
-#include "crab/common_header.h"
#include "crab/animation/range.h"
namespace Crab {
diff --git a/engines/crab/animation/imageeffect.h b/engines/crab/animation/imageeffect.h
index 8521903e560..9fc39f091c7 100644
--- a/engines/crab/animation/imageeffect.h
+++ b/engines/crab/animation/imageeffect.h
@@ -30,7 +30,6 @@
#ifndef CRAB_IMAGEEFFECT_H
#define CRAB_IMAGEEFFECT_H
-#include "crab/common_header.h"
#include "crab/image/ImageManager.h"
diff --git a/engines/crab/animation/range.h b/engines/crab/animation/range.h
index f48534c0438..fe74ea451fa 100644
--- a/engines/crab/animation/range.h
+++ b/engines/crab/animation/range.h
@@ -32,7 +32,6 @@
#define CRAB_RANGE_H
#include "crab/animation/animframe.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/animation/shadow.h b/engines/crab/animation/shadow.h
index 5000e0871bf..f6f7da8da82 100644
--- a/engines/crab/animation/shadow.h
+++ b/engines/crab/animation/shadow.h
@@ -32,8 +32,8 @@
#define CRAB_SHADOW_H
#include "crab/crab.h"
-#include "crab/common_header.h"
#include "crab/vectors.h"
+#include "crab/image/ImageManager.h"
namespace Crab {
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index c1ceb477334..4ca32f821e7 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -40,7 +40,6 @@
#include "crab/ai/SpriteConstant.h"
#include "crab/animation/animset.h"
#include "crab/collision.h"
-#include "crab/common_header.h"
#include "crab/people/person.h"
#include "crab/ai/spriteai.h"
#include "crab/timer.h"
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index c0d1ee0ad99..299aa06e68e 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -32,7 +32,6 @@
#define CRAB_WALKFRAMES_H
#include "crab/animation/animframe.h"
-#include "crab/common_header.h"
#include "crab/ai/movement.h"
#include "crab/people/personbase.h"
#include "crab/timer.h"
diff --git a/engines/crab/app.h b/engines/crab/app.h
index 6b2dc6ce930..ea33090a547 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -34,7 +34,6 @@
#include "crab/crab.h"
#include "crab/image/ImageManager.h"
#include "crab/music/MusicManager.h"
-#include "crab/common_header.h"
#include "crab/game.h"
#include "crab/gamestates.h"
#include "crab/gamestate_container.h"
diff --git a/engines/crab/backInserter.h b/engines/crab/backInserter.h
index bbef026c0db..eca02aedd44 100644
--- a/engines/crab/backInserter.h
+++ b/engines/crab/backInserter.h
@@ -1,8 +1,9 @@
-#include "crab/common_header.h"
#ifndef CRAB_BACKINSERTER_H
#define CRAB_BACKINSERTER_H
+#include "common/util.h"
+
namespace Crab {
template<class Container>
diff --git a/engines/crab/collision.h b/engines/crab/collision.h
index d6701ba3711..1d4f14e507a 100644
--- a/engines/crab/collision.h
+++ b/engines/crab/collision.h
@@ -33,7 +33,6 @@
#include "crab/Polygon.h"
#include "crab/Rectangle.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 4c48488009a..f6fb4ffce07 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -33,10 +33,7 @@
#include "engines/engine.h"
#include "engines/savestate.h"
#include "graphics/screen.h"
-#include "crab/image/ImageManager.h"
-#include "crab/input/cursor.h"
#include "crab/input/input.h"
-#include "crab/text/TextManager.h"
#include "crab/music/MusicManager.h"
#include "crab/ScreenSettings.h"
#include "crab/GameParam.h"
@@ -67,6 +64,18 @@ class FileMenu;
class SaveFileData;
} // End of namespace ui
+namespace image {
+class ImageManager;
+} // End of namespace image
+
+namespace input {
+class Cursor;
+} // End of namespace input
+
+namespace text {
+class TextManager;
+} // End of namespace text
+
} // End of namespace pyrodactyl
enum DebugDraw {
diff --git a/engines/crab/event/EventSeqGroup.h b/engines/crab/event/EventSeqGroup.h
index 628cd6058ed..cd505293481 100644
--- a/engines/crab/event/EventSeqGroup.h
+++ b/engines/crab/event/EventSeqGroup.h
@@ -30,7 +30,6 @@
#ifndef CRAB_EVENTSEQGROUP_H
#define CRAB_EVENTSEQGROUP_H
-#include "crab/common_header.h"
#include "crab/event/EventSequence.h"
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index cbb6bacd093..0f4d91093fb 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -30,7 +30,6 @@
#ifndef CRAB_EVENTSEQUENCE_H
#define CRAB_EVENTSEQUENCE_H
-#include "crab/common_header.h"
#include "crab/event/GameEventInfo.h"
#include "crab/image/ImageManager.h"
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 71e9ecb3ba9..cebbd758cd9 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -33,7 +33,6 @@
#include "crab/ui/Inventory.h"
#include "crab/stat/StatTemplate.h"
-#include "crab/common_header.h"
#include "crab/ui/journal.h"
#include "crab/people/person.h"
diff --git a/engines/crab/event/changeval.h b/engines/crab/event/changeval.h
index 302fb15c807..ed1aae30fb7 100644
--- a/engines/crab/event/changeval.h
+++ b/engines/crab/event/changeval.h
@@ -31,7 +31,6 @@
#ifndef CRAB_CHANGEVAL_H
#define CRAB_CHANGEVAL_H
-#include "crab/common_header.h"
#include "crab/people/opinion.h"
namespace Crab {
diff --git a/engines/crab/event/conversationdata.h b/engines/crab/event/conversationdata.h
index ec21444e2d2..7a53999aefa 100644
--- a/engines/crab/event/conversationdata.h
+++ b/engines/crab/event/conversationdata.h
@@ -32,7 +32,6 @@
#define CRAB_CONVERSATIONDATA_H
#include "crab/event/changeval.h"
-#include "crab/common_header.h"
#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index b30699d98be..6ad5afebdc8 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -33,7 +33,6 @@
#include "crab/event/GameEventInfo.h"
#include "crab/XMLDoc.h"
-#include "crab/common_header.h"
#include "crab/loaders.h"
#include "crab/people/person.h"
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 151c761fdfb..97ef1793add 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -33,7 +33,6 @@
#include "crab/ui/StateButton.h"
#include "crab/animation/animation.h"
-#include "crab/common_header.h"
#include "crab/event/conversationdata.h"
namespace Crab {
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index 4177960c6ec..e078ab00584 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -32,7 +32,6 @@
#define CRAB_GAMEEVENT_H
#include "crab/image/ImageManager.h"
-#include "crab/common_header.h"
#include "crab/event/effect.h"
#include "crab/event/eventstore.h"
#include "crab/people/person.h"
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 653a09f13dd..169c998f1b4 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -31,7 +31,6 @@
#ifndef CRAB_GAMEEVENTMANAGER_H
#define CRAB_GAMEEVENTMANAGER_H
-#include "crab/common_header.h"
#include "crab/event/EventSeqGroup.h"
#include "crab/level/level.h"
#include "crab/ui/ChapterIntro.h"
diff --git a/engines/crab/event/quest.h b/engines/crab/event/quest.h
index 4078bd8b92f..eb8efa29931 100644
--- a/engines/crab/event/quest.h
+++ b/engines/crab/event/quest.h
@@ -31,7 +31,6 @@
#ifndef CRAB_QUEST_H
#define CRAB_QUEST_H
-#include "crab/common_header.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/event/trigger.h b/engines/crab/event/trigger.h
index 9e36aedcde6..9867971297e 100644
--- a/engines/crab/event/trigger.h
+++ b/engines/crab/event/trigger.h
@@ -31,7 +31,6 @@
#ifndef CRAB_TRIGGER_H
#define CRAB_TRIGGER_H
#include "crab/event/GameEventInfo.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/event/triggerset.h b/engines/crab/event/triggerset.h
index c93823148f9..613f2edb90d 100644
--- a/engines/crab/event/triggerset.h
+++ b/engines/crab/event/triggerset.h
@@ -31,7 +31,6 @@
#ifndef CRAB_TRIGGERSET_H
#define CRAB_TRIGGERSET_H
-#include "crab/common_header.h"
#include "crab/event/trigger.h"
namespace Crab {
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index 13fe9e3190e..6de932937ca 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -30,7 +30,11 @@
#ifndef CRAB_FILESYSTEM_H
#define CRAB_FILESYSTEM_H
-#include "crab/common_header.h"
+#include "common/path.h"
+
+namespace Common {
+class File;
+} // End of namespace Common
namespace Crab {
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index cf9efa35568..23d6219227a 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -28,8 +28,9 @@
*
*/
-#include "crab/game.h"
#include "crab/backInserter.h"
+#include "crab/game.h"
+#include "crab/rapidxml/rapidxml_print.hpp"
namespace Crab {
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 092bb651ee9..9fbd1596ae7 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -36,7 +36,6 @@
#include "crab/event/GameEventInfo.h"
#include "crab/image/ImageManager.h"
#include "crab/LoadingScreen.h"
-#include "crab/common_header.h"
#include "crab/input/cursor.h"
#include "crab/event/gameeventmanager.h"
#include "crab/gamestate_container.h"
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index 012023b8833..5e842c934e8 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -35,7 +35,6 @@
#ifndef CRAB_GAMESTATE_CONTAINER_H
#define CRAB_GAMESTATE_CONTAINER_H
-#include "crab/common_header.h"
#include "crab/gamestates.h"
namespace Crab {
diff --git a/engines/crab/gamestates.h b/engines/crab/gamestates.h
index 036f61f8bac..2d229ac49ba 100644
--- a/engines/crab/gamestates.h
+++ b/engines/crab/gamestates.h
@@ -30,7 +30,6 @@
#ifndef CRAB_GAMESTATES_H
#define CRAB_GAMESTATES_H
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index bd893bbe54c..c3b6a2d75c7 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "image/png.h"
#include "crab/crab.h"
#include "crab/image/Image.h"
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index bec16e41bf2..4e418bf66bf 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -31,11 +31,17 @@
#ifndef CRAB_IMAGE_H
#define CRAB_IMAGE_H
-#include "image/png.h"
-#include "crab/ScreenSettings.h"
-#include "crab/filesystem.h"
+#include "crab/rapidxml/rapidxml.hpp"
#include "crab/Rectangle.h"
-#include "crab/common_header.h"
+
+namespace Graphics {
+class ManagedSurface;
+class Surface;
+} // End of namespace Graphics
+
+namespace Common {
+class Rect;
+} // End of namespace Common
namespace Crab {
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index e3e346c9061..5feaacb8a91 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -39,7 +39,6 @@
#include "crab/image/Image.h"
//#include "crab/LoadingScreen.h"
#include "crab/TMX/TMXTileSet.h"
-#include "crab/common_header.h"
#include "crab/input/cursor.h"
#include "crab/loaders.h"
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 6b7275b7286..4b36e7d335d 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -32,8 +32,9 @@
// Author: Arvind
// Purpose: Cursor class
//=============================================================================
-#include "crab/input/cursor.h"
+#include "graphics/cursorman.h"
#include "crab/crab.h"
+#include "crab/input/cursor.h"
namespace Crab {
using namespace pyrodactyl::input;
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index a1dc6cac82e..e5a9292897c 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -35,8 +35,8 @@
#ifndef CRAB_CURSOR_H
#define CRAB_CURSOR_H
+#include "common/events.h"
#include "crab/image/Image.h"
-#include "crab/common_header.h"
#include "crab/loaders.h"
#include "crab/vectors.h"
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 0e121c746ba..2d3c582ac46 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -31,7 +31,6 @@
#ifndef CRAB_FIGHTINPUT_H
#define CRAB_FIGHTINPUT_H
-#include "crab/common_header.h"
#include "crab/input/input.h"
#include "crab/loaders.h"
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index c458ea138e9..512551acd2e 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -32,7 +32,6 @@
#define CRAB_HOTKEY_H
#include "crab/crab.h"
-#include "crab/common_header.h"
#include "crab/input/input.h"
namespace Crab {
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index de850a60eba..17a5e99f35e 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -35,7 +35,6 @@
#include "backends/keymapper/keymapper.h"
#include "backends/keymapper/standard-actions.h"
-#include "crab/common_header.h"
//#include "crab/input/inputval.h"
namespace Crab {
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index 1fd91d5501c..c48dc8d7722 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -33,7 +33,6 @@
#include "crab/image/ImageManager.h"
#include "crab/stat/bonus.h"
-#include "crab/common_header.h"
#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/item/ItemCollection.h b/engines/crab/item/ItemCollection.h
index fd153a78593..346f5fe2c65 100644
--- a/engines/crab/item/ItemCollection.h
+++ b/engines/crab/item/ItemCollection.h
@@ -33,7 +33,6 @@
#include "crab/item/ItemMenu.h"
#include "crab/stat/StatDrawHelper.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index dfb9fd4483f..91a6208bfce 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -35,7 +35,6 @@
#include "crab/item/ItemSlot.h"
#include "crab/stat/StatDrawHelper.h"
#include "crab/item/StatPreview.h"
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
#include "crab/people/person.h"
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index c00cf0f0e1b..3b2b7b18d4a 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -34,7 +34,6 @@
#include "crab/image/ImageManager.h"
#include "crab/item/Item.h"
#include "crab/ui/StateButton.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/item/StatPreview.h b/engines/crab/item/StatPreview.h
index 993e675305f..f59362b7c90 100644
--- a/engines/crab/item/StatPreview.h
+++ b/engines/crab/item/StatPreview.h
@@ -30,7 +30,6 @@
#ifndef CRAB_STATPREVIEW_H
#define CRAB_STATPREVIEW_H
-#include "crab/common_header.h"
#include "crab/item/Item.h"
#include "crab/ui/SectionHeader.h"
diff --git a/engines/crab/level/LevelExit.h b/engines/crab/level/LevelExit.h
index ef8b69531f9..dfaaad0cbfb 100644
--- a/engines/crab/level/LevelExit.h
+++ b/engines/crab/level/LevelExit.h
@@ -34,7 +34,6 @@
#include "crab/event/GameEventInfo.h"
#include "crab/image/ImageManager.h"
#include "crab/Shape.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/level/MusicArea.h b/engines/crab/level/MusicArea.h
index 58a05132f33..20285641ccd 100644
--- a/engines/crab/level/MusicArea.h
+++ b/engines/crab/level/MusicArea.h
@@ -32,7 +32,6 @@
#define CRAB_MUSICAREA_H
#include "crab/Shape.h"
-#include "crab/common_header.h"
#include "crab/music/musicparam.h"
namespace Crab {
diff --git a/engines/crab/level/Stairs.h b/engines/crab/level/Stairs.h
index 2a0592964d8..e84a1571214 100644
--- a/engines/crab/level/Stairs.h
+++ b/engines/crab/level/Stairs.h
@@ -32,7 +32,6 @@
#define CRAB_STAIRS_H
#include "crab/Shape.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/level/level.h b/engines/crab/level/level.h
index be3bb39b5e9..54ec707ca05 100644
--- a/engines/crab/level/level.h
+++ b/engines/crab/level/level.h
@@ -31,19 +31,12 @@
#ifndef CRAB_LEVEL_H
#define CRAB_LEVEL_H
-#include "crab/event/GameEventInfo.h"
-#include "crab/image/ImageManager.h"
-#include "crab/ui/ParagraphData.h"
+#include "common/multimap.h"
#include "crab/PathfindingGrid.h"
-#include "crab/TMX/TMXMap.h"
-#include "crab/animation/animset.h"
-#include "crab/ui/button.h"
-#include "crab/common_header.h"
-#include "crab/animation/fightmove.h"
-#include "crab/level/level_objects.h"
-#include "crab/people/person.h"
#include "crab/animation/sprite.h"
+#include "crab/level/level_objects.h"
#include "crab/level/talknotify.h"
+#include "crab/TMX/TMXMap.h"
namespace Crab {
diff --git a/engines/crab/level/level_objects.h b/engines/crab/level/level_objects.h
index 4f3768b637f..03111c73f0a 100644
--- a/engines/crab/level/level_objects.h
+++ b/engines/crab/level/level_objects.h
@@ -32,7 +32,6 @@
#define CRAB_LEVEL_OBJECTS_H
#include "crab/image/ImageManager.h"
-#include "crab/common_header.h"
#include "crab/Rectangle.h"
namespace Crab {
diff --git a/engines/crab/level/talknotify.h b/engines/crab/level/talknotify.h
index 557b1b92b0f..f56fa05a557 100644
--- a/engines/crab/level/talknotify.h
+++ b/engines/crab/level/talknotify.h
@@ -33,7 +33,6 @@
#include "crab/event/GameEventInfo.h"
#include "crab/image/ImageManager.h"
-#include "crab/common_header.h"
#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/levelpaths.h b/engines/crab/levelpaths.h
index 08d87f1d1bd..f40254260dd 100644
--- a/engines/crab/levelpaths.h
+++ b/engines/crab/levelpaths.h
@@ -31,7 +31,6 @@
#ifndef LEVELPATHS_H
#define LEVELPATHS_H
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 11d618e0825..8dcee9bd6f0 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -32,7 +32,6 @@
#define CRAB_LOADERS_H
#include "crab/XMLDoc.h"
-#include "crab/common_header.h"
#include "crab/gametype.h"
#include "crab/numstr.h"
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 4d844696140..30da5c5e669 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -40,7 +40,6 @@
#include "crab/ui/OptionMenu.h"
#include "crab/ui/SlideShow.h"
#include "crab/ui/StateButton.h"
-#include "crab/common_header.h"
#include "crab/input/cursor.h"
#include "crab/gamestate_container.h"
#include "crab/gamestates.h"
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index 26020071071..2c283a4e4b9 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -34,7 +34,6 @@
#include "audio/mixer.h"
#include "audio/decoders/wave.h"
#include "crab/GameParam.h"
-#include "crab/common_header.h"
#include "crab/music/musicparam.h"
namespace Crab {
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index 3da20d46db6..6fb6e9c130d 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -32,7 +32,7 @@
#define CRAB_MUSICPARAM_H
#include "audio/audiostream.h"
#include "audio/decoders/vorbis.h"
-#include "crab/common_header.h"
+#include "common/file.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 2032bdac6ac..16b84730285 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -30,7 +30,6 @@
#ifndef CRAB_NUMSTR_H
#define CRAB_NUMSTR_H
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/people/opinion.h b/engines/crab/people/opinion.h
index 569b1c92a4a..84c94c1724b 100644
--- a/engines/crab/people/opinion.h
+++ b/engines/crab/people/opinion.h
@@ -30,7 +30,6 @@
#ifndef CRAB_OPINION_H
#define CRAB_OPINION_H
-#include "crab/common_header.h"
#include "crab/GameParam.h"
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index 9f5bfa7a3b7..44130b4a3be 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -34,7 +34,6 @@
#include "crab/image/ImageManager.h"
#include "crab/stat/Stat.h"
#include "crab/stat/StatTemplate.h"
-#include "crab/common_header.h"
#include "crab/people/opinion.h"
#include "crab/people/personbase.h"
#include "crab/people/trait.h"
diff --git a/engines/crab/people/personbase.h b/engines/crab/people/personbase.h
index 44e146bdb49..fae41f7c28e 100644
--- a/engines/crab/people/personbase.h
+++ b/engines/crab/people/personbase.h
@@ -32,7 +32,6 @@
#define CRAB_PERSONBASE_H
#include "crab/stat/Stat.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/people/trait.h b/engines/crab/people/trait.h
index 3ec117ebefd..fc347a163d8 100644
--- a/engines/crab/people/trait.h
+++ b/engines/crab/people/trait.h
@@ -32,7 +32,6 @@
#define CRAB_TRAIT_H
#include "crab/image/ImageManager.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/splash.h b/engines/crab/splash.h
index 3b9a83210e5..eea81f5a1f0 100644
--- a/engines/crab/splash.h
+++ b/engines/crab/splash.h
@@ -41,7 +41,6 @@
#include "crab/music/MusicManager.h"
#include "crab/ScreenSettings.h"
#include "crab/text/TextManager.h"
-#include "crab/common_header.h"
#include "crab/gamestate_container.h"
#include "crab/gamestates.h"
#include "crab/timer.h"
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index bb1355567e1..97b4ec0746a 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -30,7 +30,6 @@
#ifndef CRAB_STAT_H
#define CRAB_STAT_H
-#include "crab/common_header.h"
#include "crab/image/ImageManager.h"
//#include "crab/text/TextManager.h"
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index 7d4bb678a5b..a825ef54bb5 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -30,7 +30,6 @@
#ifndef CRAB_STATDRAWHELPER_H
#define CRAB_STATDRAWHELPER_H
-#include "crab/common_header.h"
#include "crab/ui/TextData.h"
#include "crab/people/person.h"
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index c13aded4486..c26b04bfb70 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -30,7 +30,6 @@
#ifndef CRAB_STATTEMPLATE_H
#define CRAB_STATTEMPLATE_H
-#include "crab/common_header.h"
#include "crab/stat/Stat.h"
diff --git a/engines/crab/stat/bonus.h b/engines/crab/stat/bonus.h
index 5a63f7d1091..6426e55c154 100644
--- a/engines/crab/stat/bonus.h
+++ b/engines/crab/stat/bonus.h
@@ -31,7 +31,6 @@
#ifndef CRAB_BONUS_H
#define CRAB_BONUS_H
-#include "crab/common_header.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 705a978262b..d0ca221385e 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -28,9 +28,11 @@
*
*/
+#include "graphics/font.h"
+#include "graphics/fonts/ttf.h"
#include "crab/crab.h"
-#include "crab/text/TextManager.h"
#include "crab/XMLDoc.h"
+#include "crab/text/TextManager.h"
namespace Crab {
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 2db4b076a59..44ee44c8471 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -32,10 +32,13 @@
#define CRAB_TEXTMANAGER_H
#include "crab/GameParam.h"
+#include "crab/vectors.h"
#include "crab/image/Image.h"
#include "crab/text/color.h"
-#include "crab/common_header.h"
-#include "crab/vectors.h"
+
+namespace Graphics {
+class Font;
+} // End of namespace Graphics
namespace Crab {
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index dce498c81cc..455fa4c4871 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -32,7 +32,6 @@
#define CRAB_COLOR_H
#include "crab/XMLDoc.h"
-#include "crab/common_header.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/timer.h b/engines/crab/timer.h
index c54446e2547..7397c2fb553 100644
--- a/engines/crab/timer.h
+++ b/engines/crab/timer.h
@@ -36,7 +36,6 @@
#define CRAB_TIMER_H
#include "crab/crab.h"
-#include "crab/common_header.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/ui/AlphaImage.h b/engines/crab/ui/AlphaImage.h
index 48870fdbbe6..663163d203c 100644
--- a/engines/crab/ui/AlphaImage.h
+++ b/engines/crab/ui/AlphaImage.h
@@ -32,7 +32,6 @@
#define CRAB_ALPHAIMAGE_H
#include "crab/image/ImageManager.h"
-#include "crab/common_header.h"
#include "crab/ui/element.h"
namespace Crab {
diff --git a/engines/crab/ui/Caption.h b/engines/crab/ui/Caption.h
index 9cae53e0376..d31126e092c 100644
--- a/engines/crab/ui/Caption.h
+++ b/engines/crab/ui/Caption.h
@@ -30,7 +30,6 @@
#ifndef CRAB_CAPTION_H
#define CRAB_CAPTION_H
-#include "crab/common_header.h"
#include "crab/ui/TextData.h"
diff --git a/engines/crab/ui/ClipButton.h b/engines/crab/ui/ClipButton.h
index ead753df23b..5ddaec16a30 100644
--- a/engines/crab/ui/ClipButton.h
+++ b/engines/crab/ui/ClipButton.h
@@ -31,7 +31,6 @@
#ifndef CRAB_CLIPBUTTON_H
#define CRAB_CLIPBUTTON_H
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 5a53f0a0f99..9fb76a98334 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -35,7 +35,6 @@
#include "crab/ui/TextData.h"
#include "crab/text/TextManager.h"
#include "crab/ui/button.h"
-#include "crab/common_header.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index f28101d0da7..ffc885f0f43 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -32,7 +32,6 @@
#define CRAB_DEVCONSOLE_H
#include "crab/event/GameEventInfo.h"
-#include "crab/common_header.h"
#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/FileData.cpp b/engines/crab/ui/FileData.cpp
index 45872a50748..8cd47f7905b 100644
--- a/engines/crab/ui/FileData.cpp
+++ b/engines/crab/ui/FileData.cpp
@@ -28,8 +28,8 @@
*
*/
+#include "common/savefile.h"
#include "crab/crab.h"
-#include "crab/common_header.h"
#include "crab/ui/FileData.h"
namespace Crab {
diff --git a/engines/crab/ui/FileData.h b/engines/crab/ui/FileData.h
index 50a837d3ae2..6420c71afe9 100644
--- a/engines/crab/ui/FileData.h
+++ b/engines/crab/ui/FileData.h
@@ -32,7 +32,6 @@
#define CRAB_FILEDATA_H
#include "crab/XMLDoc.h"
-#include "crab/common_header.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 1446af5e9eb..d0dc5d7e428 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -38,7 +38,6 @@
#include "crab/ui/ImageData.h"
#include "crab/ui/PageMenu.h"
#include "crab/ui/TextData.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index dd450c9846e..87233fade74 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -33,7 +33,6 @@
#include "crab/ui/ImageData.h"
#include "crab/ui/TextData.h"
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index 22cd743a71e..aafb6134fce 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -33,7 +33,6 @@
#include "crab/ui/RadioButtonMenu.h"
#include "crab/ui/ToggleButton.h"
-#include "crab/common_header.h"
#include "crab/ui/slider.h"
namespace Crab {
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index 03cb814fe9b..b9ebeffc244 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -35,7 +35,6 @@
#include "crab/ui/ResolutionMenu.h"
#include "crab/ui/StateButton.h"
#include "crab/ui/ToggleButton.h"
-#include "crab/common_header.h"
#include "crab/ui/slider.h"
namespace Crab {
diff --git a/engines/crab/ui/HealthIndicator.h b/engines/crab/ui/HealthIndicator.h
index a54c2b0723e..e13ed4b6d81 100644
--- a/engines/crab/ui/HealthIndicator.h
+++ b/engines/crab/ui/HealthIndicator.h
@@ -30,7 +30,6 @@
#ifndef CRAB_HEALTHINDICATOR_H
#define CRAB_HEALTHINDICATOR_H
-#include "crab/common_header.h"
#include "crab/image/ImageManager.h"
diff --git a/engines/crab/ui/HoverInfo.h b/engines/crab/ui/HoverInfo.h
index 4ad89c93af7..3567115395c 100644
--- a/engines/crab/ui/HoverInfo.h
+++ b/engines/crab/ui/HoverInfo.h
@@ -30,7 +30,6 @@
#ifndef CRAB_HOVERINFO_H
#define CRAB_HOVERINFO_H
-#include "crab/common_header.h"
#include "crab/ui/TextData.h"
diff --git a/engines/crab/ui/ImageData.h b/engines/crab/ui/ImageData.h
index d353ccf5b96..4591c95a463 100644
--- a/engines/crab/ui/ImageData.h
+++ b/engines/crab/ui/ImageData.h
@@ -32,7 +32,6 @@
#define CRAB_IMAGEDATA_H
#include "crab/image/ImageManager.h"
-#include "crab/common_header.h"
#include "crab/ui/element.h"
namespace Crab {
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index 4e649d3fe4f..c8a185b1b66 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -36,7 +36,6 @@
#include "crab/item/ItemSlot.h"
#include "crab/stat/Stat.h"
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 9c79e69ac6d..8481ae83c75 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -33,7 +33,6 @@
#include "crab/ui/ImageData.h"
#include "crab/ui/OptionSelect.h"
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/MapData.h b/engines/crab/ui/MapData.h
index baa7dba3ede..43edbab9798 100644
--- a/engines/crab/ui/MapData.h
+++ b/engines/crab/ui/MapData.h
@@ -32,7 +32,6 @@
#define CRAB_MAPDATA_H
#include "crab/Rectangle.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index e36f74fcb47..82135b8bff7 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -32,7 +32,6 @@
#define CRAB_MAPMARKERMENU_H
#include "crab/ui/StateButton.h"
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/ModMenu.h b/engines/crab/ui/ModMenu.h
index 0e51e5cf4fb..db555fc2101 100644
--- a/engines/crab/ui/ModMenu.h
+++ b/engines/crab/ui/ModMenu.h
@@ -32,7 +32,6 @@
#define CRAB_MODMENU_H
#include "crab/ui/FileMenu.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index a4d6c3b6d95..31ec2bf5f2c 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -37,7 +37,6 @@
#include "crab/ui/KeyBindMenu.h"
#include "crab/ui/StateButton.h"
#include "crab/ui/ToggleButton.h"
-#include "crab/common_header.h"
#include "crab/ui/slider.h"
#include "crab/timer.h"
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index f6852335317..7f7341e9521 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -30,7 +30,6 @@
#ifndef CRAB_OPTIONSELECT_H
#define CRAB_OPTIONSELECT_H
-#include "crab/common_header.h"
#include "crab/ui/TextData.h"
#include "crab/ui/button.h"
diff --git a/engines/crab/ui/PageMenu.h b/engines/crab/ui/PageMenu.h
index 51301ceb157..4475d9927c6 100644
--- a/engines/crab/ui/PageMenu.h
+++ b/engines/crab/ui/PageMenu.h
@@ -31,7 +31,6 @@
#ifndef CRAB_PAGEMENU_H
#define CRAB_PAGEMENU_H
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/ParagraphData.h b/engines/crab/ui/ParagraphData.h
index 0abe9fb694b..9e0900a2414 100644
--- a/engines/crab/ui/ParagraphData.h
+++ b/engines/crab/ui/ParagraphData.h
@@ -32,7 +32,6 @@
#define CRAB_PARAGRAPHDATA_H
#include "crab/ui/TextData.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index ccd67ee754d..0122474aac5 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -36,7 +36,6 @@
#include "crab/ui/OptionMenu.h"
#include "crab/ui/SaveGameMenu.h"
#include "crab/ui/SlideShow.h"
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
#include "crab/ui/slider.h"
#include "crab/ui/textarea.h"
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index dd219031e91..02fa96e847d 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -33,7 +33,6 @@
#include "crab/event/GameEventInfo.h"
#include "crab/ui/ProgressBar.h"
-#include "crab/common_header.h"
#include "crab/ui/dialogbox.h"
#include "crab/event/gameevent.h"
#include "crab/people/person.h"
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index 323294d7c3f..ab9c91e29f2 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -32,7 +32,6 @@
#define CRAB_PROGRESSBAR_H
#include "crab/ui/ClipButton.h"
-#include "crab/common_header.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index e0e2cfc6913..2a546a90957 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -34,7 +34,6 @@
#include "crab/ui/ImageData.h"
#include "crab/ui/ParagraphData.h"
#include "crab/ui/button.h"
-#include "crab/common_header.h"
#include "crab/event/quest.h"
namespace Crab {
diff --git a/engines/crab/ui/ReplyButton.cpp b/engines/crab/ui/ReplyButton.cpp
index 0f5465ac1e4..f1135181869 100644
--- a/engines/crab/ui/ReplyButton.cpp
+++ b/engines/crab/ui/ReplyButton.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "graphics/font.h"
#include "crab/crab.h"
#include "crab/ui/ReplyButton.h"
diff --git a/engines/crab/ui/ReplyButton.h b/engines/crab/ui/ReplyButton.h
index 16dc4e4f632..f1efaeac080 100644
--- a/engines/crab/ui/ReplyButton.h
+++ b/engines/crab/ui/ReplyButton.h
@@ -32,7 +32,6 @@
#define CRAB_REPLYBUTTON_H
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index ed9e8ef4c0a..e376e958752 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -35,7 +35,6 @@
#include "crab/ui/ImageData.h"
#include "crab/ui/PersonHandler.h"
#include "crab/ui/ReplyButton.h"
-#include "crab/common_header.h"
#include "crab/event/conversationdata.h"
#include "crab/ui/emotion.h"
#include "crab/event/eventstore.h"
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index 7accada41de..e286d6ace5b 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -30,7 +30,6 @@
#ifndef CRAB_RESOLUTIONMENU_H
#define CRAB_RESOLUTIONMENU_H
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
#include "crab/ui/textarea.h"
diff --git a/engines/crab/ui/SaveGameMenu.h b/engines/crab/ui/SaveGameMenu.h
index df4a24972d0..daedd878b8e 100644
--- a/engines/crab/ui/SaveGameMenu.h
+++ b/engines/crab/ui/SaveGameMenu.h
@@ -32,7 +32,6 @@
#define CRAB_SAVEGAMEMENU_H
#include "crab/ui/FileMenu.h"
-#include "crab/common_header.h"
#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/SectionHeader.h b/engines/crab/ui/SectionHeader.h
index 928d06cfa58..3adba546d53 100644
--- a/engines/crab/ui/SectionHeader.h
+++ b/engines/crab/ui/SectionHeader.h
@@ -34,7 +34,6 @@
#include "crab/image/ImageManager.h"
#include "crab/ui/TextData.h"
#include "crab/text/TextManager.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index cfd8f79b2df..a11e84f64f3 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -34,7 +34,6 @@
#include "crab/image/Image.h"
#include "crab/ui/ImageData.h"
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/StateButton.h b/engines/crab/ui/StateButton.h
index 7fd2bbfce7b..6fcee649293 100644
--- a/engines/crab/ui/StateButton.h
+++ b/engines/crab/ui/StateButton.h
@@ -32,7 +32,6 @@
#define CRAB_STATEBUTTON_H
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/TextData.h b/engines/crab/ui/TextData.h
index 7f96d378864..f5aa832f38b 100644
--- a/engines/crab/ui/TextData.h
+++ b/engines/crab/ui/TextData.h
@@ -32,7 +32,6 @@
#define CRAB_TEXTDATA_H
#include "crab/text/TextManager.h"
-#include "crab/common_header.h"
#include "crab/ui/element.h"
namespace Crab {
diff --git a/engines/crab/ui/ToggleButton.h b/engines/crab/ui/ToggleButton.h
index b7a38be269a..421142a7155 100644
--- a/engines/crab/ui/ToggleButton.h
+++ b/engines/crab/ui/ToggleButton.h
@@ -32,7 +32,6 @@
#define CRAB_TOGGLEBUTTON_H
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/TraitButton.h b/engines/crab/ui/TraitButton.h
index 89d3a6aa5f2..f0c20ce1ca2 100644
--- a/engines/crab/ui/TraitButton.h
+++ b/engines/crab/ui/TraitButton.h
@@ -32,7 +32,6 @@
#define CRAB_TRAITBUTTON_H
#include "crab/ui/StateButton.h"
-#include "crab/common_header.h"
#include "crab/people/trait.h"
namespace Crab {
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index 812c054b5aa..f4e815f2796 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -33,7 +33,6 @@
#include "crab/ui/ParagraphData.h"
#include "crab/ui/TraitButton.h"
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
#include "crab/people/person.h"
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index 708f9658d32..ed05553b176 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -40,7 +40,6 @@
#include "crab/image/ImageManager.h"
#include "crab/music/MusicManager.h"
#include "crab/text/TextManager.h"
-#include "crab/common_header.h"
#include "crab/ui/element.h"
#include "crab/input/hotkey.h"
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index 3db1404e82d..4e59d99b2e3 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -38,7 +38,6 @@
#include "crab/event/GameEventInfo.h"
#include "crab/ui/ParagraphData.h"
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index 0ea9ade4c89..0738d18b3f1 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -33,7 +33,6 @@
#include "crab/image/ImageManager.h"
#include "crab/ScreenSettings.h"
-#include "crab/common_header.h"
#include "crab/vectors.h"
#include "crab/Rectangle.h"
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index 76fc524309e..a4ea71e3c2b 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -32,7 +32,6 @@
#define CRAB_EMOTION_H
#include "crab/image/ImageManager.h"
-#include "crab/common_header.h"
#include "crab/event/eventstore.h"
#include "crab/ui/textarea.h"
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index 9b55d50482a..c38a23a1816 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -42,7 +42,6 @@
#include "crab/ui/PauseMenu.h"
#include "crab/ui/SlideShow.h"
#include "crab/ui/StateButton.h"
-#include "crab/common_header.h"
#include "crab/input/input.h"
#include "crab/level/level_objects.h"
#include "crab/level/talknotify.h"
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index 5a493d7956f..d51cda7dc5b 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -34,7 +34,6 @@
#include "crab/ui/ImageData.h"
#include "crab/image/ImageManager.h"
#include "crab/ui/StateButton.h"
-#include "crab/common_header.h"
#include "crab/ui/questmenu.h"
namespace Crab {
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index 631580f0b9e..e5230df42ff 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -38,7 +38,6 @@
#include "crab/ui/MapMarkerMenu.h"
#include "crab/ui/StateButton.h"
#include "crab/ui/ToggleButton.h"
-#include "crab/common_header.h"
#include "crab/ui/mapbutton.h"
#include "crab/event/triggerset.h"
diff --git a/engines/crab/ui/mapbutton.h b/engines/crab/ui/mapbutton.h
index 77c3878d625..ca1e726870f 100644
--- a/engines/crab/ui/mapbutton.h
+++ b/engines/crab/ui/mapbutton.h
@@ -30,7 +30,6 @@
#ifndef CRAB_MAPBUTTON_H
#define CRAB_MAPBUTTON_H
-#include "crab/common_header.h"
#include "crab/ui/menu.h"
#include "crab/event/triggerset.h"
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 9da2e727401..33959f1e03a 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -39,7 +39,6 @@
#include "crab/crab.h"
#include "crab/image/ImageManager.h"
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index 8a55a92d93f..a7bbe35e249 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -34,7 +34,6 @@
#include "crab/ui/PageMenu.h"
#include "crab/ui/QuestText.h"
#include "crab/ui/StateButton.h"
-#include "crab/common_header.h"
#include "crab/event/quest.h"
namespace Crab {
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 20823e9eafc..2d59c17cc62 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -35,7 +35,6 @@
#include "crab/ui/ImageData.h"
#include "crab/image/ImageManager.h"
#include "crab/ui/button.h"
-#include "crab/common_header.h"
namespace Crab {
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 48b591de246..43eb59ab3ca 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -38,7 +38,6 @@
#include "crab/ui/HoverInfo.h"
#include "crab/music/MusicManager.h"
#include "crab/text/TextManager.h"
-#include "crab/common_header.h"
//#include "crab/input/input.h"
namespace Crab {
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index 7e32f15a547..bbbb5692eaf 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -30,7 +30,6 @@
#ifndef CRAB_VECTORS_H
#define CRAB_VECTORS_H
-#include "crab/common_header.h"
#include "crab/GameParam.h"
#include "crab/loaders.h"
Commit: a0a7d3b131f82cc468fc3b434fae629baf4dd9e6
https://github.com/scummvm/scummvm/commit/a0a7d3b131f82cc468fc3b434fae629baf4dd9e6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove common_header.h
Changed paths:
R engines/crab/common_header.h
diff --git a/engines/crab/common_header.h b/engines/crab/common_header.h
deleted file mode 100644
index d9c8966efd8..00000000000
--- a/engines/crab/common_header.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#ifndef CRAB_COMMON_HEADER_H
-#define CRAB_COMMON_HEADER_H
-
-#include "common/scummsys.h"
-#include "common/path.h"
-#include "common/str.h"
-#include "common/hashmap.h"
-#include "common/stablemap.h"
-#include "common/multimap.h"
-#include "common/list.h"
-#include "common/rect.h"
-#include "common/stream.h"
-#include "common/file.h"
-#include "common/events.h"
-#include "common/savefile.h"
-
-#include "graphics/surface.h"
-#include "graphics/managed_surface.h"
-#include "graphics/cursor.h"
-#include "graphics/wincursor.h"
-#include "graphics/cursorman.h"
-#include "graphics/font.h"
-#include "graphics/fonts/ttf.h"
-
-#define RAPIDXML_NO_EXCEPTIONS
-#include "crab/rapidxml/rapidxml.hpp"
-#include "crab/rapidxml/rapidxml_print.hpp"
-
-#endif // CRAB_COMMON_HEADER_H
Commit: 4ed560b96ea2e36f02bf7a1cc38a16ca13000b68
https://github.com/scummvm/scummvm/commit/4ed560b96ea2e36f02bf7a1cc38a16ca13000b68
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup headers in crab.h
Changed paths:
engines/crab/LoadingScreen.cpp
engines/crab/PathfindingAgent.cpp
engines/crab/Polygon.cpp
engines/crab/Rectangle.cpp
engines/crab/TMX/TMXTileSet.cpp
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/event/quest.h
engines/crab/filesystem.cpp
engines/crab/game.cpp
engines/crab/image/Image.cpp
engines/crab/input/cursor.cpp
engines/crab/input/hotkey.cpp
engines/crab/input/hotkey.h
engines/crab/input/input.cpp
engines/crab/level/level_draw.cpp
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/metaengine.cpp
engines/crab/music/MusicManager.cpp
engines/crab/text/TextManager.cpp
engines/crab/timer.cpp
engines/crab/ui/SectionHeader.cpp
engines/crab/ui/textarea.cpp
diff --git a/engines/crab/LoadingScreen.cpp b/engines/crab/LoadingScreen.cpp
index 2e392e2e7a9..921da780d72 100644
--- a/engines/crab/LoadingScreen.cpp
+++ b/engines/crab/LoadingScreen.cpp
@@ -27,6 +27,8 @@
* Licensed under MIT
*
*/
+
+#include "graphics/screen.h"
#include "crab/crab.h"
#include "crab/LoadingScreen.h"
#include "crab/XMLDoc.h"
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index 85a8875c087..f5f87d00ea3 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "common/system.h"
#include "crab/crab.h"
#include "crab/PathfindingAgent.h"
diff --git a/engines/crab/Polygon.cpp b/engines/crab/Polygon.cpp
index 84e9818873b..55e8b23a339 100644
--- a/engines/crab/Polygon.cpp
+++ b/engines/crab/Polygon.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "graphics/screen.h"
#include "crab/crab.h"
#include "crab/Polygon.h"
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 80ff543c373..2646cb7ca5b 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "graphics/screen.h"
#include "crab/crab.h"
#include "crab/Rectangle.h"
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 4d7d45eea05..93e28dc7126 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "graphics/screen.h"
#include "crab/crab.h"
#include "crab/TMX/TMXTileSet.h"
#include "crab/text/TextManager.h"
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index a63931c4dbd..dca6c415d1d 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -29,6 +29,7 @@
*/
#include "common/events.h"
+#include "graphics/screen.h"
#include "crab/app.h"
namespace Crab {
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 5a612d17aed..8ef62f788c3 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -19,17 +19,16 @@
*
*/
-#include "crab/crab.h"
+
#include "common/config-manager.h"
-#include "common/debug-channels.h"
-#include "common/scummsys.h"
-#include "common/system.h"
-#include "crab/console.h"
-#include "crab/detection.h"
-#include "crab/ScreenSettings.h"
-#include "crab/app.h"
#include "engines/util.h"
+#include "graphics/cursorman.h"
+#include "graphics/managed_surface.h"
#include "graphics/palette.h"
+#include "graphics/screen.h"
+#include "crab/crab.h"
+#include "crab/app.h"
+#include "crab/console.h"
namespace Crab {
@@ -171,4 +170,8 @@ Common::Error CrabEngine::syncGame(Common::Serializer &s) {
return Common::kNoError;
}
+bool CrabEngine::canSaveGameStateCurrently() {
+ return _screenSettings->_inGame;
+}
+
} // End of namespace Crab
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index f6fb4ffce07..e9d58a50106 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -22,24 +22,17 @@
#ifndef CRAB_H
#define CRAB_H
-#include "common/error.h"
-#include "common/fs.h"
-#include "common/hash-str.h"
#include "common/random.h"
-#include "common/scummsys.h"
#include "common/serializer.h"
-#include "common/system.h"
-#include "common/util.h"
-#include "engines/engine.h"
-#include "engines/savestate.h"
-#include "graphics/screen.h"
-#include "crab/input/input.h"
-#include "crab/music/MusicManager.h"
-#include "crab/ScreenSettings.h"
-#include "crab/GameParam.h"
#include "crab/detection.h"
+namespace Graphics {
+class ManagedSurface;
+class PixelFormat;
+class Screen;
+} // End of namespace Graphics
+
namespace Crab {
class App;
@@ -47,7 +40,10 @@ struct CrabGameDescription;
class LoadingScreen;
+class FilePaths;
+class TempValue;
class StringPool;
+class ScreenSettings;
namespace pyrodactyl {
namespace event {
@@ -70,8 +66,13 @@ class ImageManager;
namespace input {
class Cursor;
+class InputManager;
} // End of namespace input
+namespace music {
+class MusicManager;
+} // End of namespace music
+
namespace text {
class TextManager;
} // End of namespace text
@@ -151,9 +152,8 @@ public:
bool canLoadGameStateCurrently() override {
return true;
}
- bool canSaveGameStateCurrently() override {
- return _screenSettings->_inGame;
- }
+
+ bool canSaveGameStateCurrently() override;
/**
* Uses a serializer to allow implementing savegame
diff --git a/engines/crab/event/quest.h b/engines/crab/event/quest.h
index eb8efa29931..7a29dda006c 100644
--- a/engines/crab/event/quest.h
+++ b/engines/crab/event/quest.h
@@ -31,6 +31,7 @@
#ifndef CRAB_QUEST_H
#define CRAB_QUEST_H
+#include "common/array.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index 5ff2dadefff..714674058e1 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "common/file.h"
#include "crab/filesystem.h"
namespace Crab {
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 23d6219227a..7341eb02c3e 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -28,6 +28,8 @@
*
*/
+#include "graphics/managed_surface.h"
+#include "graphics/screen.h"
#include "crab/backInserter.h"
#include "crab/game.h"
#include "crab/rapidxml/rapidxml_print.hpp"
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index c3b6a2d75c7..19bb3690f2c 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -28,6 +28,9 @@
*
*/
+#include "common/file.h"
+#include "graphics/managed_surface.h"
+#include "graphics/screen.h"
#include "image/png.h"
#include "crab/crab.h"
#include "crab/image/Image.h"
diff --git a/engines/crab/input/cursor.cpp b/engines/crab/input/cursor.cpp
index 4b36e7d335d..dd787d489ac 100644
--- a/engines/crab/input/cursor.cpp
+++ b/engines/crab/input/cursor.cpp
@@ -33,6 +33,7 @@
// Purpose: Cursor class
//=============================================================================
#include "graphics/cursorman.h"
+#include "graphics/managed_surface.h"
#include "crab/crab.h"
#include "crab/input/cursor.h"
diff --git a/engines/crab/input/hotkey.cpp b/engines/crab/input/hotkey.cpp
index e0da60b59da..35c37af78c0 100644
--- a/engines/crab/input/hotkey.cpp
+++ b/engines/crab/input/hotkey.cpp
@@ -28,8 +28,9 @@
*
*/
-#include "crab/input/hotkey.h"
#include "crab/crab.h"
+#include "crab/loaders.h"
+#include "crab/input/hotkey.h"
namespace Crab {
diff --git a/engines/crab/input/hotkey.h b/engines/crab/input/hotkey.h
index 512551acd2e..15239fdb68c 100644
--- a/engines/crab/input/hotkey.h
+++ b/engines/crab/input/hotkey.h
@@ -33,6 +33,7 @@
#include "crab/crab.h"
#include "crab/input/input.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 15c16a5ad60..b18417d7164 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -27,9 +27,11 @@
* Licensed under MIT
*
*/
+#include "common/system.h"
#include "common/translation.h"
-
#include "crab/crab.h"
+#include "crab/loaders.h"
+#include "crab/XMLDoc.h"
#include "crab/input/input.h"
namespace Crab {
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index 5ef5b14b0ba..c14fe0488b9 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "graphics/managed_surface.h"
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 8304ec9dbb9..b68030fda36 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 8dcee9bd6f0..14d1294c70b 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -31,9 +31,10 @@
#ifndef CRAB_LOADERS_H
#define CRAB_LOADERS_H
-#include "crab/XMLDoc.h"
+#include "common/str.h"
#include "crab/gametype.h"
#include "crab/numstr.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/metaengine.cpp b/engines/crab/metaengine.cpp
index a3f8694142b..5be0e010d66 100644
--- a/engines/crab/metaengine.cpp
+++ b/engines/crab/metaengine.cpp
@@ -18,18 +18,14 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
-
+#include "backends/keymapper/action.h"
+#include "backends/keymapper/keymapper.h"
#include "common/translation.h"
+#include "graphics/scaler.h"
#include "crab/crab.h"
-#include "crab/detection.h"
#include "crab/metaengine.h"
-
-#include "backends/keymapper/action.h"
-#include "backends/keymapper/keymapper.h"
-#include "backends/keymapper/standard-actions.h"
-
-#include "graphics/scaler.h"
+#include "crab/input/input.h"
namespace Crab {
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 10e12e4a326..a9ee719642d 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -28,11 +28,11 @@
*
*/
-
-#include "crab/music/MusicManager.h"
+#include "common/config-manager.h"
+#include "crab/crab.h"
#include "crab/ScreenSettings.h"
#include "crab/XMLDoc.h"
-#include "crab/crab.h"
+#include "crab/music/MusicManager.h"
namespace Crab {
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index d0ca221385e..1489c8aae22 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -28,8 +28,10 @@
*
*/
+#include "common/file.h"
#include "graphics/font.h"
#include "graphics/fonts/ttf.h"
+#include "graphics/screen.h"
#include "crab/crab.h"
#include "crab/XMLDoc.h"
#include "crab/text/TextManager.h"
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index 0a0bba35a60..2bf19bea827 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -32,6 +32,7 @@
// Author: Arvind
// Purpose: Timer functions
//=============================================================================
+#include "common/system.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index eaacadb7393..21528215258 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "graphics/managed_surface.h"
#include "crab/crab.h"
#include "crab/ui/SectionHeader.h"
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 8cf2a6f5286..00374f8865a 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -33,6 +33,7 @@
// Purpose: TextArea functions
//=============================================================================
#include "crab/crab.h"
+#include "crab/input/input.h"
#include "crab/ui/textarea.h"
namespace Crab {
Commit: 283f67096884d1c4de523f6a359d8a6029775de0
https://github.com/scummvm/scummvm/commit/283f67096884d1c4de523f6a359d8a6029775de0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes in ai and animation component
Changed paths:
engines/crab/animation/AnimationFrame.h
engines/crab/animation/PopUp.h
engines/crab/animation/animation.h
engines/crab/animation/animframe.h
engines/crab/animation/fightanim.h
engines/crab/animation/fightmoves.h
engines/crab/animation/sprite.h
engines/crab/animation/walkframes.h
diff --git a/engines/crab/animation/AnimationFrame.h b/engines/crab/animation/AnimationFrame.h
index 115a3c78450..978cdc2a125 100644
--- a/engines/crab/animation/AnimationFrame.h
+++ b/engines/crab/animation/AnimationFrame.h
@@ -32,9 +32,9 @@
#define CRAB_ANIMATIONFRAME_H
#include "crab/animation/AnimationEffect.h"
-#include "crab/ui/HoverInfo.h"
#include "crab/image/ImageManager.h"
#include "crab/text/TextManager.h"
+#include "crab/ui/HoverInfo.h"
namespace Crab {
diff --git a/engines/crab/animation/PopUp.h b/engines/crab/animation/PopUp.h
index 701b9799caa..e22880d2c35 100644
--- a/engines/crab/animation/PopUp.h
+++ b/engines/crab/animation/PopUp.h
@@ -31,12 +31,9 @@
#ifndef CRAB_POPUP_H
#define CRAB_POPUP_H
-#include "crab/event/GameEventInfo.h"
-#include "crab/ui/ParagraphData.h"
-#include "crab/text/TextManager.h"
+#include "crab/timer.h"
#include "crab/event/effect.h"
#include "crab/event/triggerset.h"
-#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/animation/animation.h b/engines/crab/animation/animation.h
index ff9bb95f269..22e91de42e8 100644
--- a/engines/crab/animation/animation.h
+++ b/engines/crab/animation/animation.h
@@ -31,9 +31,9 @@
#ifndef CRAB_ANIMATION_H
#define CRAB_ANIMATION_H
+#include "crab/timer.h"
#include "crab/animation/AnimationEffect.h"
#include "crab/animation/AnimationFrame.h"
-#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/animation/animframe.h b/engines/crab/animation/animframe.h
index 7accb7a03ea..449d6f0f9f4 100644
--- a/engines/crab/animation/animframe.h
+++ b/engines/crab/animation/animframe.h
@@ -32,8 +32,8 @@
#define CRAB_ANIMFRAME_H
#include "crab/Rectangle.h"
-#include "crab/animation/shadow.h"
#include "crab/vectors.h"
+#include "crab/animation/shadow.h"
namespace Crab {
diff --git a/engines/crab/animation/fightanim.h b/engines/crab/animation/fightanim.h
index 7621dd74dd0..b5d5d237c99 100644
--- a/engines/crab/animation/fightanim.h
+++ b/engines/crab/animation/fightanim.h
@@ -31,11 +31,9 @@
#ifndef CRAB_FIGHTANIM_H
#define CRAB_FIGHTANIM_H
-#include "crab/music/MusicManager.h"
-#include "crab/input/fightinput.h"
-#include "crab/animation/fm_ai_data.h"
#include "crab/ai/moveeffect.h"
-#include "crab/animation/shadow.h"
+#include "crab/animation/fm_ai_data.h"
+#include "crab/input/fightinput.h"
#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/animation/fightmoves.h b/engines/crab/animation/fightmoves.h
index 864306783e4..be6975181d7 100644
--- a/engines/crab/animation/fightmoves.h
+++ b/engines/crab/animation/fightmoves.h
@@ -31,9 +31,8 @@
#ifndef CRAB_FIGHTMOVES_H
#define CRAB_FIGHTMOVES_H
-#include "crab/music/MusicManager.h"
-#include "crab/animation/fightmove.h"
#include "crab/timer.h"
+#include "crab/animation/fightmove.h"
namespace Crab {
diff --git a/engines/crab/animation/sprite.h b/engines/crab/animation/sprite.h
index 4ca32f821e7..daee17b60fa 100644
--- a/engines/crab/animation/sprite.h
+++ b/engines/crab/animation/sprite.h
@@ -31,18 +31,13 @@
#ifndef CRAB_SPRITE_H
#define CRAB_SPRITE_H
-#include "crab/image/ImageManager.h"
-#include "crab/level/LevelExit.h"
-#include "crab/music/MusicManager.h"
-#include "crab/PathfindingAgent.h"
-#include "crab/animation/PopUp.h"
-#include "crab/Shape.h"
-#include "crab/ai/SpriteConstant.h"
-#include "crab/animation/animset.h"
#include "crab/collision.h"
-#include "crab/people/person.h"
-#include "crab/ai/spriteai.h"
#include "crab/timer.h"
+#include "crab/ai/spriteai.h"
+#include "crab/ai/SpriteConstant.h"
+#include "crab/animation/animset.h"
+#include "crab/animation/PopUp.h"
+#include "crab/level/LevelExit.h"
namespace Crab {
diff --git a/engines/crab/animation/walkframes.h b/engines/crab/animation/walkframes.h
index 299aa06e68e..2e2a9f05ce6 100644
--- a/engines/crab/animation/walkframes.h
+++ b/engines/crab/animation/walkframes.h
@@ -31,10 +31,10 @@
#ifndef CRAB_WALKFRAMES_H
#define CRAB_WALKFRAMES_H
-#include "crab/animation/animframe.h"
+#include "crab/timer.h"
#include "crab/ai/movement.h"
+#include "crab/animation/animframe.h"
#include "crab/people/personbase.h"
-#include "crab/timer.h"
namespace Crab {
Commit: c85ccac724b0ab38ab2e568e16a29c5707bdf197
https://github.com/scummvm/scummvm/commit/c85ccac724b0ab38ab2e568e16a29c5707bdf197
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes in event and image component
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/event/EventSequence.h
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/effect.cpp
engines/crab/event/effect.h
engines/crab/event/eventstore.h
engines/crab/event/gameevent.h
engines/crab/event/gameeventmanager.h
engines/crab/event/trigger.h
engines/crab/event/triggerset.cpp
engines/crab/gamestate_container.h
engines/crab/image/Image.h
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
engines/crab/level/level.cpp
engines/crab/level/level_collide.cpp
engines/crab/ui/button.cpp
engines/crab/ui/hud.cpp
engines/crab/ui/map.cpp
engines/crab/ui/slider.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index dd9379b961e..c3f0190e648 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/animation/sprite.h"
+#include "crab/input/cursor.h"
namespace Crab {
diff --git a/engines/crab/event/EventSequence.h b/engines/crab/event/EventSequence.h
index 0f4d91093fb..73324944cca 100644
--- a/engines/crab/event/EventSequence.h
+++ b/engines/crab/event/EventSequence.h
@@ -31,12 +31,7 @@
#ifndef CRAB_EVENTSEQUENCE_H
#define CRAB_EVENTSEQUENCE_H
-#include "crab/event/GameEventInfo.h"
-#include "crab/image/ImageManager.h"
-#include "crab/music/MusicManager.h"
-//#include "crab/ui/Inventory.h"
#include "crab/event/gameevent.h"
-//#include "crab/ui/journal.h"
namespace Crab {
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 6ace1750a9f..646966387d1 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -28,8 +28,8 @@
*
*/
-#include "crab/event/GameEventInfo.h"
#include "crab/event/eventstore.h"
+#include "crab/event/GameEventInfo.h"
namespace Crab {
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index cebbd758cd9..307b9e77fff 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -31,10 +31,9 @@
#ifndef CRAB_GAMEEVENTINFO_H
#define CRAB_GAMEEVENTINFO_H
-#include "crab/ui/Inventory.h"
#include "crab/stat/StatTemplate.h"
+#include "crab/ui/Inventory.h"
#include "crab/ui/journal.h"
-#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/event/effect.cpp b/engines/crab/event/effect.cpp
index 1dd53110374..7b0f10daca0 100644
--- a/engines/crab/event/effect.cpp
+++ b/engines/crab/event/effect.cpp
@@ -30,7 +30,6 @@
#include "crab/crab.h"
#include "crab/event/effect.h"
-#include "crab/music/MusicManager.h"
namespace Crab {
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index 6ad5afebdc8..1bc02be98b5 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -31,10 +31,10 @@
#ifndef CRAB_EFFECT_H
#define CRAB_EFFECT_H
-#include "crab/event/GameEventInfo.h"
-#include "crab/XMLDoc.h"
#include "crab/loaders.h"
+#include "crab/event/GameEventInfo.h"
#include "crab/people/person.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/event/eventstore.h b/engines/crab/event/eventstore.h
index 97ef1793add..49026c88786 100644
--- a/engines/crab/event/eventstore.h
+++ b/engines/crab/event/eventstore.h
@@ -31,9 +31,9 @@
#ifndef CRAB_EVENTSTORE_H
#define CRAB_EVENTSTORE_H
-#include "crab/ui/StateButton.h"
#include "crab/animation/animation.h"
#include "crab/event/conversationdata.h"
+#include "crab/ui/StateButton.h"
namespace Crab {
diff --git a/engines/crab/event/gameevent.h b/engines/crab/event/gameevent.h
index e078ab00584..52db446bd26 100644
--- a/engines/crab/event/gameevent.h
+++ b/engines/crab/event/gameevent.h
@@ -31,11 +31,9 @@
#ifndef CRAB_GAMEEVENT_H
#define CRAB_GAMEEVENT_H
-#include "crab/image/ImageManager.h"
#include "crab/event/effect.h"
#include "crab/event/eventstore.h"
#include "crab/people/person.h"
-#include "crab/people/personbase.h"
#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/event/gameeventmanager.h b/engines/crab/event/gameeventmanager.h
index 169c998f1b4..2ec898f1e54 100644
--- a/engines/crab/event/gameeventmanager.h
+++ b/engines/crab/event/gameeventmanager.h
@@ -32,13 +32,12 @@
#define CRAB_GAMEEVENTMANAGER_H
#include "crab/event/EventSeqGroup.h"
-#include "crab/level/level.h"
#include "crab/ui/ChapterIntro.h"
+#include "crab/ui/hud.h"
+#include "crab/ui/journal.h"
#include "crab/ui/PersonHandler.h"
#include "crab/ui/PersonScreen.h"
#include "crab/ui/ReplyMenu.h"
-#include "crab/ui/hud.h"
-#include "crab/ui/journal.h"
#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/event/trigger.h b/engines/crab/event/trigger.h
index 9867971297e..fd64cec3ea7 100644
--- a/engines/crab/event/trigger.h
+++ b/engines/crab/event/trigger.h
@@ -30,6 +30,7 @@
#ifndef CRAB_TRIGGER_H
#define CRAB_TRIGGER_H
+
#include "crab/event/GameEventInfo.h"
namespace Crab {
diff --git a/engines/crab/event/triggerset.cpp b/engines/crab/event/triggerset.cpp
index 1dc22674620..76797a232f2 100644
--- a/engines/crab/event/triggerset.cpp
+++ b/engines/crab/event/triggerset.cpp
@@ -28,7 +28,6 @@
*
*/
-
#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/gamestate_container.h b/engines/crab/gamestate_container.h
index 5e842c934e8..dcde872fcea 100644
--- a/engines/crab/gamestate_container.h
+++ b/engines/crab/gamestate_container.h
@@ -35,6 +35,7 @@
#ifndef CRAB_GAMESTATE_CONTAINER_H
#define CRAB_GAMESTATE_CONTAINER_H
+#include "common/events.h"
#include "crab/gamestates.h"
namespace Crab {
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 4e418bf66bf..7f573738dfb 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -31,8 +31,8 @@
#ifndef CRAB_IMAGE_H
#define CRAB_IMAGE_H
-#include "crab/rapidxml/rapidxml.hpp"
#include "crab/Rectangle.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Graphics {
class ManagedSurface;
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 7a194c881cc..787e637df1a 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -33,8 +33,9 @@
// Purpose: Contains the image manager class - used to manage in-game images
//=============================================================================
#include "crab/crab.h"
-#include "crab/image/ImageManager.h"
#include "crab/XMLDoc.h"
+#include "crab/image/ImageManager.h"
+#include "crab/input/cursor.h"
namespace Crab {
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index 5feaacb8a91..089c7ab1b84 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -35,12 +35,8 @@
#ifndef CRAB_IMAGEMANAGER_H
#define CRAB_IMAGEMANAGER_H
-#include "crab/GameParam.h"
#include "crab/image/Image.h"
-//#include "crab/LoadingScreen.h"
#include "crab/TMX/TMXTileSet.h"
-#include "crab/input/cursor.h"
-#include "crab/loaders.h"
namespace Crab {
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index dab8401a6ae..7969ac841e5 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/input/cursor.h"
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_collide.cpp b/engines/crab/level/level_collide.cpp
index 908bd0f22f2..6695d3516f1 100644
--- a/engines/crab/level/level_collide.cpp
+++ b/engines/crab/level/level_collide.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/input/cursor.h"
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index a1a20eb0713..dd9d118055d 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -33,6 +33,7 @@
// Purpose: Contains the button functions
//=============================================================================
#include "crab/crab.h"
+#include "crab/input/cursor.h"
#include "crab/ui/button.h"
namespace Crab {
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 0f77966ab66..a3594ffab79 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -32,6 +32,7 @@
// Author: Arvind
// Purpose: The tray where you have inventory, map and GameObjectives icons
//=============================================================================
+#include "crab/input/cursor.h"
#include "crab/ui/hud.h"
namespace Crab {
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 0b34647c3ae..66fbbd8b2be 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/input/cursor.h"
#include "crab/ui/map.h"
namespace Crab {
diff --git a/engines/crab/ui/slider.cpp b/engines/crab/ui/slider.cpp
index 2ce57c84175..0a406c00442 100644
--- a/engines/crab/ui/slider.cpp
+++ b/engines/crab/ui/slider.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/input/cursor.h"
#include "crab/ui/slider.h"
namespace Crab {
Commit: 6507841cd528bc18bd8b6c0889538b4366c4f4e0
https://github.com/scummvm/scummvm/commit/6507841cd528bc18bd8b6c0889538b4366c4f4e0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes in input and item component
Changed paths:
engines/crab/input/cursor.h
engines/crab/input/fightinput.cpp
engines/crab/input/fightinput.h
engines/crab/input/input.h
engines/crab/item/Item.h
engines/crab/item/ItemMenu.h
engines/crab/item/ItemSlot.h
diff --git a/engines/crab/input/cursor.h b/engines/crab/input/cursor.h
index e5a9292897c..6980061144e 100644
--- a/engines/crab/input/cursor.h
+++ b/engines/crab/input/cursor.h
@@ -36,9 +36,8 @@
#define CRAB_CURSOR_H
#include "common/events.h"
-#include "crab/image/Image.h"
-#include "crab/loaders.h"
#include "crab/vectors.h"
+#include "crab/image/Image.h"
namespace Crab {
diff --git a/engines/crab/input/fightinput.cpp b/engines/crab/input/fightinput.cpp
index e5f0e1d6afd..9234f4be352 100644
--- a/engines/crab/input/fightinput.cpp
+++ b/engines/crab/input/fightinput.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/loaders.h"
#include "crab/input/fightinput.h"
namespace Crab {
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index 2d3c582ac46..a4c40390a09 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -32,7 +32,7 @@
#define CRAB_FIGHTINPUT_H
#include "crab/input/input.h"
-#include "crab/loaders.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 17a5e99f35e..1e8ac672f67 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -35,8 +35,6 @@
#include "backends/keymapper/keymapper.h"
#include "backends/keymapper/standard-actions.h"
-//#include "crab/input/inputval.h"
-
namespace Crab {
#define ANALOG_PRESSED 2
diff --git a/engines/crab/item/Item.h b/engines/crab/item/Item.h
index c48dc8d7722..ba61486c198 100644
--- a/engines/crab/item/Item.h
+++ b/engines/crab/item/Item.h
@@ -32,8 +32,8 @@
#define CRAB_ITEM_H
#include "crab/image/ImageManager.h"
-#include "crab/stat/bonus.h"
#include "crab/people/person.h"
+#include "crab/stat/bonus.h"
namespace Crab {
diff --git a/engines/crab/item/ItemMenu.h b/engines/crab/item/ItemMenu.h
index 91a6208bfce..1d443809b67 100644
--- a/engines/crab/item/ItemMenu.h
+++ b/engines/crab/item/ItemMenu.h
@@ -31,12 +31,10 @@
#ifndef CRAB_ITEMMENU_H
#define CRAB_ITEMMENU_H
-#include "crab/ui/ItemDesc.h"
#include "crab/item/ItemSlot.h"
-#include "crab/stat/StatDrawHelper.h"
-#include "crab/item/StatPreview.h"
-#include "crab/ui/menu.h"
#include "crab/people/person.h"
+#include "crab/ui/ItemDesc.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/item/ItemSlot.h b/engines/crab/item/ItemSlot.h
index 3b2b7b18d4a..818acd0ab9f 100644
--- a/engines/crab/item/ItemSlot.h
+++ b/engines/crab/item/ItemSlot.h
@@ -31,7 +31,6 @@
#ifndef CRAB_ITEMSLOT_H
#define CRAB_ITEMSLOT_H
-#include "crab/image/ImageManager.h"
#include "crab/item/Item.h"
#include "crab/ui/StateButton.h"
Commit: e30b96978ce7f8de62bde6c073b4d01b3bdf083e
https://github.com/scummvm/scummvm/commit/e30b96978ce7f8de62bde6c073b4d01b3bdf083e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes in level and music component
Changed paths:
engines/crab/level/LevelExit.h
engines/crab/level/talknotify.h
engines/crab/music/MusicManager.h
diff --git a/engines/crab/level/LevelExit.h b/engines/crab/level/LevelExit.h
index dfaaad0cbfb..35744cfe756 100644
--- a/engines/crab/level/LevelExit.h
+++ b/engines/crab/level/LevelExit.h
@@ -31,8 +31,6 @@
#ifndef CRAB_LEVELEXIT_H
#define CRAB_LEVELEXIT_H
-#include "crab/event/GameEventInfo.h"
-#include "crab/image/ImageManager.h"
#include "crab/Shape.h"
namespace Crab {
diff --git a/engines/crab/level/talknotify.h b/engines/crab/level/talknotify.h
index f56fa05a557..edc2c2f005c 100644
--- a/engines/crab/level/talknotify.h
+++ b/engines/crab/level/talknotify.h
@@ -31,8 +31,6 @@
#ifndef CRAB_TALKNOTIFY_H
#define CRAB_TALKNOTIFY_H
-#include "crab/event/GameEventInfo.h"
-#include "crab/image/ImageManager.h"
#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index 2c283a4e4b9..25a4d811ab5 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -33,7 +33,6 @@
#include "audio/mixer.h"
#include "audio/decoders/wave.h"
-#include "crab/GameParam.h"
#include "crab/music/musicparam.h"
namespace Crab {
Commit: 565f44836397d64edb11842c600362e5ef4c081c
https://github.com/scummvm/scummvm/commit/565f44836397d64edb11842c600362e5ef4c081c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes in people and stat component
Changed paths:
engines/crab/event/changeval.h
engines/crab/people/opinion.cpp
engines/crab/people/opinion.h
engines/crab/people/person.h
engines/crab/people/personbase.cpp
engines/crab/people/personbase.h
engines/crab/stat/Stat.cpp
engines/crab/stat/Stat.h
engines/crab/stat/StatDrawHelper.h
engines/crab/stat/StatTemplate.h
diff --git a/engines/crab/event/changeval.h b/engines/crab/event/changeval.h
index ed1aae30fb7..984bcebba60 100644
--- a/engines/crab/event/changeval.h
+++ b/engines/crab/event/changeval.h
@@ -31,6 +31,8 @@
#ifndef CRAB_CHANGEVAL_H
#define CRAB_CHANGEVAL_H
+#include "common/str.h"
+#include "crab/loaders.h"
#include "crab/people/opinion.h"
namespace Crab {
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index 89f3194ef42..da0f3a7a3fd 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/people/opinion.h"
namespace Crab {
diff --git a/engines/crab/people/opinion.h b/engines/crab/people/opinion.h
index 84c94c1724b..eb1ec8136c4 100644
--- a/engines/crab/people/opinion.h
+++ b/engines/crab/people/opinion.h
@@ -31,8 +31,7 @@
#ifndef CRAB_OPINION_H
#define CRAB_OPINION_H
-#include "crab/GameParam.h"
-
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
namespace pyrodactyl {
diff --git a/engines/crab/people/person.h b/engines/crab/people/person.h
index 44130b4a3be..d5e145b9cb4 100644
--- a/engines/crab/people/person.h
+++ b/engines/crab/people/person.h
@@ -31,8 +31,6 @@
#ifndef CRAB_PERSON_H
#define CRAB_PERSON_H
-#include "crab/image/ImageManager.h"
-#include "crab/stat/Stat.h"
#include "crab/stat/StatTemplate.h"
#include "crab/people/opinion.h"
#include "crab/people/personbase.h"
diff --git a/engines/crab/people/personbase.cpp b/engines/crab/people/personbase.cpp
index 850c56c06c8..8854c3da8fa 100644
--- a/engines/crab/people/personbase.cpp
+++ b/engines/crab/people/personbase.cpp
@@ -28,15 +28,11 @@
*
*/
-
#include "crab/people/personbase.h"
-
namespace Crab {
-
-using namespace pyrodactyl::stat;
-
namespace pyrodactyl {
namespace people {
+
PersonType stringToPersonType(const Common::String &val) {
if (val == "neutral")
return PE_NEUTRAL;
diff --git a/engines/crab/people/personbase.h b/engines/crab/people/personbase.h
index fae41f7c28e..c4c4d16a11a 100644
--- a/engines/crab/people/personbase.h
+++ b/engines/crab/people/personbase.h
@@ -31,7 +31,7 @@
#ifndef CRAB_PERSONBASE_H
#define CRAB_PERSONBASE_H
-#include "crab/stat/Stat.h"
+#include "common/str.h"
namespace Crab {
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index a0182cddf70..c5687343b18 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/stat/Stat.h"
namespace Crab {
diff --git a/engines/crab/stat/Stat.h b/engines/crab/stat/Stat.h
index 97b4ec0746a..61938fffe7a 100644
--- a/engines/crab/stat/Stat.h
+++ b/engines/crab/stat/Stat.h
@@ -31,8 +31,9 @@
#ifndef CRAB_STAT_H
#define CRAB_STAT_H
-#include "crab/image/ImageManager.h"
-//#include "crab/text/TextManager.h"
+#include "common/str.h"
+#include "crab/gametype.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/stat/StatDrawHelper.h b/engines/crab/stat/StatDrawHelper.h
index a825ef54bb5..7ee515e220a 100644
--- a/engines/crab/stat/StatDrawHelper.h
+++ b/engines/crab/stat/StatDrawHelper.h
@@ -31,8 +31,8 @@
#ifndef CRAB_STATDRAWHELPER_H
#define CRAB_STATDRAWHELPER_H
-#include "crab/ui/TextData.h"
#include "crab/people/person.h"
+#include "crab/ui/TextData.h"
namespace Crab {
diff --git a/engines/crab/stat/StatTemplate.h b/engines/crab/stat/StatTemplate.h
index c26b04bfb70..451a9f12ba9 100644
--- a/engines/crab/stat/StatTemplate.h
+++ b/engines/crab/stat/StatTemplate.h
@@ -31,6 +31,7 @@
#ifndef CRAB_STATTEMPLATE_H
#define CRAB_STATTEMPLATE_H
+#include "common/array.h"
#include "crab/stat/Stat.h"
namespace Crab {
Commit: 7a385d22d1144ebb41763d9312b1d36b2ae4c28c
https://github.com/scummvm/scummvm/commit/7a385d22d1144ebb41763d9312b1d36b2ae4c28c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes in text and TMX component
Changed paths:
engines/crab/TMX/TMXLayer.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/TMX/TMXTileSet.cpp
engines/crab/text/TextManager.cpp
engines/crab/text/TextManager.h
engines/crab/text/color.cpp
engines/crab/text/color.h
diff --git a/engines/crab/TMX/TMXLayer.h b/engines/crab/TMX/TMXLayer.h
index 483eb702fb1..b2f6c84f7ae 100644
--- a/engines/crab/TMX/TMXLayer.h
+++ b/engines/crab/TMX/TMXLayer.h
@@ -31,8 +31,8 @@
#ifndef CRAB_TMXLAYER_H
#define CRAB_TMXLAYER_H
-#include "crab/image/Image.h"
#include "crab/Rectangle.h"
+#include "crab/image/Image.h"
#include "crab/TMX/TileInfo.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 30825f91dee..1dcae24b0a5 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -30,7 +30,6 @@
#include "crab/TMX/TMXMap.h"
#include "crab/text/TextManager.h"
-#include "crab/collision.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index e39d5d949f7..da1d039cdb1 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -31,15 +31,13 @@
#ifndef CRAB_TMXMAP_H
#define CRAB_TMXMAP_H
-#include "crab/image/ImageManager.h"
-#include "crab/level/LevelExit.h"
#include "crab/LevelResult.h"
-#include "crab/level/MusicArea.h"
-#include "crab/PathfindingGrid.h"
#include "crab/Shape.h"
+#include "crab/ai/spriteai.h"
+#include "crab/level/LevelExit.h"
+#include "crab/level/MusicArea.h"
#include "crab/level/Stairs.h"
#include "crab/TMX/TMXTileSet.h"
-#include "crab/ai/spriteai.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXTileSet.cpp b/engines/crab/TMX/TMXTileSet.cpp
index 93e28dc7126..48923b61e95 100644
--- a/engines/crab/TMX/TMXTileSet.cpp
+++ b/engines/crab/TMX/TMXTileSet.cpp
@@ -30,8 +30,8 @@
#include "graphics/screen.h"
#include "crab/crab.h"
-#include "crab/TMX/TMXTileSet.h"
#include "crab/text/TextManager.h"
+#include "crab/TMX/TMXTileSet.h"
namespace Crab {
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 1489c8aae22..c33dbfa60c7 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -30,8 +30,8 @@
#include "common/file.h"
#include "graphics/font.h"
-#include "graphics/fonts/ttf.h"
#include "graphics/screen.h"
+#include "graphics/fonts/ttf.h"
#include "crab/crab.h"
#include "crab/XMLDoc.h"
#include "crab/text/TextManager.h"
diff --git a/engines/crab/text/TextManager.h b/engines/crab/text/TextManager.h
index 44ee44c8471..5770bf579f9 100644
--- a/engines/crab/text/TextManager.h
+++ b/engines/crab/text/TextManager.h
@@ -31,7 +31,6 @@
#ifndef CRAB_TEXTMANAGER_H
#define CRAB_TEXTMANAGER_H
-#include "crab/GameParam.h"
#include "crab/vectors.h"
#include "crab/image/Image.h"
#include "crab/text/color.h"
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index 3e7aeeb35de..e23aa41f584 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/text/color.h"
namespace Crab {
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index 455fa4c4871..b946315b7e5 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -31,7 +31,7 @@
#ifndef CRAB_COLOR_H
#define CRAB_COLOR_H
-#include "crab/XMLDoc.h"
+#include "common/array.h"
#include "crab/loaders.h"
namespace Crab {
Commit: a2939b77a8b3e01064eaea91f1e4447cf6547f98
https://github.com/scummvm/scummvm/commit/a2939b77a8b3e01064eaea91f1e4447cf6547f98
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup app class includes
Changed paths:
engines/crab/app.cpp
engines/crab/app.h
engines/crab/crab.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index dca6c415d1d..532cc3c539e 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -28,9 +28,13 @@
*
*/
+#include "crab/app.h"
#include "common/events.h"
#include "graphics/screen.h"
-#include "crab/app.h"
+#include "crab/crab.h"
+#include "crab/game.h"
+#include "crab/mainmenu.h"
+#include "crab/splash.h"
namespace Crab {
diff --git a/engines/crab/app.h b/engines/crab/app.h
index ea33090a547..f7a42742ae2 100644
--- a/engines/crab/app.h
+++ b/engines/crab/app.h
@@ -31,18 +31,10 @@
#ifndef CRAB_APP_H
#define CRAB_APP_H
-#include "crab/crab.h"
-#include "crab/image/ImageManager.h"
-#include "crab/music/MusicManager.h"
-#include "crab/game.h"
-#include "crab/gamestates.h"
-#include "crab/gamestate_container.h"
-#include "crab/ScreenSettings.h"
-#include "crab/mainmenu.h"
-#include "crab/splash.h"
-#include "crab/timer.h"
+#include "common/str.h"
namespace Crab {
+class Game;
class App {
private:
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 8ef62f788c3..f7c703772bd 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -29,6 +29,7 @@
#include "crab/crab.h"
#include "crab/app.h"
#include "crab/console.h"
+#include "crab/game.h"
namespace Crab {
Commit: da2d783552d63da5e9f9c276d8e5c1b23108700d
https://github.com/scummvm/scummvm/commit/da2d783552d63da5e9f9c276d8e5c1b23108700d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes for most of the files in Crab/
Changed paths:
engines/crab/GameParam.cpp
engines/crab/GameParam.h
engines/crab/LevelResult.h
engines/crab/Line.h
engines/crab/LoadingScreen.h
engines/crab/Rectangle.cpp
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/TMX/TMXMap.cpp
engines/crab/TMX/TMXMap.h
engines/crab/animation/animset.cpp
engines/crab/crab.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/event/eventstore.cpp
engines/crab/image/Image.cpp
engines/crab/image/ImageManager.cpp
engines/crab/item/Item.cpp
engines/crab/item/StatPreview.cpp
engines/crab/level/level_load.cpp
engines/crab/music/MusicManager.cpp
engines/crab/people/person.cpp
engines/crab/people/trait.cpp
engines/crab/splash.cpp
engines/crab/text/TextManager.cpp
engines/crab/timer.cpp
engines/crab/timer.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/DevConsole.cpp
engines/crab/ui/Inventory.cpp
engines/crab/ui/MapData.cpp
engines/crab/ui/OptionMenu.cpp
engines/crab/ui/ReplyMenu.cpp
engines/crab/ui/button.h
engines/crab/ui/journal.cpp
engines/crab/ui/map.cpp
engines/crab/vectors.h
diff --git a/engines/crab/GameParam.cpp b/engines/crab/GameParam.cpp
index dde329056d5..203c31b6638 100644
--- a/engines/crab/GameParam.cpp
+++ b/engines/crab/GameParam.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/GameParam.h"
+#include "crab/XMLDoc.h"
namespace Crab {
// Are we in debug mode or not?
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 57b8f99418a..a45cf2c060a 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -31,11 +31,11 @@
#ifndef CRAB_GAMEPARAM_H
#define CRAB_GAMEPARAM_H
-#include "common/str.h"
#include "common/hashmap.h"
#include "common/rect.h"
-#include "crab/XMLDoc.h"
+#include "common/str.h"
#include "crab/loaders.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index 70de20bbad0..db69e27823d 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -31,7 +31,7 @@
#ifndef CRAB_LEVELRESULT_H
#define CRAB_LEVELRESULT_H
-#include "crab/image/ImageManager.h"
+#include "common/str.h"
namespace Crab {
diff --git a/engines/crab/Line.h b/engines/crab/Line.h
index 46c0bc79a57..1ff31e4b797 100644
--- a/engines/crab/Line.h
+++ b/engines/crab/Line.h
@@ -31,7 +31,6 @@
#ifndef CRAB_LINE_H
#define CRAB_LINE_H
-#include "crab/ScreenSettings.h"
#include "crab/vectors.h"
namespace Crab {
diff --git a/engines/crab/LoadingScreen.h b/engines/crab/LoadingScreen.h
index 228063434a6..de0935747fa 100644
--- a/engines/crab/LoadingScreen.h
+++ b/engines/crab/LoadingScreen.h
@@ -32,6 +32,7 @@
#define CRAB_LOADINGSCREEN_H
#include "crab/image/Image.h"
+#include "crab/ScreenSettings.h"
#include "crab/timer.h"
#include "crab/vectors.h"
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index 2646cb7ca5b..db225f72591 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -30,6 +30,7 @@
#include "graphics/screen.h"
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/Rectangle.h"
namespace Crab {
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index c1dfcb0ebe5..4959404aaa6 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -29,6 +29,8 @@
*/
#include "crab/crab.h"
+#include "crab/GameParam.h"
+#include "crab/loaders.h"
#include "crab/ScreenSettings.h"
namespace Crab {
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index 684bedee423..5970fef0e18 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -31,9 +31,7 @@
#ifndef CRAB_SCREENSETTINGS_H
#define CRAB_SCREENSETTINGS_H
-#include "crab/GameParam.h"
-#include "crab/loaders.h"
-
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/TMX/TMXMap.cpp b/engines/crab/TMX/TMXMap.cpp
index 1dcae24b0a5..6084aec0e1f 100644
--- a/engines/crab/TMX/TMXMap.cpp
+++ b/engines/crab/TMX/TMXMap.cpp
@@ -28,8 +28,9 @@
*
*/
-#include "crab/TMX/TMXMap.h"
+#include "crab/image/ImageManager.h"
#include "crab/text/TextManager.h"
+#include "crab/TMX/TMXMap.h"
namespace Crab {
diff --git a/engines/crab/TMX/TMXMap.h b/engines/crab/TMX/TMXMap.h
index da1d039cdb1..60a03829696 100644
--- a/engines/crab/TMX/TMXMap.h
+++ b/engines/crab/TMX/TMXMap.h
@@ -33,6 +33,7 @@
#include "crab/LevelResult.h"
#include "crab/Shape.h"
+#include "crab/XMLDoc.h"
#include "crab/ai/spriteai.h"
#include "crab/level/LevelExit.h"
#include "crab/level/MusicArea.h"
diff --git a/engines/crab/animation/animset.cpp b/engines/crab/animation/animset.cpp
index 615c2a8c963..d108d1f5c3f 100644
--- a/engines/crab/animation/animset.cpp
+++ b/engines/crab/animation/animset.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/animation/animset.h"
namespace Crab {
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index f7c703772bd..37aa3278ffd 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -30,6 +30,7 @@
#include "crab/app.h"
#include "crab/console.h"
#include "crab/game.h"
+#include "crab/GameParam.h"
namespace Crab {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index ab28a152936..51e06d16709 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -28,7 +28,7 @@
*
*/
-
+#include "crab/XMLDoc.h"
#include "crab/event/EventSequence.h"
namespace Crab {
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 646966387d1..101ea9fd9d4 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/event/eventstore.h"
#include "crab/event/GameEventInfo.h"
diff --git a/engines/crab/event/eventstore.cpp b/engines/crab/event/eventstore.cpp
index 043bd574db3..a4b81b99d0a 100644
--- a/engines/crab/event/eventstore.cpp
+++ b/engines/crab/event/eventstore.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/event/eventstore.h"
namespace Crab {
diff --git a/engines/crab/image/Image.cpp b/engines/crab/image/Image.cpp
index 19bb3690f2c..2aa9f075a4c 100644
--- a/engines/crab/image/Image.cpp
+++ b/engines/crab/image/Image.cpp
@@ -33,6 +33,7 @@
#include "graphics/screen.h"
#include "image/png.h"
#include "crab/crab.h"
+#include "crab/filesystem.h"
#include "crab/image/Image.h"
using ImageDecoder = Image::PNGDecoder;
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index 787e637df1a..b7e9da146d7 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -33,6 +33,8 @@
// Purpose: Contains the image manager class - used to manage in-game images
//=============================================================================
#include "crab/crab.h"
+#include "crab/GameParam.h"
+#include "crab/ScreenSettings.h"
#include "crab/XMLDoc.h"
#include "crab/image/ImageManager.h"
#include "crab/input/cursor.h"
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 9c522c9daf6..362ea39d295 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/item/Item.h"
namespace Crab {
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index 0091f76a9a9..2f95944b23c 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/item/StatPreview.h"
namespace Crab {
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 1fe3a0cd889..83900353328 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index a9ee719642d..464630681da 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -30,6 +30,7 @@
#include "common/config-manager.h"
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/ScreenSettings.h"
#include "crab/XMLDoc.h"
#include "crab/music/MusicManager.h"
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index b5c6a4696e6..2c5e98eea2b 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 27321126ccd..79707921325 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/people/trait.h"
namespace Crab {
diff --git a/engines/crab/splash.cpp b/engines/crab/splash.cpp
index 2e572263525..58fc44e86f1 100644
--- a/engines/crab/splash.cpp
+++ b/engines/crab/splash.cpp
@@ -33,6 +33,7 @@
// Author: Arvind
// Purpose: Splash functions
//=============================================================================
+#include "crab/ScreenSettings.h"
#include "crab/splash.h"
namespace Crab {
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index c33dbfa60c7..57c3ef48f0d 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -33,6 +33,7 @@
#include "graphics/screen.h"
#include "graphics/fonts/ttf.h"
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/XMLDoc.h"
#include "crab/text/TextManager.h"
diff --git a/engines/crab/timer.cpp b/engines/crab/timer.cpp
index 2bf19bea827..a666c03189c 100644
--- a/engines/crab/timer.cpp
+++ b/engines/crab/timer.cpp
@@ -33,6 +33,7 @@
// Purpose: Timer functions
//=============================================================================
#include "common/system.h"
+#include "crab/loaders.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/timer.h b/engines/crab/timer.h
index 7397c2fb553..40caefc20ae 100644
--- a/engines/crab/timer.h
+++ b/engines/crab/timer.h
@@ -36,7 +36,7 @@
#define CRAB_TIMER_H
#include "crab/crab.h"
-#include "crab/loaders.h"
+#include "crab/rapidxml/rapidxml.hpp"
namespace Crab {
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index fb395aa765a..ab500548806 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/ui/CreditScreen.h"
//#include "crab/url.h"
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index 0f5aee76b6c..b55760960b5 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/ui/DevConsole.h"
namespace Crab {
diff --git a/engines/crab/ui/Inventory.cpp b/engines/crab/ui/Inventory.cpp
index a8ab656579c..2bbefa31538 100644
--- a/engines/crab/ui/Inventory.cpp
+++ b/engines/crab/ui/Inventory.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/ui/Inventory.h"
namespace Crab {
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index de0bb9d3d7b..b7968eac855 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/GameParam.h"
#include "crab/ui/MapData.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 14472a23b6e..5d6dbde63ae 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/XMLDoc.h"
#include "crab/ui/OptionMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/ReplyMenu.cpp b/engines/crab/ui/ReplyMenu.cpp
index a1541a4606e..f3dc02c4a1c 100644
--- a/engines/crab/ui/ReplyMenu.cpp
+++ b/engines/crab/ui/ReplyMenu.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/ui/ReplyMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index ed05553b176..b08d7421179 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -35,6 +35,7 @@
#ifndef CRAB_BUTTON_H
#define CRAB_BUTTON_H
+#include "crab/GameParam.h"
#include "crab/ui/Caption.h"
#include "crab/ui/HoverInfo.h"
#include "crab/image/ImageManager.h"
diff --git a/engines/crab/ui/journal.cpp b/engines/crab/ui/journal.cpp
index d89138b9196..bb2dec34475 100644
--- a/engines/crab/ui/journal.cpp
+++ b/engines/crab/ui/journal.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/XMLDoc.h"
#include "crab/ui/journal.h"
namespace Crab {
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 66fbbd8b2be..838729b95da 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/XMLDoc.h"
#include "crab/input/cursor.h"
#include "crab/ui/map.h"
diff --git a/engines/crab/vectors.h b/engines/crab/vectors.h
index bbbb5692eaf..62fdeea9f83 100644
--- a/engines/crab/vectors.h
+++ b/engines/crab/vectors.h
@@ -31,7 +31,7 @@
#ifndef CRAB_VECTORS_H
#define CRAB_VECTORS_H
-#include "crab/GameParam.h"
+#include "common/debug.h"
#include "crab/loaders.h"
namespace Crab {
Commit: ecb8e77e4319872ee3648684b96f8d0704786eb8
https://github.com/scummvm/scummvm/commit/ecb8e77e4319872ee3648684b96f8d0704786eb8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes in UI component
Changed paths:
engines/crab/ai/spriteai.cpp
engines/crab/animation/PopUp.cpp
engines/crab/level/level.cpp
engines/crab/level/level_draw.cpp
engines/crab/level/level_load.cpp
engines/crab/mainmenu.cpp
engines/crab/ui/ChapterIntro.cpp
engines/crab/ui/ChapterIntro.h
engines/crab/ui/ClipButton.h
engines/crab/ui/CreditScreen.cpp
engines/crab/ui/CreditScreen.h
engines/crab/ui/DevConsole.h
engines/crab/ui/FileData.cpp
engines/crab/ui/FileData.h
engines/crab/ui/FileMenu.h
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GeneralSettingMenu.h
engines/crab/ui/GfxSettingMenu.h
engines/crab/ui/ImageData.h
engines/crab/ui/Inventory.h
engines/crab/ui/ItemDesc.h
engines/crab/ui/KeyBindMenu.h
engines/crab/ui/MapMarkerMenu.h
engines/crab/ui/ModMenu.cpp
engines/crab/ui/OptionMenu.h
engines/crab/ui/OptionSelect.cpp
engines/crab/ui/OptionSelect.h
engines/crab/ui/PauseMenu.h
engines/crab/ui/PersonHandler.cpp
engines/crab/ui/PersonHandler.h
engines/crab/ui/PersonScreen.h
engines/crab/ui/ProgressBar.h
engines/crab/ui/QuestText.h
engines/crab/ui/RadioButtonMenu.h
engines/crab/ui/ReplyMenu.h
engines/crab/ui/ResolutionMenu.h
engines/crab/ui/SectionHeader.h
engines/crab/ui/SlideShow.cpp
engines/crab/ui/SlideShow.h
engines/crab/ui/TraitButton.h
engines/crab/ui/TraitMenu.h
engines/crab/ui/button.h
engines/crab/ui/dialogbox.h
engines/crab/ui/element.cpp
engines/crab/ui/element.h
engines/crab/ui/emotion.h
engines/crab/ui/hud.cpp
engines/crab/ui/hud.h
engines/crab/ui/journal.h
engines/crab/ui/map.h
engines/crab/ui/mapbutton.h
engines/crab/ui/menu.h
engines/crab/ui/questmenu.h
engines/crab/ui/slider.h
engines/crab/ui/textarea.h
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index 641a1816840..dd058182ead 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/ScreenSettings.h"
#include "crab/animation/sprite.h"
namespace Crab {
diff --git a/engines/crab/animation/PopUp.cpp b/engines/crab/animation/PopUp.cpp
index d02bd559dc7..5b268a543c4 100644
--- a/engines/crab/animation/PopUp.cpp
+++ b/engines/crab/animation/PopUp.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/ScreenSettings.h"
#include "crab/animation/PopUp.h"
namespace Crab {
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index 7969ac841e5..fdeba0aeb02 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/ScreenSettings.h"
#include "crab/input/cursor.h"
#include "crab/level/level.h"
diff --git a/engines/crab/level/level_draw.cpp b/engines/crab/level/level_draw.cpp
index c14fe0488b9..7bf38b0d75a 100644
--- a/engines/crab/level/level_draw.cpp
+++ b/engines/crab/level/level_draw.cpp
@@ -29,6 +29,7 @@
*/
#include "graphics/managed_surface.h"
+#include "crab/ScreenSettings.h"
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 83900353328..31077f5d089 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/XMLDoc.h"
+#include "crab/ScreenSettings.h"
#include "crab/level/level.h"
namespace Crab {
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index deca9d331e3..030770e860f 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/mainmenu.h"
+#include "crab/XMLDoc.h"
namespace Crab {
diff --git a/engines/crab/ui/ChapterIntro.cpp b/engines/crab/ui/ChapterIntro.cpp
index c5431c4aed2..449790a67ef 100644
--- a/engines/crab/ui/ChapterIntro.cpp
+++ b/engines/crab/ui/ChapterIntro.cpp
@@ -27,6 +27,8 @@
* Licensed under MIT
*
*/
+
+#include "crab/animation/sprite.h"
#include "crab/ui/ChapterIntro.h"
namespace Crab {
diff --git a/engines/crab/ui/ChapterIntro.h b/engines/crab/ui/ChapterIntro.h
index c9fa5120513..2fe4fd45ba9 100644
--- a/engines/crab/ui/ChapterIntro.h
+++ b/engines/crab/ui/ChapterIntro.h
@@ -31,14 +31,16 @@
#ifndef CRAB_CHAPTERINTRO_H
#define CRAB_CHAPTERINTRO_H
-#include "crab/event/GameEventInfo.h"
#include "crab/ui/button.h"
#include "crab/ui/dialogbox.h"
-#include "crab/animation/sprite.h"
namespace Crab {
namespace pyrodactyl {
+namespace anim {
+class Sprite;
+} // End of namespace anim
+
namespace ui {
class ChapterIntro {
// This contains the background image info and start button
diff --git a/engines/crab/ui/ClipButton.h b/engines/crab/ui/ClipButton.h
index 5ddaec16a30..dbb71c810f4 100644
--- a/engines/crab/ui/ClipButton.h
+++ b/engines/crab/ui/ClipButton.h
@@ -30,6 +30,7 @@
#ifndef CRAB_CLIPBUTTON_H
#define CRAB_CLIPBUTTON_H
+
#include "crab/ui/button.h"
namespace Crab {
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index ab500548806..a0c1944d1e8 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -28,9 +28,9 @@
*
*/
+#include "crab/ScreenSettings.h"
#include "crab/XMLDoc.h"
#include "crab/ui/CreditScreen.h"
-//#include "crab/url.h"
namespace Crab {
diff --git a/engines/crab/ui/CreditScreen.h b/engines/crab/ui/CreditScreen.h
index 9fb76a98334..cc47c2ea82c 100644
--- a/engines/crab/ui/CreditScreen.h
+++ b/engines/crab/ui/CreditScreen.h
@@ -31,11 +31,9 @@
#ifndef CRAB_CREDITSCREEN_H
#define CRAB_CREDITSCREEN_H
+#include "crab/ui/button.h"
#include "crab/ui/ImageData.h"
#include "crab/ui/TextData.h"
-#include "crab/text/TextManager.h"
-#include "crab/ui/button.h"
-#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index ffc885f0f43..ba093251b18 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -32,6 +32,8 @@
#define CRAB_DEVCONSOLE_H
#include "crab/event/GameEventInfo.h"
+#include "crab/ui/ImageData.h"
+#include "crab/ui/menu.h"
#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/FileData.cpp b/engines/crab/ui/FileData.cpp
index 8cd47f7905b..8c39ec255aa 100644
--- a/engines/crab/ui/FileData.cpp
+++ b/engines/crab/ui/FileData.cpp
@@ -30,6 +30,8 @@
#include "common/savefile.h"
#include "crab/crab.h"
+#include "crab/loaders.h"
+#include "crab/XMLDoc.h"
#include "crab/ui/FileData.h"
namespace Crab {
diff --git a/engines/crab/ui/FileData.h b/engines/crab/ui/FileData.h
index 6420c71afe9..bccabce749d 100644
--- a/engines/crab/ui/FileData.h
+++ b/engines/crab/ui/FileData.h
@@ -31,8 +31,7 @@
#ifndef CRAB_FILEDATA_H
#define CRAB_FILEDATA_H
-#include "crab/XMLDoc.h"
-#include "crab/loaders.h"
+#include "common/str.h"
namespace Crab {
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index d0dc5d7e428..2eb85564b64 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -32,7 +32,6 @@
#define CRAB_FILEMENU_H
#include "common/savefile.h"
-
#include "crab/crab.h"
#include "crab/ui/FileData.h"
#include "crab/ui/ImageData.h"
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index 956819799ec..acb68ffe3e4 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -28,7 +28,7 @@
*
*/
-
+#include "crab/ScreenSettings.h"
#include "crab/crab.h"
#include "crab/ui/GeneralSettingMenu.h"
diff --git a/engines/crab/ui/GeneralSettingMenu.h b/engines/crab/ui/GeneralSettingMenu.h
index aafb6134fce..be9d6d97b52 100644
--- a/engines/crab/ui/GeneralSettingMenu.h
+++ b/engines/crab/ui/GeneralSettingMenu.h
@@ -32,8 +32,8 @@
#define CRAB_GENERALSETTINGMENU_H
#include "crab/ui/RadioButtonMenu.h"
-#include "crab/ui/ToggleButton.h"
#include "crab/ui/slider.h"
+#include "crab/ui/ToggleButton.h"
namespace Crab {
diff --git a/engines/crab/ui/GfxSettingMenu.h b/engines/crab/ui/GfxSettingMenu.h
index b9ebeffc244..ec32f25ddd4 100644
--- a/engines/crab/ui/GfxSettingMenu.h
+++ b/engines/crab/ui/GfxSettingMenu.h
@@ -33,9 +33,9 @@
#include "crab/ui/ImageData.h"
#include "crab/ui/ResolutionMenu.h"
+#include "crab/ui/slider.h"
#include "crab/ui/StateButton.h"
#include "crab/ui/ToggleButton.h"
-#include "crab/ui/slider.h"
namespace Crab {
diff --git a/engines/crab/ui/ImageData.h b/engines/crab/ui/ImageData.h
index 4591c95a463..c7aba36dc70 100644
--- a/engines/crab/ui/ImageData.h
+++ b/engines/crab/ui/ImageData.h
@@ -31,7 +31,6 @@
#ifndef CRAB_IMAGEDATA_H
#define CRAB_IMAGEDATA_H
-#include "crab/image/ImageManager.h"
#include "crab/ui/element.h"
namespace Crab {
diff --git a/engines/crab/ui/Inventory.h b/engines/crab/ui/Inventory.h
index c8a185b1b66..f1b3e98f596 100644
--- a/engines/crab/ui/Inventory.h
+++ b/engines/crab/ui/Inventory.h
@@ -31,11 +31,10 @@
#ifndef CRAB_INVENTORY_H
#define CRAB_INVENTORY_H
-#include "crab/ui/ImageData.h"
#include "crab/item/ItemCollection.h"
#include "crab/item/ItemSlot.h"
-#include "crab/stat/Stat.h"
#include "crab/ui/button.h"
+#include "crab/ui/ImageData.h"
namespace Crab {
diff --git a/engines/crab/ui/ItemDesc.h b/engines/crab/ui/ItemDesc.h
index f298291a2c7..272e411e4e7 100644
--- a/engines/crab/ui/ItemDesc.h
+++ b/engines/crab/ui/ItemDesc.h
@@ -31,9 +31,7 @@
#ifndef CRAB_ITEMDESC_H
#define CRAB_ITEMDESC_H
-#include "crab/item/Item.h"
#include "crab/ui/ParagraphData.h"
-#include "crab/ui/SectionHeader.h"
namespace Crab {
diff --git a/engines/crab/ui/KeyBindMenu.h b/engines/crab/ui/KeyBindMenu.h
index 8481ae83c75..3d59e257902 100644
--- a/engines/crab/ui/KeyBindMenu.h
+++ b/engines/crab/ui/KeyBindMenu.h
@@ -32,8 +32,8 @@
#define CRAB_KEYBINDMENU_H
#include "crab/ui/ImageData.h"
-#include "crab/ui/OptionSelect.h"
#include "crab/ui/menu.h"
+#include "crab/ui/OptionSelect.h"
namespace Crab {
diff --git a/engines/crab/ui/MapMarkerMenu.h b/engines/crab/ui/MapMarkerMenu.h
index 82135b8bff7..b00116a0bc5 100644
--- a/engines/crab/ui/MapMarkerMenu.h
+++ b/engines/crab/ui/MapMarkerMenu.h
@@ -31,8 +31,8 @@
#ifndef CRAB_MAPMARKERMENU_H
#define CRAB_MAPMARKERMENU_H
-#include "crab/ui/StateButton.h"
#include "crab/ui/menu.h"
+#include "crab/ui/StateButton.h"
namespace Crab {
diff --git a/engines/crab/ui/ModMenu.cpp b/engines/crab/ui/ModMenu.cpp
index 28da8fece3b..34d1b07ae1a 100644
--- a/engines/crab/ui/ModMenu.cpp
+++ b/engines/crab/ui/ModMenu.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/XMLDoc.h"
#include "crab/ui/ModMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionMenu.h b/engines/crab/ui/OptionMenu.h
index 31ec2bf5f2c..9ee04b2c25f 100644
--- a/engines/crab/ui/OptionMenu.h
+++ b/engines/crab/ui/OptionMenu.h
@@ -31,6 +31,7 @@
#ifndef CRAB_OPTIONMENU_H
#define CRAB_OPTIONMENU_H
+#include "crab/timer.h"
#include "crab/ui/GeneralSettingMenu.h"
#include "crab/ui/GfxSettingMenu.h"
#include "crab/ui/ImageData.h"
@@ -38,7 +39,6 @@
#include "crab/ui/StateButton.h"
#include "crab/ui/ToggleButton.h"
#include "crab/ui/slider.h"
-#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionSelect.cpp b/engines/crab/ui/OptionSelect.cpp
index bd2044af596..909c415e2ab 100644
--- a/engines/crab/ui/OptionSelect.cpp
+++ b/engines/crab/ui/OptionSelect.cpp
@@ -28,7 +28,6 @@
*
*/
-
#include "crab/ui/OptionSelect.h"
namespace Crab {
diff --git a/engines/crab/ui/OptionSelect.h b/engines/crab/ui/OptionSelect.h
index 7f7341e9521..bf0a9bbc604 100644
--- a/engines/crab/ui/OptionSelect.h
+++ b/engines/crab/ui/OptionSelect.h
@@ -31,8 +31,8 @@
#ifndef CRAB_OPTIONSELECT_H
#define CRAB_OPTIONSELECT_H
-#include "crab/ui/TextData.h"
#include "crab/ui/button.h"
+#include "crab/ui/TextData.h"
namespace Crab {
diff --git a/engines/crab/ui/PauseMenu.h b/engines/crab/ui/PauseMenu.h
index 0122474aac5..58fb5e5a85d 100644
--- a/engines/crab/ui/PauseMenu.h
+++ b/engines/crab/ui/PauseMenu.h
@@ -31,13 +31,13 @@
#ifndef CRAB_PAUSEMENU_H
#define CRAB_PAUSEMENU_H
-#include "crab/ui/FileMenu.h"
#include "crab/event/GameEventInfo.h"
+#include "crab/ui/FileMenu.h"
+#include "crab/ui/menu.h"
#include "crab/ui/OptionMenu.h"
#include "crab/ui/SaveGameMenu.h"
-#include "crab/ui/SlideShow.h"
-#include "crab/ui/menu.h"
#include "crab/ui/slider.h"
+#include "crab/ui/SlideShow.h"
#include "crab/ui/textarea.h"
namespace Crab {
diff --git a/engines/crab/ui/PersonHandler.cpp b/engines/crab/ui/PersonHandler.cpp
index cd0232d7065..ed44c733f9d 100644
--- a/engines/crab/ui/PersonHandler.cpp
+++ b/engines/crab/ui/PersonHandler.cpp
@@ -28,6 +28,7 @@
*
*/
+#include "crab/animation/sprite.h"
#include "crab/ui/PersonHandler.h"
namespace Crab {
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index 02fa96e847d..ec93c2e0396 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -31,16 +31,18 @@
#ifndef CRAB_PERSONHANDLER_H
#define CRAB_PERSONHANDLER_H
+#include "crab/event/gameevent.h"
#include "crab/event/GameEventInfo.h"
#include "crab/ui/ProgressBar.h"
#include "crab/ui/dialogbox.h"
-#include "crab/event/gameevent.h"
-#include "crab/people/person.h"
-#include "crab/animation/sprite.h"
namespace Crab {
namespace pyrodactyl {
+namespace anim {
+class Sprite;
+} // End of namespace Sprite
+
namespace ui {
class PersonHandler {
// The positions of various elements
diff --git a/engines/crab/ui/PersonScreen.h b/engines/crab/ui/PersonScreen.h
index b5265447645..4d78944f854 100644
--- a/engines/crab/ui/PersonScreen.h
+++ b/engines/crab/ui/PersonScreen.h
@@ -31,18 +31,19 @@
#ifndef CRAB_PERSONSCREEN_H
#define CRAB_PERSONSCREEN_H
-#include "crab/event/GameEventInfo.h"
-#include "crab/ui/ImageData.h"
-#include "crab/ui/TraitMenu.h"
#include "crab/event/gameevent.h"
+#include "crab/event/GameEventInfo.h"
#include "crab/level/level.h"
-#include "crab/ui/menu.h"
#include "crab/people/person.h"
-#include "crab/animation/sprite.h"
+#include "crab/ui/TraitMenu.h"
namespace Crab {
namespace pyrodactyl {
+namespace anim {
+class Sprite;
+} // End of namespace anim
+
namespace ui {
class PersonScreen {
// The background
diff --git a/engines/crab/ui/ProgressBar.h b/engines/crab/ui/ProgressBar.h
index ab9c91e29f2..47fbd5b28eb 100644
--- a/engines/crab/ui/ProgressBar.h
+++ b/engines/crab/ui/ProgressBar.h
@@ -31,8 +31,8 @@
#ifndef CRAB_PROGRESSBAR_H
#define CRAB_PROGRESSBAR_H
-#include "crab/ui/ClipButton.h"
#include "crab/timer.h"
+#include "crab/ui/ClipButton.h"
namespace Crab {
diff --git a/engines/crab/ui/QuestText.h b/engines/crab/ui/QuestText.h
index 2a546a90957..b1851cb1499 100644
--- a/engines/crab/ui/QuestText.h
+++ b/engines/crab/ui/QuestText.h
@@ -31,10 +31,10 @@
#ifndef CRAB_QUESTTEXT_H
#define CRAB_QUESTTEXT_H
+#include "crab/event/quest.h"
+#include "crab/ui/button.h"
#include "crab/ui/ImageData.h"
#include "crab/ui/ParagraphData.h"
-#include "crab/ui/button.h"
-#include "crab/event/quest.h"
namespace Crab {
diff --git a/engines/crab/ui/RadioButtonMenu.h b/engines/crab/ui/RadioButtonMenu.h
index d801110fc72..baeac3a29b1 100644
--- a/engines/crab/ui/RadioButtonMenu.h
+++ b/engines/crab/ui/RadioButtonMenu.h
@@ -31,8 +31,8 @@
#ifndef CRAB_RADIOBUTTONMENU_H
#define CRAB_RADIOBUTTONMENU_H
-#include "crab/ui/RadioButton.h"
#include "crab/ui/menu.h"
+#include "crab/ui/RadioButton.h"
namespace Crab {
diff --git a/engines/crab/ui/ReplyMenu.h b/engines/crab/ui/ReplyMenu.h
index e376e958752..e92f4cc797b 100644
--- a/engines/crab/ui/ReplyMenu.h
+++ b/engines/crab/ui/ReplyMenu.h
@@ -31,14 +31,13 @@
#ifndef CRAB_REPLYMENU_H
#define CRAB_REPLYMENU_H
+#include "crab/event/conversationdata.h"
+#include "crab/event/eventstore.h"
#include "crab/event/GameEventInfo.h"
+#include "crab/ui/emotion.h"
#include "crab/ui/ImageData.h"
#include "crab/ui/PersonHandler.h"
#include "crab/ui/ReplyButton.h"
-#include "crab/event/conversationdata.h"
-#include "crab/ui/emotion.h"
-#include "crab/event/eventstore.h"
-#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/ResolutionMenu.h b/engines/crab/ui/ResolutionMenu.h
index e286d6ace5b..49a511ac718 100644
--- a/engines/crab/ui/ResolutionMenu.h
+++ b/engines/crab/ui/ResolutionMenu.h
@@ -31,6 +31,7 @@
#ifndef CRAB_RESOLUTIONMENU_H
#define CRAB_RESOLUTIONMENU_H
+#include "crab/ScreenSettings.h"
#include "crab/ui/menu.h"
#include "crab/ui/textarea.h"
diff --git a/engines/crab/ui/SectionHeader.h b/engines/crab/ui/SectionHeader.h
index 3adba546d53..a38d79e0d08 100644
--- a/engines/crab/ui/SectionHeader.h
+++ b/engines/crab/ui/SectionHeader.h
@@ -31,7 +31,6 @@
#ifndef CRAB_SECTIONHEADER_H
#define CRAB_SECTIONHEADER_H
-#include "crab/image/ImageManager.h"
#include "crab/ui/TextData.h"
#include "crab/text/TextManager.h"
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index 0f18b71094f..ad41f8c2f04 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -27,6 +27,7 @@
* Licensed under MIT
*
*/
+
#include "crab/ui/SlideShow.h"
namespace Crab {
diff --git a/engines/crab/ui/SlideShow.h b/engines/crab/ui/SlideShow.h
index a11e84f64f3..aba7ec62c61 100644
--- a/engines/crab/ui/SlideShow.h
+++ b/engines/crab/ui/SlideShow.h
@@ -32,8 +32,8 @@
#define CRAB_SLIDESHOW_H
#include "crab/image/Image.h"
-#include "crab/ui/ImageData.h"
#include "crab/ui/button.h"
+#include "crab/ui/ImageData.h"
namespace Crab {
diff --git a/engines/crab/ui/TraitButton.h b/engines/crab/ui/TraitButton.h
index f0c20ce1ca2..210ac7971d6 100644
--- a/engines/crab/ui/TraitButton.h
+++ b/engines/crab/ui/TraitButton.h
@@ -31,8 +31,8 @@
#ifndef CRAB_TRAITBUTTON_H
#define CRAB_TRAITBUTTON_H
-#include "crab/ui/StateButton.h"
#include "crab/people/trait.h"
+#include "crab/ui/StateButton.h"
namespace Crab {
diff --git a/engines/crab/ui/TraitMenu.h b/engines/crab/ui/TraitMenu.h
index f4e815f2796..212b3c3192f 100644
--- a/engines/crab/ui/TraitMenu.h
+++ b/engines/crab/ui/TraitMenu.h
@@ -31,10 +31,10 @@
#ifndef CRAB_TRAITMENU_H
#define CRAB_TRAITMENU_H
+#include "crab/people/person.h"
+#include "crab/ui/menu.h"
#include "crab/ui/ParagraphData.h"
#include "crab/ui/TraitButton.h"
-#include "crab/ui/menu.h"
-#include "crab/people/person.h"
namespace Crab {
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index b08d7421179..fb6c042844e 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -36,13 +36,13 @@
#define CRAB_BUTTON_H
#include "crab/GameParam.h"
-#include "crab/ui/Caption.h"
-#include "crab/ui/HoverInfo.h"
#include "crab/image/ImageManager.h"
+#include "crab/input/hotkey.h"
#include "crab/music/MusicManager.h"
#include "crab/text/TextManager.h"
+#include "crab/ui/Caption.h"
#include "crab/ui/element.h"
-#include "crab/input/hotkey.h"
+#include "crab/ui/HoverInfo.h"
namespace Crab {
diff --git a/engines/crab/ui/dialogbox.h b/engines/crab/ui/dialogbox.h
index 4e59d99b2e3..170a2fda153 100644
--- a/engines/crab/ui/dialogbox.h
+++ b/engines/crab/ui/dialogbox.h
@@ -36,8 +36,8 @@
#define CRAB_DIALOGBOX_H
#include "crab/event/GameEventInfo.h"
-#include "crab/ui/ParagraphData.h"
#include "crab/ui/button.h"
+#include "crab/ui/ParagraphData.h"
namespace Crab {
diff --git a/engines/crab/ui/element.cpp b/engines/crab/ui/element.cpp
index 7c9ebe4a625..fba1a0f3d64 100644
--- a/engines/crab/ui/element.cpp
+++ b/engines/crab/ui/element.cpp
@@ -27,6 +27,8 @@
* Licensed under MIT
*
*/
+
+#include "crab/ScreenSettings.h"
#include "crab/crab.h"
#include "crab/ui/element.h"
diff --git a/engines/crab/ui/element.h b/engines/crab/ui/element.h
index 0738d18b3f1..46d0e914175 100644
--- a/engines/crab/ui/element.h
+++ b/engines/crab/ui/element.h
@@ -32,9 +32,8 @@
#define CRAB_ELEMENT_H
#include "crab/image/ImageManager.h"
-#include "crab/ScreenSettings.h"
-#include "crab/vectors.h"
#include "crab/Rectangle.h"
+#include "crab/vectors.h"
namespace Crab {
diff --git a/engines/crab/ui/emotion.h b/engines/crab/ui/emotion.h
index a4ea71e3c2b..0038b24448d 100644
--- a/engines/crab/ui/emotion.h
+++ b/engines/crab/ui/emotion.h
@@ -31,7 +31,6 @@
#ifndef CRAB_EMOTION_H
#define CRAB_EMOTION_H
-#include "crab/image/ImageManager.h"
#include "crab/event/eventstore.h"
#include "crab/ui/textarea.h"
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index a3594ffab79..0ca9b3409db 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -32,6 +32,7 @@
// Author: Arvind
// Purpose: The tray where you have inventory, map and GameObjectives icons
//=============================================================================
+#include "crab/XMLDoc.h"
#include "crab/input/cursor.h"
#include "crab/ui/hud.h"
diff --git a/engines/crab/ui/hud.h b/engines/crab/ui/hud.h
index c38a23a1816..2d26b5f1fdc 100644
--- a/engines/crab/ui/hud.h
+++ b/engines/crab/ui/hud.h
@@ -35,16 +35,12 @@
#ifndef CRAB_HUD_H
#define CRAB_HUD_H
-#include "crab/ui/FileMenu.h"
#include "crab/event/GameEventInfo.h"
-#include "crab/ui/GameOverMenu.h"
-#include "crab/ui/HealthIndicator.h"
-#include "crab/ui/PauseMenu.h"
-#include "crab/ui/SlideShow.h"
-#include "crab/ui/StateButton.h"
-#include "crab/input/input.h"
#include "crab/level/level_objects.h"
#include "crab/level/talknotify.h"
+#include "crab/ui/FileMenu.h"
+#include "crab/ui/GameOverMenu.h"
+#include "crab/ui/PauseMenu.h"
namespace Crab {
diff --git a/engines/crab/ui/journal.h b/engines/crab/ui/journal.h
index d51cda7dc5b..05dce6d269e 100644
--- a/engines/crab/ui/journal.h
+++ b/engines/crab/ui/journal.h
@@ -32,9 +32,8 @@
#define CRAB_JOURNAL_H
#include "crab/ui/ImageData.h"
-#include "crab/image/ImageManager.h"
-#include "crab/ui/StateButton.h"
#include "crab/ui/questmenu.h"
+#include "crab/ui/StateButton.h"
namespace Crab {
diff --git a/engines/crab/ui/map.h b/engines/crab/ui/map.h
index e5230df42ff..e219c62329e 100644
--- a/engines/crab/ui/map.h
+++ b/engines/crab/ui/map.h
@@ -33,13 +33,11 @@
#include "crab/event/GameEventInfo.h"
#include "crab/ui/ImageData.h"
-#include "crab/image/ImageManager.h"
+#include "crab/ui/mapbutton.h"
#include "crab/ui/MapData.h"
#include "crab/ui/MapMarkerMenu.h"
#include "crab/ui/StateButton.h"
#include "crab/ui/ToggleButton.h"
-#include "crab/ui/mapbutton.h"
-#include "crab/event/triggerset.h"
namespace Crab {
diff --git a/engines/crab/ui/mapbutton.h b/engines/crab/ui/mapbutton.h
index ca1e726870f..108d3e9b475 100644
--- a/engines/crab/ui/mapbutton.h
+++ b/engines/crab/ui/mapbutton.h
@@ -31,8 +31,8 @@
#ifndef CRAB_MAPBUTTON_H
#define CRAB_MAPBUTTON_H
-#include "crab/ui/menu.h"
#include "crab/event/triggerset.h"
+#include "crab/ui/menu.h"
namespace Crab {
diff --git a/engines/crab/ui/menu.h b/engines/crab/ui/menu.h
index 33959f1e03a..61cb7d339f3 100644
--- a/engines/crab/ui/menu.h
+++ b/engines/crab/ui/menu.h
@@ -35,9 +35,8 @@
#ifndef CRAB_MENU_H
#define CRAB_MENU_H
-#include "crab/metaengine.h"
#include "crab/crab.h"
-#include "crab/image/ImageManager.h"
+#include "crab/metaengine.h"
#include "crab/ui/button.h"
namespace Crab {
diff --git a/engines/crab/ui/questmenu.h b/engines/crab/ui/questmenu.h
index a7bbe35e249..c1a07824091 100644
--- a/engines/crab/ui/questmenu.h
+++ b/engines/crab/ui/questmenu.h
@@ -31,10 +31,9 @@
#ifndef CRAB_QUESTMENU_H
#define CRAB_QUESTMENU_H
+#include "crab/event/quest.h"
#include "crab/ui/PageMenu.h"
#include "crab/ui/QuestText.h"
-#include "crab/ui/StateButton.h"
-#include "crab/event/quest.h"
namespace Crab {
diff --git a/engines/crab/ui/slider.h b/engines/crab/ui/slider.h
index 2d59c17cc62..261bd06990c 100644
--- a/engines/crab/ui/slider.h
+++ b/engines/crab/ui/slider.h
@@ -33,7 +33,6 @@
#include "crab/ui/Caption.h"
#include "crab/ui/ImageData.h"
-#include "crab/image/ImageManager.h"
#include "crab/ui/button.h"
namespace Crab {
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 43eb59ab3ca..51ee71374df 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -35,10 +35,8 @@
#ifndef CRAB_TEXTAREA_H
#define CRAB_TEXTAREA_H
-#include "crab/ui/HoverInfo.h"
#include "crab/music/MusicManager.h"
-#include "crab/text/TextManager.h"
-//#include "crab/input/input.h"
+#include "crab/ui/HoverInfo.h"
namespace Crab {
Commit: f091215d161678126b818755e3aee91fa3f8de0d
https://github.com/scummvm/scummvm/commit/f091215d161678126b818755e3aee91fa3f8de0d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup includes of game class
Changed paths:
engines/crab/GameClock.h
engines/crab/crab.cpp
engines/crab/game.cpp
engines/crab/game.h
diff --git a/engines/crab/GameClock.h b/engines/crab/GameClock.h
index 270a8075faf..cbeada9fae9 100644
--- a/engines/crab/GameClock.h
+++ b/engines/crab/GameClock.h
@@ -31,6 +31,7 @@
#ifndef CRAB_GAMECLOCK_H
#define CRAB_GAMECLOCK_H
+#include "crab/numstr.h"
#include "crab/timer.h"
namespace Crab {
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 37aa3278ffd..9edeacef070 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -31,6 +31,8 @@
#include "crab/console.h"
#include "crab/game.h"
#include "crab/GameParam.h"
+#include "crab/LoadingScreen.h"
+#include "crab/input/cursor.h"
namespace Crab {
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 7341eb02c3e..23583fde302 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -32,6 +32,8 @@
#include "graphics/screen.h"
#include "crab/backInserter.h"
#include "crab/game.h"
+#include "crab/LoadingScreen.h"
+#include "crab/input/cursor.h"
#include "crab/rapidxml/rapidxml_print.hpp"
namespace Crab {
diff --git a/engines/crab/game.h b/engines/crab/game.h
index 9fbd1596ae7..b1f3fd36848 100644
--- a/engines/crab/game.h
+++ b/engines/crab/game.h
@@ -31,18 +31,13 @@
#ifndef CRAB_GAME_H
#define CRAB_GAME_H
-#include "crab/ui/DevConsole.h"
#include "crab/GameClock.h"
+#include "crab/gamestate_container.h"
#include "crab/event/GameEventInfo.h"
-#include "crab/image/ImageManager.h"
-#include "crab/LoadingScreen.h"
-#include "crab/input/cursor.h"
#include "crab/event/gameeventmanager.h"
-#include "crab/gamestate_container.h"
+#include "crab/ui/DevConsole.h"
#include "crab/ui/hud.h"
-#include "crab/level/level.h"
#include "crab/ui/map.h"
-#include "crab/ui/menu.h"
namespace Crab {
Commit: 15b1bd2ec366e0d219e8ae7b25ad9f56f5d32739
https://github.com/scummvm/scummvm/commit/15b1bd2ec366e0d219e8ae7b25ad9f56f5d32739
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add credits
Changed paths:
engines/crab/credits.pl
diff --git a/engines/crab/credits.pl b/engines/crab/credits.pl
index 076ba2ec91e..7d5af8e0c54 100644
--- a/engines/crab/credits.pl
+++ b/engines/crab/credits.pl
@@ -1,3 +1,3 @@
begin_section("Crab");
- add_person("Name 1", "Handle 1", "");
+ add_person("Kartik Agarwala", "hax0kartik", "");
end_section();
Commit: 723e33cc3253a26fb536c888f312de08649bf7a1
https://github.com/scummvm/scummvm/commit/723e33cc3253a26fb536c888f312de08649bf7a1
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Reorder files in module.mk
Changed paths:
engines/crab/module.mk
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index fd35af4cd85..05de40ab50d 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -1,16 +1,27 @@
MODULE := engines/crab
MODULE_OBJS = \
+ app.o \
crab.o \
+ collision.o \
console.o \
- metaengine.o \
filesystem.o \
- XMLDoc.o \
- loaders.o \
- ScreenSettings.o \
- collision.o \
game.o \
GameParam.o \
+ loaders.o \
+ LoadingScreen.o \
+ metaengine.o \
+ mainmenu.o \
+ PathfindingAgent.o \
+ PathfindingGraphNode.o \
+ PathfindingGrid.o \
+ Polygon.o \
+ Rectangle.o \
+ ScreenSettings.o \
+ Shape.o \
+ splash.o \
+ timer.o \
+ XMLDoc.o \
ai/moveeffect.o \
ai/movement.o \
ai/spriteai.o \
@@ -118,18 +129,7 @@ MODULE_OBJS = \
ui/textdata.o \
ui/ToggleButton.o \
ui/TraitButton.o \
- ui/TraitMenu.o \
- timer.o \
- app.o \
- splash.o \
- LoadingScreen.o \
- mainmenu.o \
- PathfindingAgent.o \
- PathfindingGraphNode.o \
- PathfindingGrid.o \
- Polygon.o \
- Rectangle.o \
- Shape.o
+ ui/TraitMenu.o
# This module can be built as a plugin
ifeq ($(ENABLE_CRAB), DYNAMIC_PLUGIN)
Commit: 197735b9f40de13c8a5fb9ebed1c2ff48f29c2fe
https://github.com/scummvm/scummvm/commit/197735b9f40de13c8a5fb9ebed1c2ff48f29c2fe
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Fix code formatting in Sprite.cpp
Changed paths:
engines/crab/animation/sprite.cpp
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index c3f0190e648..11ab2c1247a 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -273,13 +273,13 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
FightMove fm;
if (_animSet._fight.nextMove(fm)) {
- Rect actual_range;
- actual_range.x = bounds.x + fm._ai._range._val[_dir].x;
- actual_range.y = bounds.y + fm._ai._range._val[_dir].y;
- actual_range.w = fm._ai._range._val[_dir].w;
- actual_range.h = fm._ai._range._val[_dir].h;
+ Rect actualRange;
+ actualRange.x = bounds.x + fm._ai._range._val[_dir].x;
+ actualRange.y = bounds.y + fm._ai._range._val[_dir].y;
+ actualRange.w = fm._ai._range._val[_dir].w;
+ actualRange.h = fm._ai._range._val[_dir].h;
- actual_range.draw(-camera.x, -camera.y, 255, 0, 255);
+ actualRange.draw(-camera.x, -camera.y, 255, 0, 255);
}
/*int health = 0;
@@ -341,7 +341,7 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
int num = 0;
info.statGet(_id, pyrodactyl::stat::STAT_SPEED, num);
++num;
- float player_speed = static_cast<float>(num);
+ float playerSpeed = static_cast<float>(num);
// This is for Diablo style hold-mouse-button-in-direction-of-movement
// This is only used if - point and click movement isn't being used, cursor is not inside the hud, the cursor is a normal cursor and the mouse is pressed
@@ -355,39 +355,38 @@ void Sprite::handleEvents(Info &info, const Rect &camera, const SpriteConstant &
// X axis
if (g_engine->_mouse->_motion.x > x + w)
- xVel(player_speed * sc._walkVelMod.x);
+ xVel(playerSpeed * sc._walkVelMod.x);
else if (g_engine->_mouse->_motion.x < x)
- xVel(-player_speed * sc._walkVelMod.x);
+ xVel(-playerSpeed * sc._walkVelMod.x);
else
xVel(0.0f);
// Y axis
if (g_engine->_mouse->_motion.y > y + h)
- yVel(player_speed * sc._walkVelMod.y);
+ yVel(playerSpeed * sc._walkVelMod.y);
else if (g_engine->_mouse->_motion.y < y)
- yVel(-player_speed * sc._walkVelMod.y);
+ yVel(-playerSpeed * sc._walkVelMod.y);
else
yVel(0.0f);
- } else // Keyboard movement
- {
+ } else { // Keyboard movement
// Disable destination as soon as player presses a direction key
// X axis
if (g_engine->_inputManager->state(IG_LEFT)) {
_aiData._dest._active = false;
- xVel(-player_speed * sc._walkVelMod.x);
+ xVel(-playerSpeed * sc._walkVelMod.x);
} else if (g_engine->_inputManager->state(IG_RIGHT)) {
_aiData._dest._active = false;
- xVel(player_speed * sc._walkVelMod.x);
+ xVel(playerSpeed * sc._walkVelMod.x);
} else if (!_aiData._dest._active)
xVel(0.0f);
// Y axis
if (g_engine->_inputManager->state(IG_UP)) {
_aiData._dest._active = false;
- yVel(-player_speed * sc._walkVelMod.y);
+ yVel(-playerSpeed * sc._walkVelMod.y);
} else if (g_engine->_inputManager->state(IG_DOWN)) {
_aiData._dest._active = false;
- yVel(player_speed * sc._walkVelMod.y);
+ yVel(playerSpeed * sc._walkVelMod.y);
} else if (!_aiData._dest._active)
yVel(0.0f);
Commit: 32291cd3f5a81a657453921b122f1fcc6056d4b6
https://github.com/scummvm/scummvm/commit/32291cd3f5a81a657453921b122f1fcc6056d4b6
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Allow drawing sprite bound and pathing via debug console
Changed paths:
engines/crab/animation/sprite.cpp
engines/crab/console.cpp
engines/crab/crab.h
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 11ab2c1247a..79168903867 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -263,7 +263,7 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
g_engine->_imageManager->draw(x, y, _image, &_clip, _animSet.flip(_dir));
_imgEff.draw(x, y);
- if (GameDebug) {
+ if (g_engine->_debugDraw & DRAW_SPRITE_BOUNDS) {
// Nice boxes for the frames and boxV, boxD
Rect bounds = boundRect(), vul = boxV(), dmg = boxD(), debugpos = posRect();
bounds.draw(-camera.x, -camera.y);
@@ -281,17 +281,9 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
actualRange.draw(-camera.x, -camera.y, 255, 0, 255);
}
+ }
- /*int health = 0;
- info.StatGet(id, pyrodactyl::stat::STAT_HEALTH, health);
- g_engine->_textManager->draw(x + 60.0f, y - 100.0f, NumberToString(health), 0);
-
- pyrodactyl::people::PersonState state = info.State(id);
- g_engine->_textManager->draw(x, y - 60.0f, NumberToString(state), 0);
-
- g_engine->_textManager->draw(x + 120.0f, y - 60.0f, NumberToString(_aiData.dest.y), 0);*/
-
-
+ if (g_engine->_debugDraw & DRAW_PATHING) {
for (const auto &iter : _pathing._vSolution) {
bool nextToWall = false;
for (const auto &neighbor : iter->_neighborNodes) {
@@ -307,15 +299,10 @@ void Sprite::draw(pyrodactyl::event::Info &info, const Rect &camera) {
iter->getRect().draw(-camera.x, -camera.y, 200, 200, 0, 254);
}
- _pathing._goalTile->getRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
- _pathing._startTile->getRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
-
- // Draw adjacencies to the goal tile.
- /*
- for(auto neighbor = _pathing.m_pGoalTile->neighborNodes.begin(); neighbor != _pathing.m_pGoalTile->neighborNodes.end(); ++neighbor) {
- (*neighbor)->GetRect().draw(-camera.x, -camera.y, 200, 0, 0, 254);
- }
- */
+ if (_pathing._goalTile && _pathing._startTile) {
+ _pathing._goalTile->getRect().draw(-camera.x, -camera.y, 0, 0, 200, 254);
+ _pathing._startTile->getRect().draw(-camera.x, -camera.y, 0, 200, 0, 254);
+ }
Rect destinationRect = Rect((int)_pathing._destination.x - 5,
(int)_pathing._destination.y - 5,
diff --git a/engines/crab/console.cpp b/engines/crab/console.cpp
index db082a74d51..9dab909db99 100644
--- a/engines/crab/console.cpp
+++ b/engines/crab/console.cpp
@@ -40,8 +40,12 @@ bool Console::cmdDraw(int argc, const char **argv) {
g_engine->_debugDraw |= DRAW_TMX;
else if (!scumm_stricmp(argv[i], "PROPS"))
g_engine->_debugDraw |= DRAW_PROP_BOUNDS;
+ else if (!scumm_stricmp(argv[i], "SPRITE"))
+ g_engine->_debugDraw |= DRAW_SPRITE_BOUNDS;
+ else if (!scumm_stricmp(argv[i], "PATHING"))
+ g_engine->_debugDraw |= DRAW_PATHING;
else if (!scumm_stricmp(argv[i], "ALL"))
- g_engine->_debugDraw = DRAW_TMX | DRAW_PROP_BOUNDS;
+ g_engine->_debugDraw = DRAW_TMX | DRAW_PROP_BOUNDS | DRAW_SPRITE_BOUNDS | DRAW_PATHING;
}
}
return true;
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index e9d58a50106..6481e978264 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -81,7 +81,9 @@ class TextManager;
enum DebugDraw {
DRAW_TMX = 1 << 0,
- DRAW_PROP_BOUNDS = 1 << 1
+ DRAW_PROP_BOUNDS = 1 << 1,
+ DRAW_SPRITE_BOUNDS = 1 << 2,
+ DRAW_PATHING = 1 << 3
};
class CrabEngine : public Engine {
Commit: c1ee15d5e9bbf5de236b6c9dd8d2a0da9931bae7
https://github.com/scummvm/scummvm/commit/c1ee15d5e9bbf5de236b6c9dd8d2a0da9931bae7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Include copyright header in backInserter.h
Changed paths:
engines/crab/backInserter.h
diff --git a/engines/crab/backInserter.h b/engines/crab/backInserter.h
index eca02aedd44..603209e83c4 100644
--- a/engines/crab/backInserter.h
+++ b/engines/crab/backInserter.h
@@ -1,3 +1,23 @@
+/* ScummVM - Graphic Adventure Engine
+*
+* ScummVM is the legal property of its developers, whose names
+* are too numerous to list here. Please refer to the COPYRIGHT
+* file distributed with this source distribution.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU General Public License as published by
+* the Free Software Foundation, either version 3 of the License, or
+* (at your option) any later version.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU General Public License for more details.
+*
+* You should have received a copy of the GNU General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+*/
#ifndef CRAB_BACKINSERTER_H
#define CRAB_BACKINSERTER_H
@@ -37,4 +57,4 @@ backInserter(Container &x) {
} // End of namespace Crab
-#endif
\ No newline at end of file
+#endif
Commit: 03ed3cf1a764ebc54c11d4657a31e007094ace99
https://github.com/scummvm/scummvm/commit/03ed3cf1a764ebc54c11d4657a31e007094ace99
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Convert spaces to tab in backInserter.h
Changed paths:
engines/crab/backInserter.h
diff --git a/engines/crab/backInserter.h b/engines/crab/backInserter.h
index 603209e83c4..4d832411368 100644
--- a/engines/crab/backInserter.h
+++ b/engines/crab/backInserter.h
@@ -29,30 +29,30 @@ namespace Crab {
template<class Container>
class backInserterIterator {
protected:
- Container *_container;
+ Container *_container;
public:
- explicit backInserterIterator(Container& x) : _container(&x) {}
+ explicit backInserterIterator(Container &x) : _container(&x) {}
- backInserterIterator& operator=(const typename Container::value_type& value) {
- *_container += value;
- return *this;
- }
+ backInserterIterator &operator=(const typename Container::value_type &value) {
+ *_container += value;
+ return *this;
+ }
- backInserterIterator& operator=(const typename Container::value_type&& value) {
- *_container += Common::move(value);
- return *this;
- }
+ backInserterIterator &operator=(const typename Container::value_type &&value) {
+ *_container += Common::move(value);
+ return *this;
+ }
- backInserterIterator& operator*() { return *this; }
- backInserterIterator& operator++() { return *this; }
- backInserterIterator& operator++(int) { return *this; }
+ backInserterIterator &operator*() { return *this; }
+ backInserterIterator &operator++() { return *this; }
+ backInserterIterator &operator++(int) { return *this; }
};
template<class Container>
backInserterIterator<Container>
backInserter(Container &x) {
- return backInserterIterator<Container>(x);
+ return backInserterIterator<Container>(x);
}
} // End of namespace Crab
Commit: 61777adefc76c1bec3525589d9d1f35316436113
https://github.com/scummvm/scummvm/commit/61777adefc76c1bec3525589d9d1f35316436113
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove detection_tables.h
Changed paths:
R engines/crab/detection_tables.h
diff --git a/engines/crab/detection_tables.h b/engines/crab/detection_tables.h
deleted file mode 100644
index 27ff95ac140..00000000000
--- a/engines/crab/detection_tables.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-namespace Crab {
-
-const PlainGameDescriptor crabGames[] = {
- {"crab", "Crab"},
- {0, 0}};
-
-const ADGameDescription gameDescriptions[] = {
- {"crab",
- nullptr,
- AD_ENTRY1s("file1.bin", "00000000000000000000000000000000", 11111),
- Common::EN_ANY,
- Common::kPlatformDOS,
- ADGF_UNSTABLE,
- GUIO1(GUIO_NONE)},
-
- AD_TABLE_END_MARKER};
-
-} // End of namespace Crab
Commit: 7de1b64b251d3d8e0318037cbf8df7e307caab96
https://github.com/scummvm/scummvm/commit/7de1b64b251d3d8e0318037cbf8df7e307caab96
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rework game detection
Changed paths:
engines/crab/detection.cpp
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
index 53ed7feaaed..31e484f3ded 100644
--- a/engines/crab/detection.cpp
+++ b/engines/crab/detection.cpp
@@ -42,11 +42,12 @@ static const ADGameDescription gameDescriptions[] = {
{
"Unrest",
"",
- AD_ENTRY1s("Unrest.exe", "bae406538172eb062480f25ea6e387e5", 805376),
+ AD_ENTRY2s("res/anims/kanikasman1_moves.xml", "e7eb0c1346f236d8475cad8aab597283", 11778,
+ "res/traits/tanya_intelligent.png", "441221becc2b70e7c9d7838d6a8bd990", 12593),
Common::EN_ANY,
Common::kPlatformWindows,
- ADGF_NO_FLAGS,
- GUIO1(GUIO_NONE),
+ ADGF_DROPLANGUAGE | ADGF_DROPPLATFORM,
+ GUIO3(GUIO_NOSPEECH, GUIO_NOLAUNCHLOAD, GUIO_NOMIDI),
},
AD_TABLE_END_MARKER};
@@ -54,6 +55,7 @@ static const ADGameDescription gameDescriptions[] = {
CrabMetaEngineDetection::CrabMetaEngineDetection() : AdvancedMetaEngineDetection(Crab::gameDescriptions,
sizeof(ADGameDescription), crabGames) {
+ _flags = kADFlagMatchFullPaths;
}
REGISTER_PLUGIN_STATIC(CRAB_DETECTION, PLUGIN_TYPE_ENGINE_DETECTION, CrabMetaEngineDetection);
Commit: 4f22227dc9ebc09fcf7b959f25418c157bb7b621
https://github.com/scummvm/scummvm/commit/4f22227dc9ebc09fcf7b959f25418c157bb7b621
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix files not being found due to error in CrabEngine::initializePath
Changed paths:
engines/crab/crab.cpp
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 9edeacef070..1d1575e8619 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -127,8 +127,7 @@ Common::Error CrabEngine::run() {
}
void CrabEngine::initializePath(const Common::FSNode &gamePath) {
- Engine::initializePath(gamePath);
- SearchMan.addDirectory("res", gamePath, 0, 5);
+ SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 5);
}
Common::Error CrabEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
Commit: 5f045bb6f851272321c34f76abd48d1205693a44
https://github.com/scummvm/scummvm/commit/5f045bb6f851272321c34f76abd48d1205693a44
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix builds failing on msvc
Changed paths:
engines/crab/animation/imageeffect.cpp
engines/crab/level/level_objects.cpp
engines/crab/ui/AlphaImage.cpp
engines/crab/ui/ImageData.cpp
diff --git a/engines/crab/animation/imageeffect.cpp b/engines/crab/animation/imageeffect.cpp
index d621b7fe9db..9962d270966 100644
--- a/engines/crab/animation/imageeffect.cpp
+++ b/engines/crab/animation/imageeffect.cpp
@@ -30,6 +30,7 @@
#include "crab/crab.h"
#include "crab/animation/imageeffect.h"
+#include "crab/image/ImageManager.h"
namespace Crab {
diff --git a/engines/crab/level/level_objects.cpp b/engines/crab/level/level_objects.cpp
index e86eccbb133..ab8084a8056 100644
--- a/engines/crab/level/level_objects.cpp
+++ b/engines/crab/level/level_objects.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/image/ImageManager.h"
#include "crab/level/level_objects.h"
namespace Crab {
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index bac911d89c0..87be38fe682 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/image/ImageManager.h"
#include "crab/ui/AlphaImage.h"
#include "crab/text/TextManager.h"
diff --git a/engines/crab/ui/ImageData.cpp b/engines/crab/ui/ImageData.cpp
index 9c6fb6c7fb1..fc0832ce708 100644
--- a/engines/crab/ui/ImageData.cpp
+++ b/engines/crab/ui/ImageData.cpp
@@ -29,6 +29,7 @@
*/
#include "crab/crab.h"
+#include "crab/image/ImageManager.h"
#include "crab/ui/ImageData.h"
namespace Crab {
Commit: 04cf31f513710e351cd77e3bae0c16a441499a42
https://github.com/scummvm/scummvm/commit/04cf31f513710e351cd77e3bae0c16a441499a42
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Replace SDL_Color with CRAB::Color
Changed paths:
A engines/crab/color.h
engines/crab/animation/AnimationFrame.h
engines/crab/loaders.cpp
engines/crab/loaders.h
engines/crab/text/TextManager.cpp
engines/crab/text/color.cpp
engines/crab/text/color.h
diff --git a/engines/crab/animation/AnimationFrame.h b/engines/crab/animation/AnimationFrame.h
index 978cdc2a125..e5b38434309 100644
--- a/engines/crab/animation/AnimationFrame.h
+++ b/engines/crab/animation/AnimationFrame.h
@@ -41,14 +41,6 @@ namespace Crab {
namespace pyrodactyl {
namespace anim {
-// Make linker happy by temporarily defining SDL_COLOR
-struct SDL_Color {
- uint32 r;
- uint32 g;
- uint32 b;
- uint32 a;
-};
-
struct AnimationFrame : public Vector2i {
// The image drawn in this frame
ImageKey _img;
@@ -63,7 +55,7 @@ struct AnimationFrame : public Vector2i {
pyrodactyl::ui::HoverInfo _text;
// The color drawn on the screen
- SDL_Color _col;
+ Color _col;
AnimationFrame() {
_img = 0;
diff --git a/engines/crab/color.h b/engines/crab/color.h
new file mode 100644
index 00000000000..a2addaff0c3
--- /dev/null
+++ b/engines/crab/color.h
@@ -0,0 +1,35 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+#ifndef CRAB_COLOR_H
+#define CRAB_COLOR_H
+
+namespace Crab {
+struct Color {
+ uint32 r;
+ uint32 g;
+ uint32 b;
+ uint32 a;
+};
+
+} // End of namespace Crab
+
+#endif // CRAB_COLOR_H
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index b68030fda36..4f11c9a301b 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -91,7 +91,7 @@ bool loadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
}
#endif
-bool loadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo,
+bool loadColor(Color &col, rapidxml::xml_node<char> *node, const bool &echo,
const Common::String &rName, const Common::String &gName, const Common::String &bName) {
int r = 0, g = 0, b = 0;
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 14d1294c70b..4baeefaeadc 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -32,6 +32,7 @@
#define CRAB_LOADERS_H
#include "common/str.h"
+#include "crab/color.h"
#include "crab/gametype.h"
#include "crab/numstr.h"
#include "crab/rapidxml/rapidxml.hpp"
@@ -81,15 +82,8 @@ bool loadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node
return true;
}
-// Make linker happy by temporarily defining SDL_COLOR
-struct SDL_Color {
- uint32 r;
- uint32 g;
- uint32 b;
-};
-
//Load Color
-bool loadColor(SDL_Color &col, rapidxml::xml_node<char> *node, const bool &echo = true,
+bool loadColor(Color &col, rapidxml::xml_node<char> *node, const bool &echo = true,
const Common::String &r_name = "r", const Common::String &g_name = "g", const Common::String &b_name = "b");
//Shortcut to load integer color index to a number
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index 57c3ef48f0d..d3239190127 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -112,8 +112,8 @@ int TextManager::findFreeSlot() {
// Purpose: Render the SDL surface for text
//------------------------------------------------------------------------
Graphics::ManagedSurface *TextManager::renderTextBlended(const FontKey &fKey, const Common::String &text, const int &color) {
- SDL_Color sdlcolor = _colpool.get(color);
- uint32 col = g_engine->_format->ARGBToColor(255, sdlcolor.r, sdlcolor.g, sdlcolor.b);
+ Color pooledColor = _colpool.get(color);
+ uint32 col = g_engine->_format->ARGBToColor(255, pooledColor.r, pooledColor.g, pooledColor.b);
Graphics::ManagedSurface *surf = nullptr;
diff --git a/engines/crab/text/color.cpp b/engines/crab/text/color.cpp
index e23aa41f584..6a1a8a7ee71 100644
--- a/engines/crab/text/color.cpp
+++ b/engines/crab/text/color.cpp
@@ -41,14 +41,14 @@ void ColorPool::load(const Common::String &filename) {
if (colList.ready()) {
rapidxml::xml_node<char> *node = colList.doc()->first_node("colors");
for (rapidxml::xml_node<char> *n = node->first_node("color"); n != nullptr; n = n->next_sibling("color")) {
- SDL_Color c;
+ Color c;
loadColor(c, n);
_pool.push_back(c);
}
}
}
-SDL_Color &ColorPool::get(const int &num) {
+Color &ColorPool::get(const int &num) {
if (_pool.size() <= static_cast<uint>(num))
return _invalid;
diff --git a/engines/crab/text/color.h b/engines/crab/text/color.h
index b946315b7e5..d8fdaab7a1d 100644
--- a/engines/crab/text/color.h
+++ b/engines/crab/text/color.h
@@ -28,8 +28,8 @@
*
*/
-#ifndef CRAB_COLOR_H
-#define CRAB_COLOR_H
+#ifndef CRAB_TEXTCOLOR_H
+#define CRAB_TEXTCOLOR_H
#include "common/array.h"
#include "crab/loaders.h"
@@ -42,10 +42,10 @@ namespace text {
class ColorPool {
- Common::Array<SDL_Color> _pool;
+ Common::Array<Color> _pool;
// Default invalid color
- SDL_Color _invalid;
+ Color _invalid;
public:
ColorPool() {
@@ -55,7 +55,7 @@ public:
_invalid.b = 220;
}
- SDL_Color &get(const int &num);
+ Color &get(const int &num);
void load(const Common::String &filename);
};
} // End of namespace text
@@ -63,4 +63,4 @@ public:
} // End of namespace Crab
-#endif // CRAB_COLOR_H
+#endif // CRAB_TEXTCOLOR_H
Commit: f617a4c8addc6d825909cdcf5c5b6d6f538d1dff
https://github.com/scummvm/scummvm/commit/f617a4c8addc6d825909cdcf5c5b6d6f538d1dff
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Fix indentation of copyright notice
Changed paths:
engines/crab/backInserter.h
diff --git a/engines/crab/backInserter.h b/engines/crab/backInserter.h
index 4d832411368..2be7baf1b2e 100644
--- a/engines/crab/backInserter.h
+++ b/engines/crab/backInserter.h
@@ -1,23 +1,23 @@
/* ScummVM - Graphic Adventure Engine
-*
-* ScummVM is the legal property of its developers, whose names
-* are too numerous to list here. Please refer to the COPYRIGHT
-* file distributed with this source distribution.
-*
-* This program is free software: you can redistribute it and/or modify
-* it under the terms of the GNU General Public License as published by
-* the Free Software Foundation, either version 3 of the License, or
-* (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program. If not, see <http://www.gnu.org/licenses/>.
-*
-*/
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
#ifndef CRAB_BACKINSERTER_H
#define CRAB_BACKINSERTER_H
Commit: 1c6f1d4166dccec49691ba54b0227a12a92dfb6f
https://github.com/scummvm/scummvm/commit/1c6f1d4166dccec49691ba54b0227a12a92dfb6f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix warnings and errors emitted by msvc
Changed paths:
engines/crab/crab.h
engines/crab/image/Image.h
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index 6481e978264..d0cc774aa68 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -29,7 +29,7 @@
namespace Graphics {
class ManagedSurface;
-class PixelFormat;
+struct PixelFormat;
class Screen;
} // End of namespace Graphics
@@ -40,8 +40,8 @@ struct CrabGameDescription;
class LoadingScreen;
-class FilePaths;
-class TempValue;
+struct FilePaths;
+struct TempValue;
class StringPool;
class ScreenSettings;
diff --git a/engines/crab/image/Image.h b/engines/crab/image/Image.h
index 7f573738dfb..f83bb6d1141 100644
--- a/engines/crab/image/Image.h
+++ b/engines/crab/image/Image.h
@@ -36,11 +36,11 @@
namespace Graphics {
class ManagedSurface;
-class Surface;
+struct Surface;
} // End of namespace Graphics
namespace Common {
-class Rect;
+struct Rect;
} // End of namespace Common
namespace Crab {
Commit: 3963bc51240f883908a223598e8a3a53d6ea8b27
https://github.com/scummvm/scummvm/commit/3963bc51240f883908a223598e8a3a53d6ea8b27
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add proper deps in configure.engine
Changed paths:
engines/crab/configure.engine
diff --git a/engines/crab/configure.engine b/engines/crab/configure.engine
index f3144ba2a24..dccfb0ab5bf 100644
--- a/engines/crab/configure.engine
+++ b/engines/crab/configure.engine
@@ -1,3 +1,3 @@
# This file is included from the main "configure" script
# add_engine [name] [desc] [build-by-default] [subengines] [base games] [deps]
-add_engine crab "Crab" no "" "" ""
+add_engine crab "Crab" no "" "" "16bit highres png freetype2 vorbis"
Commit: a6b9374f80b83acd1a4574d22cd63452c5652920
https://github.com/scummvm/scummvm/commit/a6b9374f80b83acd1a4574d22cd63452c5652920
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rmeove code leftover in ImageManager.h
Changed paths:
engines/crab/image/ImageManager.h
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index 089c7ab1b84..a021124846e 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -113,7 +113,6 @@ public:
}
};
-extern ImageManager gImageManager;
} // End of namespace image
} // End of namespace pyrodactyl
Commit: 6fbb3d1f24218ce9b322254bedb3d3a779c86fb0
https://github.com/scummvm/scummvm/commit/6fbb3d1f24218ce9b322254bedb3d3a779c86fb0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Strip most functionality of ScreenSettings class
Changed paths:
engines/crab/ScreenSettings.cpp
engines/crab/ScreenSettings.h
engines/crab/app.cpp
engines/crab/ui/GeneralSettingMenu.cpp
engines/crab/ui/GfxSettingMenu.cpp
engines/crab/ui/OptionMenu.cpp
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index 4959404aaa6..3c930288fb2 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -35,13 +35,6 @@
namespace Crab {
-// Our global renderer
-//SDL_Renderer *gRenderer = nullptr;
-Graphics::Surface *gRendererSurface = nullptr;
-
-// Our global window object
-//SDL_Window *gWindow = nullptr;
-
void ScreenSettings::load(rapidxml::xml_node<char> *node) {
loadNum(_cur.w, "w", node);
loadNum(_cur.h, "h", node);
@@ -55,95 +48,6 @@ void ScreenSettings::load(rapidxml::xml_node<char> *node) {
loadBool(_saveOnExit, "save_on_exit", node);
loadBool(_mouseTrap, "mouse_trap", node);
loadBool(_quality, "quality", node);
-
- setVideoFlags();
- createBackup();
-}
-
-void ScreenSettings::setVideoFlags() {
-#if 0
- if (fullscreen) {
- // Window border doesn't matter in fullscreen mode
- videoflags = SDL_WINDOW_SHOWN | SDL_WINDOW_FULLSCREEN;
- } else {
- if (border)
- videoflags = SDL_WINDOW_SHOWN;
- else
- videoflags = SDL_WINDOW_SHOWN | SDL_WINDOW_BORDERLESS;
- }
-#endif
-}
-
-void ScreenSettings::createBackup() {
- _backup = *this;
-}
-
-void ScreenSettings::restoreBackup() {
- _fps = _backup._fps;
- _cur = _backup._cur;
- _fullscreen = _backup._fullscreen;
- _border = _backup._border;
- _vsync = _backup._vsync;
- _gamma = _backup._gamma;
- _videoflags = _backup._videoflags;
- _saveOnExit = _backup._saveOnExit;
- _quality = _backup._quality;
- _mouseTrap = _backup._mouseTrap;
- _textSpeed = _backup._textSpeed;
-}
-
-void ScreenSettings::setResolution() {
-#if 0
- // Check the current window flags
- Uint32 flags = SDL_GetWindowFlags(gWindow);
-
- // Are we in fullscreen mode right now?
- if ((flags & SDL_WINDOW_FULLSCREEN) == SDL_WINDOW_FULLSCREEN) {
- // Switch to windowed mode when changing resolution, then switch back once it is changed
- SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_SHOWN);
- SDL_SetWindowSize(gWindow, cur.w, cur.h);
- SDL_SetWindowFullscreen(gWindow, SDL_WINDOW_FULLSCREEN);
- } else {
- SDL_SetWindowSize(gWindow, cur.w, cur.h);
- SDL_SetWindowPosition(gWindow, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED);
- }
-
- change_interface = true;
-#endif
-}
-
-void ScreenSettings::setFullscreen() {
- setVideoFlags();
-#if 0
- SDL_SetWindowFullscreen(gWindow, videoflags);
-#endif
-}
-
-void ScreenSettings::setWindowBorder() {
-#if 0
- if (border)
- SDL_SetWindowBordered(gWindow, SDL_TRUE);
- else
- SDL_SetWindowBordered(gWindow, SDL_FALSE);
-#endif
-}
-
-void ScreenSettings::setVsync() {
-#if 0
- if (vsync)
- SDL_SetHint("SDL_HINT_RENDER_VSYNC", "1");
- else
- SDL_SetHint("SDL_HINT_RENDER_VSYNC", "0");
-#endif
-}
-
-void ScreenSettings::setMouseTrap() {
-#if 0
- if (mouse_trap)
- SDL_SetRelativeMouseMode(SDL_TRUE);
- else
- SDL_SetRelativeMouseMode(SDL_FALSE);
-#endif
}
void ScreenSettings::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
@@ -165,7 +69,6 @@ void ScreenSettings::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node
saveBool(_mouseTrap, "mouse_trap", doc, child);
root->append_node(child);
- createBackup();
}
} // End of namespace Crab
diff --git a/engines/crab/ScreenSettings.h b/engines/crab/ScreenSettings.h
index 5970fef0e18..40c3b399566 100644
--- a/engines/crab/ScreenSettings.h
+++ b/engines/crab/ScreenSettings.h
@@ -100,8 +100,6 @@ public:
// Screen attributes
class ScreenSettings : public ScreenAttributes {
- // A backup of the attributes
- ScreenAttributes _backup;
public:
// The desktop dimensions
@@ -127,17 +125,6 @@ public:
return d.w <= _desktop.w && d.h <= _desktop.h;
}
- void setVideoFlags();
- void createBackup();
- void restoreBackup();
-
- void setResolution();
- void setFullscreen();
- void setWindowBorder();
- void setVsync();
- void setGamma() { }//SDL_SetWindowBrightness(gWindow, gamma); }
- void setMouseTrap();
-
void load(rapidxml::xml_node<char> *node);
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root);
};
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 532cc3c539e..d4450868ab8 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -77,13 +77,6 @@ void App::run() {
case GAMESTATE_TITLE:
currentState = new Splash();
g_engine->_screenSettings->_inGame = false;
-
- // Now apply all settings - except resolution because that's already set at the start
- g_engine->_screenSettings->setFullscreen();
- g_engine->_screenSettings->setWindowBorder();
- g_engine->_screenSettings->setVsync();
- g_engine->_screenSettings->setGamma();
- g_engine->_screenSettings->setMouseTrap();
break;
case GAMESTATE_MAIN_MENU:
diff --git a/engines/crab/ui/GeneralSettingMenu.cpp b/engines/crab/ui/GeneralSettingMenu.cpp
index acb68ffe3e4..91a98e61400 100644
--- a/engines/crab/ui/GeneralSettingMenu.cpp
+++ b/engines/crab/ui/GeneralSettingMenu.cpp
@@ -84,7 +84,6 @@ void GeneralSettingMenu::handleEvents(const Common::Event &event) {
if (_mouseTrap.handleEvents(event)) {
g_engine->_screenSettings->_mouseTrap = !g_engine->_screenSettings->_mouseTrap;
- g_engine->_screenSettings->setMouseTrap();
}
int result = _textSpeed.handleEvents(event);
diff --git a/engines/crab/ui/GfxSettingMenu.cpp b/engines/crab/ui/GfxSettingMenu.cpp
index c59d2c8377e..0a95b7b4bf9 100644
--- a/engines/crab/ui/GfxSettingMenu.cpp
+++ b/engines/crab/ui/GfxSettingMenu.cpp
@@ -94,13 +94,11 @@ int GfxSettingMenu::handleEvents(const Common::Event &event) {
if (_fullscreen.handleEvents(event)) {
// Setting video flags is necessary when toggling fullscreen
g_engine->_screenSettings->_fullscreen = !g_engine->_screenSettings->_fullscreen;
- g_engine->_screenSettings->setFullscreen();
}
// Vsync doesn't need to set the change value
if (_vsync.handleEvents(event)) {
g_engine->_screenSettings->_vsync = !g_engine->_screenSettings->_vsync;
- g_engine->_screenSettings->setVsync();
}
// Quality and resolution can only be changed in the main menu
@@ -112,12 +110,10 @@ int GfxSettingMenu::handleEvents(const Common::Event &event) {
// Window border doesn't matter if you are in fullscreen
if (_border.handleEvents(event) && !g_engine->_screenSettings->_fullscreen) {
g_engine->_screenSettings->_border = !g_engine->_screenSettings->_border;
- g_engine->_screenSettings->setWindowBorder();
}
if (_brightness.handleEvents(event)) {
g_engine->_screenSettings->_gamma = static_cast<float>(_brightness.Value()) / 100.0f;
- g_engine->_screenSettings->setGamma();
}
return _resolution.handleEvents(event);
diff --git a/engines/crab/ui/OptionMenu.cpp b/engines/crab/ui/OptionMenu.cpp
index 5d6dbde63ae..908f64698fa 100644
--- a/engines/crab/ui/OptionMenu.cpp
+++ b/engines/crab/ui/OptionMenu.cpp
@@ -166,7 +166,6 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
if (result == 1) {
_state = STATE_CONFIRM;
_timer.start();
- g_engine->_screenSettings->setResolution();
_gfx.SetInfo();
} else if (result == 2)
_state = STATE_ENTER_W;
@@ -185,7 +184,6 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
g_engine->_screenSettings->_cur.w = stringToNumber<int>(_promptW._text);
_state = STATE_ENTER_H;
} else if (_cancel.handleEvents(event) == BUAC_LCLICK) {
- g_engine->_screenSettings->restoreBackup();
_gfx.SetInfo();
_state = STATE_GRAPHICS;
}
@@ -195,10 +193,8 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
g_engine->_screenSettings->_cur.h = stringToNumber<int>(_promptH._text);
_state = STATE_CONFIRM;
_timer.start();
- g_engine->_screenSettings->setResolution();
_gfx.SetInfo();
} else if (_cancel.handleEvents(event) == BUAC_LCLICK) {
- g_engine->_screenSettings->restoreBackup();
_gfx.SetInfo();
_state = STATE_GRAPHICS;
}
@@ -209,8 +205,6 @@ bool OptionMenu::handleEvents(Button &back, const Common::Event &event) {
_state = STATE_GRAPHICS;
_timer.stop();
} else if (_cancel.handleEvents(event)) {
- g_engine->_screenSettings->restoreBackup();
- g_engine->_screenSettings->setResolution();
_gfx.SetInfo();
_state = STATE_GRAPHICS;
}
@@ -374,8 +368,6 @@ void OptionMenu::internalEvents() {
_general.internalEvents();
if (_state == STATE_CONFIRM && _timer.targetReached()) {
- g_engine->_screenSettings->restoreBackup();
- g_engine->_screenSettings->setResolution();
_gfx.SetInfo();
_state = STATE_GRAPHICS;
}
Commit: 34627d105dd341ef6e9fbc1fb5ef9be7af95b98b
https://github.com/scummvm/scummvm/commit/34627d105dd341ef6e9fbc1fb5ef9be7af95b98b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Use command directly instead of preprocessor constant
Changed paths:
engines/crab/app.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index d4450868ab8..1908a7c882f 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -57,7 +57,7 @@ void App::run() {
g_engine->_screenSettings->_inGame = false;
// While the user hasn't quit - This is the main game loop
- while (currentStateId != GAMESTATE_EXIT && !SHOULD_QUIT) {
+ while (currentStateId != GAMESTATE_EXIT && !g_engine->shouldQuit()) {
// Start the frame timer
fps.start();
Commit: 7763801745486d538ec7ea85865a8836f8425dde
https://github.com/scummvm/scummvm/commit/7763801745486d538ec7ea85865a8836f8425dde
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix code formatting in Spriteai.cpp
Changed paths:
engines/crab/ai/spriteai.cpp
diff --git a/engines/crab/ai/spriteai.cpp b/engines/crab/ai/spriteai.cpp
index dd058182ead..b6b26ed3df1 100644
--- a/engines/crab/ai/spriteai.cpp
+++ b/engines/crab/ai/spriteai.cpp
@@ -264,9 +264,7 @@ void Sprite::flyAround(const Rect &camera, const SpriteConstant &sc) {
_aiData._walk._timer.target(sc._fly._delayMin + (g_engine->getRandomNumber(sc._fly._delayMax)));
_aiData._walk._timer.start();
}
- }
- // Flying towards the right edge
- else if (xVel() > 0) {
+ } else if (xVel() > 0) { // Flying towards the right edge
// Are we completely out of the left edge of the camera?
if (x() > camera.x + camera.w + w()) {
_aiData._walk._enabled = false;
Commit: 708c9594e60883f5cc6fdca2cbb2e3ce48578179
https://github.com/scummvm/scummvm/commit/708c9594e60883f5cc6fdca2cbb2e3ce48578179
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix code formatting of switch case blocks in multiple files
Changed paths:
engines/crab/app.cpp
engines/crab/input/input.cpp
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 1908a7c882f..33b944f2e5a 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -116,17 +116,17 @@ void App::run() {
while (g_system->getEventManager()->pollEvent(e)) {
switch (e.type) {
- case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
- g_engine->_inputManager->_ivState[e.customType] = true;
- break;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_START:
+ g_engine->_inputManager->_ivState[e.customType] = true;
+ break;
- case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
- g_engine->_inputManager->_ivState[e.customType] = false;
- break;
+ case Common::EVENT_CUSTOM_ENGINE_ACTION_END:
+ g_engine->_inputManager->_ivState[e.customType] = false;
+ break;
// explicitly specify the default block to turn off unhandled case warnings
- default:
- break;
+ default:
+ break;
}
// Do state Event handling
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index b18417d7164..10fae8d3a2e 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -435,14 +435,13 @@ void InputManager::setKeyBindingMode(KeyBindingMode mode) {
mapper->setGameKeymapState("Unrest-HUD", true);
switch (mode) {
+ case KBM_GAME:
+ mapper->setGameKeymapState("Unrest-Game", true);
+ break;
- case KBM_GAME:
- mapper->setGameKeymapState("Unrest-Game", true);
- break;
-
- case KBM_UI:
- mapper->setGameKeymapState("Unrest-UI", true);
- break;
+ case KBM_UI:
+ mapper->setGameKeymapState("Unrest-UI", true);
+ break;
}
// Clear All inputs
Commit: b2d7871a7eea1f638952b807d302c039391c34cf
https://github.com/scummvm/scummvm/commit/b2d7871a7eea1f638952b807d302c039391c34cf
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix Color struct
Changed paths:
engines/crab/color.h
diff --git a/engines/crab/color.h b/engines/crab/color.h
index a2addaff0c3..b13572ae639 100644
--- a/engines/crab/color.h
+++ b/engines/crab/color.h
@@ -24,10 +24,10 @@
namespace Crab {
struct Color {
- uint32 r;
- uint32 g;
- uint32 b;
- uint32 a;
+ uint8 r;
+ uint8 g;
+ uint8 b;
+ uint8 a;
};
} // End of namespace Crab
Commit: 6c91493bcad6d1cf1b7719e6ad303e4855d1065e
https://github.com/scummvm/scummvm/commit/6c91493bcad6d1cf1b7719e6ad303e4855d1065e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove SHOULD_QUIT preprocessor constant
Changed paths:
engines/crab/crab.h
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index d0cc774aa68..c607fb1e3b5 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -168,7 +168,6 @@ public:
};
extern CrabEngine *g_engine;
-#define SHOULD_QUIT ::Crab::g_engine->shouldQuit()
} // End of namespace Crab
Commit: c225d337b153be5f065f7c5889a094e63b254b33
https://github.com/scummvm/scummvm/commit/c225d337b153be5f065f7c5889a094e63b254b33
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Redo game detection again
Changed paths:
engines/crab/crab.cpp
engines/crab/detection.cpp
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 1d1575e8619..40006f0e2d1 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -127,7 +127,7 @@ Common::Error CrabEngine::run() {
}
void CrabEngine::initializePath(const Common::FSNode &gamePath) {
- SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 5);
+ SearchMan.addDirectory(gamePath.getParent().getPath(), gamePath.getParent(), 0, 5);
}
Common::Error CrabEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
index 31e484f3ded..f7424b00d14 100644
--- a/engines/crab/detection.cpp
+++ b/engines/crab/detection.cpp
@@ -42,8 +42,8 @@ static const ADGameDescription gameDescriptions[] = {
{
"Unrest",
"",
- AD_ENTRY2s("res/anims/kanikasman1_moves.xml", "e7eb0c1346f236d8475cad8aab597283", 11778,
- "res/traits/tanya_intelligent.png", "441221becc2b70e7c9d7838d6a8bd990", 12593),
+ AD_ENTRY2s("anims/kanikasman1_moves.xml", "e7eb0c1346f236d8475cad8aab597283", 11778,
+ "traits/tanya_intelligent.png", "441221becc2b70e7c9d7838d6a8bd990", 12593),
Common::EN_ANY,
Common::kPlatformWindows,
ADGF_DROPLANGUAGE | ADGF_DROPPLATFORM,
Commit: 7012a351e42f8d3f5fe0d7ecf43ee1c49d19dc8e
https://github.com/scummvm/scummvm/commit/7012a351e42f8d3f5fe0d7ecf43ee1c49d19dc8e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Change platform to unknown as detection entries are same for all platforms
Changed paths:
engines/crab/detection.cpp
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
index f7424b00d14..7692131f424 100644
--- a/engines/crab/detection.cpp
+++ b/engines/crab/detection.cpp
@@ -45,7 +45,7 @@ static const ADGameDescription gameDescriptions[] = {
AD_ENTRY2s("anims/kanikasman1_moves.xml", "e7eb0c1346f236d8475cad8aab597283", 11778,
"traits/tanya_intelligent.png", "441221becc2b70e7c9d7838d6a8bd990", 12593),
Common::EN_ANY,
- Common::kPlatformWindows,
+ Common::kPlatformUnknown, // These files are same on Windows, Linux and MacOS. Therefore, do not specify platform.
ADGF_DROPLANGUAGE | ADGF_DROPPLATFORM,
GUIO3(GUIO_NOSPEECH, GUIO_NOLAUNCHLOAD, GUIO_NOMIDI),
},
Commit: ef03c984dbf80003263ba5b2227ec0ae19f5d490
https://github.com/scummvm/scummvm/commit/ef03c984dbf80003263ba5b2227ec0ae19f5d490
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Print a message incase params for cmdDraw are incorrect
Changed paths:
engines/crab/console.cpp
diff --git a/engines/crab/console.cpp b/engines/crab/console.cpp
index 9dab909db99..0ad87ed81e1 100644
--- a/engines/crab/console.cpp
+++ b/engines/crab/console.cpp
@@ -46,6 +46,8 @@ bool Console::cmdDraw(int argc, const char **argv) {
g_engine->_debugDraw |= DRAW_PATHING;
else if (!scumm_stricmp(argv[i], "ALL"))
g_engine->_debugDraw = DRAW_TMX | DRAW_PROP_BOUNDS | DRAW_SPRITE_BOUNDS | DRAW_PATHING;
+ else
+ debugPrintf("Valid parameters are 'TMX', 'PROPS', 'SPRITE', 'PATHING', 'ALL' or 'OFF'\n");
}
}
return true;
Commit: f2b19a9d47c1b259810e483a98da72c7d0a88b6a
https://github.com/scummvm/scummvm/commit/f2b19a9d47c1b259810e483a98da72c7d0a88b6a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename IsChar to isChar
Changed paths:
engines/crab/event/GameEventInfo.cpp
engines/crab/event/GameEventInfo.h
engines/crab/event/trigger.cpp
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 101ea9fd9d4..9b32c215d6b 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -36,7 +36,7 @@ namespace Crab {
namespace pyrodactyl {
namespace event {
-bool IsChar(char c) {
+bool isChar(char c) {
if (c >= '0' && c <= '9')
return false;
return true;
@@ -138,7 +138,7 @@ bool Info::varGet(const Common::String &name, int &val) {
void Info::varSet(const Common::String &name, const Common::String &val) {
int varVal = 0;
- bool assignToVar = Common::find_if(val.begin(), val.end(), IsChar) != val.end();
+ bool assignToVar = Common::find_if(val.begin(), val.end(), isChar) != val.end();
if (assignToVar)
varGet(val, varVal);
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index 307b9e77fff..e0e5a24f2d1 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -39,7 +39,7 @@ namespace Crab {
namespace pyrodactyl {
namespace event {
-bool IsChar(char c);
+bool isChar(char c);
class Info {
// The characters in the game
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 938a0b2782b..569765bd48a 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -155,7 +155,7 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
case TRIG_STAT: {
StatType ty = stringToStatType(_target);
int sub = 0, value = 0;
- bool compareToVar = Common::find_if(_val.begin(), _val.end(), IsChar) != _val.end();
+ bool compareToVar = Common::find_if(_val.begin(), _val.end(), isChar) != _val.end();
info.statGet(_subject, ty, sub);
if (compareToVar)
@@ -182,7 +182,7 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
case TRIG_VAR: {
int var_sub = 0, var_val = 0;
- bool compare_to_var = Common::find_if(_val.begin(), _val.end(), IsChar) != _val.end();
+ bool compare_to_var = Common::find_if(_val.begin(), _val.end(), isChar) != _val.end();
info.varGet(_subject, var_sub);
if (compare_to_var)
Commit: 566ba3f6998572fad5a511c0fea0656ef82204a7
https://github.com/scummvm/scummvm/commit/566ba3f6998572fad5a511c0fea0656ef82204a7
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Rename some vars to follow code convention in trigger.cpp
Changed paths:
engines/crab/event/trigger.cpp
diff --git a/engines/crab/event/trigger.cpp b/engines/crab/event/trigger.cpp
index 569765bd48a..d35d0c94ae9 100644
--- a/engines/crab/event/trigger.cpp
+++ b/engines/crab/event/trigger.cpp
@@ -181,16 +181,16 @@ bool Trigger::evaluate(pyrodactyl::event::Info &info) {
break;
case TRIG_VAR: {
- int var_sub = 0, var_val = 0;
- bool compare_to_var = Common::find_if(_val.begin(), _val.end(), isChar) != _val.end();
+ int varSub = 0, varVal = 0;
+ bool compareToVar = Common::find_if(_val.begin(), _val.end(), isChar) != _val.end();
- info.varGet(_subject, var_sub);
- if (compare_to_var)
- info.varGet(_val, var_val);
+ info.varGet(_subject, varSub);
+ if (compareToVar)
+ info.varGet(_val, varVal);
else
- var_val = stringToNumber<int>(_val);
+ varVal = stringToNumber<int>(_val);
- return evaluate(var_sub, var_val);
+ return evaluate(varSub, varVal);
}
break;
Commit: 01fc771843a932b223f8917bffe3063c2a876dea
https://github.com/scummvm/scummvm/commit/01fc771843a932b223f8917bffe3063c2a876dea
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove some leftovers and code cleanup
Changed paths:
engines/crab/event/gameeventmanager.cpp
engines/crab/input/fightinput.h
engines/crab/ui/DevConsole.h
engines/crab/ui/GameOverMenu.cpp
engines/crab/ui/PersonHandler.h
diff --git a/engines/crab/event/gameeventmanager.cpp b/engines/crab/event/gameeventmanager.cpp
index 817215489e8..ae3478d1221 100644
--- a/engines/crab/event/gameeventmanager.cpp
+++ b/engines/crab/event/gameeventmanager.cpp
@@ -178,94 +178,6 @@ void Manager::handleEvents(Info &info, const Common::String &playerId, Common::E
}
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle events
-//------------------------------------------------------------------------
-void Manager::handleEvents(Info &info, const Common::String &player_id, SDL_Event &Event, HUD &hud, Level &level, Common::Array<EventResult> &result) {
- // If an event is already being performed
- if (eventMap.contains(info.curLocID()) > 0 && eventMap[info.curLocID()].EventInProgress(activeSeq)) {
- switch (_curEvent->type) {
- case EVENT_DIALOG:
- if (oh.show_journal) {
- info._journal.handleEvents(player_id, Event);
-
- if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
- oh.show_journal = false;
- } else {
- // If journal button is select from within an event, go to the entry corresponding to that person's name
- if (oh.HandleCommonEvents(Event)) {
- if (info.personValid(_curEvent->_title)) {
- Person &p = info.PersonGet(_curEvent->_title);
- if (p.alt_journal_name)
- info._journal.Open(player_id, JE_PEOPLE, p._journal_name);
- else
- info._journal.Open(player_id, JE_PEOPLE, p.name);
- }
- }
-
- if (oh.HandleDlboxEvents(Event)) {
- eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq);
- oh.show_journal = false;
- }
- }
- break;
- case EVENT_ANIM:
- // Skip animation if key pressed or mouse pressed
- if (Event.type == SDL_KEYUP || Event.type == SDL_MOUSEBUTTONUP)
- eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq);
- break;
- case EVENT_REPLY:
- if (oh.show_journal) {
- info._journal.handleEvents(player_id, Event);
-
- if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
- oh.show_journal = false;
- } else {
- // If journal button is select from within an event, go to the entry corresponding to that person's name
- if (oh.HandleCommonEvents(Event))
- if (info.personValid(_curEvent->_title))
- info._journal.Open(player_id, JE_PEOPLE, info.PersonGet(_curEvent->_title).name);
-
- int choice = reply.handleEvents(info, g_engine->_eventStore->con[_curEvent->special], _curEvent->_title, oh, Event);
- if (choice >= 0) {
- eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq, choice);
- oh.show_journal = false;
- }
- }
- break;
- case EVENT_TEXT:
- // If journal button is select from within an event, go to the entry corresponding to that person's name
- if (oh.HandleCommonEvents(Event))
- if (info.personValid(_curEvent->_title))
- info._journal.Open(player_id, JE_PEOPLE, info.PersonGet(_curEvent->_title).name);
-
- if (_textin.handleEvents(Event))
- eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq);
- break;
- case EVENT_SPLASH:
- if (intro.show_traits) {
- per.handleEvents(info, _curEvent->_title, Event);
-
- if (hud.back.handleEvents(Event) == BUAC_LCLICK || hud.pausekey.handleEvents(Event))
- intro.show_traits = false;
- } else {
- if (intro.handleEvents(Event))
- eventMap[info.curLocID()].NextEvent(activeSeq, info, player_id, result, endSeq);
-
- if (intro.show_traits)
- per.Cache(info, level.PlayerID(), level);
- }
- break;
- default:
- break;
- }
-
- EndSequence(info.curLocID());
- }
-}
-#endif
-
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
diff --git a/engines/crab/input/fightinput.h b/engines/crab/input/fightinput.h
index a4c40390a09..d5bf73434f1 100644
--- a/engines/crab/input/fightinput.h
+++ b/engines/crab/input/fightinput.h
@@ -83,9 +83,6 @@ struct FightInput {
void load(rapidxml::xml_node<char> *node);
FightAnimationType handleEvents(const Common::Event &event);
-#if 0
- FightAnimationType handleEvents(const SDL_Event &Event);
-#endif
};
} // End of namespace input
} // End of namespace pyrodactyl
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index ba093251b18..5fd48be526f 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -74,9 +74,6 @@ public:
void load(const Common::String &filename);
void draw(pyrodactyl::event::Info &info);
-#if 0
- void handleEvents(const SDL_Event &Event);
-#endif
void internalEvents();
};
} // End of namespace ui
diff --git a/engines/crab/ui/GameOverMenu.cpp b/engines/crab/ui/GameOverMenu.cpp
index b89b748aefe..1dc62f7b5a8 100644
--- a/engines/crab/ui/GameOverMenu.cpp
+++ b/engines/crab/ui/GameOverMenu.cpp
@@ -60,12 +60,6 @@ int GameOverMenu::handleEvents(const Common::Event &event) {
return _menu.handleEvents(event);
}
-#if 0
-int GameOverMenu::handleEvents(const SDL_Event &Event) {
- return menu.handleEvents(Event);
-}
-#endif
-
void GameOverMenu::draw() {
_bg.draw();
if (_cur < _quote.size())
diff --git a/engines/crab/ui/PersonHandler.h b/engines/crab/ui/PersonHandler.h
index ec93c2e0396..eeb047fcd99 100644
--- a/engines/crab/ui/PersonHandler.h
+++ b/engines/crab/ui/PersonHandler.h
@@ -99,11 +99,6 @@ public:
// Handle events for the dialog box
bool handleDlboxEvents(const Common::Event &event);
-#if 0
- bool HandleCommonEvents(const SDL_Event &Event);
- bool HandleDlboxEvents(const SDL_Event &Event);
-#endif
-
void internalEvents(const pyrodactyl::people::PersonState &state, pyrodactyl::anim::Sprite *s);
void draw(pyrodactyl::event::Info &info, pyrodactyl::event::GameEvent *event, const Common::String &personId,
Commit: 81e18e83bf21d7e5decd9a84827a7005704e2875
https://github.com/scummvm/scummvm/commit/81e18e83bf21d7e5decd9a84827a7005704e2875
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement missing functionality in SlideShow class
Changed paths:
engines/crab/ui/SlideShow.cpp
diff --git a/engines/crab/ui/SlideShow.cpp b/engines/crab/ui/SlideShow.cpp
index ad41f8c2f04..fd8da76ea10 100644
--- a/engines/crab/ui/SlideShow.cpp
+++ b/engines/crab/ui/SlideShow.cpp
@@ -82,36 +82,18 @@ void SlideShow::handleEvents(const Common::Event &event) {
using namespace pyrodactyl::input;
if (_index > 0)
- if (_prev.handleEvents(event) == BUAC_LCLICK) {
+ if (_prev.handleEvents(event) == BUAC_LCLICK || (_usekeyboard && g_engine->_inputManager->state(IU_LEFT))) {
_index--;
refresh();
}
if (_index < _path.size() - 1)
- if (_next.handleEvents(event) == BUAC_LCLICK) {
+ if (_next.handleEvents(event) == BUAC_LCLICK || (_usekeyboard && g_engine->_inputManager->state(IU_RIGHT))) {
_index++;
refresh();
}
}
-#if 0
-void SlideShow::handleEvents(const SDL_Event &Event) {
- using namespace pyrodactyl::input;
-
- if (index > 0)
- if (prev.handleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)) {
- index--;
- Refresh();
- }
-
- if (index < path.size() - 1)
- if (next.handleEvents(Event) == BUAC_LCLICK || (usekeyboard && g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)) {
- index++;
- Refresh();
- }
-}
-#endif
-
void SlideShow::refresh() {
_img.deleteImage();
Commit: 3e7f4beda59335829396e11b5c8ab0171fc3258b
https://github.com/scummvm/scummvm/commit/3e7f4beda59335829396e11b5c8ab0171fc3258b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove unused functions from ImageManager
Changed paths:
engines/crab/image/ImageManager.cpp
engines/crab/image/ImageManager.h
diff --git a/engines/crab/image/ImageManager.cpp b/engines/crab/image/ImageManager.cpp
index b7e9da146d7..ffb7e461a0c 100644
--- a/engines/crab/image/ImageManager.cpp
+++ b/engines/crab/image/ImageManager.cpp
@@ -100,19 +100,6 @@ bool ImageManager::init() {
return true;
}
-//------------------------------------------------------------------------
-// Purpose: Add texture to image map
-//------------------------------------------------------------------------
-void ImageManager::addTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex) {
- if (_map[mapindex].contains(id))
- freeTexture(id, mapindex);
-
- _map[mapindex][id].load(surface);
-#if 0
- SDL_FreeSurface(surface);
-#endif
-}
-
//------------------------------------------------------------------------
// Purpose: Get texture for a particular id
//------------------------------------------------------------------------
diff --git a/engines/crab/image/ImageManager.h b/engines/crab/image/ImageManager.h
index a021124846e..0a5c1d614c6 100644
--- a/engines/crab/image/ImageManager.h
+++ b/engines/crab/image/ImageManager.h
@@ -82,18 +82,11 @@ public:
void quit();
bool init();
- void loadPaths();
-
// image related stuff
// Load all images specified in an xml file in a map
void loadMap(const Common::String &filename, const MapID &mapid = MAP_CURRENT);
- void addTexture(const ImageKey &id, Graphics::Surface *surface, int mapindex = MAP_COMMON);
- void freeTexture(const ImageKey &id, int mapindex = MAP_COMMON) {
- _map[mapindex][id].deleteImage();
- }
-
void getTexture(const ImageKey &id, Image &data);
Image &getTexture(const ImageKey &id);
bool validTexture(const ImageKey &id);
Commit: 2e7e796e7dd2cf8d4eac7a1caed66542ab708d0d
https://github.com/scummvm/scummvm/commit/2e7e796e7dd2cf8d4eac7a1caed66542ab708d0d
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup InputManager code
Changed paths:
engines/crab/app.cpp
engines/crab/crab.cpp
engines/crab/input/input.cpp
engines/crab/input/input.h
diff --git a/engines/crab/app.cpp b/engines/crab/app.cpp
index 33b944f2e5a..8dacec2e45d 100644
--- a/engines/crab/app.cpp
+++ b/engines/crab/app.cpp
@@ -189,7 +189,6 @@ App::~App() {
g_engine->_imageManager->quit();
g_engine->_musicManager->quit();
g_engine->_textManager->quit();
- g_engine->_inputManager->quit();
g_engine->_loadingScreen->quit();
g_engine->_mouse->quit();
}
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 40006f0e2d1..d2a635793db 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -108,7 +108,6 @@ Common::Error CrabEngine::run() {
CursorMan.showMouse(true);
_mouse->reset();
- _inputManager->init();
_inputManager->populateKeyTable();
_inputManager->setKeyBindingMode(pyrodactyl::input::KBM_GAME);
diff --git a/engines/crab/input/input.cpp b/engines/crab/input/input.cpp
index 10fae8d3a2e..71c907e13cc 100644
--- a/engines/crab/input/input.cpp
+++ b/engines/crab/input/input.cpp
@@ -37,175 +37,12 @@
namespace Crab {
using namespace pyrodactyl::input;
-//using namespace boost::filesystem;
//------------------------------------------------------------------------
// Purpose: Return pressed/depressed state of key
//------------------------------------------------------------------------
bool InputManager::state(const InputType &val) {
return _ivState[val];
-
-#if 0
- const Uint8 *keystate = SDL_GetKeyboardState(NULL);
- if (keystate[iv[val].key] || keystate[iv[val].alt])
- return true;
-
- if (controller != nullptr) {
- if (iv[val].c_bu >= 0 && SDL_GameControllerGetButton(controller, iv[val].c_bu) == SDL_PRESSED)
- return true;
- else if (iv[val].c_ax.id != SDL_CONTROLLER_AXIS_INVALID) {
- int av = SDL_GameControllerGetAxis(controller, iv[val].c_ax.id);
- return (iv[val].c_ax.greater && av > iv[val].c_ax.val) || (!iv[val].c_ax.greater && av < iv[val].c_ax.val);
- }
- }
-#endif
-
- //return false;
-}
-
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Check for controller and keyboard input simultaneously
-// Return value 2 is a special case used for analog stick hotkey input
-//------------------------------------------------------------------------
-const int InputManager::Equals(const InputType &val, const SDL_Event &Event) {
- switch (Event.type) {
- case SDL_KEYDOWN:
- if (iv[val].Equals(Event.key))
- return SDL_PRESSED;
- break;
- case SDL_KEYUP:
- if (iv[val].Equals(Event.key))
- return SDL_RELEASED;
- break;
-
- case SDL_CONTROLLERBUTTONDOWN:
- if (iv[val].Equals(Event.cbutton))
- return SDL_PRESSED;
- break;
- case SDL_CONTROLLERBUTTONUP:
- if (iv[val].Equals(Event.cbutton))
- return SDL_RELEASED;
- break;
-
- case SDL_CONTROLLERAXISMOTION:
- // HACK to make left analog stick work in menus and right analog stick work in hotkeys
- if (iv[val].Equals(Event.caxis)) {
- if (iv[val].c_ax.id == SDL_CONTROLLER_AXIS_LEFTX || iv[val].c_ax.id == SDL_CONTROLLER_AXIS_LEFTY)
- return SDL_PRESSED;
- else
- return ANALOG_PRESSED;
- }
- break;
- default:
- break;
- }
-
- return -1;
-}
-#endif
-
-//------------------------------------------------------------------------
-// Purpose: Load from file
-//------------------------------------------------------------------------
-void InputManager::init() {
-
- const Common::String DEFAULT_FILENAME = "res/controls.xml";
- load(DEFAULT_FILENAME);
-
- //g_engine->getEventManager()->getKeymapper()->cleanupGameKeymaps();
-
- /*
- Common::Keymap *keymap = gameKeymaps;
- for (Common::Action *a: hudKeymaps->getActions()) {
- keymap->addAction(a);
- }
-
- keymap = uiKeymaps;
- for (Common::Action *a: hudKeymaps->getActions()) {
- keymap->addAction(a);
- }
- */
-
-
-#if 0
- const Common::String DEFAULT_FILENAME = "res/controls.xml";
-
- Common::String filename = g_engine->_filePath->appdata.c_str();
- filename += "controls.xml";
-
- if (!is_regular_file(filename)) {
- // The other file does not exist, just use the default file
- load(DEFAULT_FILENAME);
- } else {
- // We are using the other file, check if it is up to date or not
- if (Version(DEFAULT_FILENAME) > Version(filename)) {
- // The game has been updated to a different control scheme, use the default file
- load(DEFAULT_FILENAME);
- } else {
- // The version set by the player is fine, just use that
- load(filename);
- }
- }
-
- CreateBackup();
-#endif
-}
-
-//------------------------------------------------------------------------
-// Purpose: Load key & controller binding settings from file
-//------------------------------------------------------------------------
-void InputManager::load(const Common::String &filename) {
- XMLDoc controlList(filename);
- if (controlList.ready()) {
- rapidxml::xml_node<char> *node = controlList.doc()->first_node("controls");
- if (nodeValid(node)) {
- loadNum(_version, "version", node);
-
- // int i = 0;
- // for (auto n = node->first_node(); n != nullptr && i < IT_TOTAL; n = n->next_sibling(), ++i)
- // _iv[i].loadState(n);
- }
- }
-}
-
-//------------------------------------------------------------------------
-// Purpose: Initialize the controller if it is plugged in
-//------------------------------------------------------------------------
-void InputManager::addController() {
- warning("STUB: InputManager::addController()");
-
-#if 0
- if (SDL_NumJoysticks() > 0) {
- if (SDL_IsGameController(0))
- controller = SDL_GameControllerOpen(0);
- else
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "Controller not recognized", "Unsupported device", NULL);
- }
-#endif
-}
-
-#if 0
-void InputManager::HandleController(const SDL_Event &Event) {
- if (Event.type == SDL_CONTROLLERDEVICEREMOVED && controller != nullptr) {
- SDL_GameControllerClose(controller);
- controller = nullptr;
- } else if (Event.type == SDL_CONTROLLERDEVICEADDED && controller == nullptr)
- AddController();
-}
-#endif
-
-//------------------------------------------------------------------------
-// Purpose: Create and restore backup
-//------------------------------------------------------------------------
-void InputManager::createBackup() {
- for (int i = 0; i < IT_TOTAL; ++i)
- _backup[i] = _iv[i];
-}
-
-void InputManager::restoreBackup() {
- for (int i = 0; i < IT_TOTAL; ++i)
- _iv[i] = _backup[i];
}
void InputManager::populateKeyTable() {
@@ -247,45 +84,6 @@ Common::String InputManager::getAssociatedKey(const InputType &type) {
return _keyDescs[type];
}
-
-//------------------------------------------------------------------------
-// Purpose: Save to file
-// Function is not needed as of now, keeping it incase its needed in future.
-//------------------------------------------------------------------------
-void InputManager::save() {
-#if 0
- rapidxml::xml_document<char> doc;
-
- Common::String filename = g_engine->_filePath->appdata;
- filename += "controls.xml";
-
- // xml declaration
- rapidxml::xml_node<char> *decl = doc.allocate_node(rapidxml::node_declaration);
- decl->append_attribute(doc.allocate_attribute("version", "1.0"));
- decl->append_attribute(doc.allocate_attribute("encoding", "utf-8"));
- doc.append_node(decl);
-
- // root node
- rapidxml::xml_node<char> *root = doc.allocate_node(rapidxml::node_element, "controls");
- root->append_attribute(doc.allocate_attribute("version", gStrPool->Get(version)));
- for (int i = 0; i < IT_TOTAL; i++)
- iv[i].saveState(doc, root, "i");
-
- doc.append_node(root);
- Common::String xml_as_string;
- rapidxml::print(std::back_inserter(xml_as_string), doc);
-
- std::ofstream save(filename, std::ios::out);
- if (save.is_open()) {
- save << xml_as_string;
- save.close();
- }
-
- doc.clear();
- CreateBackup();
-#endif
-}
-
Common::Keymap* InputManager::getDefaultKeyMapsForGame() {
using namespace Common;
diff --git a/engines/crab/input/input.h b/engines/crab/input/input.h
index 1e8ac672f67..2a097ebdc5e 100644
--- a/engines/crab/input/input.h
+++ b/engines/crab/input/input.h
@@ -37,8 +37,6 @@
namespace Crab {
-#define ANALOG_PRESSED 2
-
namespace pyrodactyl {
namespace input {
enum InputType {
@@ -91,9 +89,6 @@ const int IG_START = IG_UP, IG_SIZE = IG_BLOCK - IG_START + 1;
const int IU_START = IU_UP, IU_SIZE = IT_TOTAL - IU_START;
class InputManager {
- // The backups used to restore in case of the user pressing cancel
- Common::String _backup[IT_TOTAL];
-
// Load key configuration from file
void load(const Common::String &filename);
@@ -108,7 +103,6 @@ class InputManager {
public:
InputManager() {
- //controller = nullptr;
_version = 0;
clearInputs();
@@ -129,15 +123,8 @@ public:
void setKeyBindingMode(KeyBindingMode mode);
- KeyBindingMode getKeyBindingMode() const { return _keyMode; }
-
- void quit() {
- warning("STUB: InputManager::quit()");
-
-#if 0
- if (controller != nullptr)
- SDL_GameControllerClose(controller);
-#endif
+ KeyBindingMode getKeyBindingMode() const {
+ return _keyMode;
}
// NOTE: The lower level arrays can have buttons in common, but buttons cannot be common within these arrays
@@ -147,35 +134,10 @@ public:
Common::String _iv[IT_TOTAL];
bool _ivState[IT_TOTAL];
- // Our controller object
- //SDL_GameController *controller;
-
- // These functions check if the value of a key matches the input values
- // Returns SDL_PRESSED for pressing a button, SDL_RELEASED for releasing a button and -1 if no input
-#if 0
- const int Equals(const InputType &val, const SDL_Event &Event);
-#endif
-
// These functions return true if key is pressed, false otherwise
bool state(const InputType &val);
- void createBackup();
- void restoreBackup();
-
- // Initialize the controller if it is plugged in
- void addController();
-
Common::String getAssociatedKey(const InputType &type);
-
-#if 0
- // Handle plugging and unplugging of controllers on the fly
- void HandleController(const SDL_Event &Event);
-#endif
-
- // Initialize the input system
- void init();
-
- void save();
};
} // End of namespace input
Commit: 75abee340cb0154b04b503386854af584475b76e
https://github.com/scummvm/scummvm/commit/75abee340cb0154b04b503386854af584475b76e
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup Game::saveState
Changed paths:
engines/crab/game.cpp
diff --git a/engines/crab/game.cpp b/engines/crab/game.cpp
index 23583fde302..15d98cbfe92 100644
--- a/engines/crab/game.cpp
+++ b/engines/crab/game.cpp
@@ -735,14 +735,14 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
root->append_attribute(doc.allocate_attribute("loc_id", loc.c_str()));
// Save location name
- Common::String loc_name = _info.curLocName();
- root->append_attribute(doc.allocate_attribute("loc_name", loc_name.c_str()));
+ Common::String locName = _info.curLocName();
+ root->append_attribute(doc.allocate_attribute("loc_name", locName.c_str()));
// Save player character name
- Common::String char_name;
+ Common::String charName;
if (_info.personValid(_level.playerId()))
- char_name = _info.personGet(_level.playerId())._name;
- root->append_attribute(doc.allocate_attribute("char_name", char_name.c_str()));
+ charName = _info.personGet(_level.playerId())._name;
+ root->append_attribute(doc.allocate_attribute("char_name", charName.c_str()));
// Difficulty
Common::String diff = "Normal";
@@ -760,59 +760,26 @@ void Game::saveState(Common::SeekableWriteStream *stream) {
Common::String playtime = _clock.getTime();
root->append_attribute(doc.allocate_attribute("time", playtime.c_str()));
- rapidxml::xml_node<char> *child_gem = doc.allocate_node(rapidxml::node_element, "events");
- _gem.saveState(doc, child_gem);
- root->append_node(child_gem);
+ rapidxml::xml_node<char> *childGem = doc.allocate_node(rapidxml::node_element, "events");
+ _gem.saveState(doc, childGem);
+ root->append_node(childGem);
- rapidxml::xml_node<char> *child_info = doc.allocate_node(rapidxml::node_element, "info");
- _info.saveState(doc, child_info);
- root->append_node(child_info);
+ rapidxml::xml_node<char> *childInfo = doc.allocate_node(rapidxml::node_element, "info");
+ _info.saveState(doc, childInfo);
+ root->append_node(childInfo);
- rapidxml::xml_node<char> *child_map = doc.allocate_node(rapidxml::node_element, "map");
- _map.saveState(doc, child_map);
- root->append_node(child_map);
+ rapidxml::xml_node<char> *childMap = doc.allocate_node(rapidxml::node_element, "map");
+ _map.saveState(doc, childMap);
+ root->append_node(childMap);
- rapidxml::xml_node<char> *child_level = doc.allocate_node(rapidxml::node_element, "level");
- _level.saveState(doc, child_level);
- root->append_node(child_level);
+ rapidxml::xml_node<char> *childLevel = doc.allocate_node(rapidxml::node_element, "level");
+ _level.saveState(doc, childLevel);
+ root->append_node(childLevel);
- Common::String xml_as_string;
- rapidxml::print(Crab::backInserter(xml_as_string), doc);
+ Common::String xmlAsString;
+ rapidxml::print(Crab::backInserter(xmlAsString), doc);
- stream->writeString(xml_as_string);
-
-#if 0
- Common::String fullpath = FullPath(filename);
-
- // We don't check for duplicates for auto-saves and iron man saves
- if (!overwrite) {
- // If a file of this name already exists, find appropriate filename
- if (boost::filesystem::exists(fullpath)) {
- // Copy the original filename, add a _1 at the end
- // Start from one because that's how humans count
- Common::String result = filename + "_1";
- int count = 1;
-
- // Keep trying a filename until it no longer exists or we reach an insanely high number
- while (boost::filesystem::exists(FullPath(result)) && count < 1000) {
- ++count;
- result = filename + "_" + NumberToString(count);
- }
-
- // Make result the new save file path
- fullpath = FullPath(result);
- }
- }
-
- std::ofstream save(fullpath.c_str(), std::ios::out);
- if (save.is_open()) {
- save << xml_as_string;
- save.close();
- }
-
- doc.clear();
- hud.pause.ScanDir();
-#endif
+ stream->writeString(xmlAsString);
}
//------------------------------------------------------------------------
// Purpose: Quit the game
Commit: 2bbe5880a0777d9258d17e8451614391820a97c4
https://github.com/scummvm/scummvm/commit/2bbe5880a0777d9258d17e8451614391820a97c4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make engine work without the res prefix in paths
Changed paths:
engines/crab/crab.cpp
engines/crab/filesystem.cpp
engines/crab/filesystem.h
engines/crab/music/MusicManager.cpp
engines/crab/music/musicparam.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index d2a635793db..0d85f568de5 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -126,7 +126,7 @@ Common::Error CrabEngine::run() {
}
void CrabEngine::initializePath(const Common::FSNode &gamePath) {
- SearchMan.addDirectory(gamePath.getParent().getPath(), gamePath.getParent(), 0, 5);
+ SearchMan.addDirectory(gamePath.getPath(), gamePath, 0, 5);
}
Common::Error CrabEngine::saveGameState(int slot, const Common::String &desc, bool isAutosave) {
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index 714674058e1..0228c5200c3 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -33,6 +33,13 @@
namespace Crab {
+Common::String cleansePath(const Common::String &path) {
+ if (path.hasPrefix("res/"))
+ return Common::String(&path.c_str()[4]);
+
+ return path;
+}
+
bool fileOpen(const Common::Path &path, char *&data) {
if (path.empty())
return false;
@@ -41,7 +48,7 @@ bool fileOpen(const Common::Path &path, char *&data) {
delete[] data;
Common::File file;
- if (!file.open(path)) {
+ if (!file.open(cleansePath(path.toString()))) {
warning("Unable to open file %s", path.toString().c_str());
data = nullptr;
return false;
@@ -66,7 +73,7 @@ bool fileOpen(const Common::Path &path, Common::File *file) {
if (file->isOpen())
file->close();
- if (!file->open(path)) {
+ if (!file->open(cleansePath(path.toString()))) {
warning("Unable to open file %s", path.toString().c_str());
return false;
}
diff --git a/engines/crab/filesystem.h b/engines/crab/filesystem.h
index 6de932937ca..b2b20bbc0f5 100644
--- a/engines/crab/filesystem.h
+++ b/engines/crab/filesystem.h
@@ -38,6 +38,7 @@ class File;
namespace Crab {
+Common::String cleansePath(const Common::String &path);
bool fileOpen(const Common::Path &path, char *&data);
bool fileOpen(const Common::Path &path, Common::File *file);
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 464630681da..051444da89f 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -141,7 +141,7 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
if (id != nullptr && path != nullptr) {
EffectAudio *audio = new EffectAudio();
- audio->_file.open(path->value());
+ audio->_file.open(cleansePath(path->value()));
audio->_handle = new Audio::SoundHandle();
audio->_stream = Audio::makeWAVStream(&audio->_file, DisposeAfterUse::NO);
_effects[stringToNumber<ChunkKey>(id->value())] = audio;
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index 6fb6e9c130d..f97e8fb9710 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -34,6 +34,7 @@
#include "audio/decoders/vorbis.h"
#include "common/file.h"
#include "crab/loaders.h"
+#include "crab/filesystem.h"
namespace Crab {
@@ -74,7 +75,7 @@ struct MusicData {
loadNum(_id, "id", node);
loadNum(_fadeInDuration, "fade_in", node);
- _file.open(node->first_attribute("path")->value());
+ _file.open(cleansePath(node->first_attribute("path")->value()));
Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(&_file, DisposeAfterUse::NO);
// loops=0 means infinite here.
_track = Audio::makeLoopingAudioStream(stream, 0, 0, 0);
Commit: 47d15889deb4c27c113edaf50b51ae4a37175f29
https://github.com/scummvm/scummvm/commit/47d15889deb4c27c113edaf50b51ae4a37175f29
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Add entries for Unrest demo
Changed paths:
engines/crab/detection.cpp
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
index 7692131f424..2355aa92722 100644
--- a/engines/crab/detection.cpp
+++ b/engines/crab/detection.cpp
@@ -42,13 +42,23 @@ static const ADGameDescription gameDescriptions[] = {
{
"Unrest",
"",
- AD_ENTRY2s("anims/kanikasman1_moves.xml", "e7eb0c1346f236d8475cad8aab597283", 11778,
+ AD_ENTRY2s("characters/backer_chars.xml", "d9028280f75836192d93e56df7313d8c", 2517,
"traits/tanya_intelligent.png", "441221becc2b70e7c9d7838d6a8bd990", 12593),
Common::EN_ANY,
Common::kPlatformUnknown, // These files are same on Windows, Linux and MacOS. Therefore, do not specify platform.
ADGF_DROPLANGUAGE | ADGF_DROPPLATFORM,
GUIO3(GUIO_NOSPEECH, GUIO_NOLAUNCHLOAD, GUIO_NOMIDI),
},
+ {
+ "Unrest",
+ "Demo",
+ AD_ENTRY2s("characters/backer_chars.xml", "5ba20126349bc57b3774623a1ec89627", 2127,
+ "traits/tanya_intelligent.png", "441221becc2b70e7c9d7838d6a8bd990", 12593),
+ Common::EN_ANY,
+ Common::kPlatformUnknown, // These files are same on Windows, Linux and MacOS. Therefore, do not specify platform.
+ ADGF_DEMO,
+ GUIO3(GUIO_NOSPEECH, GUIO_NOLAUNCHLOAD, GUIO_NOMIDI),
+ },
AD_TABLE_END_MARKER};
}
Commit: 299078fb387bda63cf9117fd047d71e94018db24
https://github.com/scummvm/scummvm/commit/299078fb387bda63cf9117fd047d71e94018db24
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix crash incase there is an error opening audio files
Changed paths:
engines/crab/music/MusicManager.cpp
engines/crab/music/musicparam.h
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 051444da89f..7b1f3d64ab4 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -141,10 +141,15 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
if (id != nullptr && path != nullptr) {
EffectAudio *audio = new EffectAudio();
- audio->_file.open(cleansePath(path->value()));
- audio->_handle = new Audio::SoundHandle();
- audio->_stream = Audio::makeWAVStream(&audio->_file, DisposeAfterUse::NO);
- _effects[stringToNumber<ChunkKey>(id->value())] = audio;
+ if (audio->_file.open(cleansePath(path->value()))) {
+ audio->_handle = new Audio::SoundHandle();
+ audio->_stream = Audio::makeWAVStream(&audio->_file, DisposeAfterUse::NO);
+ _effects[stringToNumber<ChunkKey>(id->value())] = audio;
+ } else {
+ delete audio;
+ warning("Could not open audio file : %s", path->value());
+ return false;
+ }
}
}
}
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index f97e8fb9710..e055bf79868 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -75,10 +75,13 @@ struct MusicData {
loadNum(_id, "id", node);
loadNum(_fadeInDuration, "fade_in", node);
- _file.open(cleansePath(node->first_attribute("path")->value()));
- Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(&_file, DisposeAfterUse::NO);
- // loops=0 means infinite here.
- _track = Audio::makeLoopingAudioStream(stream, 0, 0, 0);
+ if (_file.open(cleansePath(node->first_attribute("path")->value()))) {
+ Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(&_file, DisposeAfterUse::NO);
+ // loops=0 means infinite here.
+ _track = Audio::makeLoopingAudioStream(stream, 0, 0, 0);
+ } else {
+ warning("Could not open file %s", node->first_attribute("path")->value());
+ }
}
};
} // End of namespace music
Commit: a97409f24198796a837e8b06bff4dc716fdb4c23
https://github.com/scummvm/scummvm/commit/a97409f24198796a837e8b06bff4dc716fdb4c23
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Update comment in MusicManager.cpp
Changed paths:
engines/crab/music/MusicManager.cpp
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 7b1f3d64ab4..53a8758155c 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -98,7 +98,7 @@ void MusicManager::playEffect(const ChunkKey &id, const int &loops) {
}
//------------------------------------------------------------------------
-// Purpose: Initialize the music subsystem (currently SDL_mixer) and load sound effects
+// Purpose: Initialize the music subsystem and load sound effects
//------------------------------------------------------------------------
bool MusicManager::load(rapidxml::xml_node<char> *node) {
_musicHandle = new Audio::SoundHandle();
Commit: f8e6492b51acb92c6df850de043718c8fa33d645
https://github.com/scummvm/scummvm/commit/f8e6492b51acb92c6df850de043718c8fa33d645
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Show demo UI elements when playing demo
Changed paths:
engines/crab/mainmenu.cpp
engines/crab/mainmenu.h
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 030770e860f..9bd6cd990cd 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -128,17 +128,15 @@ MainMenu::MainMenu() {
loadNum(_musicKey._credits, "credits", node->first_node("music"));
}
-#ifdef UNREST_DEMO
- if (nodeValid("demo", node)) {
+ if ((g_engine->getFeatures() & ADGF_DEMO) && nodeValid("demo", node)) {
rapidxml::xml_node<char> *denode = node->first_node("demo");
if (nodeValid("steam", denode))
- steam.load(denode->first_node("steam"));
+ _steam.load(denode->first_node("steam"));
if (nodeValid("direct", denode))
- direct.load(denode->first_node("direct"));
+ _direct.load(denode->first_node("direct"));
}
-#endif
}
}
@@ -211,19 +209,18 @@ void MainMenu::handleEvents(Common::Event &event, bool &shouldChangeState, GameS
#endif
switch (_state) {
-#ifdef UNREST_DEMO
case STATE_NORMAL:
- if (steam.handleEvents(Event) == BUAC_LCLICK) {
+ if ((g_engine->getFeatures() & ADGF_DEMO) && _steam.handleEvents(event) == BUAC_LCLICK) {
// Open steam in browser window
- OpenURL("https://store.steampowered.com/app/292400/");
+ g_system->openUrl("https://store.steampowered.com/app/292400/");
}
- if (direct.handleEvents(Event) == BUAC_LCLICK) {
+ if ((g_engine->getFeatures() & ADGF_DEMO) && _direct.handleEvents(event) == BUAC_LCLICK) {
// Open humble widget in browser window
- OpenURL("https://www.humblebundle.com/store/unrest/Udg6Ytd8Dfw");
+ g_system->openUrl("https://www.humblebundle.com/store/unrest/Udg6Ytd8Dfw");
}
break;
-#endif
+
case STATE_OPTIONS:
if (g_engine->_optionMenu->handleEvents(_back, event))
changeState(STATE_NORMAL);
@@ -498,11 +495,11 @@ void MainMenu::draw() {
_meMain.draw();
-#ifdef UNREST_DEMO
- g_engine->_textManager->draw(logo.x + logo.w, logo.y + logo.h / 2, "Demo", 0, 0, ALIGN_CENTER);
- steam.draw();
- direct.draw();
-#endif
+ if (g_engine->getFeatures() & ADGF_DEMO) {
+ g_engine->_textManager->draw(_logo.x + _logo.w, _logo.y + _logo.h / 2, "Demo", 0, 0, ALIGN_CENTER);
+ _steam.draw();
+ _direct.draw();
+ }
break;
case STATE_OPTIONS:
@@ -576,10 +573,10 @@ void MainMenu::setUI() {
_warning.setUI();
_bgSave.setUI();
-#ifdef UNREST_DEMO
- steam.setUI();
- direct.setUI();
-#endif
+ if(g_engine->getFeatures() & ADGF_DEMO) {
+ _steam.setUI();
+ _direct.setUI();
+ }
}
} // End of namespace Crab
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 30da5c5e669..2b05ee6f13a 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -114,10 +114,8 @@ class MainMenu : public GameState {
}
} _musicKey;
-#ifdef UNREST_DEMO
// UI elements related to the demo
- pyrodactyl::ui::Button steam, direct;
-#endif
+ pyrodactyl::ui::Button _steam, _direct;
public:
MainMenu();
Commit: 632347a25795d237997667e18304476c0cc15f8f
https://github.com/scummvm/scummvm/commit/632347a25795d237997667e18304476c0cc15f8f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Do not playStream when id is invalid
Changed paths:
engines/crab/music/MusicManager.cpp
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 53a8758155c..0c7d00ee3d9 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -77,7 +77,7 @@ void MusicManager::playMusic(const MusicKey &id) {
}
}
- if (_bg._track != nullptr)
+ if (_bg._track != nullptr && id >= 0)
g_system->getMixer()->playStream(Audio::Mixer::kMusicSoundType, _musicHandle, _bg._track, (int)_bg._id);
}
}
Commit: 57121880ac8a63a6615d05a94136d3c42543254f
https://github.com/scummvm/scummvm/commit/57121880ac8a63a6615d05a94136d3c42543254f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix code formatting in TextManager.cpp
Changed paths:
engines/crab/text/TextManager.cpp
diff --git a/engines/crab/text/TextManager.cpp b/engines/crab/text/TextManager.cpp
index d3239190127..ff53864aeab 100644
--- a/engines/crab/text/TextManager.cpp
+++ b/engines/crab/text/TextManager.cpp
@@ -218,14 +218,12 @@ void TextManager::draw(const int &x, int y, const Common::String &text, const in
endPos++;
}
- if (lastInterrupt >= 0) // wrap a word around
- {
+ if (lastInterrupt >= 0) { // wrap a word around
for (uint i = 0; i < lastInterrupt - startPos; i++)
word += text[startPos + i];
startPos = lastInterrupt + 1;
- } else // word bigger than line, just thunk
- {
+ } else { // word bigger than line, just thunk
for (uint i = 0; i < endPos - startPos; i++)
word += text[startPos + i];
Commit: 50e5b9c93c249b810977cb56da42f927386b7958
https://github.com/scummvm/scummvm/commit/50e5b9c93c249b810977cb56da42f927386b7958
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Fix code formatting of structs
Changed paths:
engines/crab/mainmenu.h
engines/crab/ui/FileMenu.h
diff --git a/engines/crab/mainmenu.h b/engines/crab/mainmenu.h
index 2b05ee6f13a..5f3182cc7df 100644
--- a/engines/crab/mainmenu.h
+++ b/engines/crab/mainmenu.h
@@ -76,8 +76,7 @@ class MainMenu : public GameState {
pyrodactyl::ui::ImageData _logo;
// Data for the difficulty menu
- struct
- {
+ struct {
pyrodactyl::ui::ImageData _bg;
pyrodactyl::ui::HoverInfo _heading;
pyrodactyl::ui::ButtonMenu _menu;
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index 2eb85564b64..bab5e85e8f8 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -67,8 +67,7 @@ protected:
TextData tdH[DATA_HOVER_TOTAL];
// The preview picture details
- struct
- {
+ struct {
// We load only the current preview image instead of all of them
pyrodactyl::image::Image _preview;
Commit: 5d54b93bc44f8a21fe38c79fe2e2bee5265bda27
https://github.com/scummvm/scummvm/commit/5d54b93bc44f8a21fe38c79fe2e2bee5265bda27
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: No need to init Common::String with ""
Changed paths:
engines/crab/GameParam.h
engines/crab/LevelResult.h
engines/crab/event/GameEventInfo.h
engines/crab/event/effect.h
engines/crab/ui/textarea.h
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index a45cf2c060a..020c7e94efa 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -47,7 +47,7 @@ struct LevelPath {
// The name of the level
Common::String _name;
- LevelPath() : _layout(""), _asset(""), _name("") {}
+ LevelPath() {}
void load(rapidxml::xml_node<char> *node) {
loadStr(_name, "name", node);
diff --git a/engines/crab/LevelResult.h b/engines/crab/LevelResult.h
index db69e27823d..398474c25e8 100644
--- a/engines/crab/LevelResult.h
+++ b/engines/crab/LevelResult.h
@@ -46,7 +46,7 @@ struct LevelResult {
Common::String _val;
int _x, _y;
- LevelResult() : _val("") {
+ LevelResult() {
_type = LR_NONE;
_x = -1;
_y = -1;
diff --git a/engines/crab/event/GameEventInfo.h b/engines/crab/event/GameEventInfo.h
index e0e5a24f2d1..5107879d83a 100644
--- a/engines/crab/event/GameEventInfo.h
+++ b/engines/crab/event/GameEventInfo.h
@@ -67,7 +67,7 @@ class Info {
// The name of the player's current location
Common::String _name;
- PlayerLoc() : _id(""), _name("") {}
+ PlayerLoc() {}
} _loc;
// This image changes to reflect the playable character
diff --git a/engines/crab/event/effect.h b/engines/crab/event/effect.h
index 1bc02be98b5..b256f332f79 100644
--- a/engines/crab/event/effect.h
+++ b/engines/crab/event/effect.h
@@ -59,7 +59,7 @@ struct EventResult {
Common::String _val;
int _x, _y;
- EventResult() : _val("") {
+ EventResult() {
_type = ER_NONE;
_x = -1;
_y = -1;
diff --git a/engines/crab/ui/textarea.h b/engines/crab/ui/textarea.h
index 51ee71374df..a702632840d 100644
--- a/engines/crab/ui/textarea.h
+++ b/engines/crab/ui/textarea.h
@@ -55,7 +55,7 @@ class TextArea : public TextData {
public:
Common::String _text;
- TextArea() : _text("") {
+ TextArea() {
_size = 20;
_seEntry = -1;
_seErase = -1;
Commit: 608d13f70d021a3d872ba51e1a4e2ccf81c57beb
https://github.com/scummvm/scummvm/commit/608d13f70d021a3d872ba51e1a4e2ccf81c57beb
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Improve code for Level::getSprite
Changed paths:
engines/crab/level/level.cpp
diff --git a/engines/crab/level/level.cpp b/engines/crab/level/level.cpp
index fdeba0aeb02..5085f157741 100644
--- a/engines/crab/level/level.cpp
+++ b/engines/crab/level/level.cpp
@@ -71,15 +71,14 @@ void Level::reset() {
}
//------------------------------------------------------------------------
-// Purpose: Get index of a sprite in the object array
+// Purpose: Get sprite in the object array
//------------------------------------------------------------------------
pyrodactyl::anim::Sprite *Level::getSprite(const Common::String &id) {
- int count = 0;
- for (auto i = _objects.begin(); i != _objects.end(); ++i, ++count)
- if (i->id() == id)
- return &_objects[count];
+ for (auto &i : _objects)
+ if (i.id() == id)
+ return &i;
- return NULL;
+ return nullptr;
}
//------------------------------------------------------------------------
Commit: 3e2f011bb5c8ad9e6212ada57396e7e0fe758906
https://github.com/scummvm/scummvm/commit/3e2f011bb5c8ad9e6212ada57396e7e0fe758906
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Be consistent with usage of nullptr
Changed paths:
engines/crab/PathfindingAgent.cpp
engines/crab/PathfindingGrid.cpp
engines/crab/XMLDoc.cpp
engines/crab/ui/SectionHeader.cpp
diff --git a/engines/crab/PathfindingAgent.cpp b/engines/crab/PathfindingAgent.cpp
index f5f87d00ea3..c5923c70380 100644
--- a/engines/crab/PathfindingAgent.cpp
+++ b/engines/crab/PathfindingAgent.cpp
@@ -148,7 +148,7 @@ void PathfindingAgent::update(uint32 timeslice) {
if (current->getLocation() == _goalTile) { // We're done.
// m_vSolution = getSolution();
- _vSolution = getPrunedSolution(NULL);
+ _vSolution = getPrunedSolution(nullptr);
_solutionFound = true;
return;
} else if (current->getLocation()->getMovementCost() > 0 && current->getLocation()->adjacentToNode(_clickedTile) && _clickedTile->getMovementCost() < 0) {
diff --git a/engines/crab/PathfindingGrid.cpp b/engines/crab/PathfindingGrid.cpp
index 780612fe6bd..cc56f8d63df 100644
--- a/engines/crab/PathfindingGrid.cpp
+++ b/engines/crab/PathfindingGrid.cpp
@@ -273,7 +273,7 @@ PathfindingGraphNode *PathfindingGrid::getNearestOpenNode(Vector2f nodePos, Vect
checkNodes.pop_front();
}
- return NULL;
+ return nullptr;
}
} // End of namespace Crab
diff --git a/engines/crab/XMLDoc.cpp b/engines/crab/XMLDoc.cpp
index 4f16291e9ba..e656dd65d36 100644
--- a/engines/crab/XMLDoc.cpp
+++ b/engines/crab/XMLDoc.cpp
@@ -52,7 +52,7 @@ const rapidxml::xml_document<> *XMLDoc::doc() const {
if (_text != nullptr)
return &_doc;
else
- return NULL;
+ return nullptr;
}
} // End of namespace Crab
diff --git a/engines/crab/ui/SectionHeader.cpp b/engines/crab/ui/SectionHeader.cpp
index 21528215258..5bd3b20375e 100644
--- a/engines/crab/ui/SectionHeader.cpp
+++ b/engines/crab/ui/SectionHeader.cpp
@@ -40,7 +40,7 @@ using namespace pyrodactyl::image;
void SectionHeader::load(rapidxml::xml_node<char> *node) {
- if (TextData::load(node, NULL, false)) {
+ if (TextData::load(node, nullptr, false)) {
loadStr(_text, "text", node);
_text.insertChar(' ', 0);
_text += " ";
@@ -86,7 +86,7 @@ void SectionHeader::draw(const Common::String &str, const int &xOffset, const in
g_engine->_imageManager->draw(_left.x + xOffset, _left.y + yOffset, _img);
if (_drawR)
- g_engine->_imageManager->draw(_right.x + xOffset, _right.y + yOffset, _img, (Rect*)NULL, FLIP_X);
+ g_engine->_imageManager->draw(_right.x + xOffset, _right.y + yOffset, _img, (Rect*)nullptr, FLIP_X);
TextData::draw(str, xOffset, yOffset);
}
Commit: ddfca3c1d9f7752dd9b29736d1719a75450c121c
https://github.com/scummvm/scummvm/commit/ddfca3c1d9f7752dd9b29736d1719a75450c121c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub code for handling closing various submenus in mainmenu
Changed paths:
engines/crab/mainmenu.cpp
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index 9bd6cd990cd..b88070c9b29 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -199,14 +199,13 @@ void MainMenu::handleEvents(Common::Event &event, bool &shouldChangeState, GameS
}
}
-#if 0
- if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_PRESSED || (back.handleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
- if (state == STATE_SAVENAME)
- ChangeState(STATE_DIFF);
- else if (state != STATE_NORMAL)
- ChangeState(STATE_NORMAL);
+ if (g_engine->_inputManager->state(IU_BACK) || (_back.handleEvents(event) && (_state != STATE_SAVENAME && _state != STATE_CREDITS))) {
+ if (_state == STATE_SAVENAME)
+ changeState(STATE_DIFF);
+ else if (_state != STATE_NORMAL)
+ changeState(STATE_NORMAL);
}
-#endif
+
switch (_state) {
case STATE_NORMAL:
Commit: 78d969cacd25300cfa440f3306adfb930b4f6765
https://github.com/scummvm/scummvm/commit/78d969cacd25300cfa440f3306adfb930b4f6765
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove old code in mainmenu
Changed paths:
engines/crab/mainmenu.cpp
diff --git a/engines/crab/mainmenu.cpp b/engines/crab/mainmenu.cpp
index b88070c9b29..6c16ec111ee 100644
--- a/engines/crab/mainmenu.cpp
+++ b/engines/crab/mainmenu.cpp
@@ -281,138 +281,6 @@ void MainMenu::handleEvents(Common::Event &event, bool &shouldChangeState, GameS
}
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Event/input handling Events
-//------------------------------------------------------------------------
-void MainMenu::handleEvents(SDL_Event &Event, bool &ShouldChangeState, GameStateID &NewStateID) {
- g_engine->_mouse->handleEvents(Event);
-
- if (state != STATE_CREDITS) {
- int choice = me_main.handleEvents(Event);
- if (choice >= 0) {
- for (uint i = 0; i < me_main.element.size(); ++i)
- me_main.element[i].State(i == choice);
-
- switch (choice) {
- case 0:
- if (g_engine->_loadMenu->SelectNewestFile()) {
- ChangeState(STATE_NORMAL);
- ShouldChangeState = true;
- NewStateID = GAMESTATE_LOAD_GAME;
- }
- break;
- case 1:
- ChangeState(STATE_DIFF);
- break;
- case 2:
- ChangeState(STATE_LOAD);
- g_engine->_loadMenu->ScanDir();
- break;
- case 3:
- ChangeState(STATE_OPTIONS);
- break;
- case 4:
- ChangeState(STATE_MOD);
- break;
- case 5:
- ChangeState(STATE_HELP);
- break;
- case 6:
- ChangeState(STATE_CREDITS);
- credits.reset();
- break;
- case 7:
- ShouldChangeState = true;
- NewStateID = GAMESTATE_EXIT;
- break;
- default:
- break;
- }
- }
- }
-
- if (g_engine->_inputManager->Equals(IU_BACK, Event) == SDL_PRESSED || (back.handleEvents(Event) && (state != STATE_SAVENAME && state != STATE_CREDITS))) {
- if (state == STATE_SAVENAME)
- ChangeState(STATE_DIFF);
- else if (state != STATE_NORMAL)
- ChangeState(STATE_NORMAL);
- }
-
- switch (state) {
-#ifdef UNREST_DEMO
- case STATE_NORMAL:
- if (steam.handleEvents(Event) == BUAC_LCLICK) {
- // Open steam in browser window
- OpenURL("https://store.steampowered.com/app/292400/");
- }
-
- if (direct.handleEvents(Event) == BUAC_LCLICK) {
- // Open humble widget in browser window
- OpenURL("https://www.humblebundle.com/store/unrest/Udg6Ytd8Dfw");
- }
- break;
-#endif
- case STATE_OPTIONS:
- if (g_engine->_optionMenu->handleEvents(back, Event))
- ChangeState(STATE_NORMAL);
- break;
-
- case STATE_CREDITS:
- if (credits.handleEvents(Event))
- ChangeState(STATE_NORMAL);
- break;
-
- case STATE_LOAD:
- if (g_engine->_loadMenu->handleEvents(Event)) {
- ChangeState(STATE_NORMAL);
- ShouldChangeState = true;
- NewStateID = GAMESTATE_LOAD_GAME;
- return;
- }
- break;
-
- case STATE_DIFF: {
- int choice = diff.menu.handleEvents(Event);
-
- // First menu option is Non-iron man, second is iron man
- // For the second choice, we must display a prompt to choose the name of the save game
- if (choice == 0) {
- g_engine->_tempData->ironman = false;
- ShouldChangeState = true;
- NewStateID = GAMESTATE_NEW_GAME;
- } else if (choice == 1)
- ChangeState(STATE_SAVENAME);
- } break;
-
- case STATE_SAVENAME:
- if (save.handleEvents(Event) || accept.handleEvents(Event)) {
- if (save.text != "") {
- g_engine->_tempData->filename = save.text;
- g_engine->_tempData->ironman = true;
- ShouldChangeState = true;
- NewStateID = GAMESTATE_NEW_GAME;
- } else
- fprintf(stdout, "Please enter a valid filename for the iron man save.\n");
- } else if (cancel.handleEvents(Event))
- ChangeState(STATE_DIFF);
-
- break;
-
- case STATE_MOD:
- if (mod.handleEvents(Event))
- ChangeState(STATE_NORMAL);
- break;
-
- case STATE_HELP:
- g_engine->_helpScreen->handleEvents(Event);
- break;
-
- default:
- break;
- }
-}
-#endif
//------------------------------------------------------------------------
// Purpose: Internal Events
//------------------------------------------------------------------------
Commit: df9d7db35d4ead6728c9a711876dbde54ea529eb
https://github.com/scummvm/scummvm/commit/df9d7db35d4ead6728c9a711876dbde54ea529eb
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub code to warn when xml attribs/values are invalid
Changed paths:
engines/crab/loaders.cpp
engines/crab/loaders.h
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 4f11c9a301b..921b495dfc6 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -35,29 +35,21 @@ namespace Crab {
bool nodeValid(rapidxml::xml_node<char> *node, const bool &echo) {
if (node == nullptr) {
- /*if (echo)
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", "node not found", NULL);*/
-
+ if (echo)
+ warning("XML: node not found");
return false;
}
-
return true;
}
bool nodeValid(const Common::String &name, rapidxml::xml_node<char> *parentNode, const bool &echo) {
if (parentNode == nullptr) {
- /*if (echo)
- {
- Common::String error_msg = "parent node of " + name + " not found \n";
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
- }*/
+ if (echo)
+ warning("XML: parent node of %s not found", name.c_str());
return false;
} else if (parentNode->first_node(name.c_str()) == nullptr) {
- /*if (echo)
- {
- Common::String error_msg = "child node " + name + " of parent node " + parent_node->name() + " not found \n";
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
- }*/
+ if (echo)
+ warning("XML: child node %s of parent node %s not found", name.c_str(), parentNode->name());
return false;
}
@@ -68,11 +60,8 @@ bool loadStr(Common::String &val, const Common::String &name, rapidxml::xml_node
if (node->first_attribute(name.c_str()) != nullptr)
val = node->first_attribute(name.c_str())->value();
else {
- /*if (echo)
- {
- Common::String error_msg = "string " + name + " not found in " + node->name() + "\n";
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
- }*/
+ if (echo)
+ warning("XML: string %s not found in %s", name.c_str(), node->name());
return false;
}
diff --git a/engines/crab/loaders.h b/engines/crab/loaders.h
index 4baeefaeadc..4e334b2117c 100644
--- a/engines/crab/loaders.h
+++ b/engines/crab/loaders.h
@@ -31,6 +31,7 @@
#ifndef CRAB_LOADERS_H
#define CRAB_LOADERS_H
+#include "common/debug.h"
#include "common/str.h"
#include "crab/color.h"
#include "crab/gametype.h"
@@ -54,11 +55,8 @@ bool loadNum(T &val, const Common::String &name, rapidxml::xml_node<char> *node,
if (node->first_attribute(name.c_str()) != nullptr)
val = stringToNumber<T>(node->first_attribute(name.c_str())->value());
else {
- /*if (echo)
- {
- Common::String error_msg = "attribute " + name + " not found in node " + node->parent()->name() + " -> " + node->name();
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
- }*/
+ if (echo)
+ warning("XML: attribute %s not found in node %s -> %s", name.c_str(), node->parent()->name(), node->name());
return false;
}
@@ -71,11 +69,8 @@ bool loadEnum(T &val, const Common::String &name, rapidxml::xml_node<char> *node
if (node->first_attribute(name.c_str()) != nullptr)
val = static_cast<T>(stringToNumber<int>(node->first_attribute(name.c_str())->value()));
else {
- /*if (echo)
- {
- Common::String error_msg = "attribute " + name + " not found in node " + node->parent()->name() + " -> " + node->name();
- SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_WARNING, "XML error", error_msg.c_str(), NULL);
- }*/
+ if (echo)
+ warning("XML: attribute %s not found in node %s -> %s", name.c_str(), node->parent()->name(), node->name());
return false;
}
Commit: f62c609e49e0aef7184e367843973d37a4323004
https://github.com/scummvm/scummvm/commit/f62c609e49e0aef7184e367843973d37a4323004
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove loadRect()
Changed paths:
engines/crab/loaders.cpp
diff --git a/engines/crab/loaders.cpp b/engines/crab/loaders.cpp
index 921b495dfc6..6e38ccbdeca 100644
--- a/engines/crab/loaders.cpp
+++ b/engines/crab/loaders.cpp
@@ -68,18 +68,6 @@ bool loadStr(Common::String &val, const Common::String &name, rapidxml::xml_node
return true;
}
-#if 0
-
-bool loadRect(SDL_Rect &rect, rapidxml::xml_node<char> *node, const bool &echo,
- const Common::String &x_name, const Common::String &y_name, const Common::String &w_name, const Common::String &h_name)
-{
- if (loadNum(rect.x, x_name, node, echo) && loadNum(rect.y, y_name, node, echo)
- && loadNum(rect.w, w_name, node, echo) && loadNum(rect.h, h_name, node, echo))
- return true;
- return false;
-}
-#endif
-
bool loadColor(Color &col, rapidxml::xml_node<char> *node, const bool &echo,
const Common::String &rName, const Common::String &gName, const Common::String &bName) {
int r = 0, g = 0, b = 0;
Commit: a54f0ee80f866e57b2b52984e7e68e8c0a0abb5a
https://github.com/scummvm/scummvm/commit/a54f0ee80f866e57b2b52984e7e68e8c0a0abb5a
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Allow sound settings to be changed while the game is active
Changed paths:
engines/crab/crab.cpp
engines/crab/crab.h
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
diff --git a/engines/crab/crab.cpp b/engines/crab/crab.cpp
index 0d85f568de5..b8816b8d223 100644
--- a/engines/crab/crab.cpp
+++ b/engines/crab/crab.cpp
@@ -176,4 +176,10 @@ bool CrabEngine::canSaveGameStateCurrently() {
return _screenSettings->_inGame;
}
+void CrabEngine::syncSoundSettings() {
+ Engine::syncSoundSettings();
+
+ _musicManager->syncSettings();
+}
+
} // End of namespace Crab
diff --git a/engines/crab/crab.h b/engines/crab/crab.h
index c607fb1e3b5..4fe57b0274e 100644
--- a/engines/crab/crab.h
+++ b/engines/crab/crab.h
@@ -165,6 +165,10 @@ public:
Common::Error saveGameState(int slot, const Common::String &desc, bool isAutosave) override;
Common::Error loadGameState(int slot) override;
+
+ void syncSoundSettings() override;
+
+
};
extern CrabEngine *g_engine;
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 0c7d00ee3d9..0aaa753e813 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -97,12 +97,8 @@ void MusicManager::playEffect(const ChunkKey &id, const int &loops) {
}
}
-//------------------------------------------------------------------------
-// Purpose: Initialize the music subsystem and load sound effects
-//------------------------------------------------------------------------
-bool MusicManager::load(rapidxml::xml_node<char> *node) {
- _musicHandle = new Audio::SoundHandle();
+void MusicManager::syncSettings() {
bool mute = false;
if (ConfMan.hasKey("mute"))
mute = ConfMan.getBool("mute");
@@ -110,6 +106,17 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
int volumeEff = mute ? 0 : ConfMan.getInt("sfx_volume");
int volumeMus = mute ? 0 : ConfMan.getInt("music_volume");
+ // Set the volume from the settings
+ volEffects(volumeEff);
+ volMusic(volumeMus);
+}
+
+//------------------------------------------------------------------------
+// Purpose: Initialize the music subsystem and load sound effects
+//------------------------------------------------------------------------
+bool MusicManager::load(rapidxml::xml_node<char> *node) {
+ _musicHandle = new Audio::SoundHandle();
+
if (nodeValid("sound", node)) {
rapidxml::xml_node<char> *volnode = node->first_node("sound");
/* Originally the game loads the music and sound effect at the default value of 100 from the settings file.
@@ -124,9 +131,7 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
loadNum(_chunksize, "chunk_size", volnode);
}
- // Set the volume from the settings
- volEffects(volumeEff);
- volMusic(volumeMus);
+ syncSettings();
// Load sound effects
XMLDoc trackList(g_engine->_filePath->_soundEffect);
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index 25a4d811ab5..c28b35eaebc 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -85,6 +85,8 @@ public:
bool load(rapidxml::xml_node<char> *node);
+ void syncSettings();
+
void playMusic(const MusicKey &id);
void playEffect(const ChunkKey &id, const int &loops);
Commit: 706f5edef9d8d0d3925c30d2c78cfa6c8af145ef
https://github.com/scummvm/scummvm/commit/706f5edef9d8d0d3925c30d2c78cfa6c8af145ef
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Unstub GameOverMenu::reset()
Changed paths:
engines/crab/ui/GameOverMenu.h
diff --git a/engines/crab/ui/GameOverMenu.h b/engines/crab/ui/GameOverMenu.h
index 87233fade74..e3c16587e07 100644
--- a/engines/crab/ui/GameOverMenu.h
+++ b/engines/crab/ui/GameOverMenu.h
@@ -63,10 +63,7 @@ public:
~GameOverMenu() {}
void reset() {
- warning("STUB: GameOverMenu::reset()");
-#if 0
- cur = gRandom.Num() % quote.size();
-#endif
+ _cur = g_engine->getRandomNumber(_quote.size());
}
void load(rapidxml::xml_node<char> *node);
Commit: 2b3d7f5a8b7cc03e45cc0db0a25567a075dddaa0
https://github.com/scummvm/scummvm/commit/2b3d7f5a8b7cc03e45cc0db0a25567a075dddaa0
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Cleanup FileMenu.h
Changed paths:
engines/crab/ui/FileMenu.h
engines/crab/ui/SaveGameMenu.cpp
diff --git a/engines/crab/ui/FileMenu.h b/engines/crab/ui/FileMenu.h
index bab5e85e8f8..525e70adcbc 100644
--- a/engines/crab/ui/FileMenu.h
+++ b/engines/crab/ui/FileMenu.h
@@ -114,8 +114,6 @@ public:
}
void scanDir() {
- warning("STUB: FileMenu::scanDir()");
-
Common::String res = "CRAB_*";
res += g_engine->_filePath->_saveExt;
Common::StringArray saves = g_engine->getSaveFileManager()->listSavefiles(res);
@@ -130,33 +128,6 @@ public:
}
_menu.assignPaths();
-
-#if 0
- using namespace boost::filesystem;
-
- slot_info.clear();
- menu.Clear();
-
- path filedir(directory);
- if (exists(filedir) && is_directory(filedir)) {
- directory_iterator dir_it(filedir);
- Common::Array<path> file_in_dir;
-
- std::copy(directory_iterator(filedir), directory_iterator(), std::back_inserter(file_in_dir));
- std::sort(file_in_dir.begin(), file_in_dir.end(), PathCompare);
-
- // First, we must load all the files with the same extension as our save file
- uint count_slot = 0, count_menu = 0;
- for (auto i = file_in_dir.begin(); i != file_in_dir.end(); ++i)
- if (is_regular_file(*i) && i->extension().string() == extension) {
- slot_info.push_back(FileType(*i));
- menu.Add(count_slot, count_menu);
- }
- } else
- create_directories(filedir);
-
- menu.AssignPaths();
-#endif
}
void load(rapidxml::xml_node<char> *node) {
@@ -218,10 +189,10 @@ public:
tdB[DATA_LASTMODIFIED].draw(_slotInfo[i]._lastModified, base_x, base_y);
}
- DrawHover();
+ drawHover();
}
- void DrawHover() {
+ void drawHover() {
if (_menu.hoverIndex() >= 0) {
int i = _menu.hoverIndex();
diff --git a/engines/crab/ui/SaveGameMenu.cpp b/engines/crab/ui/SaveGameMenu.cpp
index 35b4b6eb811..ea2e70bd09e 100644
--- a/engines/crab/ui/SaveGameMenu.cpp
+++ b/engines/crab/ui/SaveGameMenu.cpp
@@ -125,7 +125,7 @@ void GameSaveMenu::draw() {
tdB[DATA_SAVENAME].draw(_slotInfo[i]._name, base_x, base_y);
}
- DrawHover();
+ drawHover();
}
void GameSaveMenu::setUI() {
Commit: 368208cca6bb37bf5ecb0e045d0b82d9f9679806
https://github.com/scummvm/scummvm/commit/368208cca6bb37bf5ecb0e045d0b82d9f9679806
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Get rid of unused FileMenu.cpp
Changed paths:
R engines/crab/ui/FileMenu.cpp
engines/crab/module.mk
diff --git a/engines/crab/module.mk b/engines/crab/module.mk
index 05de40ab50d..cc11458dafc 100644
--- a/engines/crab/module.mk
+++ b/engines/crab/module.mk
@@ -93,7 +93,6 @@ MODULE_OBJS = \
ui/element.o \
ui/emotion.o \
ui/FileData.o \
- ui/FileMenu.o \
ui/GameOverMenu.o \
ui/GeneralSettingMenu.o \
ui/GfxSettingMenu.o \
diff --git a/engines/crab/ui/FileMenu.cpp b/engines/crab/ui/FileMenu.cpp
deleted file mode 100644
index b76160c6241..00000000000
--- a/engines/crab/ui/FileMenu.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
- */
-
-/*
- * This code is based on the CRAB engine
- *
- * Copyright (c) Arvind Raja Yadav
- *
- * Licensed under MIT
- *
- */
-
-#include "crab/ui/FileMenu.h"
-
-namespace Crab {
-
-namespace pyrodactyl {
-namespace ui {
-
-}
-} // End of namespace pyrodactyl
-
-} // End of namespace Crab
Commit: a11f7c58eb03e40f64dbe306b0cb3d8db1b4d50b
https://github.com/scummvm/scummvm/commit/a11f7c58eb03e40f64dbe306b0cb3d8db1b4d50b
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement missing openURL calls() in CreditScreen and remove old code
Changed paths:
engines/crab/ui/CreditScreen.cpp
diff --git a/engines/crab/ui/CreditScreen.cpp b/engines/crab/ui/CreditScreen.cpp
index a0c1944d1e8..e860b6bb845 100644
--- a/engines/crab/ui/CreditScreen.cpp
+++ b/engines/crab/ui/CreditScreen.cpp
@@ -115,28 +115,13 @@ bool CreditScreen::handleEvents(Common::Event &event) {
else if (_reverse.handleEvents(event) == BUAC_LCLICK)
_speed._cur = _speed._reverse;
- return (_back.handleEvents(event) == BUAC_LCLICK);
-}
+ if (_website.handleEvents(event))
+ g_system->openUrl("http://pyrodactyl.com");
+ else if (_twitter.handleEvents(event))
+ g_system->openUrl("https://www.twitter.com/pyrodactylgames");
-#if 0
-bool CreditScreen::handleEvents(SDL_Event &Event) {
- if (slow.handleEvents(Event) == BUAC_LCLICK)
- speed.cur = speed.slow;
- else if (fast.handleEvents(Event) == BUAC_LCLICK)
- speed.cur = speed.fast;
- else if (pause.handleEvents(Event) == BUAC_LCLICK)
- speed.cur = 0.0f;
- else if (reverse.handleEvents(Event) == BUAC_LCLICK)
- speed.cur = speed.reverse;
-
- if (website.handleEvents(Event))
- OpenURL("http://pyrodactyl.com");
- else if (twitter.handleEvents(Event))
- OpenURL("https://www.twitter.com/pyrodactylgames");
-
- return (back.handleEvents(Event) == BUAC_LCLICK);
+ return (_back.handleEvents(event) == BUAC_LCLICK);
}
-#endif
void CreditScreen::draw() {
_bg.draw();
Commit: c1558ca1bc383fde4c03611d9e41df3f90d119d8
https://github.com/scummvm/scummvm/commit/c1558ca1bc383fde4c03611d9e41df3f90d119d8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make StringPool class follow code conventions
Changed paths:
engines/crab/GameParam.h
engines/crab/Rectangle.cpp
engines/crab/ScreenSettings.cpp
engines/crab/animation/sprite.cpp
engines/crab/event/EventSeqGroup.cpp
engines/crab/event/EventSequence.cpp
engines/crab/event/GameEventInfo.cpp
engines/crab/item/Item.cpp
engines/crab/item/StatPreview.cpp
engines/crab/level/level_load.cpp
engines/crab/people/opinion.cpp
engines/crab/people/person.cpp
engines/crab/people/trait.cpp
engines/crab/stat/Stat.cpp
engines/crab/ui/MapData.cpp
engines/crab/ui/button.h
engines/crab/ui/map.cpp
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index 020c7e94efa..c1eb0cce3f2 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -124,14 +124,14 @@ public:
poolF.clear();
}
- const char *Get(const int &num) {
+ const char *get(const int &num) {
if (poolI.contains(num) == false)
poolI[num] = numberToString<int>(num);
return poolI.getVal(num).c_str();
}
- const char *FGet(const float &num) {
+ const char *fGet(const float &num) {
for (auto &i : poolF)
if (i._val == num)
return i._str.c_str();
diff --git a/engines/crab/Rectangle.cpp b/engines/crab/Rectangle.cpp
index db225f72591..3540158e57a 100644
--- a/engines/crab/Rectangle.cpp
+++ b/engines/crab/Rectangle.cpp
@@ -121,10 +121,10 @@ void Rect::draw(const int &xOffset, const int &yOffset, const uint8 &r, const ui
void Rect::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get(x)));
- child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get(y)));
- child->append_attribute(doc.allocate_attribute("w", g_engine->_stringPool->Get(w)));
- child->append_attribute(doc.allocate_attribute("h", g_engine->_stringPool->Get(h)));
+ child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->get(x)));
+ child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->get(y)));
+ child->append_attribute(doc.allocate_attribute("w", g_engine->_stringPool->get(w)));
+ child->append_attribute(doc.allocate_attribute("h", g_engine->_stringPool->get(h)));
root->append_node(child);
}
diff --git a/engines/crab/ScreenSettings.cpp b/engines/crab/ScreenSettings.cpp
index 3c930288fb2..79de7e4b312 100644
--- a/engines/crab/ScreenSettings.cpp
+++ b/engines/crab/ScreenSettings.cpp
@@ -51,15 +51,15 @@ void ScreenSettings::load(rapidxml::xml_node<char> *node) {
}
void ScreenSettings::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("version", g_engine->_stringPool->Get(_version)));
+ root->append_attribute(doc.allocate_attribute("version", g_engine->_stringPool->get(_version)));
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "screen");
- child->append_attribute(doc.allocate_attribute("w", g_engine->_stringPool->Get(_cur.w)));
- child->append_attribute(doc.allocate_attribute("h", g_engine->_stringPool->Get(_cur.h)));
- child->append_attribute(doc.allocate_attribute("fps", g_engine->_stringPool->Get(_fps)));
+ child->append_attribute(doc.allocate_attribute("w", g_engine->_stringPool->get(_cur.w)));
+ child->append_attribute(doc.allocate_attribute("h", g_engine->_stringPool->get(_cur.h)));
+ child->append_attribute(doc.allocate_attribute("fps", g_engine->_stringPool->get(_fps)));
- child->append_attribute(doc.allocate_attribute("gamma", g_engine->_stringPool->FGet(_gamma)));
- child->append_attribute(doc.allocate_attribute("text_speed", g_engine->_stringPool->FGet(_textSpeed)));
+ child->append_attribute(doc.allocate_attribute("gamma", g_engine->_stringPool->fGet(_gamma)));
+ child->append_attribute(doc.allocate_attribute("text_speed", g_engine->_stringPool->fGet(_textSpeed)));
saveBool(_vsync, "vsync", doc, child);
saveBool(_border, "border", doc, child);
diff --git a/engines/crab/animation/sprite.cpp b/engines/crab/animation/sprite.cpp
index 79168903867..32865eb698f 100644
--- a/engines/crab/animation/sprite.cpp
+++ b/engines/crab/animation/sprite.cpp
@@ -653,8 +653,8 @@ void Sprite::internalEvents(Info &info, const Common::String &player_id, Common:
//------------------------------------------------------------------------
void Sprite::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
root->append_attribute(doc.allocate_attribute("id", _id.c_str()));
- root->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get(_pos.x)));
- root->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get(_pos.y)));
+ root->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->get(_pos.x)));
+ root->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->get(_pos.y)));
}
//------------------------------------------------------------------------
diff --git a/engines/crab/event/EventSeqGroup.cpp b/engines/crab/event/EventSeqGroup.cpp
index ec65456b0a9..c1fb6c61f83 100644
--- a/engines/crab/event/EventSeqGroup.cpp
+++ b/engines/crab/event/EventSeqGroup.cpp
@@ -77,12 +77,12 @@ bool EventSeqGroup::activeSeq(uint &activeSeq) {
void EventSeqGroup::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
for (const auto &i : _end) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "end");
- child->value(g_engine->_stringPool->Get(i));
+ child->value(g_engine->_stringPool->get(i));
root->append_node(child);
}
for (auto &i : _seq)
- i._value.saveState(doc, root, g_engine->_stringPool->Get(i._key));
+ i._value.saveState(doc, root, g_engine->_stringPool->get(i._key));
}
void EventSeqGroup::loadState(rapidxml::xml_node<char> *node) {
diff --git a/engines/crab/event/EventSequence.cpp b/engines/crab/event/EventSequence.cpp
index 51e06d16709..c9b6e096a2b 100644
--- a/engines/crab/event/EventSequence.cpp
+++ b/engines/crab/event/EventSequence.cpp
@@ -117,12 +117,12 @@ void EventSequence::saveState(rapidxml::xml_document<char> &doc, rapidxml::xml_n
// Write current event id and name to node
seqnode->append_attribute(doc.allocate_attribute("name", name));
- seqnode->append_attribute(doc.allocate_attribute("current", g_engine->_stringPool->Get(_cur)));
+ seqnode->append_attribute(doc.allocate_attribute("current", g_engine->_stringPool->get(_cur)));
// Prepare strings of next events and write them
for (uint i = 0; i < _next.size(); i++) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "next");
- child->value(g_engine->_stringPool->Get(_next[i]));
+ child->value(g_engine->_stringPool->get(_next[i]));
seqnode->append_node(child);
}
diff --git a/engines/crab/event/GameEventInfo.cpp b/engines/crab/event/GameEventInfo.cpp
index 9b32c215d6b..e94e25f829e 100644
--- a/engines/crab/event/GameEventInfo.cpp
+++ b/engines/crab/event/GameEventInfo.cpp
@@ -331,7 +331,7 @@ void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
for (const auto &v : _var) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "var");
child->append_attribute(doc.allocate_attribute("id", v._key.c_str()));
- child->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(v._value)));
+ child->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->get(v._value)));
root->append_node(child);
}
@@ -348,7 +348,7 @@ void Info::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
root->append_node(childUnr);
rapidxml::xml_node<char> *child_img = doc.allocate_node(rapidxml::node_element, "img");
- child_img->append_attribute(doc.allocate_attribute("index", g_engine->_stringPool->Get(_playerImg)));
+ child_img->append_attribute(doc.allocate_attribute("index", g_engine->_stringPool->get(_playerImg)));
root->append_node(child_img);
rapidxml::xml_node<char> *child_money = doc.allocate_node(rapidxml::node_element, "money");
diff --git a/engines/crab/item/Item.cpp b/engines/crab/item/Item.cpp
index 362ea39d295..3fda61d0fa9 100644
--- a/engines/crab/item/Item.cpp
+++ b/engines/crab/item/Item.cpp
@@ -76,7 +76,7 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
root->append_attribute(doc.allocate_attribute("id", _id.c_str()));
root->append_attribute(doc.allocate_attribute("name", _name.c_str()));
root->append_attribute(doc.allocate_attribute("type", _type.c_str()));
- root->append_attribute(doc.allocate_attribute("img", g_engine->_stringPool->Get(_img)));
+ root->append_attribute(doc.allocate_attribute("img", g_engine->_stringPool->get(_img)));
root->append_attribute(doc.allocate_attribute("desc", _desc.c_str()));
for (const auto &i : _bonus) {
@@ -100,7 +100,7 @@ void Item::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *ro
break;
}
- n->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->Get(i._val)));
+ n->append_attribute(doc.allocate_attribute("val", g_engine->_stringPool->get(i._val)));
root->append_node(n);
}
}
diff --git a/engines/crab/item/StatPreview.cpp b/engines/crab/item/StatPreview.cpp
index 2f95944b23c..3e2e8b6c12f 100644
--- a/engines/crab/item/StatPreview.cpp
+++ b/engines/crab/item/StatPreview.cpp
@@ -59,7 +59,7 @@ void StatPreview::draw(Item &item, pyrodactyl::stat::StatDrawHelper &helper) {
int count = 0;
for (auto i = item._bonus.begin(); i != item._bonus.end(); ++i, ++count) {
stat.draw(helper.name(i->_type), _incS.x * count, _incS.y * count);
- unit.draw(g_engine->_stringPool->Get(i->_val), _incU.x * count, _incU.y * count);
+ unit.draw(g_engine->_stringPool->get(i->_val), _incU.x * count, _incU.y * count);
}
}
}
diff --git a/engines/crab/level/level_load.cpp b/engines/crab/level/level_load.cpp
index 31077f5d089..336728166ce 100644
--- a/engines/crab/level/level_load.cpp
+++ b/engines/crab/level/level_load.cpp
@@ -214,7 +214,7 @@ void Level::loadConst(const Common::String &filename) {
// Purpose: Save all sprite positions to save file
//------------------------------------------------------------------------
void Level::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("player_index", g_engine->_stringPool->Get(_playerIndex)));
+ root->append_attribute(doc.allocate_attribute("player_index", g_engine->_stringPool->get(_playerIndex)));
for (auto &i : _objects) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "sprite");
diff --git a/engines/crab/people/opinion.cpp b/engines/crab/people/opinion.cpp
index da0f3a7a3fd..cb4d8095b3e 100644
--- a/engines/crab/people/opinion.cpp
+++ b/engines/crab/people/opinion.cpp
@@ -73,9 +73,9 @@ void Opinion::validate(const OpinionType &type) {
void Opinion::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "opinion");
- child->append_attribute(doc.allocate_attribute("like", g_engine->_stringPool->Get(_val[OPI_LIKE])));
- child->append_attribute(doc.allocate_attribute("fear", g_engine->_stringPool->Get(_val[OPI_FEAR])));
- child->append_attribute(doc.allocate_attribute("respect", g_engine->_stringPool->Get(_val[OPI_RESPECT])));
+ child->append_attribute(doc.allocate_attribute("like", g_engine->_stringPool->get(_val[OPI_LIKE])));
+ child->append_attribute(doc.allocate_attribute("fear", g_engine->_stringPool->get(_val[OPI_FEAR])));
+ child->append_attribute(doc.allocate_attribute("respect", g_engine->_stringPool->get(_val[OPI_RESPECT])));
root->append_node(child);
}
diff --git a/engines/crab/people/person.cpp b/engines/crab/people/person.cpp
index 2c5e98eea2b..24ac0678f73 100644
--- a/engines/crab/people/person.cpp
+++ b/engines/crab/people/person.cpp
@@ -110,7 +110,7 @@ void Person::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *
child->append_attribute(doc.allocate_attribute("name", _name.c_str()));
uint val = static_cast<uint>(_state);
- child->append_attribute(doc.allocate_attribute("state", g_engine->_stringPool->Get(val)));
+ child->append_attribute(doc.allocate_attribute("state", g_engine->_stringPool->get(val)));
_opinion.saveState(doc, child);
diff --git a/engines/crab/people/trait.cpp b/engines/crab/people/trait.cpp
index 79707921325..090d913b9b4 100644
--- a/engines/crab/people/trait.cpp
+++ b/engines/crab/people/trait.cpp
@@ -63,10 +63,10 @@ void Trait::clear() {
//------------------------------------------------------------------------
void Trait::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *rootname) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, rootname);
- child->append_attribute(doc.allocate_attribute("id", g_engine->_stringPool->Get(_id)));
+ child->append_attribute(doc.allocate_attribute("id", g_engine->_stringPool->get(_id)));
child->append_attribute(doc.allocate_attribute("name", _name.c_str()));
child->append_attribute(doc.allocate_attribute("desc", _desc.c_str()));
- child->append_attribute(doc.allocate_attribute("img", g_engine->_stringPool->Get(_img)));
+ child->append_attribute(doc.allocate_attribute("img", g_engine->_stringPool->get(_img)));
saveBool(_unread, "unread", doc, child);
diff --git a/engines/crab/stat/Stat.cpp b/engines/crab/stat/Stat.cpp
index c5687343b18..9fa0244ecc0 100644
--- a/engines/crab/stat/Stat.cpp
+++ b/engines/crab/stat/Stat.cpp
@@ -105,10 +105,10 @@ void Stat::validate() {
void Stat::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root, const char *name) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, name);
- child->append_attribute(doc.allocate_attribute("cur", g_engine->_stringPool->Get(_cur)));
- child->append_attribute(doc.allocate_attribute("def", g_engine->_stringPool->Get(_def)));
- child->append_attribute(doc.allocate_attribute("min", g_engine->_stringPool->Get(_min)));
- child->append_attribute(doc.allocate_attribute("max", g_engine->_stringPool->Get(_max)));
+ child->append_attribute(doc.allocate_attribute("cur", g_engine->_stringPool->get(_cur)));
+ child->append_attribute(doc.allocate_attribute("def", g_engine->_stringPool->get(_def)));
+ child->append_attribute(doc.allocate_attribute("min", g_engine->_stringPool->get(_min)));
+ child->append_attribute(doc.allocate_attribute("max", g_engine->_stringPool->get(_max)));
root->append_node(child);
}
diff --git a/engines/crab/ui/MapData.cpp b/engines/crab/ui/MapData.cpp
index b7968eac855..73689e9a4ad 100644
--- a/engines/crab/ui/MapData.cpp
+++ b/engines/crab/ui/MapData.cpp
@@ -59,8 +59,8 @@ void MapData::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char>
for (auto &d : _dest) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "pos");
child->append_attribute(doc.allocate_attribute("name", d._name.c_str()));
- child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->Get(d._pos.x)));
- child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->Get(d._pos.y)));
+ child->append_attribute(doc.allocate_attribute("x", g_engine->_stringPool->get(d._pos.x)));
+ child->append_attribute(doc.allocate_attribute("y", g_engine->_stringPool->get(d._pos.y)));
child_dest->append_node(child);
}
root->append_node(child_dest);
diff --git a/engines/crab/ui/button.h b/engines/crab/ui/button.h
index fb6c042844e..bb779044b7d 100644
--- a/engines/crab/ui/button.h
+++ b/engines/crab/ui/button.h
@@ -77,9 +77,9 @@ struct ButtonImage {
}
void saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
- root->append_attribute(doc.allocate_attribute("img_b", g_engine->_stringPool->Get(_normal)));
- root->append_attribute(doc.allocate_attribute("img_s", g_engine->_stringPool->Get(_select)));
- root->append_attribute(doc.allocate_attribute("img_h", g_engine->_stringPool->Get(_hover)));
+ root->append_attribute(doc.allocate_attribute("img_b", g_engine->_stringPool->get(_normal)));
+ root->append_attribute(doc.allocate_attribute("img_s", g_engine->_stringPool->get(_select)));
+ root->append_attribute(doc.allocate_attribute("img_h", g_engine->_stringPool->get(_hover)));
}
};
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index 838729b95da..bcf5686609c 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -451,7 +451,7 @@ void Map::destDel(const Common::String &name) {
void Map::saveState(rapidxml::xml_document<> &doc, rapidxml::xml_node<char> *root) {
rapidxml::xml_node<char> *child = doc.allocate_node(rapidxml::node_element, "map");
- child->append_attribute(doc.allocate_attribute("cur", g_engine->_stringPool->Get(_cur)));
+ child->append_attribute(doc.allocate_attribute("cur", g_engine->_stringPool->get(_cur)));
saveBool(_overlay, "overlay", doc, child);
for (auto &r : _map) {
Commit: 2bca19e367a2cb8e59d7b3fedc98fc7b6e42873c
https://github.com/scummvm/scummvm/commit/2bca19e367a2cb8e59d7b3fedc98fc7b6e42873c
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Handle floats in numberTostring
Changed paths:
engines/crab/numstr.h
diff --git a/engines/crab/numstr.h b/engines/crab/numstr.h
index 16b84730285..9bf83d5156f 100644
--- a/engines/crab/numstr.h
+++ b/engines/crab/numstr.h
@@ -34,10 +34,15 @@
namespace Crab {
template<typename T>
-Common::String numberToString(T number) {
+inline Common::String numberToString(T number) {
return Common::String::format("%d", number);
}
+template<>
+inline Common::String numberToString<float>(float number) {
+ return Common::String::format("%f", number);
+}
+
template<typename T>
inline T stringToNumber(char *text) {
int res = 0;
Commit: 3e5e3987c53853b65310a99ab235e739e6bc4fa5
https://github.com/scummvm/scummvm/commit/3e5e3987c53853b65310a99ab235e739e6bc4fa5
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Fix StringPool::fGet()
Changed paths:
engines/crab/GameParam.h
diff --git a/engines/crab/GameParam.h b/engines/crab/GameParam.h
index c1eb0cce3f2..08c17e54500 100644
--- a/engines/crab/GameParam.h
+++ b/engines/crab/GameParam.h
@@ -138,7 +138,7 @@ public:
FloatString fs;
fs._val = num;
- //fs.str = NumberToString<float>(num);
+ fs._str = numberToString<float>(num);
poolF.push_back(fs);
auto ret = poolF.back();
Commit: 5957287eb552559e9965ec74985282f5f5f7c6d8
https://github.com/scummvm/scummvm/commit/5957287eb552559e9965ec74985282f5f5f7c6d8
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Properly initialize the value of AlphaImage
Changed paths:
engines/crab/ui/AlphaImage.cpp
diff --git a/engines/crab/ui/AlphaImage.cpp b/engines/crab/ui/AlphaImage.cpp
index 87be38fe682..360129c01e6 100644
--- a/engines/crab/ui/AlphaImage.cpp
+++ b/engines/crab/ui/AlphaImage.cpp
@@ -46,7 +46,7 @@ void AlphaImage::load(rapidxml::xml_node<char> *node, const bool &echo) {
loadNum(alpha._max, "max", node);
loadNum(alpha._change, "inc", node);
- alpha._cur = alpha._max; //alpha.cur = alpha.min + gRandom.Num() % (alpha.max - alpha.min - 1);
+ alpha._cur = alpha._min + g_engine->getRandomNumber(alpha._max - alpha._min - 1);
}
void AlphaImage::internalEvents() {
Commit: 64d5affe6037844e72e5f15479675d7c552e05c4
https://github.com/scummvm/scummvm/commit/64d5affe6037844e72e5f15479675d7c552e05c4
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Cleanup MusicManager class
Changed paths:
engines/crab/music/MusicManager.cpp
engines/crab/music/MusicManager.h
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index 0aaa753e813..e3b8ea5fa62 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -116,21 +116,6 @@ void MusicManager::syncSettings() {
//------------------------------------------------------------------------
bool MusicManager::load(rapidxml::xml_node<char> *node) {
_musicHandle = new Audio::SoundHandle();
-
- if (nodeValid("sound", node)) {
- rapidxml::xml_node<char> *volnode = node->first_node("sound");
- /* Originally the game loads the music and sound effect at the default value of 100 from the settings file.
- However, we get these values from the ConfMan, so skip reading these values from settings
- */
-
- //loadNum(_volumeMus, "music", volnode);
- //loadNum(_volumeEff, "effects", volnode);
-
- loadNum(_freq, "frequency", volnode);
- loadNum(_channels, "channels", volnode);
- loadNum(_chunksize, "chunk_size", volnode);
- }
-
syncSettings();
// Load sound effects
diff --git a/engines/crab/music/MusicManager.h b/engines/crab/music/MusicManager.h
index c28b35eaebc..dc4aa4eb5eb 100644
--- a/engines/crab/music/MusicManager.h
+++ b/engines/crab/music/MusicManager.h
@@ -50,13 +50,6 @@ class MusicManager {
MusicData _bg;
Common::HashMap<ChunkKey, EffectAudio *> _effects;
-#if 0
- // The sound effects in the game
- std::unordered_map<ChunkKey, Mix_Chunk *> effect;
-#endif
-
- // Data about the audio
- int _freq, _channels, _chunksize;
Audio::SoundHandle *_musicHandle;
@@ -65,20 +58,10 @@ public:
ChunkKey _notify, _repInc, _repDec;
MusicManager() {
-#if 0
- freq = MIX_DEFAULT_FREQUENCY;
- channels = MIX_DEFAULT_CHANNELS;
-#endif
- _chunksize = 1024;
-
_notify = -1;
_repInc = -1;
_repDec = -1;
- (void)_freq;
- (void)_channels;
- (void)_chunksize;
-
_musicHandle = nullptr;
}
~MusicManager() {}
Commit: 6cf971524427764c4bb8037f20006495675d71fa
https://github.com/scummvm/scummvm/commit/6cf971524427764c4bb8037f20006495675d71fa
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Make gameid lowercase in gameDescriptions
Changed paths:
engines/crab/detection.cpp
diff --git a/engines/crab/detection.cpp b/engines/crab/detection.cpp
index 2355aa92722..c43c4229e1a 100644
--- a/engines/crab/detection.cpp
+++ b/engines/crab/detection.cpp
@@ -40,7 +40,7 @@ namespace Crab {
static const ADGameDescription gameDescriptions[] = {
{
- "Unrest",
+ "unrest",
"",
AD_ENTRY2s("characters/backer_chars.xml", "d9028280f75836192d93e56df7313d8c", 2517,
"traits/tanya_intelligent.png", "441221becc2b70e7c9d7838d6a8bd990", 12593),
@@ -50,7 +50,7 @@ static const ADGameDescription gameDescriptions[] = {
GUIO3(GUIO_NOSPEECH, GUIO_NOLAUNCHLOAD, GUIO_NOMIDI),
},
{
- "Unrest",
+ "unrest",
"Demo",
AD_ENTRY2s("characters/backer_chars.xml", "5ba20126349bc57b3774623a1ec89627", 2127,
"traits/tanya_intelligent.png", "441221becc2b70e7c9d7838d6a8bd990", 12593),
Commit: 6fb80da1a184c90c7839c125b4ecc9878ed62183
https://github.com/scummvm/scummvm/commit/6fb80da1a184c90c7839c125b4ecc9878ed62183
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement DebugConsole::handleEvents()
Changed paths:
engines/crab/ui/DevConsole.cpp
engines/crab/ui/DevConsole.h
diff --git a/engines/crab/ui/DevConsole.cpp b/engines/crab/ui/DevConsole.cpp
index b55760960b5..623414d7901 100644
--- a/engines/crab/ui/DevConsole.cpp
+++ b/engines/crab/ui/DevConsole.cpp
@@ -90,38 +90,36 @@ void DebugConsole::draw(pyrodactyl::event::Info &info) {
}
}
-#if 0
-void DebugConsole::handleEvents(const SDL_Event &Event) {
- switch (state) {
+void DebugConsole::handleEvents(const Common::Event &event) {
+ switch (_state) {
case STATE_NORMAL: {
- int choice = menu.handleEvents(Event);
+ int choice = _menu.handleEvents(event);
if (choice == 0)
- state = STATE_VAR;
+ _state = STATE_VAR;
} break;
case STATE_VAR:
- text_field.handleEvents(Event);
+ _textField.handleEvents(event);
- if (check.handleEvents(Event))
- var_name = text_field.text;
+ if (_check.handleEvents(event))
+ _varName = _textField._text;
// Control+V pastes clipboard text into text field
- if (Event.type == SDL_KEYDOWN && Event.key.keysym.scancode == SDL_SCANCODE_V && Event.key.keysym.mod & KMOD_CTRL) {
- if (SDL_HasClipboardText() == SDL_TRUE) {
- char *temp = SDL_GetClipboardText();
- text_field.text = temp;
- SDL_free(temp);
+ if (event.kbd.hasFlags(Common::KBD_CTRL) && event.kbd.keycode == Common::KEYCODE_v) {
+ if (g_system->hasTextInClipboard()) {
+ Common::U32String str = g_system->getTextFromClipboard();
+ _textField._text = convertFromU32String(str).c_str();
}
}
- if (back.handleEvents(Event))
- state = STATE_NORMAL;
+ if (_back.handleEvents(event)) {
+ _state = STATE_NORMAL;
+ }
break;
default:
break;
}
}
-#endif
void DebugConsole::internalEvents() {
}
diff --git a/engines/crab/ui/DevConsole.h b/engines/crab/ui/DevConsole.h
index 5fd48be526f..a8b415b73ee 100644
--- a/engines/crab/ui/DevConsole.h
+++ b/engines/crab/ui/DevConsole.h
@@ -71,6 +71,8 @@ public:
return (_state == STATE_VAR || _menu.hoverIndex() != -1);
}
+ void handleEvents(const Common::Event &event);
+
void load(const Common::String &filename);
void draw(pyrodactyl::event::Info &info);
Commit: 0d111de090fde6f766e0acaf2daf070c002138c2
https://github.com/scummvm/scummvm/commit/0d111de090fde6f766e0acaf2daf070c002138c2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Print cleansedPath instead of normal path in warnings
Changed paths:
engines/crab/filesystem.cpp
engines/crab/music/MusicManager.cpp
engines/crab/music/musicparam.h
diff --git a/engines/crab/filesystem.cpp b/engines/crab/filesystem.cpp
index 0228c5200c3..fcc21a37062 100644
--- a/engines/crab/filesystem.cpp
+++ b/engines/crab/filesystem.cpp
@@ -48,8 +48,9 @@ bool fileOpen(const Common::Path &path, char *&data) {
delete[] data;
Common::File file;
- if (!file.open(cleansePath(path.toString()))) {
- warning("Unable to open file %s", path.toString().c_str());
+ Common::String cleansedPath = cleansePath(path.toString());
+ if (!file.open(cleansedPath)) {
+ warning("Unable to open file %s", cleansedPath.c_str());
data = nullptr;
return false;
}
@@ -73,8 +74,9 @@ bool fileOpen(const Common::Path &path, Common::File *file) {
if (file->isOpen())
file->close();
- if (!file->open(cleansePath(path.toString()))) {
- warning("Unable to open file %s", path.toString().c_str());
+ Common::String cleansedPath = cleansePath(path.toString());
+ if (!file->open(cleansedPath)) {
+ warning("Unable to open file %s", cleansedPath.c_str());
return false;
}
diff --git a/engines/crab/music/MusicManager.cpp b/engines/crab/music/MusicManager.cpp
index e3b8ea5fa62..9a9bf8efb84 100644
--- a/engines/crab/music/MusicManager.cpp
+++ b/engines/crab/music/MusicManager.cpp
@@ -131,13 +131,14 @@ bool MusicManager::load(rapidxml::xml_node<char> *node) {
rapidxml::xml_attribute<char> *id = n->first_attribute("id"), *path = n->first_attribute("path");
if (id != nullptr && path != nullptr) {
EffectAudio *audio = new EffectAudio();
- if (audio->_file.open(cleansePath(path->value()))) {
+ Common::String cleansedPath = cleansePath(path->value());
+ if (audio->_file.open(cleansedPath)) {
audio->_handle = new Audio::SoundHandle();
audio->_stream = Audio::makeWAVStream(&audio->_file, DisposeAfterUse::NO);
_effects[stringToNumber<ChunkKey>(id->value())] = audio;
} else {
delete audio;
- warning("Could not open audio file : %s", path->value());
+ warning("Could not open audio file : %s", cleansedPath.c_str());
return false;
}
}
diff --git a/engines/crab/music/musicparam.h b/engines/crab/music/musicparam.h
index e055bf79868..d1cb8ea5e5e 100644
--- a/engines/crab/music/musicparam.h
+++ b/engines/crab/music/musicparam.h
@@ -75,12 +75,13 @@ struct MusicData {
loadNum(_id, "id", node);
loadNum(_fadeInDuration, "fade_in", node);
- if (_file.open(cleansePath(node->first_attribute("path")->value()))) {
+ Common::String cleansedPath = cleansePath(node->first_attribute("path")->value());
+ if (_file.open(cleansedPath)) {
Audio::SeekableAudioStream *stream = Audio::makeVorbisStream(&_file, DisposeAfterUse::NO);
// loops=0 means infinite here.
_track = Audio::makeLoopingAudioStream(stream, 0, 0, 0);
} else {
- warning("Could not open file %s", node->first_attribute("path")->value());
+ warning("Could not open file %s", cleansedPath.c_str());
}
}
};
Commit: 4099b18b7a02b49305167ab000b837a3e969fc2f
https://github.com/scummvm/scummvm/commit/4099b18b7a02b49305167ab000b837a3e969fc2f
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: JANITORIAL: Remove old code in PauseMEnu::handleEvents()
Changed paths:
engines/crab/ui/PauseMenu.cpp
diff --git a/engines/crab/ui/PauseMenu.cpp b/engines/crab/ui/PauseMenu.cpp
index e65ede78e50..91651ab9790 100644
--- a/engines/crab/ui/PauseMenu.cpp
+++ b/engines/crab/ui/PauseMenu.cpp
@@ -118,68 +118,6 @@ PauseSignal PauseMenu::handleEvents(const Common::Event &event, Button &back) {
return PS_NONE;
}
-#if 0
-PauseSignal PauseMenu::handleEvents(const SDL_Event &Event, Button &back) {
- switch (state) {
- case STATE_NORMAL:
- choice = menu.handleEvents(Event);
- if (choice == -1) {
- if (back.hotkey.handleEvents(Event))
- return PS_RESUME;
- } else {
- switch (choice) {
- case 0:
- state = STATE_NORMAL;
- return PS_RESUME;
- case 1:
- state = STATE_SAVE;
- save.ScanDir();
- break;
- case 2:
- state = STATE_LOAD;
- g_engine->_loadMenu->ScanDir();
- break;
- case 3:
- state = STATE_OPTION;
- break;
- case 4:
- return PS_HELP;
- case 5:
- return PS_QUIT_MENU;
- case 6:
- return PS_QUIT_GAME;
- default:
- break;
- }
- }
- break;
- case STATE_SAVE:
- if (save.handleEvents(Event)) {
- state = STATE_NORMAL;
- return PS_SAVE;
- } else if (back.handleEvents(Event) == BUAC_LCLICK && !save.DisableHotkeys())
- state = STATE_NORMAL;
- break;
- case STATE_OPTION:
- if (g_engine->_optionMenu->handleEvents(back, Event)) {
- g_engine->_optionMenu->reset();
- state = STATE_NORMAL;
- }
- break;
- case STATE_LOAD:
- if (g_engine->_loadMenu->handleEvents(Event))
- return PS_LOAD;
- else if (back.handleEvents(Event) == BUAC_LCLICK)
- state = STATE_NORMAL;
- break;
- default:
- break;
- }
-
- return PS_NONE;
-}
-#endif
-
bool PauseMenu::disableHotkeys() {
return (_state == STATE_SAVE && _save.disableHotkeys()) || (_state == STATE_OPTION && g_engine->_optionMenu->disableHotkeys());
}
Commit: f2ebf7276d76fb6e6aaed69b7846722eb8ed8119
https://github.com/scummvm/scummvm/commit/f2ebf7276d76fb6e6aaed69b7846722eb8ed8119
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove leftover in HUD::draw()
Changed paths:
engines/crab/ui/hud.cpp
diff --git a/engines/crab/ui/hud.cpp b/engines/crab/ui/hud.cpp
index 0ca9b3409db..37dcd18b118 100644
--- a/engines/crab/ui/hud.cpp
+++ b/engines/crab/ui/hud.cpp
@@ -107,7 +107,6 @@ void HUD::draw(pyrodactyl::event::Info &info, const Common::String &id) {
g_engine->_imageManager->draw(_menu._element[HS_MAP].x + _menu._element[HS_MAP].w - _clip.w / 2,
_menu._element[HS_MAP].y - _clip.h / 2, _notifyAnim, &_clip);
}
-//#endif
}
void HUD::internalEvents(bool showMap) {
Commit: 36f348da5e64527352e18606f74429c9883382e3
https://github.com/scummvm/scummvm/commit/36f348da5e64527352e18606f74429c9883382e3
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove code leftover in Button:handleEvents()
Changed paths:
engines/crab/ui/button.cpp
diff --git a/engines/crab/ui/button.cpp b/engines/crab/ui/button.cpp
index dd9d118055d..c01c6d15140 100644
--- a/engines/crab/ui/button.cpp
+++ b/engines/crab/ui/button.cpp
@@ -193,58 +193,6 @@ ButtonAction Button::handleEvents(const Common::Event &event, const int &xOffset
return BUAC_IGNORE;
}
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Handle input and stuff
-//------------------------------------------------------------------------
-ButtonAction Button::handleEvents(const SDL_Event &Event, const int &XOffset, const int &YOffset) {
- Rect dim = *this;
- dim.x += XOffset;
- dim.y += YOffset;
-
- if (visible) {
- if (dim.Contains(g_engine->_mouse->motion.x, g_engine->_mouse->motion.y)) {
- hover_mouse = true;
-
- if (!hover_prev) {
- hover_prev = true;
- g_engine->_musicManager->PlayEffect(se_hover, 0);
- }
- } else {
- hover_prev = false;
- hover_mouse = false;
- }
-
- if (Event.type == SDL_MOUSEMOTION) {
- if (canmove && mousepressed) {
- x += g_engine->_mouse->rel.x;
- y += g_engine->_mouse->rel.y;
- return BUAC_GRABBED;
- }
- } else if (Event.type == SDL_MOUSEBUTTONDOWN) {
- // The g_engine->_mouse button pressed, then released, comprises of a click action
- if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y))
- mousepressed = true;
- } else if (Event.type == SDL_MOUSEBUTTONUP && mousepressed) {
- reset();
- if (dim.Contains(g_engine->_mouse->button.x, g_engine->_mouse->button.y)) {
- mousepressed = false;
- if (Event.button.button == SDL_BUTTON_LEFT) {
- g_engine->_musicManager->PlayEffect(se_click, 0);
- return BUAC_LCLICK;
- } else if (Event.button.button == SDL_BUTTON_RIGHT)
- return BUAC_RCLICK;
- }
- } else if (hotkey.handleEvents(Event)) {
- g_engine->_musicManager->PlayEffect(se_click, 0);
- return BUAC_LCLICK;
- }
- }
-
- return BUAC_IGNORE;
-}
-#endif
-
void Button::setUI(Rect *parent) {
Element::setUI(parent);
Commit: a939f3e962c080b83b19757c380708b3913c58f2
https://github.com/scummvm/scummvm/commit/a939f3e962c080b83b19757c380708b3913c58f2
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Implement Map::move keyboard controls and remove old code
Changed paths:
engines/crab/ui/map.cpp
diff --git a/engines/crab/ui/map.cpp b/engines/crab/ui/map.cpp
index bcf5686609c..e7c5c3d258c 100644
--- a/engines/crab/ui/map.cpp
+++ b/engines/crab/ui/map.cpp
@@ -233,97 +233,23 @@ void Map::move(const Common::Event &event) {
}
break;
default:
- warning("STUB: Map keyboard processing");
-#if 0
// Move the map camera if player presses the direction keys
- if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_PRESSED)
- vel.y = -1 * speed;
- else if (g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_PRESSED)
- vel.y = speed;
- else if (g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)
- vel.x = speed;
- else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)
- vel.x = -1 * speed;
+ if (g_engine->_inputManager->state(IU_UP))
+ _vel.y = -1 * _speed;
+ else if (g_engine->_inputManager->state(IU_DOWN))
+ _vel.y = _speed;
+ else if (g_engine->_inputManager->state(IU_RIGHT))
+ _vel.x = _speed;
+ else if (g_engine->_inputManager->state(IU_LEFT))
+ _vel.x = -1 * _speed;
// Stop moving when we release a key (but only in that direction)
- else if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_RELEASED || g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_RELEASED)
- vel.y = 0;
- else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_RELEASED || g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_RELEASED)
- vel.x = 0;
- break;
- }
-#endif
- }
-}
-
-#if 0
-//------------------------------------------------------------------------
-// Purpose: Move
-//------------------------------------------------------------------------
-void Map::Move(const SDL_Event &Event) {
- // Reset the velocity to avoid weirdness
- vel.x = 0;
- vel.y = 0;
-
- // We don't use the result, but this keeps the button states up to date
- scroll.handleEvents(Event);
-
- switch (Event.type) {
- case SDL_MOUSEBUTTONDOWN: {
- bool click = false;
- int count = 0;
- for (auto &i : scroll.element) {
- if (i.Contains(g_engine->_mouse->button)) {
- if (count == DIRECTION_UP)
- vel.y = -1 * speed;
- else if (count == DIRECTION_DOWN)
- vel.y = speed;
- else if (count == DIRECTION_RIGHT)
- vel.x = speed;
- else if (count == DIRECTION_LEFT)
- vel.x = -1 * speed;
-
- click = true;
- }
- count++;
- }
-
- if (!click) {
- pan = true;
- vel.x = 0;
- vel.y = 0;
- } else
- pan = false;
- } break;
- case SDL_MOUSEBUTTONUP:
- pan = false;
- break;
- case SDL_MOUSEMOTION:
- if (pan) {
- camera.x -= g_engine->_mouse->rel.x;
- camera.y -= g_engine->_mouse->rel.y;
- Validate();
- }
- break;
- default: {
- // Move the map camera if player presses the direction keys
- if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_PRESSED)
- vel.y = -1 * speed;
- else if (g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_PRESSED)
- vel.y = speed;
- else if (g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_PRESSED)
- vel.x = speed;
- else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_PRESSED)
- vel.x = -1 * speed;
- // Stop moving when we release a key (but only in that direction)
- else if (g_engine->_inputManager->Equals(IU_UP, Event) == SDL_RELEASED || g_engine->_inputManager->Equals(IU_DOWN, Event) == SDL_RELEASED)
- vel.y = 0;
- else if (g_engine->_inputManager->Equals(IU_LEFT, Event) == SDL_RELEASED || g_engine->_inputManager->Equals(IU_RIGHT, Event) == SDL_RELEASED)
- vel.x = 0;
+ else if (!g_engine->_inputManager->state(IU_UP) && !g_engine->_inputManager->state(IU_DOWN))
+ _vel.y = 0;
+ else if (!g_engine->_inputManager->state(IU_LEFT) && !g_engine->_inputManager->state(IU_RIGHT))
+ _vel.x = 0;
break;
}
- }
}
-#endif
//------------------------------------------------------------------------
// Purpose: Internal Events
Commit: a85cd0fa0b4e2ca4301c6b858a13bdff743f4f55
https://github.com/scummvm/scummvm/commit/a85cd0fa0b4e2ca4301c6b858a13bdff743f4f55
Author: hax0kartik (agarwala.kartik at gmail.com)
Date: 2023-08-10T17:06:59+02:00
Commit Message:
CRAB: Remove bogus warning in TextArea::handleEvents()
Changed paths:
engines/crab/ui/textarea.cpp
diff --git a/engines/crab/ui/textarea.cpp b/engines/crab/ui/textarea.cpp
index 00374f8865a..d8e98cb1636 100644
--- a/engines/crab/ui/textarea.cpp
+++ b/engines/crab/ui/textarea.cpp
@@ -57,7 +57,6 @@ void TextArea::load(rapidxml::xml_node<char> *node) {
}
bool TextArea::handleEvents(const Common::Event &event, bool numbersOnly) {
- warning("STUB: TextArea::handleEvents()");
if (event.type == Common::EVENT_KEYDOWN && event.kbd.ascii == Common::ASCII_BACKSPACE && _text.size() != 0) {
// Now play the text erase sound
g_engine->_musicManager->playEffect(_seErase, 0);
More information about the Scummvm-git-logs
mailing list